Skip to content

Server Installation

Baytae Tistear edited this page Jul 7, 2026 · 2 revisions

Server Installation

Parent section: Installation and Setup

This page covers a first-time production server install. It avoids secrets and uses placeholder names where values are private.

1. Prepare The Server

Use an Ubuntu server with a regular deployment user. The common production path is:

/home/ubuntu/discord-screenshot-bot

Install normal system basics such as Python, Git, build tools, and Nginx/Certbot if the installer does not handle them for your environment.

2. Get The Code

Use the project repository or the official release installer. If working from source, the app should end up at:

cd /home/ubuntu/discord-screenshot-bot

The main files on the server are:

  • bot.py
  • dashboard.py
  • config.py
  • database_migrations.py
  • database_backend.py
  • config.json
  • scripts/
  • systemd/
  • nginx/
  • media/

3. Run The Ubuntu Installer

From the app directory:

cd /home/ubuntu/discord-screenshot-bot
bash scripts/install_ubuntu.sh

Dedicated service user option:

cd /home/ubuntu/discord-screenshot-bot
SDAC_APP_USER=sdac SDAC_CREATE_APP_USER=1 bash scripts/install_ubuntu.sh

The installer should set up the Python environment, service files, database prerequisites, and initial dashboard owner flow depending on the installed version.

4. Create Or Update The Env File

Production commonly uses:

/etc/sdac-bot/sdac.env

Document variable names only. Add real values on the server, not in the wiki:

DISCORD_TOKEN=
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
DISCORD_REDIRECT_URI=
SDAC_ADMIN_KEY=
SDAC_PUBLIC_BASE_URL=
SDAC_MEDIA_PUBLIC_BASE_URL=
SDAC_DATABASE_URL=

Only DISCORD_TOKEN is required for the bot to log in. OAuth variables are required for Discord OAuth login. SDAC_DATABASE_URL is experimental and only needed for PostgreSQL testing.

5. Set File Permissions

The app user needs access to:

  • The app directory.
  • config.json.
  • sdac.db.
  • media/.
  • Backup directories.
  • The env file.

The env file should not be world-writable. Avoid printing its contents in logs or screenshots.

6. Run Database Migrations

Run migrations after install or update:

cd /home/ubuntu/discord-screenshot-bot
venv/bin/python scripts/migrate_database.py --db sdac.db

7. Install Services

Expected services:

  • sdac-bot.service
  • sdac-dashboard.service

Useful commands:

sudo systemctl daemon-reload
sudo systemctl enable sdac-bot
sudo systemctl enable sdac-dashboard
sudo systemctl restart sdac-bot
sudo systemctl restart sdac-dashboard
sudo systemctl status sdac-bot --no-pager
sudo systemctl status sdac-dashboard --no-pager

8. Configure Nginx And HTTPS

If using a public dashboard domain:

cd /home/ubuntu/discord-screenshot-bot
SDAC_DOMAIN=YOUR_DOMAIN bash scripts/install_nginx_site.sh
sudo certbot --nginx -d YOUR_DOMAIN --cert-name YOUR_DOMAIN --key-type rsa
sudo certbot renew --dry-run

After HTTPS is active, OAuth redirect URLs should use the public HTTPS URL.

9. Create The First Dashboard Owner

If the installer did not create the first owner account, create/reset one from the server shell:

cd /home/ubuntu/discord-screenshot-bot
venv/bin/python scripts/reset_admin_login.py --username owner --role owner

Create an admin with an email and Discord link:

venv/bin/python scripts/reset_admin_login.py --username alex --email alex@example.com --discord-user-id 123456789012345678 --role admin

Use example values in docs only. Do not publish real private account details unless they are intentionally public.

10. Install The Update Command

If sdac-update is not installed yet, install it from the latest official release installer/update script. After it is installed:

sdac-update latest-official

Useful aliases:

sdac-update "Version 3"
sdac-update latest-experimental
sdac-update 3.1.0

11. Verify Health

Local health:

curl http://127.0.0.1:5000/health

Public health:

curl -I https://YOUR_DOMAIN/health

Service logs:

journalctl -u sdac-bot -n 80 --no-pager
journalctl -u sdac-dashboard -n 80 --no-pager
journalctl -u nginx -n 80 --no-pager

12. Continue Setup

After the server is installed:

Clone this wiki locally