mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-02 11:10:12 +03:00
First pass at Elastic Beanstalk integration
This commit is contained in:
parent
a950eb82f6
commit
9d30f24888
|
@ -21,5 +21,6 @@
|
||||||
"postgresql_version": ["9.5", "9.4", "9.3", "9.2"],
|
"postgresql_version": ["9.5", "9.4", "9.3", "9.2"],
|
||||||
"js_task_runner": ["Gulp", "Grunt", "None"],
|
"js_task_runner": ["Gulp", "Grunt", "None"],
|
||||||
"use_lets_encrypt": "n",
|
"use_lets_encrypt": "n",
|
||||||
"open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"]
|
"open_source_license": ["MIT", "BSD", "GPLv3", "Apache Software License 2.0", "Not open source"],
|
||||||
|
"use_elasticbeanstalk": "y"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
packages:
|
||||||
|
yum:
|
||||||
|
git: []
|
||||||
|
postgresql94-devel: []
|
||||||
|
libjpeg-turbo-devel: []
|
13
{{cookiecutter.project_slug}}/.ebextensions/10_python.config
Normal file
13
{{cookiecutter.project_slug}}/.ebextensions/10_python.config
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
container_commands:
|
||||||
|
01_migrate:
|
||||||
|
command: "source /opt/python/run/venv/bin/activate && python manage.py migrate"
|
||||||
|
leader_only: True
|
||||||
|
02_collectstatic:
|
||||||
|
command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput"
|
||||||
|
option_settings:
|
||||||
|
"aws:elasticbeanstalk:container:python":
|
||||||
|
WSGIPath: "config/wsgi.py"
|
||||||
|
NumProcesses: 3
|
||||||
|
NumThreads: 20
|
||||||
|
"aws:elasticbeanstalk:container:python:staticfiles":
|
||||||
|
"/static/": "www/static/"
|
29
{{cookiecutter.project_slug}}/ebsetenv.py
Normal file
29
{{cookiecutter.project_slug}}/ebsetenv.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
"""Converts a .env file to Elastic Beanstalk environment variables"""
|
||||||
|
|
||||||
|
from sys import exit
|
||||||
|
from subprocess import check_call
|
||||||
|
|
||||||
|
try:
|
||||||
|
import dotenv
|
||||||
|
except ImportError:
|
||||||
|
print("Please install the 'dotenv' library: 'pip install dotenv'")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
command = ['eb', 'setenv']
|
||||||
|
failures = []
|
||||||
|
for key, value in dotenv.Dotenv('.env').items():
|
||||||
|
if value:
|
||||||
|
command.append("{}={}".format(key, value))
|
||||||
|
else:
|
||||||
|
failures.append(key)
|
||||||
|
if failures:
|
||||||
|
for failure in failures:
|
||||||
|
print("{} requires a value".format(failure))
|
||||||
|
else:
|
||||||
|
print(' '.join(command))
|
||||||
|
check_call(command)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
# PostgreSQL
|
# PostgreSQL
|
||||||
POSTGRES_PASSWORD=mysecretpass
|
POSTGRES_PASSWORD=mysecretpass
|
||||||
POSTGRES_USER=postgresuser
|
POSTGRES_USER=postgresuser
|
||||||
|
@ -33,4 +34,4 @@ DJANGO_OPBEAT_SECRET_TOKEN
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if cookiecutter.use_compressor == 'y' -%}
|
{% if cookiecutter.use_compressor == 'y' -%}
|
||||||
COMPRESS_ENABLED=
|
COMPRESS_ENABLED=
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user