Skip to content

Commit

Permalink
Changes for deployment to AWS
Browse files Browse the repository at this point in the history
 - Deployment and provisioning scripts.
 - AWS CloudFormation template.
 - Refactor Ansible playbooks.
 - Database and Django production environment setup.
 - nginx + uWSGI web server setup.
  • Loading branch information
Ian Ross committed Feb 8, 2016
1 parent 377442c commit 5e64c93
Show file tree
Hide file tree
Showing 48 changed files with 1,751 additions and 140 deletions.
10 changes: 5 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ Vagrant.configure(2) do |config|
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
#
# View the documentation for the provider you are using for more
# information on available options.
Expand All @@ -71,7 +71,7 @@ Vagrant.configure(2) do |config|

# Enable provisioning using Ansible
config.vm.provision "ansible" do |ansible|
ansible.verbose = "vvv"
# ansible.verbose = "vvv"
ansible.playbook = "provision/vagrant.yml"
end
end
4 changes: 2 additions & 2 deletions app/src/js/settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const SETTINGS = {
API_BASE: 'http://localhost:5000',
API_BASE: 'http://localhost:5000'
};

export default SETTINGS;
export default SETTINGS;
6 changes: 3 additions & 3 deletions cadasta/config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_app',
'USER': 'django',
'PASSWORD': 'sdjgh34iutwefhfgbqkj3',
'NAME': 'cadasta',
'USER': 'cadasta',
'PASSWORD': 'cadasta',
'HOST': 'localhost',
}
}
Expand Down
43 changes: 37 additions & 6 deletions cadasta/config/settings/production.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,50 @@
import os
from .default import *


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DEBUG = False

SECRET_KEY = os.environ['SECRET_KEY']

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_app',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
'NAME': 'cadasta',
'USER': 'cadasta',
'PASSWORD': 'cadasta',
'HOST': os.environ['DB_HOST']
}
}

DJOSER.update({
'DOMAIN': 'cadasta.org',
})

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

ADMINS = [('Cadasta platform admins', '[email protected]')]
EMAIL_HOST = 'email-smtp.us-west-2.amazonaws.com'
EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER']
EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD']
SERVER_EMAIL = '[email protected]'

# Debug logging...
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/var/log/django/debug.log',
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
Loading

0 comments on commit 5e64c93

Please sign in to comment.