Skip to content

daimatz/scotty-on-heroku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scotty on Heroku

http://scotty-on-heroku.herokuapp.com/

A simple example of Scotty application on Heroku. You can see the running application on the URL above.

Installation

(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

Running on Other Environment

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

Using SQLite

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

About

Example scotty application running on Heroku

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published