Skip to content

Commit

Permalink
Merge pull request #348 from Cadasta/staging
Browse files Browse the repository at this point in the history
Provisioning and deployment updates
  • Loading branch information
ian-ross authored Jul 8, 2016
2 parents 109f8a0 + d5a9c16 commit 133591a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
7 changes: 6 additions & 1 deletion cadasta/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

SECRET_KEY = os.environ['SECRET_KEY']

DEFAULT_FILE_STORAGE = 'buckets.storage.S3Storage'

DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
Expand All @@ -21,7 +23,7 @@
})

# Adding localhost here for uWSGI debugging!
ALLOWED_HOSTS = [os.environ['API_HOST'], 'localhost']
ALLOWED_HOSTS = [os.environ['API_HOST'], os.environ['DOMAIN'], 'localhost']

ADMINS = [('Cadasta platform admins', '[email protected]')]
EMAIL_HOST = 'email-smtp.us-west-2.amazonaws.com'
Expand All @@ -33,6 +35,9 @@
DEFAULT_FROM_EMAIL = '[email protected]'
ROOT_URLCONF = 'config.urls.production'

STATIC_URL = '/static/'
STATIC_ROOT = '/opt/cadasta/cadasta-platform/cadasta/static/'

# Debug logging...
LOGGING = {
'version': 1,
Expand Down
22 changes: 20 additions & 2 deletions provision/roles/webserver/production/templates/nginx-production
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ server {

client_max_body_size 75M;

# alias favicon.* to static
location ~ ^/favicon.(\w*)$ {
alias {{ application_path }}cadasta/static/favicon.png;
}

location /static/ {
alias {{ application_path }}cadasta/static/;
}

location / {
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Methods' 'GET, PUT, PATCH, POST, DELETE, OPTIONS';
Expand Down Expand Up @@ -40,8 +49,17 @@ server {

client_max_body_size 75M;

# alias favicon.* to static
location ~ ^/favicon.(\w*)$ {
alias {{ application_path }}cadasta/static/favicon.png;
}

location /static/ {
alias {{ application_path }}cadasta/static/;
}

location / {
root {{ application_path}}static;
index index.html;
uwsgi_pass django;
include {{ application_path }}uwsgi_params;
}
}
4 changes: 3 additions & 1 deletion provision/roles/webserver/production/templates/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[uwsgi]

plugins-dir = /usr/local/bin
plugin = python35
home = {{ virtualenv_path }}
chdir = {{ application_path }}cadasta
module = config.wsgi
home = {{ virtualenv_path }}

uid = cadasta
gid = cadasta
Expand Down

0 comments on commit 133591a

Please sign in to comment.