Created
December 8, 2015 19:14
-
-
Save dkarchmer/5a3bf917d843c31fedd5 to your computer and use it in GitHub Desktop.
Elastic Beanstalk .ebextension sample for Django based project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packages: | |
yum: | |
libjpeg-turbo-devel: [] | |
postgresql93-devel: [] | |
container_commands: | |
01_migrate: | |
command: "django-admin.py migrate --noinput" | |
leader_only: true | |
02_initadmin: | |
# A custom management command that will create an admin account if users.count == 0 | |
command: "django-admin.py initadmin" | |
leader_only: true | |
03_wsgireplace: | |
command: 'cp wsgi.conf ../wsgi.conf' | |
option_settings: | |
- namespace: aws:elasticbeanstalk:container:python | |
option_name: WSGIPath | |
value: config/wsgi.py | |
- option_name: DJANGO_SETTINGS_MODULE | |
value: config.settings.production | |
- option_name: DJANGO_SECRET_KEY | |
value: some-secret-ket | |
# Database ENV Vars (of a preconfigured and persistent RDS database) | |
- option_name: RDS_DB_NAME | |
value: db_name | |
- option_name: RDS_USERNAME | |
value: ebroot | |
- option_name: RDS_PASSWORD | |
value: secret%Password | |
- option_name: RDS_HOSTNAME | |
value: XXXXXXXXX.YYYYYYYYY.us-east-1.rds.amazonaws.com | |
- option_name: RDS_PORT | |
value: 5432 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadModule wsgi_module modules/mod_wsgi.so | |
WSGIPythonHome /opt/python/run/baselinenv | |
WSGISocketPrefix run/wsgi | |
WSGIRestrictEmbedded On | |
<VirtualHost *:80> | |
Alias /static/ /opt/python/current/app/static/ | |
<Directory /opt/python/current/app/static/> | |
Order allow,deny | |
Allow from all | |
</Directory> | |
WSGIScriptAlias / /opt/python/current/app/config/wsgi.py | |
<Directory /opt/python/current/app/> | |
Require all granted | |
</Directory> | |
WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \ | |
python-path=/opt/python/current/app:/opt/python/run/venv/lib/python3.4/site-packages user=wsgi group=wsgi \ | |
home=/opt/python/current/app | |
WSGIProcessGroup wsgi | |
RewriteEngine On | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule !/about https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] | |
</VirtualHost> | |
LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | |
WSGIPassAuthorization On |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment