diff --git a/CHANGELOG.md b/CHANGELOG.md index a89974064b..e8a67394bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Storage * Add PostgreSQL quota manager and storage backend by @robstradling in https://github.com/google/trillian/pull/3644 +* PostgreSQL deployment example by @robstradling in https://github.com/google/trillian/pull/3675 ### Misc diff --git a/examples/deployment/docker/db_server/postgresql/Dockerfile b/examples/deployment/docker/db_server/postgresql/Dockerfile new file mode 100644 index 0000000000..2a1681f0c2 --- /dev/null +++ b/examples/deployment/docker/db_server/postgresql/Dockerfile @@ -0,0 +1,5 @@ +FROM postgres:latest + +# expects the build context to be: $GOPATH/src/github.com/google/trillian +COPY storage/postgresql/schema/storage.sql /docker-entrypoint-initdb.d/storage.sql +RUN chmod -R 775 /docker-entrypoint-initdb.d diff --git a/examples/deployment/postgresql/docker-compose.yml b/examples/deployment/postgresql/docker-compose.yml new file mode 100644 index 0000000000..53b84a8802 --- /dev/null +++ b/examples/deployment/postgresql/docker-compose.yml @@ -0,0 +1,52 @@ +version: '3.1' +services: + postgresql: + build: + context: ../../.. + dockerfile: examples/deployment/docker/db_server/postgresql/Dockerfile + environment: + - POSTGRES_HOST_AUTH_METHOD=trust + - POSTGRESQL_DATABASE=defaultdb + - POSTGRESQL_USER=test + - POSTGRESQL_PASSWORD=zaphod + restart: always # keep the PostgreSQL server running + trillian-log-server: + build: + context: ../../.. + dockerfile: examples/deployment/docker/log_server/Dockerfile + args: + - GOFLAGS + command: [ + "--quota_system=postgresql", + "--storage_system=postgresql", + "--postgresql_uri=postgresql:///defaultdb?host=localhost&user=test&password=zaphod", + "--rpc_endpoint=0.0.0.0:8090", + "--http_endpoint=0.0.0.0:8091", + "--alsologtostderr", + ] + restart: always # retry while PostgreSQL is starting up + ports: + - "8090:8090" + - "8091:8091" + depends_on: + - postgresql + trillian-log-signer: + build: + context: ../../.. + dockerfile: examples/deployment/docker/log_signer/Dockerfile + args: + - GOFLAGS + command: [ + "--quota_system=postgresql", + "--storage_system=postgresql", + "--postgresql_uri=postgresql:///defaultdb?host=localhost&user=test&password=zaphod", + "--rpc_endpoint=0.0.0.0:8090", + "--http_endpoint=0.0.0.0:8091", + "--force_master", + "--alsologtostderr", + ] + restart: always # retry while PostgreSQL is starting up + ports: + - "8092:8091" + depends_on: + - postgresql