http://scotty-on-heroku.herokuapp.com/
A simple example of Scotty application on Heroku. You can see the running application on the URL above.
(Heroku registration and setup are omitted.)
Clone this repository:
$ git clone git://github.com/daimatz/scotty-on-heroku.git
$ cd scotty-on-heroku
Create a new Heroku application:
$ heroku create --stack=cedar --buildpack https://github.com/pufuwozu/heroku-buildpack-haskell.git
Add PostgreSQL addon:
$ heroku addons:add heroku-postgresql:dev
Find out which color of db is created:
$ heroku config
=== app Config Vars
BUILDPACK_URL: https://github.com/pufuwozu/heroku-buildpack-haskell.git
HEROKU_POSTGRESQL_ORANGE_URL: postgres://uuuuu:[email protected]/zzzzz
Set the db to primary:
$ heroku pg:promote HEROKU_POSTGRESQL_ORANGE_URL
Make sure that DATABASE_URL
is set:
$ heroku config
=== app Config Vars
BUILDPACK_URL: https://github.com/pufuwozu/heroku-buildpack-haskell.git
DATABASE_URL: postgres://uuuuu:[email protected]/zzzzz
HEROKU_POSTGRESQL_ORANGE_URL: postgres://uuuuu:[email protected]/zzzzz
Push to Heroku:
$ git push heroku master
Wait for 5 or 6 minutes and then access to the application:
$ heroku open
Of cource you can run this application on localhost.
But you have to set PORT
and DATABASE_URL
manually.
$ cabal-dev update
$ cabal-dev install --only-dependencies
$ cabal-dev configure
$ cabal-dev build
$ PORT=3000 DATABASE_URL=postgres://uuuuu:[email protected]/zzzzz \
dist/build/scotty-on-heroku/scotty-on-heroku
You can use SQLite database instead of PostgreSQL for local development
(and in this case you don't have to set DATABASE_URL
).
Uncomment #define SQLite
in src/DBUtil.hs
:
-- Uncomment this line:
#define SQLite
If you didn't install PostgreSQL to your machine,
you also have to comment out persistent-postgresql
dependency in
scotty-on-heroku.cabal
.
, persistent < 1.1
-- , persistent-postgresql
, persistent-sqlite