1
0
mirror of https://gitlab.com/psono/psono-server synced 2025-04-18 09:44:01 +03:00

Migrated from uwsgi to Daphne & alpine 3.20

Signed-off-by: Sascha Pfeiffer <sascha.pfeiffer@esaqa.com>
This commit is contained in:
Sascha Pfeiffer 2024-10-15 16:02:25 +02:00
parent 9e25411b07
commit 60ddccc670
7 changed files with 63 additions and 21 deletions

View File

@ -1,5 +1,5 @@
# PSONO Dockerfile for Alpine
FROM psono-docker.jfrog.io/python:3.11.3-alpine3.16
FROM psono-docker.jfrog.io/python:3.11.10-alpine3.20
LABEL maintainer="Sascha Pfeiffer <sascha.pfeiffer@psono.com>"
COPY psono/static/email /var/www/html/static/email
@ -28,7 +28,6 @@ RUN apk upgrade && \
if [ "$TARGETARCH" = "amd64" ]; then \
pip3 install -r requirements-amd64.txt ; \
fi; \
pip3 install uwsgi && \
mkdir -p /root/.psono_server && \
cp /root/configs/mainconfig/settings.yaml /root/.psono_server/settings.yaml && \
sed -i /root/.psono_server/settings.yaml \

View File

@ -1,3 +1,3 @@
python3 /root/createconfig.py /root/configs/docker/psono_uwsgi_port.ini.tpl /root/configs/docker/psono_uwsgi_port.ini && \
python3 /root/psono/manage.py migrate && \
uwsgi --ini /root/configs/docker/psono_uwsgi_port.ini
cd /root/psono && \
daphne -b 0.0.0.0 -p 80 asgi:application

View File

@ -1,10 +0,0 @@
[uwsgi]
http-socket = :{{ UWSGI_PORT }}
chdir = /root/psono
module = wsgi
master = true
log-x-forwarded-for = true
processes = {{ UWSGI_PROCESSES }}
die-on-term = true
buffer-size = {{ UWSGI_BUFFER_SIZE }}

View File

@ -5,9 +5,6 @@ from django.template import Engine, Context
def get_config_vars():
config_vars = {
'UWSGI_PORT': os.environ.get('UWSGI_PORT', '80'),
'UWSGI_PROCESSES': os.environ.get('UWSGI_PROCESSES', '10'),
'UWSGI_BUFFER_SIZE': os.environ.get('UWSGI_BUFFER_SIZE', '8192'),
'NGINX_STRICT_TRANSPORT_SECURITY': os.environ.get('NGINX_STRICT_TRANSPORT_SECURITY', ''),
'NGINX_HEADER_REFERRER_POLICY': os.environ.get('NGINX_HEADER_REFERRER_POLICY', 'same-origin'),
'NGINX_HEADER_X_FRAME_OPTIONS': os.environ.get('NGINX_HEADER_X_FRAME_OPTIONS', 'DENY'),

16
psono/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for mysite project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "psono.settings")
application = get_asgi_application()

View File

@ -1,4 +1,5 @@
cffi==1.15.0
daphne==4.1.2
django==4.2.16
google-cloud-storage==2.14.0
apache-libcloud==3.8.0

View File

@ -9,11 +9,21 @@ apache-libcloud==3.8.0
# -r requirements.in
# django-storages
asgiref==3.7.2
# via django
# via
# daphne
# django
asn1crypto==1.5.1
# via webauthn
async-timeout==4.0.2
# via redis
attrs==24.2.0
# via
# service-identity
# twisted
autobahn==24.4.2
# via daphne
automat==24.8.1
# via twisted
azure-core==1.24.2
# via
# azure-storage-blob
@ -51,12 +61,18 @@ cffi==1.15.0
# pynacl
charset-normalizer==2.0.11
# via requests
constantly==23.10.4
# via twisted
cryptography==43.0.1
# via
# autobahn
# azure-storage-blob
# paramiko
# pyopenssl
# service-identity
# webauthn
daphne==4.1.2
# via -r requirements.in
dj-database-url==2.1.0
# via -r requirements.in
django==4.2.16
@ -107,8 +123,17 @@ google-resumable-media==2.7.0
# via google-cloud-storage
googleapis-common-protos==1.63.0
# via google-api-core
hyperlink==21.0.0
# via
# autobahn
# twisted
idna==3.7
# via requests
# via
# hyperlink
# requests
# twisted
incremental==24.7.2
# via twisted
isodate==0.6.1
# via msrest
jmespath==0.9.5
@ -146,8 +171,11 @@ pyasn1==0.6.0
# via
# pyasn1-modules
# rsa
# service-identity
pyasn1-modules==0.4.0
# via google-auth
# via
# google-auth
# service-identity
pycparser==2.21
# via cffi
pycryptodomex==3.19.1
@ -159,7 +187,9 @@ pynacl==1.5.0
# -r requirements.in
# paramiko
pyopenssl==24.2.1
# via webauthn
# via
# twisted
# webauthn
pyotp==2.3.0
# via -r requirements.in
python-dateutil==2.8.0
@ -191,6 +221,8 @@ scrypt==0.8.19
# via -r requirements.in
sentry-sdk[django]==2.16.0
# via -r requirements.in
service-identity==24.1.0
# via twisted
six==1.16.0
# via
# azure-core
@ -201,12 +233,17 @@ sqlparse==0.5.0
# via django
toml==0.10.2
# via -r requirements.in
twisted[tls]==24.7.0
# via daphne
txaio==23.1.1
# via autobahn
typing-extensions==4.3.0
# via
# azure-core
# dj-database-url
# psycopg
# pydantic
# twisted
tzdata==2023.4
# via -r requirements.in
urllib3==1.26.19
@ -218,6 +255,8 @@ webauthn==1.8.1
# via -r requirements.in
yubico-client==1.12.0
# via -r requirements.in
zope-interface==7.1.0
# via twisted
# The following packages are considered to be unsafe in a requirements file:
# setuptools