maintenance: update to Django 5, Redis 7, Postgres 16, add dev SRS

This commit is contained in:
Jan Koppe 2024-02-25 11:24:42 +01:00
parent ab729dcb7c
commit 2d01023a4b
Signed by: thunfisch
GPG Key ID: BE935B0735A2129B
9 changed files with 53 additions and 13 deletions

View File

@ -1,4 +1,4 @@
FROM python:3.8-alpine
FROM python:3.12-alpine
WORKDIR /app
# set env

View File

@ -2,13 +2,13 @@ from django.contrib import admin
from .models import Identity, Task
@admin.register(Identity)
class IdentityAdmin(admin.ModelAdmin):
fields = ['identity', 'name', 'notes', 'heartbeat']
@admin.register(Task)
class TaskAdmin(admin.ModelAdmin):
fields = ['stream', 'type', 'config_id', 'configuration', 'claimed_by']
admin.site.register(Identity, IdentityAdmin)
admin.site.register(Task, TaskAdmin)

View File

@ -24,10 +24,17 @@ services:
- "EMAIL_HOST_USER=${EMAIL_HOST_USER}"
- "EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD}"
redis:
image: redis:5-alpine
image: redis:7-alpine
postgres:
image: postgres:11.7-alpine
image: postgres:16-alpine
environment:
POSTGRES_PASSWORD: "portier"
POSTGRES_USER: "portier"
POSTGRES_DB: "portier"
srs:
image: ossrs/srs:4
ports:
- 1935:1935
- 8888:8888
volumes:
- ./srs.dev.conf:/usr/local/srs/conf/docker.conf:ro

View File

@ -26,6 +26,7 @@ SECRET_KEY = os.environ.get("SECRET_KEY", default="CHANGE_ME!")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = int(os.environ.get("DEBUG", default=0))
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", default="*").split(" ")
CSRF_TRUSTED_ORIGINS = os.environ.get("DJANGO_CSRF_TRUSTED_ORIGINS", default="http://localhost").split(" ")
DEFAULT_GROUP = 'default'
@ -68,6 +69,8 @@ AUTHENTICATION_BACKENDS = (
'guardian.backends.ObjectPermissionBackend',
)
ANONYMOUS_USER_NAME = None
ROOT_URLCONF = 'portier.urls'
TEMPLATES = [
@ -103,7 +106,6 @@ DATABASES = {
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
@ -133,7 +135,6 @@ ACCOUNT_ACTIVATION_DAYS = 7
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = [
@ -182,3 +183,5 @@ CELERY_RESULT_BACKEND = "redis://{}:{}".format(os.environ.get('REDIS_HOST', defa
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

View File

@ -1,4 +1,4 @@
django==3.1.13
django==5.0.2
django-registration>=3.1
django-bootstrap4
django-guardian

View File

@ -3,8 +3,8 @@ from guardian.admin import GuardedModelAdmin
from .models import RestreamConfig
@admin.register(RestreamConfig)
class RestreamConfigAdmin(GuardedModelAdmin):
fields = ['name', 'active', 'stream', 'format', 'target']
admin.site.register(RestreamConfig, RestreamConfigAdmin)

View File

@ -3,13 +3,13 @@ from guardian.admin import GuardedModelAdmin
from .models import Application, Stream
@admin.register(Application)
class ApplicationAdmin(GuardedModelAdmin):
fields = ['name']
@admin.register(Stream)
class StreamAdmin(GuardedModelAdmin):
fields = ['application', 'stream', 'name', 'publish_counter']
admin.site.register(Application, ApplicationAdmin)
admin.site.register(Stream, StreamAdmin)

View File

@ -1,4 +1,4 @@
from django.dispatch import Signal
stream_active = Signal(providing_args=['stream', 'params'])
stream_inactive = Signal(providing_args=['stream', 'params'])
stream_active = Signal()
stream_inactive = Signal()

30
srs.dev.conf Normal file
View File

@ -0,0 +1,30 @@
listen 1935;
max_connections 1000;
srs_log_tank console;
pid ./objs/srs.pid;
utc_time on;
inotify_auto_reload on;
daemon off;
http_api {
enabled on;
listen 8888;
}
srt_server {
enabled on;
listen 8889;
}
vhost __defaultVhost__ {
security {
enabled on;
allow publish all;
allow play all;
}
http_hooks {
enabled on;
on_publish http://app/rtmp/callback/srs;
on_unpublish http://app/rtmp/callback/srs;
}
}