clean up stage configs, start of live configs

This commit is contained in:
Oliver Marks 2017-02-21 19:09:15 +00:00
parent 496f6ad8d7
commit 223de57b6b
5 changed files with 46 additions and 90 deletions

View File

@ -2,15 +2,11 @@
"""
Production Configurations
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis for cache
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
@ -78,7 +74,6 @@ AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
AWS_AUTO_CREATE_BUCKET = True
AWS_QUERYSTRING_AUTH = False
AWS_S3_CALLING_FORMAT = OrdinaryCallingFormat()
# AWS cache settings, don't change unless you know what you're doing:
AWS_EXPIRY = 60 * 60 * 24 * 7
@ -93,7 +88,7 @@ AWS_HEADERS = {
# URL that handles the media served from MEDIA_ROOT, used for managing
# stored files.
MEDIA_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
# MEDIA_URL = ''
# Static Assets
@ -108,17 +103,25 @@ COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', default=True)
# EMAIL
# ------------------------------------------------------------------------------
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
default='Maidstone Hackspace <noreply@maidstone-hackspace.org.uk>')
default='Maidstone Hackspace <no-reply@maidstone-hackspace.org.uk>')
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[Maidstone Hackspace] ')
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
SERVER_EMAIL_PORT = '587'
EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_PASSWORD = env('EMAIL_PASSWORD')
EMAIL_HOST_USER = env('EMAIL_USER')
EMAIL_PORT = 587
# Anymail with Mailgun
INSTALLED_APPS += ("anymail", )
ANYMAIL = {
"MAILGUN_API_KEY": env('DJANGO_MAILGUN_API_KEY'),
"MAILGUN_SENDER_DOMAIN": env('MAILGUN_SENDER_DOMAIN')
}
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
#INSTALLED_APPS += ("anymail", )
#ANYMAIL = {
# "MAILGUN_API_KEY": env('DJANGO_MAILGUN_API_KEY'),
# "MAILGUN_SENDER_DOMAIN": env('MAILGUN_SENDER_DOMAIN')
#}
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
# TEMPLATE CONFIGURATION
# ------------------------------------------------------------------------------
@ -187,23 +190,28 @@ LOGGING = {
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'logfile': {
'level':'DEBUG',
'class':'logging.FileHandler',
'filename': "%s/django.log" % ROOT_DIR,
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'handlers': ['mail_admins', 'logfile'],
'level': 'ERROR',
'propagate': True
},
'django.security.DisallowedHost': {
'level': 'ERROR',
'handlers': ['console', 'mail_admins'],
'handlers': ['logfile', 'console', 'mail_admins'],
'propagate': True
}
}
}
# Custom Admin URL, use {% url 'admin:index' %}
ADMIN_URL = env('DJANGO_ADMIN_URL')
ADMIN_URL = env('DJANGO_ADMIN_URL', default='admin')
# Your production stuff: Below this line define 3rd party library settings
# ------------------------------------------------------------------------------

View File

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
"""
Production Configurations
Stage Configurations
- Use mailgun to send emails
- Use Redis for cache
"""

View File

@ -1,55 +1,43 @@
version: '2'
volumes:
gunicorn_socket: {}
postgres_data_dev: {}
postgres_backup_dev: {}
sockets:
external: true
postgres_data:
driver: local
postgres_backup:
driver: local
services:
postgres:
build: ./compose/postgres
volumes:
- postgres_data_dev:/var/lib/postgresql/data
- postgres_backup_dev:/backups
# environment:
# - POSTGRES_USER=${POSTGRES_USER}
- postgres_data:/var/lib/postgresql/data
- postgres_backup:/backups
env_file: .env
django:
build:
context: .
dockerfile: ./compose/django/Dockerfile
command: /start-dev.sh
user: django
depends_on:
- postgres
environment:
- POSTGRES_USER=${POSTGRES_USER}
- USE_DOCKER=yes
- redis
command: /gunicorn.sh
env_file: .env
volumes:
- .:/app
- gunicorn_socket:/var/run/gunicorn/
ports:
- "8180:8000"
links:
- postgres
- mailhog
- sockets:/data/sockets
nginx:
build: ./compose/nginx
depends_on:
- django
environment:
- MY_DOMAIN_NAME=maidstone-hackspace.org.uk
ports:
- "0.0.0.0:80:80"
# - "0.0.0.0:443:443"
node:
image: node:7-onbuild
command: npm install
volumes:
- gunicorn_socket:/var/run/gunicorn/
mailhog:
image: mailhog/mailhog
ports:
- "8125:8025"
- ./:/usr/src/app
redis:
image: redis:latest

View File

@ -1,7 +1,7 @@
{% load static %}
{% get_static_prefix as STATIC_PREFIX %}
<h3 class="mb-1">See what our memberrs have been creating below.</h3>
<h3 class="mb-1">See what our members have been creating below.</h3>
<br />
<div class="card-columns" id="feeds">
<div class="card-deck">

View File

@ -8,14 +8,6 @@ volumes:
postgres_backup:
driver: local
# volumes:
# sockets:
# driver: local
# data:
# driver: local
services:
postgres:
build: ./compose/postgres
@ -38,37 +30,7 @@ services:
- .:/app
- sockets:/data/sockets
# nginx:
# build: ./compose/nginx
# env_file: .env
# depends_on:
# - django
# - certbot
#
# environment:
# - MY_DOMAIN_NAME=test.maidstone-hackspace.org.uk
# ports:
# - "0.0.0.0:8080:80"
# volumes:
# - .:/app
# - sockets:/data/sockets
# - "0.0.0.0:443:443"
# volumes:
# - /etc/letsencrypt:/etc/letsencrypt
# - /var/lib/letsencrypt:/var/lib/letsencrypt
# certbot:
# image: quay.io/letsencrypt/letsencrypt
# command: bash -c "sleep 6 && certbot certonly -n --standalone -d maidstone-hackspace.org.uk --text --agree-tos --email support@maidstone-hackspace.org.uk --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --verbose --keep-until-expiring --standalone-supported-challenges http-01"
# entrypoint: ""
# volumes:
# - /etc/letsencrypt:/etc/letsencrypt
# - /var/lib/letsencrypt:/var/lib/letsencrypt
# ports:
# - "80"
# - "443"
# environment:
# - TERM=xterm
node:
image: node:7-onbuild