You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Nova Resource:Discourse/runbooks

From Wikitech-static
< Nova Resource:Discourse
Revision as of 05:31, 5 December 2021 by imported>Gergő Tisza
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Unicorn

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).

Updating

  1. backup the site:
    cd /var/discourse/
    sudo ./launcher enter app
    discourse backup
    exit
    # 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
Discourse.enable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)
# or Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)