Skip to content

Commit

Permalink
add docker-compose override example and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Guthe committed Nov 19, 2021
1 parent 65a5082 commit fc7b267
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,28 @@ Why is it called "autograph"? Because it's a service to sign stuff.

This will download the latest build of autograph from DockerHub and run it with its dev configuration.

### Using go get
### Using Docker Compose

If you don't yet have a GOPATH, export one:
```bash
$ export GOPATH=$HOME/go
$ mkdir $GOPATH
```
Autograph writes to /tmp and relies on the apksigner and gpg2 binaries
being in specific locations, so it's cleanest to develop it in a
container.

Install ltdl:
* on Ubuntu: ltdl-dev
* on RHEL/Fedora/Arch: libtool-ltdl-devel
* on MacOS: libtool (NB: this might require `brew unlink libtool && brew link libtool`)
1. copy over the local dev config to run the server in debug mode with
the host repo mounted to `/host`:

Then download and build autograph:
```bash
$ go get github.com/mozilla-services/autograph
```sh
cp docker-compose.override.yml.example docker-compose.override.yml
```

The resulting binary will be placed in `$GOPATH/bin/autograph`. To run autograph with the example conf, do:
```bash
$ cd $GOPATH/src/github.com/mozilla-services/autograph
$ $GOPATH/bin/autograph -c autograph.yaml
```
1. run `make build` to build the docker images

Example clients are in the `tools` directory. You can install the Go one like this:
```bash
$ go get github.com/mozilla-services/autograph/tools/autograph-client
$ $GOPATH/bin/autograph-client -u alice -p fs5wgcer9qj819kfptdlp8gm227ewxnzvsuj9ztycsx08hfhzu -t http://localhost:8000/sign/data -r '[{"input": "Y2FyaWJvdW1hdXJpY2UK"}]'
2016/08/23 17:25:55 signature 0 pass
```
1. run `docker-compose up -d db app` to start the app and db (`app-hsm`
runs the app using softhsm)

1. run `make unit-test` or `make integration-test` to test changes
1. alternatively run `docker-compose exec -w /host -u 0 -- app
/bin/bash` then `make test` to run unit tests without having to
rebuild the `unit-test` image

## Documentation

Expand Down
21 changes: 21 additions & 0 deletions docker-compose.override.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3"
services:
app:
container_name: autograph-app
volumes:
- ${PWD}:/host/
command:
[
"/app/src/autograph/bin/wait-for-it.sh",
"db:5432",
"--",
"autograph",
"-D",
"-c",
"/app/autograph.yaml",
]

app-hsm:
container_name: autograph-app-hsm
volumes:
- ${PWD}:/host/

0 comments on commit fc7b267

Please sign in to comment.