Skip to content

Deployment

Alex Stephan edited this page Nov 20, 2024 · 1 revision

Deployment Methods

Docker

Deploying the backend with Docker is simple. Just run the following command:

docker run -it -p 8080:8080 ghcr.io/letgamer/rspass:main -e JWT_SECRET=$(openssl rand -base64 32)

This will start the backend, expose it on port 8080, and generate a random JWT secret for authentication.

Docker Compose

For easier management and configuration, you can deploy the backend using Docker Compose.
Create a docker-compose.yaml file with the following content:

services:
  rspass-backend:
    image: ghcr.io/letgamer/rspass:main
    container_name: rspass-api
    restart: always
    ports:
      - 8080:8080
    environment:
      JWT_SECRET: ${JWT_SECRET}
    volumes:
    - ./database.db:/usr/local/bin/database.db
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "5"

Make sure to create a .env file in the same directory where the docker-compose.yaml file is located, and store the JWT_SECRET variable there.
Example .env file:

JWT_SECRET=your_secret_key_here

This setup will ensure your backend is always restarted in case of failure, log management is configured, and your database is persisted in the ./database.db file on the host.

Now start the container:

docker compose up -d
Clone this wiki locally