wiki:InstallationGuidelines/Heroku

Version 1 (modified by somayjain, 11 years ago) ( diff )

--

Heroku

Table of Contents

  1. Introduction
  2. Deployment

Introduction

Eden can be easily deployed on heroku. The initial 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, appropriate pricing is available.

More information can be found here - Pricing

Deployment

  • The deployment process is very straightforward.
  • Changes when committed and pushed to git automatically reflect in the deployment, and the application is rebuilt and redeployed.

The following script will be useful in deploying eden on heroku -

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

# Get latest web2py
git clone https://github.com/web2py/web2py.git web2py
cd web2py/applications

# Get latest copy of Sahana Eden.
git clone https://github.com/flavour/eden.git eden

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

cd ..

# 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 web2py.py -a '$passwd' -i 0.0.0.0 -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

  • Whenever git push heroku master is done with some changes, those changes are pushed into the application deployed on heroku.
Note: See TracWiki for help on using the wiki.