These are the steps I used to run a Yesod scaffold in Cloud9. The whole process took a few hours and I had to upgrade memory and disk (do this before proceeding):
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 575159689BEFB442
echo 'deb http://download.fpcomplete.com/ubuntu trusty main'|sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update && sudo apt-get install stack -y
Status: running $ stack
from the command line works as expected
stack new yesodOnC9 yesod-postgres && cd yesodOnC9
stack build yesod-bin cabal-install --install-ghc
stack build
$ sudo service postgresql start
$ sudo sudo -u postgres psql
postgres=# CREATE DATABASE "yesodDB";
postgres=# CREATE DATABASE "yesodDB_test"
postgres-# \password postgres
Enter new password: MYPASSWORD
Result:
user: postgres
password: MYPASSWORD
user: "_env:PGUSER:postgres"
password: "_env:PGPASS:MYPASSWORD"
database: "_env:PGDATABASE:yesodDB"
database: yesodDB_test
stack exec -- yesod devel -b $IP -p $PORT
Result: Successful, Running Scaffold
If you leave your workspace, you will have to restart the PostgreSQL service with:
$ sudo service postgresql start
when you return.
Did you configure Postgres to accept TCP connections as indicated by the error message? Your installation of Yesod seems ok, but Yesod reads the DB to make a migration at start time so it needs a connection to your DB.