diff --git a/scaffold.hs b/scaffold.hs index 8d0fb6ab..c76fe7b7 100644 --- a/scaffold.hs +++ b/scaffold.hs @@ -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")) diff --git a/scaffold/deploy/Procfile.cg b/scaffold/deploy/Procfile.cg new file mode 100644 index 00000000..3f79f92c --- /dev/null +++ b/scaffold/deploy/Procfile.cg @@ -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 diff --git a/yesod.cabal b/yesod.cabal index 287f6d18..b5171709 100644 --- a/yesod.cabal +++ b/yesod.cabal @@ -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,