Merge branch 'feature/production-1.1' into develop

This commit is contained in:
rascencio 2015-05-31 05:44:07 -06:00
commit d7b809f3f6
15 changed files with 250 additions and 3 deletions

View File

@ -0,0 +1,19 @@
[circus]
check_delay = 5
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
stats_endpoint = tcp://127.0.0.1:5557
copy_env = True
[socket:dynamicweb]
host = 127.0.0.1
port = 8080
[watcher:dynamicweb]
cmd = /home/r/.virtualenvs/dynamicweb/bin/chaussette --backend meinheld --fd $(circus.sockets.dynamicweb) dynamicweb.wsgi.application
use_sockets = True
copy_env = True
numprocesses = 5
[env:dynamicweb]
PYTHONPATH = /home/r/dynamicweb

View File

@ -0,0 +1,7 @@
[watcher:nginx]
cmd = /usr/sbin/nginx -c nginx.dynamicweb.conf
numprocesses = 1
use_sockets = False
copy_env = True
singleton = True
autostart = True

View File

@ -0,0 +1,17 @@
[circus]
check_delay = 5
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
stats_endpoint = tcp://127.0.0.1:5557
[watcher:web]
cmd = /home/r/.virtualenvs/dynamicweb-blog/bin/chaussette --fd $(circus.sockets.web) --backend tornado dynamicweb.wsgi.application
use_sockets = True
numprocesses = 5
copy_env = True
virtualenv = /home/r/.virtualenvs/dynamicweb-blog
[socket:web]
host = 127.0.0.1
port = 8000
copy_env = True

View File

@ -0,0 +1,27 @@
postgresql:
image: postgres
env_file: envs/psql.env
hostname: db
ports:
- "5432:5432"
nginx:
image: nginx
env_file: envs/nginx.env
hostname: proxy
volumes:
- sites-enabled:/etc/nginx/conf.d
ports:
- "8000:8000"
memcached:
image: memcached
env_file: envs/memcached.env
hostname: cache
dynamicweb:
build: .
links:
- memcached
- db
- proxy

View File

@ -0,0 +1,69 @@
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
daemon off;
events {
worker_connections 512;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
port_in_redirect on;
server_names_hash_bucket_size 128;
server_name_in_redirect off;
client_max_body_size 60m;
include /etc/nginx/mime.types;
default_type application/octet-stream;
send_timeout 300;
client_body_timeout 300;
client_header_timeout 300;
access_log /logs/access.log;
error_log /logs/error.log;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
upstream django {
server 127.0.0.1:8000;
}
server {
listen 80 default;
server_name localhost;
location / {
proxy_pass http://django;
include proxy_params;
}
location /media/ {
root /data;
expires max;
access_log off;
}
location /static/ {
root /data;
expires max;
access_log off;
}
location ~ /\.ht { deny all; }
location ~ /\.hg { deny all; }
location ~ /\.svn { deny all; }
}
}

25
configs/nginx.proxy.conf Normal file
View File

@ -0,0 +1,25 @@
server {
listen destruction.io:8080;
server_name destruction.io;
location /static {
alias /home/r/dynamicweb/static/;
}
location /media {
alias /home/r/dynamicweb/media/;
}
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_pass_header Server;
proxy_set_header Host $host:8080;
proxy_set_header X-Forwarded-Host $host:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
}
}

View File

@ -15,6 +15,10 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
ADMINS = (
('Nico Schottelius', 'nico.schottelius@ungleich.ch'),
)
SITE_ID = 1
APP_ROOT_ENDPOINT = "/"
@ -225,6 +229,12 @@ CMS_PLACEHOLDER_CONF = {
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'unix:/tmp/memcached.sock',
}
}
try:
from dynamicweb.local.local_settings import *
@ -250,8 +260,9 @@ STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Media files.
MEDIA_ROOT = os.path.abspath(os.path.join(BASE_DIR, '..', 'media'))
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = APP_ROOT_ENDPOINT + 'media/'
FILE_UPLOAD_PERMISSIONS = 0o644
# Templates confs
TEMPLATE_DIRS = (
@ -305,7 +316,9 @@ THUMBNAIL_PROCESSORS = (
# django-cms-text-ckeditor
TEXT_SAVE_IMAGE_FUNCTION='cmsplugin_filer_image.integrations.ckeditor.create_image_plugin'
TEXT_ADDITIONAL_TAGS = ('iframe',)
TEXT_ADDITIONAL_ATTRIBUTES = ('scrolling', 'allowfullscreen', 'frameborder')
USE_X_FORWARDED_HOST = True
try:
from .local.local_settings import *
except ImportError as e:

View File

13
requirements.debian.txt Normal file
View File

@ -0,0 +1,13 @@
python3-dev
virtualenvwrapper
libzmq-dev
libevent-dev
nginx
postgresql
postgresql-dev
postgresql-server-dev-9.4
memcached
libmemcached-dev
libxml2-dev
libxslt1-dev
python3-lxml # this depends on the amount of ram that the server has.

View File

@ -3,6 +3,7 @@ psycopg2>=2.6
Pillow>=2
html5lib==0.999
six==1.3.0 #compat
python-memcached
# django
django==1.7.8
@ -42,3 +43,10 @@ djangocms-oembed
djangocms-table
cmsplugin-filer==0.10.1
# production
-e git+git@github.com:circus-tent/circus.git#egg=circus
circus-web
chaussette
meinheld
gevent

View File

@ -3,6 +3,7 @@ psycopg2==2.6
Pillow==2.8.1
html5lib==0.999
six==1.3.0
python-memcached==1.54
# django
django==1.7.8
@ -41,11 +42,18 @@ djangocms-oembed==0.5
djangocms-table==1.2
cmsplugin-filer==0.10.1
# production
circus==0.11.1
circus-web==0.5
chaussette==1.2
meinheld==0.5.7
## The following requirements were added by pip freeze:
aldryn-blog==0.4.6
aldryn-boilerplates==0.7
aldryn-common==0.1.3
aldryn-search==0.2.7
anyjson==0.3.3
cssselect==0.9.1
Django==1.7.8
django-admin-enhancer==1.0.0
@ -67,12 +75,22 @@ django-taggit-autosuggest==0.2.7
django-taggit-templatetags==0.2.5
django-templatetag-sugar==1.0
easy-thumbnails==2.2
greenlet==0.4.7
iowait==0.2
lxml==3.4.4
Mako==1.0.1
MarkupSafe==0.23
micawber==0.3.2
ply==3.6
psutil==2.2.1
pyquery==1.2.9
pytz==2015.4
pyzmq==14.6.0
simplejson==3.7.2
South==1.0.2
tomako==0.1.0
TornadIO2==0.0.4
tornado==4.2
Unidecode==0.4.17
URLObject==2.4.0
YURL==0.13

View File

@ -396,4 +396,8 @@ body {
.text-center {
text-align: center;
}
.blog-content img {
width: 100%;
}

13
templates/404.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Page not found</title>
</head>
<body>
<h1>Page not found</h1>
<p>Sorry, but the requested page could not be found.</p>
</body>
</html>

15
templates/505.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Page unavailable</title>
</head>
<body>
<h1>Page unavailable</h1>
<p>Sorry, but the requested page is unavailable due to a
server hiccup.</p>
<p>Our engineers have been notified, so check back later.</p>
</body>
</html>

View File

@ -8,7 +8,6 @@ import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
('filer', '0002_auto_20150522_0450'),
('ungleich', '0001_initial'),
]