Post

Did You Know Spellbreak Can Let Players Self Host Playit

Welcome to this guide where we will walk you through the process of self-hosting the popular game, Spellbreak, on Playit, an open-source gaming platform. This tutorial assumes you have a.

# Self-Hosting Spellbreak on Playit: A Comprehensive Guide for DevOps Engineers

Welcome to this guide where we will walk you through the process of self-hosting the popular game, Spellbreak, on Playit, an open-source gaming platform. This tutorial assumes you have a basic understanding of Linux system administration, Docker, and DevOps practices. Let’s get started!

Prerequisites

  1. Ubuntu 20.04 or later with Docker installed (apt install docker-ce=5.0.8)
  2. Docker Compose version 1.27.x or higher (curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose)
  3. Sufficient system resources to run the Spellbreak server (minimum 4GB RAM, 2 vCPUs)
  4. Stable internet connection for downloading game assets and updates

Setup Self-Hosted Playit Infrastructure

  1. Clone the official Playit repository:
    1
    2
    
    git clone https://github.com/Playit-org/playit.git
    cd playit
    
  2. Create a docker-compose.yml file in the root directory of your cloned Playit repository:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    version: '3'
    services:
      playit:
        image: ghcr.io/playit-org/playit:latest
        environment:
          - PLAYIT_API_SECRET=your_secret_key
          - PLAYIT_WEBSOCKET_PORT=8001
          - PLAYIT_DATABASE_DRIVER=postgresql
        ports:
          - "80:80"
          - "443:443"
          - "8001:8001/tcp"
        volumes:
          - ./playit-data:/data
        restart: always
    

    Replace your_secret_key with a randomly generated secret key for Playit API.

  3. Create the necessary directories and files in your playit-data volume directory:
    1
    2
    
    mkdir -p playit-data/postgresql/data
    touch playit-data/nginx/conf.d/default.conf
    
  4. Configure the Nginx server block for Playit in playit-data/nginx/conf.d/default.conf:
    1
    2
    3
    4
    5
    6
    7
    8
    
    server {
      listen 80;
      server_name _;
    
      location / {
        proxy_pass http://playit:8001;
      }
    }
    
  5. Start the Playit service with Docker Compose:
    1
    
    docker-compose up -d
    

Install and Configure Spellbreak Server on Playit

  1. Navigate to the Playit server’s data directory:
    1
    
    docker exec -it playit sh -c "cd /data"
    
  2. Download and unzip the latest Spellbreak server release:
    1
    
    wget https://cdn.epicgames.com/SpellbreakGame/RelocatedContent/linux-server-latest.tar.gz && tar -xzf linux-server-latest.tar.gz
    
  3. Rename the unzipped directory to spellbreak:
    1
    
    mv spellbreak-* spellbreak
    
  4. Update the spellbreak/config/SpellbreakServer.ini configuration file with your desired settings (e.g., region, max players, etc.)
  5. Create a systemd service unit file for the Spellbreak server:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    cat > /etc/systemd/system/spellbreak.service << EOF
    [Unit]
    Description=Spellbreak Server
    After=network.target
    
    [Service]
    ExecStart=/usr/local/bin/docker run -it --rm --name spellbreak_server -v /etc/timezone:/etc/timezone -v /data/spellbreak:/spellbreak -e "PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)" ghcr.io/playit-org/spellbreak:latest runCmd
    Restart=always
    User=root
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
  6. Enable and start the Spellbreak service:
    1
    2
    
    systemctl enable spellbreak
    systemctl start spellbreak
    

Troubleshooting

  • Ensure the Playit API secret key is correctly set in your docker-compose.yml file
  • Verify that the Spellbreak server container is running with the correct port forwarding (e.g., docker ps -a | grep spellbreak)
  • Check the logs for both the Playit and Spellbreak services to identify any issues

Conclusion

In this article, you learned how to self-host the Spellbreak game on Playit infrastructure using Docker and DevOps practices. By following these steps, you have built a robust and flexible gaming environment in your homelab, allowing you to enjoy the freedom of customization while leveraging open-source solutions for automation and infrastructure management. Happy gaming!

This post is licensed under CC BY 4.0 by the author.