diff --git a/api/tacticalrmm/requirements-dev.txt b/api/tacticalrmm/requirements-dev.txt index 87fee09b..5fb43073 100644 --- a/api/tacticalrmm/requirements-dev.txt +++ b/api/tacticalrmm/requirements-dev.txt @@ -1,4 +1,5 @@ black +daphne==4.0.0 Werkzeug django-extensions isort diff --git a/api/tacticalrmm/requirements.txt b/api/tacticalrmm/requirements.txt index b98bc0ee..d8d6b313 100644 --- a/api/tacticalrmm/requirements.txt +++ b/api/tacticalrmm/requirements.txt @@ -6,7 +6,6 @@ cffi==1.15.1 channels==4.0.0 channels_redis==4.1.0 cryptography==41.0.5 -daphne==4.0.0 Django==4.2.6 django-cors-headers==4.3.0 django-filter==23.3 @@ -33,6 +32,7 @@ six==1.16.0 sqlparse==0.4.4 twilio==8.10.0 urllib3==2.0.7 +uvicorn[standard]==0.23.2 uWSGI==2.0.22 validators==0.20.0 vine==5.0.0 diff --git a/api/tacticalrmm/tacticalrmm/settings.py b/api/tacticalrmm/tacticalrmm/settings.py index 18f03ee6..a2b5aed9 100644 --- a/api/tacticalrmm/tacticalrmm/settings.py +++ b/api/tacticalrmm/tacticalrmm/settings.py @@ -108,7 +108,6 @@ if not DEBUG: ) INSTALLED_APPS = [ - "daphne", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", @@ -177,6 +176,7 @@ if SWAGGER_ENABLED: INSTALLED_APPS += ("drf_spectacular",) if DEBUG and not DEMO: + INSTALLED_APPS.insert(0, "daphne") INSTALLED_APPS += ( "django_extensions", "silk", diff --git a/docker/containers/tactical/entrypoint.sh b/docker/containers/tactical/entrypoint.sh index 4351f73e..84d964b4 100644 --- a/docker/containers/tactical/entrypoint.sh +++ b/docker/containers/tactical/entrypoint.sh @@ -169,5 +169,5 @@ if [ "$1" = 'tactical-websockets' ]; then export DJANGO_SETTINGS_MODULE=tacticalrmm.settings - daphne tacticalrmm.asgi:application --port 8383 -b 0.0.0.0 + uvicorn --host 0.0.0.0 --port 8383 --forwarded-allow-ips='*' tacticalrmm.asgi:application fi diff --git a/install.sh b/install.sh index 85bdef92..5a33b274 100644 --- a/install.sh +++ b/install.sh @@ -559,10 +559,10 @@ EOF )" echo "${rmmservice}" | sudo tee /etc/systemd/system/rmm.service >/dev/null -daphneservice="$( +uviservice="$( cat </dev/null +echo "${uviservice}" | sudo tee /etc/systemd/system/daphne.service >/dev/null natsservice="$( cat </dev/null +fi + sudo systemctl daemon-reload print_green "Installing Python ${PYTHON_VER}" diff --git a/update.sh b/update.sh index 5eeb7125..6b5480f8 100644 --- a/update.sh +++ b/update.sh @@ -112,15 +112,14 @@ for i in nginx nats-api nats rmm daphne; do sudo systemctl stop ${i} done -CHECK_DAPHNE=$(grep v2 /etc/systemd/system/daphne.service) -if ! [[ $CHECK_DAPHNE ]]; then - +# migrate daphne to uvicorn +if ! grep -q uvicorn /etc/systemd/system/daphne.service; then sudo rm -f /etc/systemd/system/daphne.service - daphneservice="$( + uviservice="$( cat </dev/null + echo "${uviservice}" | sudo tee /etc/systemd/system/daphne.service >/dev/null sudo systemctl daemon-reload fi