Skip to content

Commit

Permalink
Docker compose for hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchinson committed Apr 27, 2023
1 parent 63fa859 commit f1aa9ad
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 6 deletions.
25 changes: 19 additions & 6 deletions helloworld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,33 @@ deployment it would be necessary to define an interface between the client
and the personality, for example a RESTful API or gRPC.

In order to run the tests, it is necessary to first have a Trillian log
running, which itself means it is necessary to have MySQL or MariaDB
running (see [MySQL
setup](http://github.com/google/trillian#mysql-setup) for more
information). In one terminal, run the following commands:
running. Follow one of the two steps below:

```
export GO111MODULE=on
## Manual

Set up MySQL or MariaDB using [MySQL setup](http://github.com/google/trillian#mysql-setup).
Then, in one terminal, run the following commands:

```bash
go run github.com/google/trillian/cmd/trillian_log_server --rpc_endpoint="localhost:50054" --http_endpoint="localhost:50055" &
go run github.com/google/trillian/cmd/trillian_log_signer --sequencer_interval="1s" --batch_size=500 --rpc_endpoint="localhost:50056" --http_endpoint="localhost:50057" --num_sequencers=1 --force_master &
# Trillian services are now running

export TREE_ID=$(go run github.com/google/trillian/cmd/createtree --admin_server=localhost:50054)
```

## Docker

```bash
wget https://raw.githubusercontent.com/google/trillian/master/storage/mysql/schema/storage.sql
docker compose up -d
docker exec -i helloworld_db_1 mysql -pzaphod -Dtest < storage.sql
```

# Running the tests

After setting up the trillian environment using the Manual or Docker instructions:

Now, in another terminal run `go build` and then `go test --tree_id=${TREE_ID}`.
This runs three tests.
1. `TestAppend` ensures that checkpoints update properly on the
Expand Down
55 changes: 55 additions & 0 deletions helloworld/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "3.1"

services:
db:
image: mariadb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=zaphod
- MYSQL_DATABASE=test
- MYSQL_USER=test
- MYSQL_PASSWORD=zaphod
ports:
- "3306:3306"
healthcheck:
test: mysql --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD --silent --execute "SHOW DATABASES;"
interval: 3s
timeout: 2s
retries: 5

trillian-log-server:
image: gcr.io/trillian-opensource-ci/log_server
command: [
"--storage_system=mysql",
"--mysql_uri=test:zaphod@tcp(db:3306)/test",
"--rpc_endpoint=0.0.0.0:50054",
"--http_endpoint=0.0.0.0:50055",
"--alsologtostderr",
]
restart: always
ports:
- "50054:50054"
- "50055:50055"
depends_on:
- db

trillian-log-signer:
image: gcr.io/trillian-opensource-ci/log_signer
command: [
"--storage_system=mysql",
"--mysql_uri=test:zaphod@tcp(db:3306)/test",
"--sequencer_interval=1s",
"----batch_size=500",
"--num_sequencers=1",
"--force_master",
"--rpc_endpoint=0.0.0.0:8090",
"--http_endpoint=0.0.0.0:8091",
"--alsologtostderr",
]
restart: always
ports:
- "8092:8091"
depends_on:
- db
- trillian-log-server

0 comments on commit f1aa9ad

Please sign in to comment.