Upgrading Discourse and PostgreSQL Issues


(Brandon Mathis) #1

This all started with me wanting to change my remote tracking branch to tests-passed as defined here

When I tried to rebuild I was told that I need a new version of docker so I upgraded docker.

root@discourse:/var/docker# docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): linux/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f

Now I need to upgrade postgres (ouch) I followed these steps presented to me.

-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES FAILED
 
You are going to need to export your data and import into a clean instance:
 
Add the line: base_image: "samsaffron/discourse:0.1.1"
Change: templates/postgres.template.yml TO templates/postgres.9.2.template.yml
 
Run ./launcher bootstrap again
 
When your instance is running:
- Go to the admin UI, enable readonly and backup your site
 
Then destroy your container ./launcher destroy standalone
Undo the base_image and postgres.9.2 template from your container config
Run: sudo mv /var/docker/shared/postgres_data /var/shared/postgres_data_old
Run: ./launcher bootstrap
 
Login to the blank site, and import your backup (remember to set the allow_restore site setting)
Restart your container: ./launcher restart
-------------------------------------------------------------------------------------

Now I am getting 502 and 500 errors and I am not sure where to go. Where is mah logs? :frowning:


(Brandon Mathis) #2

It also probably doesn’t help that I get lots of postgresql errors durring bootstrap

I, [2014-10-28T16:44:49.020067 #41]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake assets:precompile'
2014-10-28 16:44:50 UTC ERROR:  relation "site_contents" does not exist at character 323
2014-10-28 16:44:50 UTC STATEMENT:                SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                             pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                        FROM pg_attribute a LEFT JOIN pg_attrdef d
                          ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                       WHERE a.attrelid = '"site_contents"'::regclass
                         AND a.attnum > 0 AND NOT a.attisdropped
                       ORDER BY a.attnum

(Sam Saffron) #3

Do you have a backup? If so the easiest thing would be to start from scratch and restore from backup

If not, you need to upgrade the database files from 9.2 to 9.3


(Brandon Mathis) #4

I did upgrade from a digialocean backup.

I’m wondering where things went wrong. All I really want to do is set the remote tracking branch to tests-passed.


(Brandon Mathis) #5

Do you have an ideas what may have prompted this postgresql upgrade? Any way I can avoid it?


(Sam Saffron) #6

You were using a very old base image. Our base image is on 9.3 for the last 8 or so months