nakama Docker & Self-Hosted Deployment

GitHub

Scalable open-source game backend server: multiplayer, matchmaking, leaderboards, chat, and social features for games.

13,638 stars Go Go 1 file ยท ~126,854 tokens #backend#cpp#csharp#dotnet#game#game-backend#game-framework#gamedev
RAW Compose
1. Pull Image (DOCKERHUB) docker pull registry.heroiclabs.com/heroiclabs/nakama
2. Docker Run (1-Click Launch) docker run -d --name nakama -p 26257:26257 --restart always registry.heroiclabs.com/heroiclabs/nakama:3.37.0
3. Podman Run podman run -d --name nakama -p 26257:26257 --restart always registry.heroiclabs.com/heroiclabs/nakama:3.37.0
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://docker.io/registry.heroiclabs.com/heroiclabs/nakama:3.37.0
5. ORAS Pull (OCI Artifact) oras pull registry.heroiclabs.com/heroiclabs/nakama:3.37.0
6. Compose Deployment docker compose up -d
docker-compose.yml
Download .yml
services:
  cockroachdb:
    image: cockroachdb/cockroach:latest-v24.1
    command: start-single-node --insecure --store=attrs=ssd,path=/var/lib/cockroach/
    restart: "no"
    volumes:
      - data:/var/lib/cockroach
    expose:
      - "8080"
      - "26257"
    ports:
      - "26257:26257"
      - "8080:8080"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
      interval: 3s
      timeout: 3s
      retries: 5
  nakama:
    image: registry.heroiclabs.com/heroiclabs/nakama:3.37.0
    entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >
          /nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
          exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --logger.level DEBUG --session.token_expiry_sec 7200 --metrics.prometheus_port 9100
    restart: "no"
    links:
      - "cockroachdb:db"
    depends_on:
      cockroachdb:
        condition: service_healthy
      prometheus:
        condition: service_started
    volumes:
      - ./:/nakama/data
    expose:
      - "7349"
      - "7350"
      - "7351"
      - "9100"
    ports:
      - "7349:7349"
      - "7350:7350"
      - "7351:7351"
    healthcheck:
      test: ["CMD", "/nakama/nakama", "healthcheck"]
      interval: 10s
      timeout: 5s
      retries: 5
  prometheus:
    image: prom/prometheus
    entrypoint: /bin/sh -c
    command: |
      'sh -s <<EOF
        cat > ./prometheus.yml <<EON
      global:
        scrape_interval:     15s
        evaluation_interval: 15s

      scrape_configs:
        - job_name: prometheus
          static_configs:
          - targets: ['localhost:9090']

        - job_name: nakama
          metrics_path: /
          static_configs:
          - targets: ['nakama:9100']
      EON
      prometheus --config.file=./prometheus.yml
      EOF'
    ports:
      - '9090:9090'
volumes:
  data: