Production Environment - Monadical-SAS/oddslingers.poker GitHub Wiki
If your environment is docker see Production management commands for docker
Just need to deploy? Jump to Common Tasks
# oddslingers-server help
Usage:
-h | --help See a list of all functions
function [args] Run a function (funcs are defined in /opt/oddslingers.poker/bin/oddslingers-server.fish)
Functions:
start Start all production services
stop Stop all production services
stop_heartbeats Kill all the table heartbeat processes running on production
manage Run manage.py [cmd] [args] e.g. migrate
shell Open the production django shell_plus
migrate Run migrations on the production db
setup Run the commands which set up the server and install apt dependencies
update Pull a fresh copy of the specified [branch] to the server
offsite_backup Backup and save files to remote [host]
backup Dump a production db backup to
load_backup Load a [oddslingers.sql] backup into the database
notify Post a notification to the zulip #logs stream
clear_caches Clear CND edge caches, e.g. cloudflare
chowndirs Set the correct permissions on the data dirs
setup_tunnels Setup stunnels between necessary servers
deploy Use deploy function instead of thisMangement Commands
oddslingers-server manage <command>
[grater]
active_sessions
archive_table
create_admins
create_demo_data
daily_report
integration_test
safe_shutdown
send_mass_email
send_signup_email
track_analytics_event
utils
[poker]
boot_inactive
bot_heartbeat
table_heartbeat
...and more, see `oddslingers-server manage help`- repo:
/opt/oddslingers.poker - config:
/opt/oddslingers.poker/env - bin:
/opt/oddslingers,poker/binis added to$PATH - etc: files in
/etcare symlinked to/opt/oddslingers.poker/etc/ - data:
/datais symlinked to/opt/oddslingers.poker/data- logs/ (
/var/log/oddslingers.pokeris symlinked todata/logs) - database/ (
/var/lib/postgresql/10/main/is symlinked todata/database) - redis/
- debug_dumps/
- geoip/
- newsletters/
- support_tickets/
- logs/ (
# always run status first to see which groups are started or stopped & having problems
supervisorctl status
# start or stop whole groups
supervisorctl start blitzka-base:
supervisorctl stop blitzka-bg:
supervisorctl restart blitzka-django:
# start or stop individual services
supervisorctl start blitzka-base:nginx
supervisorctl stop blitzka-bg:botbeat
supervisorctl restart blitzka-django:django-http-workerFor a full list of available services and their configs, see etc/supervisor/<server-name>.conf.
To view the logs for a service and see why it has errors, see /opt/oddslingers.poker/data/logs/<service-name>.log
oddslingers-server backupBackups will be saved in /data/backups/grater_<date>.sql.gz.
oddslingers-server deploy prod # always backup first if there are migrationsor
oddslingers-server deploy betaoddslingers-server deploystatic prododdslingers-server migratesupervisorctl restart blitzka-base:nginx
oddslingers-server clear_cachesThis restarts nginx and pings Cloudflare to empty their content, you can also do this manually on the Cloudflare Dashboard.
supervisorctl restart blitzka-django:cd /data/logs
ls -lah
cat <log_here>.logcd /data/support_tickets/<ticket_short_id>
ls -lah
cat <artifact_here>
