Rejig the requirements and update drone to latest spec.

This commit is contained in:
Oliver Marks 2018-12-15 11:49:13 +00:00
parent 4c9c2e2858
commit 11d4ee4659
9 changed files with 40 additions and 108 deletions

View File

@ -1,16 +1,15 @@
workspace: kind: pipeline
base: /drone name: default
path: src
pipeline:
tests:
image: python:3.5
steps:
- name: tests
image: python:3.6
environment: environment:
- PYTHONUSERBASE=/drone/src/cache/packages PYTHONUSERBASE: /drone/src/cache/packages
- POSTGRES_USER=mhackspace POSTGRES_USER: mhackspace
- USE_DOCKER=yes USE_DOCKER: yes
- DJANGO_SETTINGS_MODULE=config.settings.test DJANGO_SETTINGS_MODULE: config.settings.test
BUCKET_URL: http://minio:9000
commands: commands:
- cp -n env.example .env - cp -n env.example .env
- mkdir -p ./cache/packages ./cache/pip - mkdir -p ./cache/packages ./cache/pip
@ -19,7 +18,7 @@ pipeline:
- python manage.py collectstatic --no-input - python manage.py collectstatic --no-input
- python manage.py test mhackspace --keepdb --verbosity 2 - python manage.py test mhackspace --keepdb --verbosity 2
publish-test: - name: publish-stage
pull: True pull: True
image: appleboy/drone-ssh image: appleboy/drone-ssh
host: stage.maidstone-hackspace.org.uk host: stage.maidstone-hackspace.org.uk
@ -36,7 +35,7 @@ pipeline:
- docker-compose -fstage.yml down --remove-orphans - docker-compose -fstage.yml down --remove-orphans
- docker-compose -fstage.yml up -d - docker-compose -fstage.yml up -d
publish-live: - name: publish-live
pull: True pull: True
image: appleboy/drone-ssh image: appleboy/drone-ssh
user: root user: root
@ -52,19 +51,18 @@ pipeline:
event: [ tag ] event: [ tag ]
services: services:
mailhog: - name: mailhog
image: mailhog/mailhog image: mailhog/mailhog
node: - name: node
image: node:alpine image: node:alpine
commands: commands:
- npm --version - npm --version
- npm install - npm install
bucket: - name: minio
image: minio/minio image: minio/minio
environment: environment:
- MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE
- MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
commands: command: [ "server", "--config-dir=/tmp/minio", "/bucket/" ]
- minio server /data &

View File

@ -198,7 +198,7 @@ EMAIL_BACKEND = env(
) )
EMAIL_PORT = 1025 EMAIL_PORT = 1025
EMAIL_HOST = env("EMAIL_HOST", default="mailhog") EMAIL_HOST = env("EMAIL_HOST", default="mailhog")
MSG_PREFIX = env("EMAIL_HOST", default="MHT") MSG_PREFIX = env("EMAIL_PREFIX", default="MHT")
# MANAGER CONFIGURATION # MANAGER CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -296,14 +296,17 @@ STATICFILES_FINDERS = (
AWS_AUTO_CREATE_BUCKET = True AWS_AUTO_CREATE_BUCKET = True
AWS_DEFAULT_ACL = "public-read" AWS_DEFAULT_ACL = "public-read"
AWS_S3_SECURE_URLS = False AWS_S3_ENDPOINT_URL = env('BUCKET_URL', default="http://127.0.0.1:9000")
AWS_ACCESS_KEY_ID = env('BUCKET_ACCESS_KEY') AWS_ACCESS_KEY_ID = env('BUCKET_ACCESS_KEY')
AWS_SECRET_ACCESS_KEY = env('BUCKET_SECRET_KEY') AWS_SECRET_ACCESS_KEY = env('BUCKET_SECRET_KEY')
AWS_STORAGE_BUCKET_NAME = "mhackspace-local" AWS_STORAGE_BUCKET_NAME = env('BUCKET_NAME', default="mhackspace-local")
AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"} AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
AWS_LOCATION = "dev" AWS_LOCATION = "static"
AWS_S3_SECURE_URLS = True AWS_S3_SECURE_URLS = True
STATIC_URL = '%s/%s/%s/' % (AWS_S3_ENDPOINT_URL, AWS_STORAGE_BUCKET_NAME, AWS_LOCATION)
# MEDIA CONFIGURATION # MEDIA CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root # See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root

View File

@ -4,11 +4,7 @@ import socket
import os import os
from .common import * # noqa from .common import * # noqa
DEBUG = env.bool('DJANGO_DEBUG', default=True)
DEBUG = True
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
# 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'] # 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':
@ -107,21 +103,6 @@ LOGGING = {
PAYMENT_PROVIDERS['gocardless']['redirect_url'] = 'http://127.0.0.1:8180' PAYMENT_PROVIDERS['gocardless']['redirect_url'] = 'http://127.0.0.1:8180'
TEMPLATE_DEBUG = True
AWS_S3_SECURE_URLS = False
AWS_ACCESS_KEY_ID = env('BUCKET_ACCESS_KEY')
AWS_SECRET_ACCESS_KEY = env('BUCKET_SECRET_KEY')
AWS_STORAGE_BUCKET_NAME = 'mhackspace-local'
AWS_S3_ENDPOINT_URL = 'http://%s:9000' % socket.gethostbyname('bucket')
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400',
}
AWS_LOCATION = 'dev'
AWS_S3_SECURE_URLS = True
STATIC_URL = '%s/%s/' % (AWS_S3_ENDPOINT_URL, AWS_STORAGE_BUCKET_NAME)
# COMPRESSOR # COMPRESSOR
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -181,9 +181,6 @@ AWS_HEADERS = {
} }
AWS_S3_SECURE_URLS = True AWS_S3_SECURE_URLS = True
AWS_ACCESS_KEY_ID = env('BUCKET_ACCESS_KEY')
AWS_SECRET_ACCESS_KEY = env('BUCKET_SECRET_KEY')
AWS_STORAGE_BUCKET_NAME = 'mhackspace'
AWS_S3_ENDPOINT_URL = 'https://ams3.digitaloceanspaces.com' AWS_S3_ENDPOINT_URL = 'https://ams3.digitaloceanspaces.com'
AWS_S3_OBJECT_PARAMETERS = { AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400', 'CacheControl': 'max-age=86400',

View File

@ -7,19 +7,6 @@ Test settings
from .common import * # noqa from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
# Turn debug off so tests run faster
DEBUG = False
TEMPLATES[0]['OPTIONS']['debug'] = False
# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
# Note: This key only used for development and testing.
SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
# Mail settings # Mail settings
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
EMAIL_HOST = 'localhost' EMAIL_HOST = 'localhost'
@ -29,35 +16,10 @@ EMAIL_PORT = 1025
# for unit testing purposes # for unit testing purposes
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
# CACHING
# ------------------------------------------------------------------------------
# Speed advantages of in-memory caching without having to run Memcached
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': ''
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
}
# TESTING # TESTING
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
TEST_RUNNER = 'django.test.runner.DiscoverRunner' TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# PASSWORD HASHING
# ------------------------------------------------------------------------------
# Use fast password hasher so tests run faster
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
# TEMPLATE LOADERS
# ------------------------------------------------------------------------------
# Keep templates in memory so tests run faster # Keep templates in memory so tests run faster
TEMPLATES[0]['OPTIONS']['loaders'] = [ TEMPLATES[0]['OPTIONS']['loaders'] = [
('django.template.loaders.cached.Loader', [ ('django.template.loaders.cached.Loader', [
@ -72,3 +34,4 @@ DATABASES = {
'NAME': os.path.join(str(ROOT_DIR), 'cache/test_database.db'), 'NAME': os.path.join(str(ROOT_DIR), 'cache/test_database.db'),
} }
} }

View File

@ -13,12 +13,13 @@ DATABASE_URL=postgres://mhackspace:mysecretpass@postgres:5432/mhackspace
# General settings # General settings
DJANGO_ADMIN_URL=admin DJANGO_ADMIN_URL=admin
DJANGO_SETTINGS_MODULE=config.settings.local DJANGO_SETTINGS_MODULE=config.settings.test
DJANGO_SECRET_KEY=iud%k99yw!e+z+c12uatugbn=&lsdyd(t_byk9)@dp@lj6*c*n DJANGO_SECRET_KEY=iud%k99yw!e+z+c12uatugbn=&lsdyd(t_byk9)@dp@lj6*c*n
DJANGO_ALLOWED_HOSTS=.maidstone-hackspace.org.uk DJANGO_ALLOWED_HOSTS=.maidstone-hackspace.org.uk
# AWS Settings # AMS / AWS / MINIO bucket settings
BUCKET_NAME=local BUCKET_URL=http://bucket:9000
BUCKET_NAME=mhackspace-local
BUCKET_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE BUCKET_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE
BUCKET_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY BUCKET_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

View File

@ -48,7 +48,7 @@ pytz==2018.7
django-redis==4.10.0 django-redis==4.10.0
redis<=2.10.6 redis<=2.10.6
rcssmin==1.0.62.1.3 rcssmin==1.0.6
django-compressor==2.2 django-compressor==2.2
#fix for use with s3 buckets merged in master, so next release we can remove this #fix for use with s3 buckets merged in master, so next release we can remove this

View File

@ -1,15 +1,9 @@
# Local development dependencies go here # Local development dependencies go here
-r base.txt -r test.txt
coverage==4.4.1
django-coverage-plugin==1.5.0
Sphinx==1.5.5 Sphinx==1.5.5
django-test-plus==1.0.18
factory-boy==2.8.1
django-debug-toolbar==1.8 django-debug-toolbar==1.8
# improved REPL # improved REPL
ipdb==0.10.3 ipdb==0.10.3
pytest-django==3.1.2
pytest-sugar==0.8.0

View File

@ -1,20 +1,15 @@
# Test dependencies go here. # Test dependencies go here.
-r base.txt -r base.txt
# linting
flake8==3.3.0 # pyup: != 2.6.0
coverage==4.4.1 coverage==4.4.1
flake8==3.3.0 # pyup: != 2.6.0
django-test-plus==1.0.18
factory-boy==2.8.1 factory-boy==2.8.1
django-coverage-plugin==1.5.0
django-test-plus==1.1.1
# pytest # pytest
pytest-django==3.1.2 pytest-django==3.1.2
pytest-sugar==0.8.0 pytest-sugar==0.8.0
django-test-plus==1.0.18
# improved REPL
ipdb==0.10.3
pytest-django==3.1.2
pytest-sugar==0.8.0