Compare commits

..

8 Commits

Author SHA1 Message Date
7393d8720b new release: 0.12.10-stable 2020-11-11 14:54:29 +01:00
287cb72d6f root: fix websockets not working correctly 2020-11-11 14:51:26 +01:00
c5eff4bdd6 outposts: fix selection of outpost's service connection not showing name 2020-11-11 14:34:43 +01:00
e9a33ed8ab root: fix exclusion in dockerignore 2020-11-11 14:24:43 +01:00
875173a86e outposts: fix migration error 2020-11-11 14:10:15 +01:00
df7642b365 build(deps): bump boto3 from 1.16.14 to 1.16.15 (#324)
Bumps [boto3](https://github.com/boto/boto3) from 1.16.14 to 1.16.15.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](https://github.com/boto/boto3/compare/1.16.14...1.16.15)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-11 09:54:19 +01:00
3bc1c0aa8b build(deps): bump channels from 3.0.1 to 3.0.2 (#322)
Bumps [channels](https://github.com/django/channels) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/django/channels/releases)
- [Changelog](https://github.com/django/channels/blob/master/CHANGELOG.txt)
- [Commits](https://github.com/django/channels/compare/3.0.1...3.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jens L <jens@beryju.org>
2020-11-10 23:41:29 +01:00
8951f5695e build(deps): bump boto3 from 1.16.13 to 1.16.14 (#323)
Bumps [boto3](https://github.com/boto/boto3) from 1.16.13 to 1.16.14.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](https://github.com/boto/boto3/compare/1.16.13...1.16.14)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-10 21:50:42 +01:00
19 changed files with 65 additions and 54 deletions

View File

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 0.12.9-stable current_version = 0.12.10-stable
tag = True tag = True
commit = True commit = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\-(?P<release>.*) parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\-(?P<release>.*)

View File

@ -3,4 +3,4 @@ helm
passbook-ui passbook-ui
static static
*.env.yml *.env.yml
node_modules/ **/node_modules

View File

@ -18,11 +18,11 @@ jobs:
- name: Building Docker Image - name: Building Docker Image
run: docker build run: docker build
--no-cache --no-cache
-t beryju/passbook:0.12.9-stable -t beryju/passbook:0.12.10-stable
-t beryju/passbook:latest -t beryju/passbook:latest
-f Dockerfile . -f Dockerfile .
- name: Push Docker Container to Registry (versioned) - name: Push Docker Container to Registry (versioned)
run: docker push beryju/passbook:0.12.9-stable run: docker push beryju/passbook:0.12.10-stable
- name: Push Docker Container to Registry (latest) - name: Push Docker Container to Registry (latest)
run: docker push beryju/passbook:latest run: docker push beryju/passbook:latest
build-proxy: build-proxy:
@ -48,11 +48,11 @@ jobs:
cd proxy cd proxy
docker build \ docker build \
--no-cache \ --no-cache \
-t beryju/passbook-proxy:0.12.9-stable \ -t beryju/passbook-proxy:0.12.10-stable \
-t beryju/passbook-proxy:latest \ -t beryju/passbook-proxy:latest \
-f Dockerfile . -f Dockerfile .
- name: Push Docker Container to Registry (versioned) - name: Push Docker Container to Registry (versioned)
run: docker push beryju/passbook-proxy:0.12.9-stable run: docker push beryju/passbook-proxy:0.12.10-stable
- name: Push Docker Container to Registry (latest) - name: Push Docker Container to Registry (latest)
run: docker push beryju/passbook-proxy:latest run: docker push beryju/passbook-proxy:latest
build-static: build-static:
@ -77,11 +77,11 @@ jobs:
run: docker build run: docker build
--no-cache --no-cache
--network=$(docker network ls | grep github | awk '{print $1}') --network=$(docker network ls | grep github | awk '{print $1}')
-t beryju/passbook-static:0.12.9-stable -t beryju/passbook-static:0.12.10-stable
-t beryju/passbook-static:latest -t beryju/passbook-static:latest
-f static.Dockerfile . -f static.Dockerfile .
- name: Push Docker Container to Registry (versioned) - name: Push Docker Container to Registry (versioned)
run: docker push beryju/passbook-static:0.12.9-stable run: docker push beryju/passbook-static:0.12.10-stable
- name: Push Docker Container to Registry (latest) - name: Push Docker Container to Registry (latest)
run: docker push beryju/passbook-static:latest run: docker push beryju/passbook-static:latest
test-release: test-release:
@ -114,5 +114,5 @@ jobs:
SENTRY_PROJECT: passbook SENTRY_PROJECT: passbook
SENTRY_URL: https://sentry.beryju.org SENTRY_URL: https://sentry.beryju.org
with: with:
tagName: 0.12.9-stable tagName: 0.12.10-stable
environment: beryjuorg-prod environment: beryjuorg-prod

30
Pipfile.lock generated
View File

@ -32,10 +32,10 @@
}, },
"asgiref": { "asgiref": {
"hashes": [ "hashes": [
"sha256:a5098bc870b80e7b872bff60bb363c7f2c2c89078759f6c47b53ff8c525a152e", "sha256:5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17",
"sha256:cd88907ecaec59d78e4ac00ea665b03e571cb37e3a0e37b3702af1a9e86c365a" "sha256:7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"
], ],
"version": "==3.3.0" "version": "==3.3.1"
}, },
"async-timeout": { "async-timeout": {
"hashes": [ "hashes": [
@ -74,18 +74,18 @@
}, },
"boto3": { "boto3": {
"hashes": [ "hashes": [
"sha256:23d2575b7bd01c4e7153f283c1d1c12d329dabf78a6279d4192f2e752bb67b1a", "sha256:60cc37e027d8911f4890275bcd8d1e3f9f5bdb18b3506641a343ae7e60a1d41a",
"sha256:cb3f4c2f2576153b845e5b4f325d54a04f4ca00c156f2063965432bfa5d714dd" "sha256:904d2f1935241c4437781769f9c0d90826470c59eef0d62ea7df4aaf63295d7c"
], ],
"index": "pypi", "index": "pypi",
"version": "==1.16.13" "version": "==1.16.15"
}, },
"botocore": { "botocore": {
"hashes": [ "hashes": [
"sha256:1b1b4cf5efd552ecc7f1ce0fc674d5fba56857db5ffe6394ee76edd1a568d7a6", "sha256:4e9dc37fb3cc47425c6480dc22999d556ca3cf71714f2937df0fc3db2a7f6581",
"sha256:b3b4b8fa33620f015c52e426a92e7db21b5e667ed4785c5fbc484ebfdb2b5153" "sha256:a2d789c8bed5bf1165cc57c95e2db1e74ec50508beb770a89f7c89bc68523281"
], ],
"version": "==1.19.13" "version": "==1.19.15"
}, },
"cachetools": { "cachetools": {
"hashes": [ "hashes": [
@ -152,11 +152,11 @@
}, },
"channels": { "channels": {
"hashes": [ "hashes": [
"sha256:5cdd9c6b9ee663cdf1bbb00de7cdab885a3c418f9d32a29f04b09498828020f6", "sha256:74db79c9eca616be69d38013b22083ab5d3f9ccda1ab5e69096b1bb7da2d9b18",
"sha256:b02e150b48704ec3607d4168402ac5c26138dd183fcdb7f2aeb965e6e19fd558" "sha256:f50a6e79757a64c1e45e95e144a2ac5f1e99ee44a0718ab182c501f5e5abd268"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.0.1" "version": "==3.0.2"
}, },
"channels-redis": { "channels-redis": {
"hashes": [ "hashes": [
@ -1260,10 +1260,10 @@
}, },
"asgiref": { "asgiref": {
"hashes": [ "hashes": [
"sha256:a5098bc870b80e7b872bff60bb363c7f2c2c89078759f6c47b53ff8c525a152e", "sha256:5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17",
"sha256:cd88907ecaec59d78e4ac00ea665b03e571cb37e3a0e37b3702af1a9e86c365a" "sha256:7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"
], ],
"version": "==3.3.0" "version": "==3.3.1"
}, },
"astroid": { "astroid": {
"hashes": [ "hashes": [

View File

@ -19,7 +19,7 @@ services:
networks: networks:
- internal - internal
server: server:
image: beryju/passbook:${PASSBOOK_TAG:-0.12.9-stable} image: beryju/passbook:${PASSBOOK_TAG:-0.12.10-stable}
command: server command: server
environment: environment:
PASSBOOK_REDIS__HOST: redis PASSBOOK_REDIS__HOST: redis
@ -40,7 +40,7 @@ services:
env_file: env_file:
- .env - .env
worker: worker:
image: beryju/passbook:${PASSBOOK_TAG:-0.12.9-stable} image: beryju/passbook:${PASSBOOK_TAG:-0.12.10-stable}
command: worker command: worker
networks: networks:
- internal - internal
@ -54,7 +54,7 @@ services:
env_file: env_file:
- .env - .env
static: static:
image: beryju/passbook-static:${PASSBOOK_TAG:-0.12.9-stable} image: beryju/passbook-static:${PASSBOOK_TAG:-0.12.10-stable}
networks: networks:
- internal - internal
labels: labels:

View File

@ -13,7 +13,7 @@ Download the latest `docker-compose.yml` from [here](https://raw.githubuserconte
To optionally enable error-reporting, run `echo PASSBOOK_ERROR_REPORTING__ENABLED=true >> .env` To optionally enable error-reporting, run `echo PASSBOOK_ERROR_REPORTING__ENABLED=true >> .env`
To optionally deploy a different version run `echo PASSBOOK_TAG=0.12.9-stable >> .env` To optionally deploy a different version run `echo PASSBOOK_TAG=0.12.10-stable >> .env`
If this is a fresh passbook install run the following commands to generate a password: If this is a fresh passbook install run the following commands to generate a password:

View File

@ -11,7 +11,7 @@ This installation automatically applies database migrations on startup. After th
image: image:
name: beryju/passbook name: beryju/passbook
name_static: beryju/passbook-static name_static: beryju/passbook-static
tag: 0.12.9-stable tag: 0.12.10-stable
serverReplicas: 1 serverReplicas: 1
workerReplicas: 1 workerReplicas: 1

View File

@ -4,7 +4,7 @@ name: passbook
home: https://passbook.beryju.org home: https://passbook.beryju.org
sources: sources:
- https://github.com/BeryJu/passbook - https://github.com/BeryJu/passbook
version: "0.12.9-stable" version: "0.12.10-stable"
icon: https://raw.githubusercontent.com/BeryJu/passbook/master/docs/images/logo.svg icon: https://raw.githubusercontent.com/BeryJu/passbook/master/docs/images/logo.svg
dependencies: dependencies:
- name: postgresql - name: postgresql

View File

@ -4,7 +4,7 @@
image: image:
name: beryju/passbook name: beryju/passbook
name_static: beryju/passbook-static name_static: beryju/passbook-static
tag: 0.12.9-stable tag: 0.12.10-stable
serverReplicas: 1 serverReplicas: 1
workerReplicas: 1 workerReplicas: 1

View File

@ -1,4 +1,5 @@
"""Gunicorn config""" """Gunicorn config"""
import os
import warnings import warnings
from multiprocessing import cpu_count from multiprocessing import cpu_count
from pathlib import Path from pathlib import Path
@ -14,6 +15,8 @@ worker_class = "uvicorn.workers.UvicornWorker"
# Docker containers don't have /tmp as tmpfs # Docker containers don't have /tmp as tmpfs
worker_tmp_dir = "/dev/shm" worker_tmp_dir = "/dev/shm"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.root.settings")
logconfig_dict = { logconfig_dict = {
"version": 1, "version": 1,
"disable_existing_loggers": False, "disable_existing_loggers": False,

View File

@ -1,2 +1,2 @@
"""passbook""" """passbook"""
__version__ = "0.12.9-stable" __version__ = "0.12.10-stable"

View File

@ -1,5 +1,5 @@
"""passbook sentry integration""" """passbook sentry integration"""
from aioredis.errors import ReplyError from aioredis.errors import ReplyError, ConnectionClosedError
from billiard.exceptions import WorkerLostError from billiard.exceptions import WorkerLostError
from botocore.client import ClientError from botocore.client import ClientError
from celery.exceptions import CeleryError from celery.exceptions import CeleryError
@ -40,6 +40,7 @@ def before_send(event, hint):
RedisError, RedisError,
ResponseError, ResponseError,
ReplyError, ReplyError,
ConnectionClosedError,
# websocket errors # websocket errors
ChannelFull, ChannelFull,
WebSocketException, WebSocketException,

View File

@ -8,6 +8,7 @@ from passbook.outposts.models import (
DockerServiceConnection, DockerServiceConnection,
KubernetesServiceConnection, KubernetesServiceConnection,
Outpost, Outpost,
OutpostServiceConnection,
) )
from passbook.providers.proxy.models import ProxyProvider from passbook.providers.proxy.models import ProxyProvider
@ -18,6 +19,9 @@ class OutpostForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields["providers"].queryset = ProxyProvider.objects.all() self.fields["providers"].queryset = ProxyProvider.objects.all()
self.fields[
"service_connection"
].queryset = OutpostServiceConnection.objects.select_subclasses()
class Meta: class Meta:

View File

@ -25,8 +25,8 @@ def migrate_to_service_connection(apps: Apps, schema_editor: BaseDatabaseSchemaE
# Ensure that local connection have been created # Ensure that local connection have been created
PassbookOutpostConfig.init_local_connection(None) PassbookOutpostConfig.init_local_connection(None)
docker = DockerServiceConnection.objects.filter(local=True) docker = DockerServiceConnection.objects.filter(local=True).first()
k8s = KubernetesServiceConnection.objects.filter(local=True) k8s = KubernetesServiceConnection.objects.filter(local=True).first()
try: try:
for outpost in ( for outpost in (

View File

@ -6,19 +6,21 @@ It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
""" """
import os
import typing import typing
from time import time from time import time
from typing import Any, ByteString, Dict from typing import Any, ByteString, Dict
import django import django
from asgiref.compatibility import guarantee_single_callable from asgiref.compatibility import guarantee_single_callable
from channels.routing import ProtocolTypeRouter, URLRouter
from defusedxml import defuse_stdlib from defusedxml import defuse_stdlib
from django.core.asgi import get_asgi_application from django.core.asgi import get_asgi_application
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
from structlog import get_logger from structlog import get_logger
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.root.settings") from passbook.root import websocket
# DJANGO_SETTINGS_MODULE is set in gunicorn.conf.py
defuse_stdlib() defuse_stdlib()
django.setup() django.setup()
@ -129,5 +131,14 @@ class ASGILogger:
application = ASGILogger( application = ASGILogger(
guarantee_single_callable(SentryAsgiMiddleware(get_asgi_application())) guarantee_single_callable(
SentryAsgiMiddleware(
ProtocolTypeRouter(
{
"http": get_asgi_application(),
"websocket": URLRouter(websocket.websocket_urlpatterns),
}
)
)
)
) )

View File

@ -1,14 +0,0 @@
"""root Websocket URLS"""
from channels.routing import ProtocolTypeRouter, URLRouter
from django.urls import path
from passbook.outposts.channels import OutpostConsumer
application = ProtocolTypeRouter(
{
# (http->django views is added by default)
"websocket": URLRouter(
[path("ws/outpost/<uuid:pk>/", OutpostConsumer.as_asgi())]
),
}
)

View File

@ -208,7 +208,7 @@ TEMPLATES = [
}, },
] ]
ASGI_APPLICATION = "passbook.root.routing.application" ASGI_APPLICATION = "passbook.root.asgi.application"
CHANNEL_LAYERS = { CHANNEL_LAYERS = {
"default": { "default": {

View File

@ -0,0 +1,6 @@
"""root Websocket URLS"""
from django.urls import path
from passbook.outposts.channels import OutpostConsumer
websocket_urlpatterns = [path("ws/outpost/<uuid:pk>/", OutpostConsumer.as_asgi())]

View File

@ -1,3 +1,3 @@
package pkg package pkg
const VERSION = "0.12.9-stable" const VERSION = "0.12.10-stable"