Skip to content

Instantly share code, notes, and snippets.

@kljensen
Last active November 19, 2018 18:43
Show Gist options
  • Save kljensen/93937f09679842ce45f9a2eca05e0eaa to your computer and use it in GitHub Desktop.
Save kljensen/93937f09679842ce45f9a2eca05e0eaa to your computer and use it in GitHub Desktop.

I don't why c9 has such ancient node versions some times. To get something more recent, do

nvm install 8
nvm alias default 8

This is a summary of these instructions for installing postgres 10 on ubuntu, along with some specifics for c9. The c9 vms are all ubuntu as far as I can tell.

See what Ubuntu you are running.

lsb_release -a

I suspect it is "Ubuntu 14.04.5 LTS".

See your postgres version

psql -v

I suspect it is 9.3 or 9.6. 11 is the latest. 10 is reasonable.

Uninstall old postgres

dpkg -l | grep postgres|awk '{print $2}'|xargs sudo apt-get --purge remove -y

Install postgres 10

sudo add-apt-repository 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-10
sudo service postgresql start

If you're not on ubuntu 14, see these instructions for an alternative URL on the first line.

Now that we postgresql 10 installed, let's set up some databases to match the dev and test database structure described in the project starter.

Change to the postgres user

sudo su - postgres

Then as the postgres user

createuser -P dev_user
createuser -P testing_user
createdb -O testing_user testing_db
createdb -O dev_user dev_db
exit

You'll need to choose passwords for the dev_user and testing_user

The exit will return you to the default user, "ubuntu" on cloud9. Then you could connect to the database like

psql -h localhost -U dev_user dev_db

and give the password you entered above. You could run the jest tests like

TEST_DATABASE_URL=postgres://testing_user:testing_pass@localhost/testing_db npm test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment