Cannot create hstore on upgrade

unsupported-install

(Jared W) #1

Hey All,
We are attempting to upgrade from 9.3.2 to 1.0.2 and are running into some issues. We started with the base Bitnami instance and ended up getting in a bad spot with our initial VM so we’re now attempting to restore a backup from the 9.3.2 system onto the 1.0.2 instance of Bitnami.

I’ve been following this guide:
http://wiki.bitnami.com/Applications/BitNami_Discourse#How_to_upgrade_Discourse.3f
and for the most part things have gone smoothly until I attempt to run the Rake command to do the migration. Which results in the following error:

bitnami@bitnami-discourse-e6ab:/opt/bitnami/apps/discourse/htdocs$ bin/rake db:migrate RAILS_ENV=production
2014-10-08T01:16:08Z 45804 TID-otkppfgm4 INFO: Sidekiq client with redis options {:url=>"redis://localhost:6379/0", :namespace=>"sidekiq"}
== 20120924182000 AddHstoreExtension: migrating ===============================
-- execute("CREATE EXTENSION IF NOT EXISTS hstore")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  permission denied to create extension "hstore"
HINT:  Must be superuser to create this extension.
: CREATE EXTENSION IF NOT EXISTS hstore/opt/bitnami/apps/discourse/htdocs/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.1/lib/patches/sql_patches.rb:160:in `exec'

Previously it seemed to be stopping on 20120921162512_add_meta_data_to_forum_threads.rb however now it’s stopping on 20120924182000_add_hstore_extension.rb. Both attempt to add the hstore extension.

I’ve verified that the extensions do exist in postgres:

postgres=# \dx
                                    List of installed extensions
  Name   | Version |   Schema   |                            Description
---------+---------+------------+-------------------------------------------------------------------
 hstore  | 1.2     | public     | data type for storing sets of (key, value) pairs
 pg_trgm | 1.1     | public     | text similarity measurement and index searching based on trigrams
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(3 rows)

I’m certainly not a Ruby or Postgres expert so any help here would be beneficial! I’ve attempted to run the migration as root but that doesn’t seem to make any difference.

I should mention we don’t have any customization besides some CSS. It’s a pretty vanilla install. It would be great to get our users and posts back but minimally our users would be acceptable!

Thanks in advance!
Jared


(Sam Saffron) #2

We strongly recommend you move to our officially supported Docker based install. We are unable to support the bitnami install here.


(Jens Maier) #3

Are you sure that you connected to Discourse’s production database and not e.g. the postgres database?

Anyways, one solution is to make the Discourse user a Postgres super user with psql postgres -c 'ALTER ROLE discourse SUPERUSER;', then run the migration and revoke superuser privileges again (same command but with NOSUPERUSER instead of SUPERUSER).


(Jared W) #4

Jens,
That worked! Thank you so much!

Jared