Skip to content

Instantly share code, notes, and snippets.

@mikerourke
Last active June 3, 2022 12:41
Show Gist options
  • Save mikerourke/0c2cac1bec77fb4c1d875bfaee487074 to your computer and use it in GitHub Desktop.
Save mikerourke/0c2cac1bec77fb4c1d875bfaee487074 to your computer and use it in GitHub Desktop.
Upgrades/Installation in Cloud9

Installing Yarn in Cloud9

You can't just follow the directions on the site, you have to do some mojo first.

Step 1. Run update.

sudo apt-get update

Step 2. Install apt-transport-https.

sudo apt-get install apt-transport-https

Step 3. Configure the repository (from Yarn installation).

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Step 4. Run update again and install Yarn.

sudo apt-get update && sudo apt-get install yarn

You're good to go!

Upgrading PostgreSQL in Cloud9

I got most of this information from this blog post and this Medium post. I'm going to upgrade to version 9.5 to get the JSONB functionality.

Steps

Step 1. Figure out which version you're using.

psql --version

Use this version number for the next commands. I have 9.3.14 installed, so I'll be using 9.3 in any commands that require it.

Step 2. Stop PostgreSQL service.

sudo pg_ctlcluster 9.3 main stop

Step 3. Add apt repository to your sources.

echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/postgres.list

Step 4. Add repository key for newly added source.

sudo apt-get install wget ca-certificates

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Step 5. Update and install the new package.

sudo apt-get update

sudo apt-get install postgresql-9.5

Note: When the prompt appears asking what to do about the createcluster.conf file, select keep the local version currently installed.

Step 6. Remove the newly created empty cluster.

sudo pg_dropcluster --stop 9.5 main

Step 7. Upgrade your databases.

sudo pg_upgradecluster 9.3 main

Note: This may take a while.

Step 8. Check the clusters for giggles.

sudo pg_lsclusters

Step 9. Drop the old cluster.

sudo pg_dropcluster 9.3 main

You're good to go!

@ademidun
Copy link

Thanks for sharing @mikerourke , though I think this information might be outdated. I found another link that might be more recent. Btw, I haven't tried it yet ( I have to go eat dinner 😁 ) but it can at least help as a starting pioint
https://serverfault.com/questions/747442/upgrading-postgresql-on-ec2-with-minimum-impact-to-existing-configuration

It helps to think of Cloud 9 as pretty much just a layer on top of EC2, so if you are trying to do something on cloud 9 you can ask the related question of how would you do it on EC2

Some interesting stuff to also read: https://aws.amazon.com/blogs/database/moving-on-from-amazon-rds-for-postgresql-versions-9-4/

@mikerourke
Copy link
Author

Hi @ademidun, thanks for the links. These instructions were actually from way back in the day before Cloud9 was bought by Amazon and moved to AWS, so it is definitely outdated! I should probably just take this gist down.

@ademidun
Copy link

ademidun commented May 17, 2020

You're welcome and I don't think you should take it down, it's good to have it for posterity. Especially because it might either:

  1. Help people solve a different problem that is postgres and not cloud 9 specific
  2. They might come here via Google and see my comment and that might help them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment