Auto Tournament

Install

Run Auto Tournament with Docker Compose.

Auto Tournament runs as two containers: the app and a PostgreSQL database. You need a Linux, macOS or Windows machine with Docker and Docker Compose.

Old names

The Docker image is still sivertio/matchzy-auto-tournament and the container is still called matchzy-tournament-api. They keep these names until 3.0. The commands on this page use the current names.

Create a folder

mkdir -p autotournament && cd autotournament

Save docker-compose.yml

Save this file as docker-compose.yml in the folder:

docker-compose.yml
services:
  postgres:
    image: postgres:16-alpine
    container_name: matchzy-postgres
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${DB_USER:-postgres}
      - POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
      - POSTGRES_DB=${DB_NAME:-matchzy_tournament}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U ${DB_USER:-postgres}']
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - matchzy-network

  matchzy-tournament:
    image: sivertio/matchzy-auto-tournament:latest
    container_name: matchzy-tournament-api
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    env_file:
      - .env
    ports:
      - '${HOST_PORT:-3069}:3069'
    environment:
      - NODE_ENV=production
      - PORT=3000
      - DB_HOST=postgres
      - DATABASE_URL=postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@postgres:5432/${DB_NAME:-matchzy_tournament}
      - SESSION_SECRET=${SESSION_SECRET:-}
    volumes:
      - ./data:/app/data
    healthcheck:
      test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:3069/health']
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 10s
    networks:
      - matchzy-network

networks:
  matchzy-network:
    driver: bridge

volumes:
  postgres-data:
    driver: local

PORT=3000 is the internal port of the API. Do not change it. The web app and API are both served on port 3069. Set HOST_PORT in .env to use another port on your machine.

Create .env

This command creates .env with two new random secrets:

cat > .env <<EOF
SESSION_SECRET=$(openssl rand -base64 32)
SERVER_TOKEN=$(openssl rand -base64 24 | tr -d '=+/')
FRONTEND_BASE_URL=http://localhost:3069
STEAM_API_KEY=
AUTH_STEAM_ENABLED=true
LOG_LEVEL=info
EOF

Then open .env and fill in two values:

  • STEAM_API_KEY: get a key from the Steam Web API key page. Steam login does not work without it.
  • FRONTEND_BASE_URL: the address you open in the browser. Your game servers also use this address to send results back, so localhost only works when the game servers run on the same machine. If they run somewhere else, use the LAN IP or domain, for example http://192.168.1.50:3069 or https://tournament.example.com.

All other settings are in Configuration.

Start

docker compose up -d

Check that it is running:

curl -fsS http://localhost:3069/health

Open the app

Open the value of FRONTEND_BASE_URL in your browser, for example http://localhost:3069. Continue with First login.

Where the data is

  • The database is in the Docker volume postgres-data. docker compose down keeps it. docker compose down -v deletes it.
  • Uploaded files, such as demos, are in the data/ folder next to docker-compose.yml.

Before you update, read Updating.

Use a domain with HTTPS

Put a reverse proxy in front of port 3069 and set FRONTEND_BASE_URL to the https:// address. See Reverse proxy.

On this page