Version 2 (modified by Michael Howden, 11 years ago) ( diff )




Heroku (http://www.heroku) is a Cloud Application which Sahana Eden can easily be deployed on. The basic deployment is free of cost and does not require a credit card. For making the deployment scalable, and to introduce more add-ons to the deployment, Heroku offers a number of different Pricing options.


The deployment process is very straightforward.:

  1. Create Heroku Account
  2. Install Heroku Toolbelt
  3. Create Git Branch with Web2Py + Sahana Eden
  4. Create Heroku App

Create Git Branch with Web2Py + Sahana Eden

It's recommended to do this in a separate local directory to avoid interfering with your working Web2Py + Sahana Eden branches.

# Choose the Admin Password
read -p "Choose your admin password?" passwd

# Get latest web2py
git clone web2py
cd web2py/applications

# Get Sahana Eden TRUNK.
git clone eden

# OR get your Sahana Eden branch.
git clone eden

# Copy and edit the config file
cp eden/private/templates/ eden/models/
cat eden/models/ | sed "s/FINISHED_EDITING_CONFIG_FILE = False/FINISHED_EDITING_CONFIG_FILE = True/" > temp
mv temp eden/models/

Create Heroku App

# Install virtualenv and postgres DB
sudo pip install virtualenv
sudo pip install psycopg2

# Activate the virtual environment
virtualenv venv --distribute
source venv/bin/activate

# Generate the requirements for Eden.
cp applications/eden/requirements.txt .
echo "" >> requirements.txt
pip freeze >> requirements.txt

# Write the Procfile used by heroku
echo "web: python -a '$passwd' -i -p \$PORT" > Procfile

# Create a remote for heroku
heroku create

# Choose the application name
read -p "Choose your application name?" appname
heroku apps:rename $appname    

# Remove eden from version control and add it to web2py version control (there should be one version control)
cd applications/eden/
rm -rf .git
git add -f .
cd ../../
git add .
git add Procfile

git commit -a -m "first commit"

# Push Eden to heroku
git push heroku master

# Add add-ons : Postgres DB
heroku addons:add heroku-postgresql:dev --app $appname
heroku scale web=1 --app $appname

# Open the application.
heroku open --app $appname


When changes merged and the pushed to Heroku the application is rebuilt with these changes.

Currently updates can only be made directly to the combined branch. We need instructions to set up the git branch so that the you can still update from the Sahana Eden branch, eg:

# Pull changes from trunk
git pull upstream git:// master

# OR Pull changes from your branch 
git pull git:// master

# Push Changes to Heroku App
git push heroku master

To Do

  • Preserve Sahana Eden git to be able to pull Sahana Eden updates
  • Redirect to Sahana Eden - not ( Web2Py
  • Access Error Tickets
  • Commands / Scripts to clear the database
Note: See TracWiki for help on using the wiki.