Skip to content
Jia Huang edited this page Feb 16, 2015 · 12 revisions

#Discourse

Overview

  • Provider: DigitalOcean
  • Instance Type: medium
  • OS: Ubuntu 14.04
  • Contact: Jia
  • Hostname: discourse-0.9.9.7
  • External: ssh [email protected]
  • Docker: yes
  • Ansible: no
  • Users
    • root - sudo access
  • Services
  • Data
    • on the web /admin/backups
    • /var/docker/shared/standalone/backups/default
  • Logs
    • if you’re on the web go to /sidekiq
    • tail -f /var/docker/shared/standalone/log/rails/production.log

Upgrading

First back it up on /admin/backups/logs.

Then go to /admin/docker and upgrade.

Backups

  • go to /admin/backups/logs
  • start the backup

##Restarting docker Docker configurations are run through /var/docker/launcher. The name of the discourse instance is located at /var/docker/containers/*. Ex: if you had a app.yml file in /var/docker/containers/, the launcher script would be called through launcher <cmd> app.

/var/docker/launcher destroy app;
/var/docker/launcher bootstrap app;
/var/docker/launcher start app;

Rebootstrapping takes a while to resetup

Restore from backup

Restoring from backups only work if you are on the same version of Discourse. Otherwise you need to upgrade from the current box and reapply the rake migrations.

  • Make sure "restore from backups" is enabled
  • go to /admin/backups/logs
  • restore from a tar.gz file

Restoring will take a few min. The admin will get an email when the process is done.

Restore from a sql dump

kinda modified from here: https://meta.discourse.org/t/manually-create-and-restore-discourse-backups/18273

First prevent the new discourse box from sending out emails. Go to the existing box under /admin settings and check disable emails before doing a sql dump. Make sure you have login that doesn't depend on oauth because those oauth keys won't work until dns swaps over.

Grab the sql dump from an existing discourse box:

  • enter the docker box ./launcher enter app
  • get the sql dump sudo -u postgres pg_dump discourse > discourse_backup.sql

scp that file over to the new discourse box

On the new discourse box:

  • enter the docker box ./launcher enter app

  • restore the database psql discourse < discourse_backup.sql

  • run the rails migration

    su - discourse
    RAILS_ENV=production bundle exec rake db:migrate
    
  • exit out of docker

  • restart the app ./launcher restart app

  • flip DNS (on aws)

  • stop old discourse box

Bringing online a new box from scratch

  • Enable Google Oauth and Github Oauth
  • Set up s3 uploading
    • set up backups to go through s3
    • enable backups
  • enable ssl
  • set up embedding comments for projects
    • Note that urls need to be prefixed with http:// or https:// (unlike what's in the example)
    • poll feed url is projects.tessel.io/projects/feed
    • after it's set up, check /sidekiq for the pollFeed job and make sure it goes through ok

##Async tasks are failing and I don't know what's happening The job queue can be accessed through /sidekiq when you're logged in as an admin.

You can also view the logs with tail -f /var/discourse/shared/standalone/log/rails/production.log