Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compose override example #800

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ build: generate
integration-test:
./bin/run_integration_tests.sh

unit-test:
docker-compose run unit-test

dummy-statsd:
nc -kluvw 0 localhost 8125

Expand Down
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/