Cloud9: Updating Go and getting Buffalo setup with Postgres
Jul 18, 2020 - 2 minutesWhen you setup your cloud9 IDE for the first time, it comes pre-installed with go1.9 - if you’d like to update to the latest (as of this writing), just run the following commands:
1wget https://golang.org/dl/go1.14.6.linux-amd64.tar.gz
2sudo tar -C /usr/local -xzf ./go1.14.6.linux-amd64.tar.gz
3mv /usr/bin/go /usr/bin/go-old # move the old binary
Edit your .bashrc
file so your $PATH
has the new location:
1export PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/go/bin
Source the file again so your settings are reloaded:
1source ~/.bashrc
And now go version
should show 1.14.6
Now lets install Buffalo with gofish
:
1curl -fsSL https://raw.githubusercontent.com/fishworks/gofish/master/scripts/install.sh | bash
2gofish init
3gofish install buffalo
4buffalo version # should say 0.16.12 or whatever latest is
And finally let’s setup postgres:
1sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
2wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3sudo apt-get update
4sudo apt-get install postgresql-12
5sudo su - postgres
6psql
7postgres=# create role ubuntu with superuser createdb login password 'ubuntu';
8postgres=# create database ubuntu;
9postgres=# exit
10exit
You should now be to execute psql
from your regular user.
Let’s create our demo buffalo app:
1buffalo new demo
2cd demo
Edit your database.yml to look like this for development:
1---
2development:
3 url: {{envOr "DEV_DATABASE_URL" "postgres://ubuntu:ubuntu@/demo_development"}}
Then you can create and migrate your database:
1buffalo db create && buffalo db migrate
Now just run buffalo dev
in your Cloud9 terminal and you can preview your
application! (Cloud9 already sets the PORT
env var).
And then you realize that auto-complete support doesn’t work with a small little
This feature is in an experimental state for this language. It is not fully implemented and is not documented or supported.
on the AWS product page, and go back to IntelliJ.