⬆ Bump all the things

This commit is contained in:
nikolark committed 2019-12-31 00:21:23 +01:00
1 parent 35929d755a
commit 946af247c6
6 files changed
+49 -63

No files matched your search

+3 -12
View File
@@ -1,20 +1,11 @@
# Install
apt install python-dev libmysqlclient-dev python-virtualenv
virtualenv venv
python -m venv venv
. venv/bin/activate
pip install -r requirements
pip install -r requirements.txt
# Deploy
First you need to have your public key in /home/gitdeploy/.ssh/authorized_keys on the server.
Then, to deploy via login.neuf.no, add the following to your personal ~/.ssh/config
Host lynx.neuf.no
User gitdeploy
ForwardAgent yes
ProxyCommand ssh -W %h:%p login.neuf.no -l USERNAME
Then you can do
First you need to have your public key in `/home/gitdeploy/.ssh/authorized_keys` on the server and then you can do:
fab deploy
+5 -6
View File
@@ -1,11 +1,10 @@
from __future__ import unicode_literals
import logging
import operator
from functools import reduce
from django.db.models import Q
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.decorators import list_route
from rest_framework.decorators import action
from rest_framework.mixins import ListModelMixin
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
@@ -25,9 +24,9 @@ class AliasViewSet(ListModelMixin, GenericViewSet):
serializer_class = AliasSerializer
permission_classes = [IsAuthenticated]
filter_backends = (DjangoFilterBackend, AliasRegexFilterBackend)
filter_fields = ('domain', 'domain__name',)
filterset_fields = ('domain', 'domain__name',)
@list_route(methods=['post'])
@action(detail=False, methods=['post'])
def create_bulk(self, request):
serializer = AliasSerializer(data=request.data, many=True)
@@ -36,7 +35,7 @@ class AliasViewSet(ListModelMixin, GenericViewSet):
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
@list_route(methods=['delete'])
@action(detail=False, methods=['delete'])
def delete_bulk(self, request):
serializer = AliasDeleteSerializer(data=request.data, many=True)
@@ -67,7 +66,7 @@ class DomainViewSet(viewsets.ModelViewSet):
serializer_class = DomainSerializer
permission_classes = [IsAuthenticated]
filter_backends = (DjangoFilterBackend,)
filter_fields = ('name',)
filterset_fields = ('name',)
class UserViewSet(viewsets.ModelViewSet):
+17 -16
View File
@@ -8,6 +8,10 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
@@ -25,11 +29,12 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.messages',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'raven.contrib.django.raven_compat',
'django_extensions',
'rest_framework',
'django_filters',
@@ -106,7 +111,7 @@ LOGGING = {
'disable_existing_loggers': False,
'root': {
'level': 'INFO',
'handlers': ['console', 'sentry'],
'handlers': ['console'],
},
'formatters': {
'verbose': {
@@ -114,10 +119,6 @@ LOGGING = {
},
},
'handlers': {
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
@@ -130,19 +131,19 @@ LOGGING = {
'handlers': ['console'],
'propagate': False,
},
'raven': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': False,
},
'sentry.errors': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': False,
},
},
}
SENTRY_DSN = os.getenv('SENTRY_DSN', 'https://0f0067c4548445a6867a471e2b69a419@sentry.neuf.no/2')
if SENTRY_DSN:
SENTRY_ENVIRONMENT = os.getenv('SENTRY_ENVIRONMENT', 'production')
sentry_sdk.init(
dsn=SENTRY_DSN,
environment=SENTRY_ENVIRONMENT,
integrations=[DjangoIntegration()]
)
try:
from .local_settings import *
except ImportError:
-2
View File
@@ -9,9 +9,7 @@ https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
import os
from django.core.wsgi import get_wsgi_application
from raven.contrib.django.middleware.wsgi import Sentry
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dpdapisite.settings")
application = get_wsgi_application()
application = Sentry(application)
Vendored
+15 -18
View File
@@ -1,25 +1,22 @@
from contextlib import contextmanager as _contextmanager
from fabric.api import run, sudo, env, cd, prefix
import os
env.use_ssh_config = True
env.hosts = ['lynx.neuf.no']
env.project_path = '/var/www/neuf.no/django-postfix-dovecot-api'
env.user = 'gitdeploy'
env.activate = 'source {}/venv/bin/activate'.format(env.project_path)
from fabric import Connection
from invoke import task
@_contextmanager
def virtualenv():
with cd(env.project_path), prefix(env.activate):
yield
@task()
def deploy(c):
"""Make sure proxy_user is set to your neuf username."""
project_path = '/var/www/neuf.no/django-postfix-dovecot-api'
proxy_user = os.getenv('DEPLOY_USER', os.getenv('USER'))
c = Connection(host='gitdeploy@lynx.neuf.no', gateway=Connection('login.neuf.no', user=proxy_user))
def deploy():
with virtualenv():
run('git pull') # Get source
run('pip install -r requirements.txt') # install deps in virtualenv
run('umask 022; python manage.py collectstatic --noinput') # Collect static
run('python manage.py migrate') # Run DB migrations
with c.cd(project_path), c.prefix('source {}/venv/bin/activate'.format(project_path)):
c.run('git pull') # Get source
c.run('pip install -r requirements.txt') # install deps in virtualenv
c.run('umask 022; python manage.py collectstatic --noinput') # Collect static
c.run('python manage.py migrate') # Run DB migrations
# Reload mxapi.neuf.no
sudo('/usr/bin/supervisorctl pid mxapi.neuf.no | xargs kill -HUP', shell=False)
c.sudo('/usr/bin/supervisorctl pid mxapi.neuf.no | xargs kill -HUP', shell=False)
+9 -9
View File
@@ -1,9 +1,9 @@
Django==2.0.8
Fabric3==1.14.post1
django-extensions==2.1.0
django-filter==1.1.0
djangorestframework==3.7.7
gunicorn==19.9.0
mysqlclient==1.3.13
passlib==1.7.1
raven==6.9.0
Django==2.2.*
fabric==2.5.*
django-extensions==2.2.*
django-filter==2.2.*
djangorestframework==3.11.*
gunicorn==20.0.*
mysqlclient==1.4.6
passlib==1.7.*
sentry-sdk==0.13.*