maintenance: update to Django 5, Redis 7, Postgres 16, add dev SRS
This commit is contained in:
parent
ab729dcb7c
commit
2d01023a4b
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.8-alpine
|
FROM python:3.12-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# set env
|
# set env
|
||||||
|
|
|
@ -2,13 +2,13 @@ from django.contrib import admin
|
||||||
from .models import Identity, Task
|
from .models import Identity, Task
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Identity)
|
||||||
class IdentityAdmin(admin.ModelAdmin):
|
class IdentityAdmin(admin.ModelAdmin):
|
||||||
fields = ['identity', 'name', 'notes', 'heartbeat']
|
fields = ['identity', 'name', 'notes', 'heartbeat']
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Task)
|
||||||
class TaskAdmin(admin.ModelAdmin):
|
class TaskAdmin(admin.ModelAdmin):
|
||||||
fields = ['stream', 'type', 'config_id', 'configuration', 'claimed_by']
|
fields = ['stream', 'type', 'config_id', 'configuration', 'claimed_by']
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Identity, IdentityAdmin)
|
|
||||||
admin.site.register(Task, TaskAdmin)
|
|
||||||
|
|
|
@ -24,10 +24,17 @@ services:
|
||||||
- "EMAIL_HOST_USER=${EMAIL_HOST_USER}"
|
- "EMAIL_HOST_USER=${EMAIL_HOST_USER}"
|
||||||
- "EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD}"
|
- "EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD}"
|
||||||
redis:
|
redis:
|
||||||
image: redis:5-alpine
|
image: redis:7-alpine
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:11.7-alpine
|
image: postgres:16-alpine
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: "portier"
|
POSTGRES_PASSWORD: "portier"
|
||||||
POSTGRES_USER: "portier"
|
POSTGRES_USER: "portier"
|
||||||
POSTGRES_DB: "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
|
|
@ -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!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = int(os.environ.get("DEBUG", default=0))
|
DEBUG = int(os.environ.get("DEBUG", default=0))
|
||||||
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", default="*").split(" ")
|
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'
|
DEFAULT_GROUP = 'default'
|
||||||
|
@ -68,6 +69,8 @@ AUTHENTICATION_BACKENDS = (
|
||||||
'guardian.backends.ObjectPermissionBackend',
|
'guardian.backends.ObjectPermissionBackend',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ANONYMOUS_USER_NAME = None
|
||||||
|
|
||||||
ROOT_URLCONF = 'portier.urls'
|
ROOT_URLCONF = 'portier.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
|
@ -103,7 +106,6 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
@ -133,7 +135,6 @@ ACCOUNT_ACTIVATION_DAYS = 7
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = 'UTC'
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
USE_L10N = True
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
LANGUAGES = [
|
LANGUAGES = [
|
||||||
|
@ -182,3 +183,5 @@ CELERY_RESULT_BACKEND = "redis://{}:{}".format(os.environ.get('REDIS_HOST', defa
|
||||||
CELERY_ACCEPT_CONTENT = ['application/json']
|
CELERY_ACCEPT_CONTENT = ['application/json']
|
||||||
CELERY_RESULT_SERIALIZER = 'json'
|
CELERY_RESULT_SERIALIZER = 'json'
|
||||||
CELERY_TASK_SERIALIZER = 'json'
|
CELERY_TASK_SERIALIZER = 'json'
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
django==3.1.13
|
django==5.0.2
|
||||||
django-registration>=3.1
|
django-registration>=3.1
|
||||||
django-bootstrap4
|
django-bootstrap4
|
||||||
django-guardian
|
django-guardian
|
||||||
|
|
|
@ -3,8 +3,8 @@ from guardian.admin import GuardedModelAdmin
|
||||||
from .models import RestreamConfig
|
from .models import RestreamConfig
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(RestreamConfig)
|
||||||
class RestreamConfigAdmin(GuardedModelAdmin):
|
class RestreamConfigAdmin(GuardedModelAdmin):
|
||||||
fields = ['name', 'active', 'stream', 'format', 'target']
|
fields = ['name', 'active', 'stream', 'format', 'target']
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(RestreamConfig, RestreamConfigAdmin)
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ from guardian.admin import GuardedModelAdmin
|
||||||
from .models import Application, Stream
|
from .models import Application, Stream
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Application)
|
||||||
class ApplicationAdmin(GuardedModelAdmin):
|
class ApplicationAdmin(GuardedModelAdmin):
|
||||||
fields = ['name']
|
fields = ['name']
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Stream)
|
||||||
class StreamAdmin(GuardedModelAdmin):
|
class StreamAdmin(GuardedModelAdmin):
|
||||||
fields = ['application', 'stream', 'name', 'publish_counter']
|
fields = ['application', 'stream', 'name', 'publish_counter']
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Application, ApplicationAdmin)
|
|
||||||
admin.site.register(Stream, StreamAdmin)
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.dispatch import Signal
|
from django.dispatch import Signal
|
||||||
|
|
||||||
stream_active = Signal(providing_args=['stream', 'params'])
|
stream_active = Signal()
|
||||||
stream_inactive = Signal(providing_args=['stream', 'params'])
|
stream_inactive = Signal()
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue