Simplify config fix wiki styles.

This commit is contained in:
Oliver Marks 2018-01-31 08:48:36 +00:00 committed by Oliver Marks
parent 7426c1fb05
commit ae1f830785
16 changed files with 6333 additions and 179 deletions

View File

@ -121,19 +121,20 @@ docker-compose -fstage.yml run --rm postgres psql -U postgres
Create a backup file with today's date Create a backup file with today's date
#+BEGIN_SRC bash #+BEGIN_SRC bash
docker exec -t {CONTAINER_NAME} pg_dump -Fp -c -U postgresuser > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql docker exec -t {CONTAINER_NAME} pg_dump -Fp -c -U postgresuser > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
docker exec {CONTAINER_NAME} bash -lc 'pg_dump --format custom vmdb_production' > dump_`date +%d-%m-%Y"_"%H_%M_%S`.pgdata
#+END_SRC #+END_SRC
Import previously made backup Import previously made backup
#+BEGIN_SRC bash #+BEGIN_SRC bash
docker exec -i -u {USER} {CONTAINER_NAME} pg_restore -C --clean -d {DATABASE_USER} < dump_31-01-2018_13_09_24.pgdata
cat dump_27-01-2018_14_26_09.sql | docker exec -i {CONTAINER_ID} psql -U postgres cat dump_27-01-2018_14_26_09.sql | docker exec -i {CONTAINER_ID} psql -U postgres
#+END_SRC #+END_SRC
letsencrypt config
#+BEGIN_SRC bash
letsencrypt certonly --renew --webroot -w /var/www/.well-known -d maidstone-hackspace.org.uk -d maidstone-hackspace.org.uk -d www.maidstone-hackspace.org.uk
#+END_SRC
docker exec -i {CONTINERID} pg_restore -U postgresuser < ./dump_27-01-2018_18_16_45.sql
docker exec miq_latest bash -lc 'pg_dump --format custom vmdb_production' > /tmp/pg_dump.pgdata
docker exec {CONTAINERID} bash -lc 'pg_dump --format custom -U postgresuser' > pg_dump.pgdata
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
sudo chmod -R a+rX static/ sudo chmod -R a+rX static/

View File

@ -5,8 +5,7 @@ ENV PYTHONUNBUFFERED 1
#RUN apk add --no-cache libev-dev git postgresql-dev gcc python3-dev musl-dev #RUN apk add --no-cache libev-dev git postgresql-dev gcc python3-dev musl-dev
#RUN apt update RUN apt update && apt install -y libev-dev libmagic-dev && pip install bjoern
#RUN apt install -y libev-dev libevdev2 git python3-dev
# Requirements have to be pulled and installed here, otherwise caching won't work # Requirements have to be pulled and installed here, otherwise caching won't work
COPY ./requirements /requirements COPY ./requirements /requirements

View File

@ -2,4 +2,4 @@
#python /app/manage.py collectstatic --noinput #python /app/manage.py collectstatic --noinput
#python /app/manage.py compilescss #python /app/manage.py compilescss
/usr/local/bin/gunicorn config.wsgi -w 1 -b unix:/data/sockets/dev-gunicorn-mhackspace.sock --reload --chdir=/app /usr/local/bin/gunicorn config.wsgi -w 1 -b unix:/data/sockets/gunicorn-mhackspace.sock --reload --chdir=/app

View File

@ -13,6 +13,7 @@ from __future__ import absolute_import, unicode_literals
import os import os
import time import time
import environ import environ
import socket
# from spirit.settings import * # from spirit.settings import *
ROOT_DIR = environ.Path(__file__) - 3 # (mhackspace/config/settings/common.py - 3 = mhackspace/) ROOT_DIR = environ.Path(__file__) - 3 # (mhackspace/config/settings/common.py - 3 = mhackspace/)
@ -49,6 +50,7 @@ ST_UPLOAD_FILE_ENABLED = True
ST_TESTS_RATELIMIT_NEVER_EXPIRE = False ST_TESTS_RATELIMIT_NEVER_EXPIRE = False
ST_BASE_DIR = os.path.dirname(__file__) ST_BASE_DIR = os.path.dirname(__file__)
SECRET_KEY = env('DJANGO_SECRET_KEY', default='wq)sg12k&5&adv)e%56n5e97o@))6xu90b**=-w+)d^c+cd9%1')
HAYSTACK_CONNECTIONS = { HAYSTACK_CONNECTIONS = {
'default': { 'default': {
@ -193,6 +195,9 @@ FIXTURE_DIRS = (
# EMAIL CONFIGURATION # EMAIL CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend') EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
EMAIL_PORT = 1025
EMAIL_HOST = env("EMAIL_HOST", default='mailhog')
MSG_PREFIX = env("EMAIL_HOST", default='MHT')
# MANAGER CONFIGURATION # MANAGER CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -406,6 +411,7 @@ CELERY_RESULT_SERIALIZER = 'json'
INSTALLED_APPS += ("compressor", 'sass_processor',) INSTALLED_APPS += ("compressor", 'sass_processor',)
INSTALLED_APPS += ('django_extensions', ) INSTALLED_APPS += ('django_extensions', )
INSTALLED_APPS += ('storages', ) INSTALLED_APPS += ('storages', )
INSTALLED_APPS += ('gunicorn', )
STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", ) STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", )
# Location of root django.contrib.admin URL, use {% url 'admin:index' %} # Location of root django.contrib.admin URL, use {% url 'admin:index' %}
@ -500,3 +506,37 @@ AWS_S3_OBJECT_PARAMETERS = {
} }
COMPRESS_URL = 'cache/' COMPRESS_URL = 'cache/'
# django-debug-toolbar
# ---------------------MDVTDNXFTRJSJBX9KWOJTMCGSNMYASEFNBPDUZJMGSPPCVMQRUZMZAEXDTIGHPZCP9JBGLVKGSJMZKPVV---------------------------------------------------------
MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar', )
ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', '172.22.0.9', '192.168.1.113', '172.22.0.4', '0.0.0.0', '192.168.1.64']
# tricks to have debug toolbar when developing with docker
if os.environ.get('USE_DOCKER') == 'yes':
ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + "1"]
# CACHING
# ------------------------------------------------------------------------------
REDIS_LOCATION = '{0}/{1}'.format(env('REDIS_URL', default='redis://redis:6379'), 0)
# Heroku URL does not pass the DB number, so we parse it in
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': REDIS_LOCATION,
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'IGNORE_EXCEPTIONS': True, # mimics memcache behavior.
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
}

View File

@ -24,49 +24,19 @@ TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing. # Note: This key only used for development and testing.
SECRET_KEY = env('DJANGO_SECRET_KEY', default='wq)sg12k&5&adv)e%56n5e97o@))6xu90b**=-w+)d^c+cd9%1')
# Mail settings
# ------------------------------------------------------------------------------
EMAIL_PORT = 1025
EMAIL_HOST = env("EMAIL_HOST", default='mailhog')
MSG_PREFIX = 'MHT'
# CACHING
# ------------------------------------------------------------------------------
REDIS_LOCATION = '{0}/{1}'.format(env('REDIS_URL', default='redis://redis:6379'), 0)
# Heroku URL does not pass the DB number, so we parse it in
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': REDIS_LOCATION,
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'IGNORE_EXCEPTIONS': True, # mimics memcache behavior.
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
}
# django-debug-toolbar # django-debug-toolbar
# ---------------------MDVTDNXFTRJSJBX9KWOJTMCGSNMYASEFNBPDUZJMGSPPCVMQRUZMZAEXDTIGHPZCP9JBGLVKGSJMZKPVV--------------------------------------------------------- # ---------------------MDVTDNXFTRJSJBX9KWOJTMCGSNMYASEFNBPDUZJMGSPPCVMQRUZMZAEXDTIGHPZCP9JBGLVKGSJMZKPVV---------------------------------------------------------
MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',) # MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar', ) # MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
# INSTALLED_APPS += ('debug_toolbar', )
ALLOWED_HOSTS = ['*'] # ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ] # INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', '172.22.0.9', '192.168.1.113', '172.22.0.4', '0.0.0.0']
# tricks to have debug toolbar when developing with docker # tricks to have debug toolbar when developing with docker
if os.environ.get('USE_DOCKER') == 'yes': if os.environ.get('USE_DOCKER') == 'yes':
ip = socket.gethostbyname('nginx')
INTERNAL_IPS += [ip[:-1] + "1"]
ip = socket.gethostbyname(socket.gethostname()) ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + "1"] INTERNAL_IPS += [ip[:-1] + "1"]
@ -148,15 +118,13 @@ LOGGING = {
} }
} }
# Custom Admin URL, use {% url 'admin:index' %}
ADMIN_URL = env('DJANGO_ADMIN_URL', default='trustee/')
# Your production stuff: Below this line define 3rd party library settings # Your production stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
PAYMENT_PROVIDERS['gocardless']['redirect_url'] = 'http://127.0.0.1:8180' PAYMENT_PROVIDERS['gocardless']['redirect_url'] = 'http://127.0.0.1:8180'
TEMPLATE_DEBUG = False TEMPLATE_DEBUG = True
AWS_S3_SECURE_URLS = False AWS_S3_SECURE_URLS = False
AWS_ACCESS_KEY_ID = env('MINIO_ACCESS_KEY') AWS_ACCESS_KEY_ID = env('MINIO_ACCESS_KEY')
@ -177,3 +145,6 @@ STATICFILES_STORAGE = 'mhackspace.core.storage.SassStorageFix'
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True) COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True)
COMPRESS_STORAGE = STATICFILES_STORAGE COMPRESS_STORAGE = STATICFILES_STORAGE
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': True,
}

View File

@ -1,13 +1,18 @@
upstream app-dev { upstream app-gunicorn {
server unix:/data/sockets/dev-gunicorn-mhackspace.sock fail_timeout=0; server unix:/data/sockets/gunicorn-mhackspace.sock fail_timeout=0;
} }
upstream app-bjoern {
server unix:/data/sockets/bjoern-mhackspace.sock fail_timeout=0;
}
server { server {
listen 80; listen 80;
server_name dev.maidstone-hackspace.org.uk; server_name dev.maidstone-hackspace.org.uk;
root /var/www/maidstone-hackspace-website; root /var/www/maidstone-hackspace-website;
resolver 8.8.8.8; # resolver 8.8.8.8;
resolver 127.0.0.11;
server_tokens off; server_tokens off;
add_header X-Frame-Options "ALLOW-FROM riot.im"; add_header X-Frame-Options "ALLOW-FROM riot.im";
@ -17,6 +22,12 @@ server {
error_page 404 = /404.htm; error_page 404 = /404.htm;
# only for dev to test different wsgi servers
set $upstream "django:8000";
if ($http_cookie ~ "proxy_override=([\w-]+)") {
set $upstream $1;
}
location /media { location /media {
alias /var/www/maidstone-hackspace-website/mhackspace/media; alias /var/www/maidstone-hackspace-website/mhackspace/media;
expires 1d; expires 1d;
@ -26,17 +37,17 @@ server {
location / { location / {
# try_files $uri $uri;
access_log on; access_log on;
proxy_redirect off; proxy_redirect off;
proxy_pass http://app-dev;
proxy_pass_header Server; proxy_pass_header Server;
resolver 127.0.0.11;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-SSL-Protocol $ssl_protocol; proxy_set_header X-SSL-Protocol $ssl_protocol;
proxy_pass http://$upstream;
proxy_ssl_session_reuse off; proxy_ssl_session_reuse off;
} }

View File

@ -8,23 +8,8 @@ Production Configurations
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from django.utils import six from django.utils import six
from .common import * # noqa from .common import * # noqa
# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = env('DJANGO_SECRET_KEY')
# This ensures that Django will be able to detect a secure connection
# properly on Heroku.
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Use Whitenoise to serve static files
# See: https://whitenoise.readthedocs.io/
# SECURITY CONFIGURATION # SECURITY CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# See https://docs.djangoproject.com/en/1.9/ref/middleware/#module-django.middleware.security # See https://docs.djangoproject.com/en/1.9/ref/middleware/#module-django.middleware.security
@ -56,18 +41,6 @@ ALLOWED_HOSTS.append('172.18.0.5')
# END SITE CONFIGURATION # END SITE CONFIGURATION
INSTALLED_APPS += ('gunicorn', )
# STORAGE CONFIGURATION
# ------------------------------------------------------------------------------
# Uploaded Media Files
# ------------------------
# See: http://django-storages.readthedocs.io/en/latest/index.html
INSTALLED_APPS += (
'storages',
)
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID') AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY') AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME') AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
@ -85,15 +58,6 @@ AWS_HEADERS = {
AWS_EXPIRY, AWS_EXPIRY)) AWS_EXPIRY, AWS_EXPIRY))
} }
# URL that handles the media served from MEDIA_ROOT, used for managing
# stored files.
# MEDIA_URL = ''
# Static Assets
# ------------------------
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
# EMAIL # EMAIL
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL', DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
@ -212,8 +176,6 @@ LOGGING = {
} }
} }
# Custom Admin URL, use {% url 'admin:index' %}
ADMIN_URL = env('DJANGO_ADMIN_URL', default='trustee/')
# Your production stuff: Below this line define 3rd party library settings # Your production stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -8,27 +8,8 @@ Stage Configurations
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from django.utils import six from django.utils import six
from .common import * # noqa from .common import * # noqa
# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = env('DJANGO_SECRET_KEY')
# This ensures that Django will be able to detect a secure connection
# properly on Heroku.
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Use Whitenoise to serve static files
# See: https://whitenoise.readthedocs.io/
# SECURITY CONFIGURATION
# ------------------------------------------------------------------------------
# See https://docs.djangoproject.com/en/1.9/ref/middleware/#module-django.middleware.security
# and https://docs.djangoproject.com/ja/1.9/howto/deployment/checklist/#run-manage-py-check-deploy
# set this to 60 seconds and then to 518400 when you can prove it works # set this to 60 seconds and then to 518400 when you can prove it works
SECURE_HSTS_SECONDS = 60 SECURE_HSTS_SECONDS = 60
@ -56,18 +37,8 @@ ALLOWED_HOSTS.append('172.18.0.5')
# END SITE CONFIGURATION # END SITE CONFIGURATION
INSTALLED_APPS += ('gunicorn', )
# STORAGE CONFIGURATION
# ------------------------------------------------------------------------------
# Uploaded Media Files
# ------------------------
# See: http://django-storages.readthedocs.io/en/latest/index.html
INSTALLED_APPS += (
'storages',
)
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID') AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY') AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME') AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
@ -84,16 +55,6 @@ AWS_HEADERS = {
'Cache-Control': six.b('max-age=%d, s-maxage=%d, must-revalidate' % ( 'Cache-Control': six.b('max-age=%d, s-maxage=%d, must-revalidate' % (
AWS_EXPIRY, AWS_EXPIRY)) AWS_EXPIRY, AWS_EXPIRY))
} }
# URL that handles the media served from MEDIA_ROOT, used for managing
# stored files.
# MEDIA_URL = ''
# Static Assets
# ------------------------
# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
# EMAIL # EMAIL
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL', DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
@ -136,28 +97,6 @@ TEMPLATES[0]['OPTIONS']['loaders'] = [
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
DATABASES['default'] = env.db('DATABASE_URL') DATABASES['default'] = env.db('DATABASE_URL')
# CACHING
# ------------------------------------------------------------------------------
REDIS_LOCATION = '{0}/{1}'.format(env('REDIS_URL', default='redis://redis:6379'), 0)
# Heroku URL does not pass the DB number, so we parse it in
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': REDIS_LOCATION,
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'IGNORE_EXCEPTIONS': True, # mimics memcache behavior.
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
}
# LOGGING CONFIGURATION # LOGGING CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -212,8 +151,6 @@ LOGGING = {
} }
} }
# Custom Admin URL, use {% url 'admin:index' %}
ADMIN_URL = env('DJANGO_ADMIN_URL', default='trustee/')
# Your production stuff: Below this line define 3rd party library settings # Your production stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -8,10 +8,14 @@ volumes:
postgres_backup: postgres_backup:
driver: local driver: local
services: services:
nginx: nginx:
image: olymk2/nginx image: olymk2/nginx
depends_on:
- django
volumes: volumes:
- ./cache:/etc/ssl/certs
- ./config/settings/nginx/maidstone-hackspace.org.uk:/etc/nginx/sites-enabled/default - ./config/settings/nginx/maidstone-hackspace.org.uk:/etc/nginx/sites-enabled/default
- ./:/var/www - ./:/var/www
- sockets:/data/sockets - sockets:/data/sockets
@ -20,7 +24,6 @@ services:
build: ./compose/postgres build: ./compose/postgres
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
- postgres_backup:/backups
env_file: .env env_file: .env
django: django:
@ -31,14 +34,38 @@ services:
depends_on: depends_on:
- postgres - postgres
# - redis # - redis
# command: python /bjorne.py command: python manage.py runserver 0.0.0.0:8000
command: /dev-gunicorn-mhackspace.sh env_file: .env
volumes:
- .:/app
- sockets:/data/sockets
django_bjoren:
build:
context: .
dockerfile: ./compose/django/Dockerfile-dev
user: django
depends_on:
- postgres
command: python /app/wsgi_bjoern.py
env_file: .env
volumes:
- .:/app
- sockets:/data/sockets
django_gunicorn:
build:
context: .
dockerfile: ./compose/django/Dockerfile-dev
user: django
depends_on:
- postgres
command: /usr/local/bin/gunicorn config.wsgi -w 1 -b unix:/data/sockets/gunicorn-mhackspace.sock --reload --chdir=/app
env_file: .env env_file: .env
volumes: volumes:
- .:/app - .:/app
- sockets:/data/sockets - sockets:/data/sockets
# port 8125
mailhog: mailhog:
image: mailhog/mailhog image: mailhog/mailhog
ports: ports:

View File

@ -8,3 +8,8 @@ $red: #b94a48;
$teal: #008080; $teal: #008080;
$brand-primary: $teal; $brand-primary: $teal;
$font-family-sans-serif: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
$font-size-base: 14px !default;
$headings-font-family: inherit !default;

File diff suppressed because one or more lines are too long

View File

@ -175,6 +175,7 @@
{% block modal %}{% endblock modal %} {% block modal %}{% endblock modal %}
{% block javascript %} {% block javascript %}
<script src="{% static 'js/popper.min.js' %}"></script>
<script <script
src="https://code.jquery.com/jquery-3.2.1.min.js" src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="

View File

@ -59,7 +59,6 @@
{% addtoblock "css" %} {% addtoblock "css" %}
<link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" /> <link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" />
<link href="{% static 'plugins/css/semantic.min.css' %}" type="text/css" media="all" rel="stylesheet" />
<link href="{% static 'martor/css/martor.css' %}" type="text/css" media="all" rel="stylesheet" /> <link href="{% static 'martor/css/martor.css' %}" type="text/css" media="all" rel="stylesheet" />
{% endaddtoblock css %} {% endaddtoblock css %}
@ -85,4 +84,3 @@
{{ block.super }} {{ block.super }}
<script src="{% static "wiki/js/core.js" %}"></script> <script src="{% static "wiki/js/core.js" %}"></script>
{% endblock javascript %} {% endblock javascript %}

View File

@ -17,19 +17,19 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for child in children_slice %} {% for child in children_slice %}
<li> <li>
<a href="{% url 'wiki:get' path=child.path %}"> <a class="dropdown-item" href="{% url 'wiki:get' path=child.path %}">
{{ child.article.current_revision.title }} {{ child.article.current_revision.title }}
</a> </a>
</li> </li>
{% empty %} {% empty %}
<li><a href="#"><em>{% trans "No sub-articles" %}</em></a></li> <li><a class="dropdown-item" href="#"><em>{% trans "No sub-articles" %}</em></a></li>
{% endfor %} {% endfor %}
{% if children_slice_more %} {% if children_slice_more %}
<li><a href="#"><em>{% trans "...and more" %}</em></a></li> <li><a class="dropdown-item" href="#"><em>{% trans "...and more" %}</em></a></li>
{% endif %} {% endif %}
<li class="divider"></li> <li class="divider"></li>
<li> <li>
<a href="{% url 'wiki:dir' path=urlpath.path %}">{% trans "Browse articles in this level" %} &raquo;</a> <a class="dropdown-item" href="{% url 'wiki:dir' path=urlpath.path %}">{% trans "Browse articles in this level" %} &raquo;</a>
</li> </li>
</ul> </ul>
</div> </div>
@ -43,12 +43,12 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
{% if urlpath.parent %} {% if urlpath.parent %}
<a href="{% url 'wiki:create' path=urlpath.parent.path %}" style="padding: 7px;"> <a class="dropdown-item" href="{% url 'wiki:create' path=urlpath.parent.path %}" style="padding: 7px;">
<span class="fa fa-arrow-right"></span> <span class="fa fa-arrow-right"></span>
{% trans "New article next to" %} {{ article.current_revision.title }} {% trans "New article next to" %} {{ article.current_revision.title }}
</a> </a>
{% endif %} {% endif %}
<a href="{% url 'wiki:create' path=urlpath.path %}" style="padding: 7px;"> <a class="dropdown-item" href="{% url 'wiki:create' path=urlpath.path %}" style="padding: 7px;">
<span class="fa fa-arrow-down"></span> <span class="fa fa-arrow-down"></span>
{% trans "New article below" %} {{ article.current_revision.title }} {% trans "New article below" %} {{ article.current_revision.title }}
</a> </a>

View File

@ -3,7 +3,6 @@
# See http://bitly.com/wheel-building-fails-CPython-35 # See http://bitly.com/wheel-building-fails-CPython-35
# Verified bug on Python 3.5.1 # Verified bug on Python 3.5.1
wheel==0.29.0 wheel==0.29.0
# Bleeding edge Django # Bleeding edge Django
django==1.11.4 django==1.11.4

66
wsgi_bjoern.py Normal file
View File

@ -0,0 +1,66 @@
"""
WSGI config for Maidstone Hackspace project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
import bjoern
import socket
from django.core.wsgi import get_wsgi_application
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
# apply Werkzeug WSGI middleware
# if os.environ.setdefault('DJANGO_DEBUG', 'False') is True:
from werkzeug.debug import DebuggedApplication
application = DebuggedApplication(application, evalex=True, pin_security=True, pin_logging=True)
application.debug = True
# bjoern.run(application, 'unix:/data/sockets/bjoern-mhackspace.sock')
#https://stackoverflow.com/questions/46301706/bjoern-wsgi-server-unix-socket-permissions
# class ReloadApplicationMiddleware(object):
# def __call__(self, *args, **kwargs):
# print('Reloading...')
# self.app = self.import_func()
# return self.app(*args, **kwargs)
# application = ReloadApplicationMiddleware(application)
socket_path = '/data/sockets/bjoern-mhackspace.sock'
if os.path.exists(socket_path):
os.unlink(socket_path)
sock = socket.socket(socket.AF_UNIX)
sock.bind(socket_path)
sock.listen(1024)
os.chmod(socket_path, 0o666)
try:
bjoern.server_run(sock, application)
except KeyboardInterrupt:
os.unlink(sock.getsockname())
sock.close()