Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Deploy Settings #155

Merged
merged 4 commits into from
May 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/salt/project/django/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ manage:
- mode: 700
- template: jinja
- context:
settings: "{{ pillar['project_name']}}.settings.{{ pillar['environment'] }}"
settings: "{{ pillar['project_name']}}.settings.deploy"
virtualenv_root: "{{ vars.venv_dir }}"
directory: "{{ vars.source_dir }}"
- require:
Expand Down
5 changes: 3 additions & 2 deletions conf/salt/project/django/manage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Shell script to setup necessary environment variables and run a management command
export DJANGO_SETTINGS_MODULE={{ settings }}
export ALLOWED_HOSTS={{ pillar['domain'] }}
export DJANGO_SETTINGS_MODULE='{{ settings }}'
export ALLOWED_HOSTS='{{ pillar["domain"] }}'
export ENVIRONMENT='{{ pillar["environment"] }}'
{% for key, value in pillar.get('secrets', {}).items() + pillar.get('env', {}).items() %}
export {{ key }}='{{ value }}'
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion conf/salt/project/web/app.sls
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ gunicorn_conf:
- template: jinja
- context:
log_dir: "{{ vars.log_dir }}"
settings: "{{ pillar['project_name'] }}.settings.{{ pillar['environment'] }}"
settings: "{{ pillar['project_name'] }}.settings.deploy"
virtualenv_root: "{{ vars.venv_dir }}"
directory: "{{ vars.source_dir }}"
- require:
Expand Down
2 changes: 1 addition & 1 deletion conf/salt/project/web/gunicorn.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stopwaitsecs=60
stdout_logfile={{ log_dir }}/gunicorn.log
redirect_stderr=true
stderr_logfile={{ log_dir }}/gunicorn.error.log
environment=DJANGO_SETTINGS_MODULE="{{ settings }}",ALLOWED_HOSTS="{{ pillar['domain'] }}",
environment=DJANGO_SETTINGS_MODULE="{{ settings }}",ENVIRONMENT="{{ pillar['environment'] }}",ALLOWED_HOSTS="{{ pillar['domain'] }}",
{%- for key, value in pillar.get('secrets', {}).items() + pillar.get('env', {}).items() -%}
{{ key }}="{{ value }}"{%- if not loop.last -%},{%- endif -%}
{%- endfor -%}
2 changes: 1 addition & 1 deletion conf/salt/project/worker/beat.sls
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ beat_conf:
- template: jinja
- context:
log_dir: "{{ vars.log_dir }}"
settings: "{{ pillar['project_name'] }}.settings.{{ pillar['environment'] }}"
settings: "{{ pillar['project_name'] }}.settings.deploy"
virtualenv_root: "{{ vars.venv_dir }}"
directory: "{{ vars.source_dir }}"
name: "celery-beat"
Expand Down
2 changes: 1 addition & 1 deletion conf/salt/project/worker/celery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ startsecs=1
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs=60
environment=DJANGO_SETTINGS_MODULE="{{ settings }}",ALLOWED_HOSTS="{{ pillar['domain'] }}",
environment=DJANGO_SETTINGS_MODULE="{{ settings }}",ENVIRONMENT="{{ pillar['environment'] }}",ALLOWED_HOSTS="{{ pillar['domain'] }}",
{%- for key, value in pillar.get('secrets', {}).items() + pillar.get('env', {}).items() -%}
{{ key }}="{{ value }}"{%- if not loop.last -%},{%- endif -%}
{%- endfor -%}
2 changes: 1 addition & 1 deletion conf/salt/project/worker/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ default_conf:
- template: jinja
- context:
log_dir: "{{ vars.log_dir }}"
settings: "{{ pillar['project_name'] }}.settings.{{ pillar['environment'] }}"
settings: "{{ pillar['project_name'] }}.settings.deploy"
virtualenv_root: "{{ vars.venv_dir }}"
directory: "{{ vars.source_dir }}"
name: "celery-default"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from {{ project_name }}.settings.base import * # noqa
# Settings for live deployed environments: vagrant, staging, production, etc
from .base import * # noqa

os.environ.setdefault('CACHE_HOST', '127.0.0.1:11211')
os.environ.setdefault('BROKER_HOST', '127.0.0.1:5672')

ENVIRONMENT = os.environ['ENVIRONMENT']

DEBUG = False
TEMPLATE_DEBUG = DEBUG

DATABASES['default']['NAME'] = '{{ project_name }}_staging'
DATABASES['default']['USER'] = '{{ project_name }}_staging'
DATABASES['default']['NAME'] = '{{ project_name }}_%s' % ENVIRONMENT.lower()
DATABASES['default']['USER'] = '{{ project_name }}_%s' % ENVIRONMENT.lower()
DATABASES['default']['HOST'] = os.environ.get('DB_HOST', '')
DATABASES['default']['PORT'] = os.environ.get('DB_PORT', '')
DATABASES['default']['PASSWORD'] = os.environ['DB_PASSWORD']
Expand All @@ -30,7 +33,7 @@
}
}

EMAIL_SUBJECT_PREFIX = '[{{ project_name|title }} Staging] '
EMAIL_SUBJECT_PREFIX = '[{{ project_name|title }} %s] ' % ENVIRONMENT.title()

COMPRESS_ENABLED = True

Expand All @@ -43,3 +46,9 @@
# Uncomment if using celery worker configuration
# CELERY_SEND_TASK_ERROR_EMAILS = True
# BROKER_URL = 'amqp://{{ project_name }}_staging:%(BROKER_PASSWORD)s@%(BROKER_HOST)s/{{ project_name }}_staging' % os.environ # noqa

# Environment overrides
# These should be kept to an absolute minimum
if ENVIRONMENT.upper() == 'LOCAL':
# Don't send emails from the Vagrant boxes
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
11 changes: 0 additions & 11 deletions project_name/settings/production.py

This file was deleted.