From e97f91f475d017d7fa030535d31fc5640cf9128a Mon Sep 17 00:00:00 2001 From: Chris Franklin Date: Sun, 12 Oct 2014 15:59:17 +0100 Subject: [PATCH 1/4] Add dokku deployment instructions Not ready to be merged, WIP. --- {{cookiecutter.repo_name}}/README.rst | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/{{cookiecutter.repo_name}}/README.rst b/{{cookiecutter.repo_name}}/README.rst index 56adbccc..20177f8d 100644 --- a/{{cookiecutter.repo_name}}/README.rst +++ b/{{cookiecutter.repo_name}}/README.rst @@ -84,6 +84,11 @@ It's time to write the code!!! 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: .. code-block:: bash @@ -104,3 +109,39 @@ Run these commands to deploy the project to Heroku: heroku run python {{cookiecutter.repo_name}}/manage.py createsuperuser 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= + +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 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 From f4e4dce6f2f77f21792baab82d6d1b73f1e3f6c9 Mon Sep 17 00:00:00 2001 From: Chris Franklin Date: Sun, 12 Oct 2014 16:07:02 +0100 Subject: [PATCH 2/4] Fix RST syntax. --- {{cookiecutter.repo_name}}/README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.repo_name}}/README.rst b/{{cookiecutter.repo_name}}/README.rst index 20177f8d..78c1abe6 100644 --- a/{{cookiecutter.repo_name}}/README.rst +++ b/{{cookiecutter.repo_name}}/README.rst @@ -132,6 +132,7 @@ You can specify the buildpack you wish to use by creating a file name .env conta 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 From 593ed5a07d17aafe33adaccf76946c34af3e19d5 Mon Sep 17 00:00:00 2001 From: Chris Franklin Date: Sun, 12 Oct 2014 16:13:48 +0100 Subject: [PATCH 3/4] Add sendgrid instructions and note about backup. --- {{cookiecutter.repo_name}}/README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/{{cookiecutter.repo_name}}/README.rst b/{{cookiecutter.repo_name}}/README.rst index 78c1abe6..e10c9b75 100644 --- a/{{cookiecutter.repo_name}}/README.rst +++ b/{{cookiecutter.repo_name}}/README.rst @@ -144,5 +144,9 @@ You can then deploy by running the following commands. 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. From 3e1f2a26103a4b5f842660af61b6d81144e6e35e Mon Sep 17 00:00:00 2001 From: Chris Franklin Date: Mon, 13 Oct 2014 13:27:10 +0100 Subject: [PATCH 4/4] Update CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 497c71cd..b01db9a5 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -29,7 +29,7 @@ Russell Davies SÅ‚awek Ehlert / @slafs Alberto Sanchez / @alb3rto Eyad Al Sibai / @eyadsibai - +Chris Franklin * Possesses commit rights