From ce8a711cf63f2dca307cfd607fdb20c3a2982936 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Thu, 22 Sep 2016 17:38:22 -0700 Subject: [PATCH] Fixed config and README cleanup --- .../.ebextensions/40_python.config | 2 +- {{cookiecutter.project_slug}}/README.rst | 33 +++++++++++++++++++ {{cookiecutter.project_slug}}/ebsetenv.py | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.ebextensions/40_python.config b/{{cookiecutter.project_slug}}/.ebextensions/40_python.config index 61b29375a..02636e1ad 100644 --- a/{{cookiecutter.project_slug}}/.ebextensions/40_python.config +++ b/{{cookiecutter.project_slug}}/.ebextensions/40_python.config @@ -6,9 +6,9 @@ container_commands: command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput" option_settings: "aws:elasticbeanstalk:application:environment": + DJANGO_SETTINGS_MODULE: "config.settings.production" REDIS_ENDPOINT_ADDRESS: '`{ "Fn::GetAtt" : [ "MyElastiCache", "RedisEndpoint.Address"]}`' REDIS_PORT: '`{ "Fn::GetAtt" : [ "MyElastiCache", "RedisEndpoint.Port"]}`' -option_settings: "aws:elasticbeanstalk:container:python": WSGIPath: "config/wsgi.py" NumProcesses: 3 diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst index f760a1e2c..d2417e42d 100644 --- a/{{cookiecutter.project_slug}}/README.rst +++ b/{{cookiecutter.project_slug}}/README.rst @@ -138,3 +138,36 @@ See detailed `cookiecutter-django Docker documentation`_. .. _`cookiecutter-django Docker documentation`: http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html {% endif %} +{% if cookiecutter.use_elasticbeanstalk %} + +Elastic Beanstalk +~~~~~~~~~~~~~~~~~~ + + +``` +# creates the directory of environments (servers) +eb init -p python3.4 {{ cookiecutter.project_slug }} + +# Creates the environment (server) where the app will run +eb create {{ cookiecutter.project_slug }} +# Note: This will fail on a postgres error, because postgres doesn't exist yet + +# Make sure you are in the right environment +eb list + +# If you are not in the right environment +eb use {{ cookiecutter.project_slug }} + +# Set the environment variables +python ebsetenv.py + +# Go to EB AWS config. Create new RDS database (postgres, 9.4.9, db.t2.micro) +# Get some coffee, this is going to take a while + +# Deploy again +eb deploy + +# Take a look +eb open +``` +{% endif %} diff --git a/{{cookiecutter.project_slug}}/ebsetenv.py b/{{cookiecutter.project_slug}}/ebsetenv.py index b343e2968..fbb8dc2d8 100644 --- a/{{cookiecutter.project_slug}}/ebsetenv.py +++ b/{{cookiecutter.project_slug}}/ebsetenv.py @@ -13,6 +13,8 @@ def main(): command = ['eb', 'setenv'] failures = [] for key, value in dotenv.Dotenv('.env').items(): + if key.startswith('POSTGRES'): + continue if value: command.append("{}={}".format(key, value)) else: