Production Setup (Ubuntu) - Juules32/wordguessr GitHub Wiki
- Set up new redis server running on a custom port with a password (important!)
- Copy
.env.example
to.env.production
and fill in the values, including some locally generated cron secret. The redis connection string should include the password in the form:redis://:<password>@localhost:<port>
- Make python venv and enter it to install dependencies
- Generate template puzzles with:
python puzzle_generation.py
- Make service files for the production redis server:
[Unit]
Description=Redis Production Server
After=network.target
[Service]
ExecStart=/usr/bin/redis-server /etc/redis/redis-prod.conf
ExecStop=/usr/bin/redis-cli -p <port> shutdown
Restart=always
User=redis
Group=redis
[Install]
WantedBy=multi-user.target
- ... and the python webserver:
[Unit]
Description=WordGuessr (Uvicorn) Service
After=network.target
[Service]
User=benny
WorkingDirectory=<repo path>
ExecStart=<repo path>/.venv/bin/uvicorn main:app --port <port> --env-file .env.production
Restart=on-failure
[Install]
WantedBy=multi-user.target
- Enable and test the services
- Make cron scripts that triger the /cron endpoint with the secret generated cron secret and add them to the crontab
- (Optional) add CNAME record to the webserver for example using Cloudflare Tunnels