Merge pull request #144 from chrisfranklin/patch-2

Add dokku deployment instructions
This commit is contained in:
Daniel Greenfeld 2014-10-13 13:17:58 -07:00
commit eee57ca95d
2 changed files with 47 additions and 1 deletions

View File

@ -29,7 +29,7 @@ Russell Davies
Sławek Ehlert / @slafs Sławek Ehlert / @slafs
Alberto Sanchez / @alb3rto Alberto Sanchez / @alb3rto
Eyad Al Sibai / @eyadsibai Eyad Al Sibai / @eyadsibai
Chris Franklin
* Possesses commit rights * Possesses commit rights

View File

@ -84,6 +84,11 @@ It's time to write the code!!!
Deployment Deployment
------------ ------------
It is possible to deploy to Heroku or to your own server by using Dokku, an open source Heroku clone.
Heroku
^^^^^^
Run these commands to deploy the project to Heroku: Run these commands to deploy the project to Heroku:
.. code-block:: bash .. code-block:: bash
@ -104,3 +109,44 @@ Run these commands to deploy the project to Heroku:
heroku run python {{cookiecutter.repo_name}}/manage.py createsuperuser heroku run python {{cookiecutter.repo_name}}/manage.py createsuperuser
heroku open heroku open
Dokku
^^^^^
You need to make sure you have a server running Dokku with at least 1GB of RAM. Backing services are
added just like in Heroku however you must ensure you have the relevant Dokku plugins installed.
.. code-block:: bash
cd /var/lib/dokku/plugins
git clone https://github.com/rlaneve/dokku-link.git link
git clone https://github.com/jezdez/dokku-memcached-plugin memcached
git clone https://github.com/jezdez/dokku-postgres-plugin postgres
dokku plugins-install
You can specify the buildpack you wish to use by creating a file name .env containing the following.
.. code-block:: bash
export BUILDPACK_URL=<repository>
You can then deploy by running the following commands.
.. code-block:: bash
git remote add dokku dokku@yourservername.com:{{cookiecutter.repo_name}}
git push dokku master
ssh -t dokku@yourservername.com dokku memcached:create {{cookiecutter.repo_name}}-memcached
ssh -t dokku@yourservername.com dokku memcached:link {{cookiecutter.repo_name}}-memcached {{cookiecutter.repo_name}}
ssh -t dokku@yourservername.com dokku postgres:create {{cookiecutter.repo_name}}-postgres
ssh -t dokku@yourservername.com dokku postgres:link {{cookiecutter.repo_name}}-postgres {{cookiecutter.repo_name}}
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} DJANGO_CONFIGURATION=Production
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} DJANGO_SECRET_KEY=RANDOM_SECRET_KEY_HERE
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} DJANGO_AWS_ACCESS_KEY_ID=YOUR_AWS_ID_HERE
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} DJANGO_AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY_HERE
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} DJANGO_AWS_STORAGE_BUCKET_NAME=YOUR_AWS_S3_BUCKET_NAME_HERE
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} SENDGRID_USERNAME=YOUR_SENDGRID_USERNAME
ssh -t dokku@yourservername.com dokku config:set {{cookiecutter.repo_name}} SENDGRID_PASSWORD=YOUR_SENDGRID_PASSWORD
ssh -t dokku@yourservername.com dokku run {{cookiecutter.repo_name}} python {{cookiecutter.repo_name}}/manage.py migrate
ssh -t dokku@yourservername.com dokku run {{cookiecutter.repo_name}} python {{cookiecutter.repo_name}}/manage.py createsuperuser
When deploying via Dokku make sure you backup your database in some fashion as it is NOT done automatically.