parent
3f689da8ac
commit
ec8f60876a
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=bots telegram bots service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=http
|
||||
Group=http
|
||||
WorkingDirectory=/srv/apps/bots
|
||||
ExecStart=/srv/apps/bots/venv/bin/python /srv/apps/bots/manage.py bot_worker
|
||||
KillSignal=SIGINT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=bots celeryd service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=http
|
||||
Group=http
|
||||
WorkingDirectory=/srv/apps/bots
|
||||
ExecStart=/srv/apps/bots/venv/bin/celery worker --app=config -l info
|
||||
KillSignal=SIGINT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=bots telegram bots service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=http
|
||||
Group=http
|
||||
WorkingDirectory=/srv/apps/bots
|
||||
ExecStart=/srv/apps/bots/venv/bin/python /srv/apps/bots/manage.py periodic_bots
|
||||
KillSignal=SIGINT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=bots telegram bots service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=http
|
||||
Group=http
|
||||
WorkingDirectory=/srv/apps/bots
|
||||
ExecStart=/srv/apps/bots/venv/bin/python /srv/apps/bots/manage.py periodic_feeds
|
||||
KillSignal=SIGINT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=bots main service
|
||||
After=network.target
|
||||
Requires=bots-celeryd.service
|
||||
Requires=bots-bot-worker.service
|
||||
Requires=bots-periodic-feeds.service
|
||||
Requires=bots-periodic-bots.service
|
||||
# Requires=bots-aggregator-client.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=http
|
||||
Group=http
|
||||
WorkingDirectory=/srv/apps/bots
|
||||
ExecStart=/srv/apps/bots/venv/bin/daphne -u /tmp/bots.sock config.asgi:application
|
||||
KillSignal=SIGINT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for config.settings 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.0-rc1/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
||||
|
||||
application = get_asgi_application()
|
@ -1,20 +1,51 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name bots.bakatrouble.pw;
|
||||
server_name ~^bots\.bakatrouble\.(pw|me)$;
|
||||
|
||||
access_log /srv/apps/bots/logs/nginx.access;
|
||||
error_log /srv/apps/bots/logs/nginx.error;
|
||||
access_log /srv/apps/bots/logs/nginx.access;
|
||||
error_log /srv/apps/bots/logs/nginx.error;
|
||||
|
||||
location /static {
|
||||
alias /srv/apps/bots/public/static;
|
||||
}
|
||||
location /static {
|
||||
alias /srv/apps/bots/public/static;
|
||||
}
|
||||
|
||||
location /uploads {
|
||||
alias /srv/apps/bots/public/uploads;
|
||||
}
|
||||
location /uploads {
|
||||
alias /srv/apps/bots/public/uploads;
|
||||
}
|
||||
|
||||
location / {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass unix:///tmp/bots.sock;
|
||||
}
|
||||
location / {
|
||||
proxy_pass unix:///tmp/bots.sock;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
|
||||
listen [::]:443 http2 ssl ipv6only=on;
|
||||
listen 443 http2 ssl;
|
||||
ssl_certificate /etc/letsencrypt/live/bakatrouble.pw/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/bakatrouble.pw/privkey.pem;
|
||||
# include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
|
||||
|
||||
|
||||
if ($scheme != "https") {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
if ($host ~ ^bots\.bakatrouble\.(pw|me)$) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
listen [::]:80 ipv6only=on;
|
||||
listen 80;
|
||||
server_name ~^bots\.bakatrouble\.(pw|me)$;
|
||||
return 404;
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
[group:bots]
|
||||
programs = bots_web,bots_aggregator_client,bots_celeryd,bots_celerybeat
|
||||
|
||||
[program:bots_web]
|
||||
user = http
|
||||
directory = /srv/apps/bots
|
||||
command = /srv/apps/bots/venv/bin/uwsgi --yaml /srv/apps/bots/uwsgi.yml
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stderr_logfile = /srv/apps/bots/logs/uwsgi.log
|
||||
stdout_logfile = /srv/apps/bots/logs/uwsgi.log
|
||||
stopsignal = INT
|
||||
|
||||
[program:bots_aggregator_client]
|
||||
user = http
|
||||
directory = /srv/apps/bots
|
||||
command = /srv/apps/bots/venv/bin/python /srv/apps/bots/manage.py start_aggregator_client
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stderr_logfile = /srv/apps/bots/logs/aggregator_client.log
|
||||
stdout_logfile = /srv/apps/bots/logs/aggregator_client.log
|
||||
stopsignal = INT
|
||||
|
||||
[program:bots_celeryd]
|
||||
user = http
|
||||
directory = /srv/apps/bots
|
||||
command=/srv/apps/bots/venv/bin/celery worker --app=config -l info
|
||||
stdout_logfile=/srv/apps/bots/logs/celeryd.log
|
||||
stderr_logfile=/srv/apps/bots/logs/celeryd.log
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=10
|
||||
stopwaitsecs=600
|
||||
|
||||
[program:bots_celerybeat]
|
||||
user = http
|
||||
directory = /srv/apps/bots
|
||||
command=/srv/apps/bots/venv/bin/celery beat --app=config -l info
|
||||
stdout_logfile=/srv/apps/bots/logs/celerybeat.log
|
||||
stderr_logfile=/srv/apps/bots/logs/celerybeat.log
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=10
|
||||
stopwaitsecs=600
|
Loading…
Reference in new issue