Skip to content

Instantly share code, notes, and snippets.

@stevekinney
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevekinney/e818ce7fdd9c3d731c3a to your computer and use it in GitHub Desktop.
Save stevekinney/e818ce7fdd9c3d731c3a to your computer and use it in GitHub Desktop.

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