In QuestFantasy backend
Copy .env.example to .env and edit values:
SECRET_KEY: Set a strong random stringDEBUG=False: For safer defaultsDB_NAME,DB_USER,DB_PASSWORD: Set secure credentials for databaseTOKEN_TTL_SECONDS: Login session token expiration in secondsTUNNEL_TOKEN: Cloudflare Tunnel Token for remote access (optional, required for online mode)
Before starting the deployment, ensure your system meets the following requirements:
- Ubuntu operating system (or other Linux distribution)
- Administrator privileges (sudo)
- Internet connection (for downloading Docker and related packages)
If your system meets these requirements, you can simply skip the following tools installation.
First, update the system package list and upgrade existing packages:
sudo apt update && sudo apt upgrade -yInstall necessary dependencies:
sudo apt install -y ca-certificates curl gnupgAdd Docker official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.ascSetup Docker official repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullUpdate package:
sudo apt updateInstall Docker and its related components:
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginTo avoid needing sudo for every Docker command, add the current user to the Docker group:
sudo groupadd docker
sudo usermod -aG docker $USERImportant: After executing the above commands, you need to log out and log back in, or execute the following command to make the group change take effect immediately:
newgrp dockerStart the Docker service and enable it to start on boot:
sudo systemctl start docker
sudo systemctl enable dockerVerify that Docker is correctly installed:
docker --version
docker compose versionIf both commands display version numbers, the installation is successful.
To start the default services (Backend + Database) only:
docker compose up --build -dTo start the services with Cloudflare Tunnel enabled (Online Mode):
docker compose --profile online up --build -ddocker compose ps
docker compose logs -f backenddocker compose downThis removes all PostgreSQL data:
docker compose down -v- User passwords are stored hashed by Django auth.
- Token authentication is configured with server-side expiration.
- The
backendcontainer applies migrations on startup automatically.