Transitioning to Docker


(Tom Spilman) #1

So I need to figure out how to correctly backup an old instance of Discourse (v1.1.0) that was created using the original Ubuntu install guide:

… then restore our data on a new Docker based instance.

Are there any guides for this available?


(Jeff Atwood) #2

The general strategy is to upgrade it to latest, if you can, then move the exported data over. There is a howto on transitioning to docker here in the howto category, I believe.


(Erlend Sogge Heggen) #3

yup:


(Tom Spilman) #4

FYI. I finally got around to updating my old Discourse v1.1.0 custom install to the latest Discourse release. Some notes for anyone that later might be making this sort of jump.

I ended up updating our webserver to Ubuntu 14.04 to get PostgreSQL 9.3 which is needed for the newer releases of Discourse. I could have forced Ubuntu 12.x to use it (see Upgrade PostgreSQL from 9.1 to 9.3 on Ubuntu 12.04 · GitHub), but it seemed like it would be more reliable to just move to 14.04.

Once on 14.04 updating to PostgreSQL 9.3 was easy (used info from NixMash Post: Upgrading PostgreSQL 9.1 to 9.3 in Ubuntu):

sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-contrib-9.3 postgresql-server-dev-9.3 pgadmin3
sudo service postgresql stop
sudo pg_dropcluster --stop 9.3 main
sudo pg_upgradecluster 9.1 main
sudo service postgresql start 9.3

Then I switch to the Discourse user and followed the old v1.1.0 upgrade instructions (see discourse/INSTALL-ubuntu.md at v1.1.0.beta4 · discourse/discourse · GitHub):

sudo su - discourse
# Run these commands as the discourse user
bluepill stop
bluepill quit
# Back up your install
DATESTAMP=$(TZ=UTC date +%F-%T)
pg_dump --no-owner --clean discourse_prod | gzip -c > ~/discourse-db-$DATESTAMP.sql.gz
tar cfz ~/discourse-dir-$DATESTAMP.tar.gz -C /var/www discourse
# get the latest Discourse code
cd /var/www/discourse
git checkout master
git pull
git fetch --tags
# To run on the latest numbered release instead of bleeding-edge:
#git checkout latest-release
#
# Follow the section below titled:
# "Check sample configuration files for new settings"
#
bundle install --without test --deployment
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production bundle exec rake db:migrate
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production bundle exec rake assets:precompile
# restart bluepill
crontab -l
# Here, run the command to start bluepill.
# Get it from the crontab output above.

Now that i’m up to date I can then look into moving to a Docker setup.