diff --git a/configs/circus.dynamicweb.ini.example b/configs/circus.dynamicweb.ini.example new file mode 100644 index 00000000..3167a3d4 --- /dev/null +++ b/configs/circus.dynamicweb.ini.example @@ -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 \ No newline at end of file diff --git a/configs/circus.nginx.ini.example b/configs/circus.nginx.ini.example new file mode 100644 index 00000000..d13c7ef7 --- /dev/null +++ b/configs/circus.nginx.ini.example @@ -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 \ No newline at end of file diff --git a/configs/circus.ungleich.ini b/configs/circus.ungleich.ini new file mode 100644 index 00000000..c64745ff --- /dev/null +++ b/configs/circus.ungleich.ini @@ -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 diff --git a/configs/docker.services.yml b/configs/docker.services.yml new file mode 100644 index 00000000..eada936a --- /dev/null +++ b/configs/docker.services.yml @@ -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 \ No newline at end of file diff --git a/configs/nginx.dynamicweb.conf b/configs/nginx.dynamicweb.conf new file mode 100644 index 00000000..ba25debc --- /dev/null +++ b/configs/nginx.dynamicweb.conf @@ -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; } + } +} diff --git a/configs/nginx.proxy.conf b/configs/nginx.proxy.conf new file mode 100644 index 00000000..4f9f3420 --- /dev/null +++ b/configs/nginx.proxy.conf @@ -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; + } +} diff --git a/dynamicweb/settings.py b/dynamicweb/settings.py index 5f19bbdb..2ee2e704 100644 --- a/dynamicweb/settings.py +++ b/dynamicweb/settings.py @@ -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: diff --git a/foo.txt b/foo.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/requirements.debian.txt b/requirements.debian.txt new file mode 100644 index 00000000..149d8130 --- /dev/null +++ b/requirements.debian.txt @@ -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. diff --git a/requirements.txt b/requirements.txt index b3958b4c..9abdc6d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/stable_requirements.txt b/stable_requirements.txt index c59ac5de..9b5ff470 100644 --- a/stable_requirements.txt +++ b/stable_requirements.txt @@ -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 diff --git a/static/blog.ungleich.ch/css/clean-blog.css b/static/blog.ungleich.ch/css/clean-blog.css index 30e12c42..c1df6431 100755 --- a/static/blog.ungleich.ch/css/clean-blog.css +++ b/static/blog.ungleich.ch/css/clean-blog.css @@ -396,4 +396,8 @@ body { .text-center { text-align: center; +} + +.blog-content img { + width: 100%; } \ No newline at end of file diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 00000000..ae7ae0f4 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,13 @@ + + +
+Sorry, but the requested page could not be found.
+ + + diff --git a/templates/505.html b/templates/505.html new file mode 100644 index 00000000..a7beaded --- /dev/null +++ b/templates/505.html @@ -0,0 +1,15 @@ + + + +Sorry, but the requested page is unavailable due to a + server hiccup.
+ +Our engineers have been notified, so check back later.
+ + diff --git a/ungleich/migrations/0002_ungleichpage_image.py b/ungleich/migrations/0002_ungleichpage_image.py index b98b272f..44a6be64 100644 --- a/ungleich/migrations/0002_ungleichpage_image.py +++ b/ungleich/migrations/0002_ungleichpage_image.py @@ -8,7 +8,6 @@ import filer.fields.image class Migration(migrations.Migration): dependencies = [ - ('filer', '0002_auto_20150522_0450'), ('ungleich', '0001_initial'), ]