Merge pull request #90 from gregwebs/heroku3

Heroku3
This commit is contained in:
Michael Snoyman 2011-07-17 02:10:37 -07:00
commit 5ece9efca0
10 changed files with 79 additions and 12 deletions

View File

@ -2,9 +2,13 @@
## Test suite
install the shelltest package: cabal install shelltests
Run this from the project root directory. It will make sure each site type builds. It first does an sdist, which ensures we are testing what will be put on hackage.
shelltest tests/scaffold.shelltest
tests/run.sh
Give it the --debug flag to see all output
## Quicker, repeatable site building

View File

@ -100,6 +100,9 @@ scaffold = do
mkDir "static/js"
mkDir "config"
mkDir "Model"
mkDir "deploy"
writeFile' ("deploy/Procfile") $(codegen "deploy/Procfile")
case backendS of
"s" -> writeFile' ("config/" ++ backendLower ++ ".yml") $(codegen ("config/sqlite.yml"))

View File

@ -51,6 +51,7 @@ executable ~project~
, yesod-auth >= 0.4 && < 0.5
, yesod-static >= 0.1 && < 0.2
, mime-mail
, clientsession
, wai-extra
, directory
, bytestring

View File

@ -0,0 +1,47 @@
# Simple and free deployment to Heroku.
#
# !! Warning: You must use a 64 bit machine to compile !!
#
# This could mean using a virtual machine. Give your VM as much memory as you can to speed up linking.
#
# Yesod setup:
#
# * Move this file out of the deploy directory and into your root directory
#
# mv deploy/Procfile ./
#
# * Create an empty Gemfile and Gemfile.lock
#
# touch Gemfile && touch Gemfile.lock
#
# * TODO: code to read DATABASE_URL environment variable.
#
# import System.Environment
# main = do
# durl <- getEnv "DATABASE_URL"
# # parse env variable
# # pass settings to withConnectionPool instead of directly using loadConnStr
#
# Heroku setup:
# Find the Heroku guide. Roughly:
#
# * sign up for a heroku account and register your ssh key
# * create a new application on the *cedar* stack
#
# * make your Yesod project the git repository for that application
# * create a deploy branch
#
# git checkout -b deploy
#
# Repeat these steps to deploy:
# * add your web executable binary (referenced below) to the git repository
#
# git add ./dist/build/~project~/~project~
#
# * push to Heroku
#
# git push heroku deploy:master
# Heroku configuration that runs your app
web: ./dist/build/~project~/~project~ -p $PORT

View File

@ -48,6 +48,7 @@ executable ~project~
build-depends: base >= 4 && < 5
, yesod-core >= 0.8 && < 0.9
, yesod-static
, clientsession
, wai-extra
, directory
, bytestring

View File

@ -24,6 +24,7 @@ import Control.Monad (unless)
import Control.Monad.Trans.Class (lift)
import Control.Monad.IO.Class (liftIO)
import qualified Data.Text as T
import Web.ClientSession (getKey)
-- | The site argument for your application. This can be a good place to
-- keep settings and values requiring initialization before your application

17
tests/run.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash -x
#
# A wrapper for the shelltest test. Passes along options to shelltest.
#
# cabal install shelltestrunner
cabal clean && cabal install && cabal sdist
# I am not that good at shell scripting
# this for loop only operates on 1 file (as per tail -1)
for f in $(ls -1rt dist/*.tar.gz | tail -1)
do
tar -xzvf $f && cd `basename $f .tar.gz`
shelltest ../tests/scaffold.shelltest $@
cd ..
rm -r `basename $f .tar.gz`
done

View File

@ -1,3 +1,3 @@
#!/bin/bash -x
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..

View File

@ -1,13 +1,4 @@
# This uses shelltest
#
# cabal install shelltestrunner
# shelltest tests/scaffold.shelltest
#
# note that the first 2 lines setup this test but will also be counted as 2 tests.
cabal clean && cabal install && cabal sdist
for f in $(ls -1rt dist/*.tar.gz | tail -1); do tar -xzvf $f && cd `basename $f .tar.gz`; done
# Important! run with tests/run.sh
rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd ..
<<<

View File

@ -16,6 +16,7 @@ build-type: Simple
homepage: http://www.yesodweb.com/
extra-source-files:
input/*.cg
scaffold/cassius/default-layout.cassius.cg,
scaffold/cassius/homepage.cassius.cg,
scaffold/Model.hs.cg scaffold/sitearg.hs.cg,
@ -31,6 +32,7 @@ extra-source-files:
scaffold/pconn1.cg,
scaffold/.ghci.cg,
scaffold/cabal.cg,
scaffold/deploy/Procfile.cg,
scaffold/Controller.hs.cg,
scaffold/julius/homepage.julius.cg,
scaffold/hamlet/homepage.hamlet.cg,