Skip to content

Commit

Permalink
chore(ci): docker-compose-prebuilt & README
Browse files Browse the repository at this point in the history
  • Loading branch information
heronimus committed Aug 16, 2023
1 parent c42a6dc commit 1b92801
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,34 @@ Alternatively, killing the `mage start` process will also stop Nakama and Cardin
Note, for now, if any Cardinal endpoints have been added or removed Nakama must be relaunched (via `mage stop` and `mage start`).
We will add a future to hot reload this in the future.

# Running with the prebuilt Docker Images

Prerequisites:
- Docker installed

Docker Images Container Registry URLs:
- Cardinal: `us-docker.pkg.dev/argus-labs/starter-game-template/cardinal:<latest/tag_version>`
- Nakama: `us-docker.pkg.dev/argus-labs/starter-game-template/nakama:<latest/tag_version>`


To start the starter-game-template Nakama and Cardinal with prebuilt Docker Images:

```bash
docker compose -f docker-compose-prebuilt.yml up --detach --wait
```

To check the services status & logs:

```bash
docker compose -f docker-compose-prebuilt.yml ps
docker compose -f docker-compose-prebuilt.yml logs
```

To stop Nakama and Cardinal:
```bash
docker compose -f docker-compose-prebuilt.yml down
```

# Verify the Server is Running

Visit `localhost:7351` in a web browser to access Nakama. For local development, use `admin:password` as your login
Expand Down
74 changes: 74 additions & 0 deletions docker-compose-prebuilt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
version: "3"
services:
postgres:
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all
environment:
- POSTGRES_DB=nakama
- POSTGRES_PASSWORD=localdb
expose:
- "5432"
image: postgres:12.2-alpine
ports:
- "5432:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "nakama"]
interval: 3s
timeout: 3s
retries: 5
volumes:
- data:/var/lib/postgresql/data
redis: # This doesn't have the correct persistence settings. Don't use on for prod.
image: redis:latest
command: redis-server # TODO: This runs without password. Don't use for prod.
expose:
- "6379"
ports:
- "6379:6379"
restart: always
cardinal:
image: us-docker.pkg.dev/argus-labs/starter-game-template/cardinal:${STARTER_VERSION:-latest}
restart: unless-stopped
depends_on:
- redis
expose:
- "3333"
ports:
- "3333:3333"
environment:
- CARDINAL_PORT=3333
- REDIS_ADDR=redis:6379
- REDIS_MODE=normal
nakama:
image: us-docker.pkg.dev/argus-labs/starter-game-template/nakama:${STARTER_VERSION:-latest}
restart: unless-stopped
depends_on:
- postgres
- cardinal
environment:
- CARDINAL_ADDR=${CARDINAL_ADDR:-http://cardinal:3333}
- CARDINAL_NAMESPACE=0
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
exec /nakama/nakama --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama
extra_hosts:
- "host.docker.internal:host-gateway"
expose:
- "7349"
- "7350"
- "7351"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7350/"]
interval: 10s
timeout: 5s
retries: 5
links:
- "postgres:db"
ports:
- "7349:7349"
- "7350:7350"
- "7351:7351"
volumes:
data:

0 comments on commit 1b92801

Please sign in to comment.