Added deployment information for production site
This commit is contained in:
31
deploy/gunicorn.conf.py
Normal file
31
deploy/gunicorn.conf.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# invoke gunicorn using
|
||||
# 'gunicorn -c <this_file> <project_module>.wsgi:application
|
||||
import os
|
||||
import multiprocessing
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
bind = settings.GUNICORN_BIND
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
|
||||
preload_app = True
|
||||
|
||||
chdir = settings.BASE_DIR
|
||||
|
||||
user = settings.PROCESS_USER
|
||||
group = user
|
||||
|
||||
log_dir = os.path.join(
|
||||
os.path.dirname(settings.BASE_DIR), 'gunicorn_logs', settings.PROCESS_NAME)
|
||||
if not os.path.isdir(log_dir):
|
||||
os.makedirs(log_dir)
|
||||
import pwd
|
||||
import grp
|
||||
os.chown(log_dir,
|
||||
pwd.getpwnam(user).pw_uid,
|
||||
grp.getgrnam(group).gr_gid)
|
||||
|
||||
accesslog = os.path.join(log_dir, 'access.log')
|
||||
errorlog = os.path.join(log_dir, 'error.log')
|
||||
|
||||
proc_name = settings.PROCESS_NAME
|
||||
34
deploy/production/nginx.conf
Normal file
34
deploy/production/nginx.conf
Normal file
@@ -0,0 +1,34 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name mayan.crossculturalconsult.com www.mayan.crossculturalconsult.com;
|
||||
|
||||
access_log /var/log/nginx/mayan.crossculturalconsult.com.access.log;
|
||||
error_log /var/log/nginx/mayan.crossculturalconsult.com.error.log;
|
||||
root /home/mayan/production/;
|
||||
|
||||
location /static/ {
|
||||
alias /home/mayan/production/static_collected/;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /home/mayan/production/media/;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
alias /home/mayan/production/media/favicon.ico;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
alias /home/mayan/production/media/robots.txt;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8731;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_max_body_size 10m;
|
||||
}
|
||||
allow all;
|
||||
}
|
||||
10
deploy/production/service_demon.sh
Executable file
10
deploy/production/service_demon.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Run the gunicorn service
|
||||
|
||||
# Make sure we're in the right virtual env and location
|
||||
source /home/mayan/.virtualenvs/production/bin/activate
|
||||
source /home/mayan/.virtualenvs/production/bin/postactivate
|
||||
|
||||
cd /home/mayan/production
|
||||
|
||||
exec gunicorn -c /home/mayan/production/deploy/gunicorn.conf.py mayan.wsgi:application
|
||||
10
deploy/production/upstart.conf
Normal file
10
deploy/production/upstart.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
start on started rc
|
||||
stop on stopped rc
|
||||
|
||||
respawn
|
||||
respawn limit 3 5
|
||||
|
||||
setuid mayan
|
||||
setgid mayan
|
||||
|
||||
exec /home/mayan/production/deploy/production/service_demon.sh
|
||||
@@ -5,4 +5,16 @@ from .includes.common import *
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ALLOWED_HOSTS = ['.crossculturalconsult.com']
|
||||
ALLOWED_HOSTS = ['.crossculturalconsult.com']
|
||||
|
||||
|
||||
###################
|
||||
# DEPLOY SETTINGS #
|
||||
###################
|
||||
|
||||
GUNICORN_BIND = "127.0.0.1:8731"
|
||||
PROCESS_USER = 'mayan'
|
||||
PROCESS_NAME = 'mayan_production'
|
||||
SITE_TITLE = 'Mayan CCCS'
|
||||
SITE_TAGLINE = None
|
||||
VIRTUALENV = 'production'
|
||||
Reference in New Issue
Block a user