[Question posted by a user on YugabyteDB Community Slack]
I have setup YugabyteDB and nakama (server for realtime social and web & mobile game apps) docker containers. Both work and I can query yugabytedb through DBeaver and now i wanted it to make connection with nakama server.
In nakama compose they have given example for cockroachdb and postgresql but not for yugabyte specifically. Here i have mentioned docker compose where they have given database configuration setup for postgresql. I want some help for yugabyte configuration:
version: '3'
services:
postgres:
container_name: postgres
image: postgres:9.6-alpine
environment:
- POSTGRES_DB=nakama
- POSTGRES_PASSWORD=localdb
volumes:
- data:/var/lib/postgresql/data
expose:
- "8080"
- "5432"
ports:
- "5432:5432"
- "8080:8080"
nakama:
container_name: nakama
image: heroiclabs/nakama:3.12.0
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
exec /nakama/nakama --name nakama1 --database.address postgres:localdb@postgres:5432/nakama --logger.level DEBUG --session.token_expiry_sec 7200
restart: always
links:
- "postgres:db"
depends_on:
- postgres
volumes:
- ./:/nakama/data
expose:
- "7349"
- "7350"
- "7351"
ports:
- "7349:7349"
- "7350:7350"
- "7351:7351"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7350/"]
interval: 10s
timeout: 5s
retries: 5
volumes:
data:
First, remove the
postgrescontainer and add the following to that start a single-node cluster (one container is for a tserver and another is for a master). You can bump up the yugabytedb version:Second, replace the occurences of the postgres connection string with the following:
This should work for you.