Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

PG on DigitalOcean

Things we did while debugging our postgresql server on Digital Ocean (documenting b/c who knows, we might need again, or others might).

We did this while going through this tutorial

Set env to production

by adding this to ~/.bash_profile (otherwise it creates the development db)

export RAILS_ENV=production
export RACK_ENV=production

Create the user

When it was complaining about the user not being in there, we created the user (weren't getting anywhere trying to figure out how to tell it we were the one we initially created)

This gave us the ability to create the correct database

$ sudo su - postgres
$ psql
> \du -- display all users and their roles
> CREATE ROLE merlin WITH CREATEDB LOGIN PASSWORD 'footprints1406';

Adding the hstore extension

We still could not migrate, because one of the migrations tried to create the hstore extension. So, we had the superuser create it:

$ rake db:create
$ sudo su - postgres
$ psql
> \list                           -- see all databases, make sure it's there
> \connect travel_hub_production  -- connect to the db we want to add the extension to
> create extension hstore;        -- create the hstore extension (we can do this, we're root)
> \q
$ exit
$ rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment