Nova Resource:Discourse/runbooks

From Wikitech


The site uses unicorn. Restart with

cd /var/discourse/
sudo ./launcher enter app
killall -s SIGUSR2 unicorn_launcher

Logs are at /var/www/discourse/log/unicorn.[stdout|stderr].log (on the container).


  1. backup the site:
    cd /var/discourse/
    sudo ./launcher enter app
    discourse backup
    # possibly make local copy of /var/discourse/shared/standalone/backups/default/<filename>
    # possibly make local copy of /var/discourse/containers/app.yml
  2. do the upgrade:
    cd /var/discourse/
    git status
    sudo git tag -f state-before-upgrade
    sudo git pull
    # this will take a while, might want to use screen
    # if there isn't enough space, stop the app first with
    #   sudo ./launcher stop app
    sudo ./launcher rebuild app

If you are out of space, you can stop the app and delete containers first (will render the site inoperable until a successful rebuild):

sudo ./launcher stop app --skip-prereqs
sudo ./launcher cleanup
sudo ./launcher rebuild app

Freeing up disk space

  1. delete old docker containers:
    cd /var/discourse/
    sudo ./launcher cleanup
  2. delete some of the older backups from /var/discourse/shared/standalone/backups/default/
  3. delete apt cache: sudo apt-get clean

Enabling/disabling readonly mode from command line

cd /var/discourse/
sudo ./launcher enter app
rails c
# or Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)

Exporting backups

Create backup via <discourse site>/admin/backups/logs. Ideally exporting would happen via the "Download" button there, but that doesn't seem to work reliably. Instead you can use

cd /var/discourse/
sudo docker cp app:/var/www/discourse/public/backups/default/<filename> ~

and then fetch from the Cloud VPS machine via scp.