Skip to content

ptahproject/heroku-ptah

Repository files navigation

To deploy this app on Heroku, do the following:

Install Heroku Toolbelt: https://toolbelt.herokuapp.com/

$ virtualenv cloudapp --distribute --no-site-packages
$ cd cloudapp
$ . bin/activate
$ git clone git://github.com/ptahproject/heroku-ptah.git
$ cd heroku-ptah
$ heroku create --stack cedar
$ heroku addons:add shared-database
$ git push heroku master
$ heroku ps:scale web=1
$ heroku open

To deploy this app on dotcloud, do the following:

$ virtualenv cloudapp --distribute --no-site-packages
$ cd cloudapp
$ . bin/activate
$ pip install dotcloud
$ git clone git://github.com/ptahproject/heroku-ptah.git
$ cd heroku-ptah
$ dotcloud create ptah
$ dotcloud push --all ptah

The directory structure will look like:
  
  ./
  ./cloudapp
    ./bin
    ./src
    ./lib
    ./heroku-ptah
      ./setup.py
      ./settings.ini
      ./herokuapp
        ./__init__.py
        ./ ...
      ./Procfile  
      ./runapp.py
      ./run
      ./ ...
      ./dotcloud.yml
      ./builder
      ./wsgi.py
      ./ ...

Heroku files are: Profile, runapp.py, and run

dotcloud files are: dotcloud.yml, builder, wsgi.py
    
Ideally, you would have forked the repository first, and so checked out a
writable clone in step five instead of a read-only copy.

To run this code locally, do the following in cloudapp/heroku-ptah:

$ pip install -r localrequirements.txt
$ python setup.py develop
$ ../cloudapp/bin/pserve settings.ini --reload


Changes made to this skeleton from the default ptah_starter:

Heroku::

1. Procfile added to tell Heroku what to run upon deployment to start the web
   service.

2. A 'run' bash script that causes Heroku to develop then run the app.

3. runapp.py that actually runs the app using waitress.

4. requirements.txt informs Heroku what the dependencies are. Dependencies
   added from the stock ptah_starter are waitress and psycopg2. These haven't
   been added to localrequirements.txt.

5. Heroku doesn't support SQLite, so a small change was required to get Ptah
   to use the shared postgres db that Heroku provisions. Heroku exposes the DB
   connection string as the environment variable DATABASE_URL (if the database
   is a shared database, it is also available as SHARED_DATABASE_URL). app.py
   has been modified to use this environment variable (if present) to override
   the sqlalchemy.url parameter from settings.ini before the settings are
   applied.

dotcloud::

1. dotcloud.yml added to tell dotcloud what environment should be setup for the
   project.  As well as how to start the web server.

2. builder script which installs requirements and run herokuapp setup.py develop

3. wsgi.py The python module which starts the WSGI server

4. dotcloud *does* support SQLite so postgresql is not necessary. although each
   time you deploy you will lose your data.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published