Prepare for queue
This commit is contained in:
parent
e07968df09
commit
cb9e16371d
5 changed files with 29 additions and 2 deletions
12
misc/celery.service
Normal file
12
misc/celery.service
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Celery Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=vpn
|
||||
Group=vpn
|
||||
WorkingDirectory=/opt/vpnmanager
|
||||
ExecStart=/bin/sh -c '/usr/local/bin/celery -A vpnmanager worker -l info'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
4
setup.sh
4
setup.sh
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y python3-pip npm openvpn easy-rsa postfix
|
||||
sudo pip3 install -U django django-cron uwsgi django-two-factor-auth django-bootstrap-form twilio argon2_cffi GitPython
|
||||
sudo apt install -y python3-pip npm openvpn easy-rsa postfix rabbitmq-server
|
||||
sudo pip3 install -U django django-cron uwsgi celery django-celery-results django-two-factor-auth django-bootstrap-form twilio argon2_cffi GitPython
|
||||
sudo useradd vpn
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
from .celery import app as celery_app
|
||||
|
||||
__all__ = ('celery_app', )
|
7
vpnmanager/celery.py
Normal file
7
vpnmanager/celery.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
import os
|
||||
from celery import Celery
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vpnmanager.settings')
|
||||
app = Celery('vpnmanager')
|
||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
app.autodiscover_tasks()
|
|
@ -23,6 +23,7 @@ TWILIO_CALLER_ID = "+43676800555559"
|
|||
INSTALLED_APPS = [
|
||||
'bootstrapform',
|
||||
'django_otp',
|
||||
'django_celery_results',
|
||||
'django_otp.plugins.otp_static',
|
||||
'django_otp.plugins.otp_totp',
|
||||
'two_factor',
|
||||
|
@ -141,3 +142,7 @@ PASSWORD_HASHERS = [
|
|||
CRON_CLASSES = [
|
||||
"manager.cronjobs.FetchRemoteCron",
|
||||
]
|
||||
|
||||
# Celery config
|
||||
|
||||
CELERY_RESULT_BACKEND = 'django-db'
|
||||
|
|
Loading…
Reference in a new issue