adding the service files and and a script to gather them
This commit is contained in:
21
copy_systemd_files.py
Normal file
21
copy_systemd_files.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
if __name__ == "__main__":
|
||||
source_dir = r'/etc/systemd/system'
|
||||
info_file = 'restart_services.sh'
|
||||
items = os.listdir(source_dir)
|
||||
print(items)
|
||||
with open(info_file, 'r') as file:
|
||||
for line in file:
|
||||
filename = line.strip().split()[-1]
|
||||
print(filename)
|
||||
if filename != 'nginx':
|
||||
socket_file = os.path.join(source_dir,f'{filename}.socket')
|
||||
service_file = os.path.join(source_dir,f'{filename}.service')
|
||||
if os.path.isfile(socket_file):
|
||||
shutil.copyfile(socket_file, f'./systemd/{filename}.socket')
|
||||
if os.path.isfile(service_file):
|
||||
shutil.copyfile(service_file,f'./systemd/{filename}.service')
|
||||
|
||||
|
||||
18
systemd/beta_dta_wsgi.service
Normal file
18
systemd/beta_dta_wsgi.service
Normal file
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Beta Ditch The Agent WSGI daemon
|
||||
Requires=beta_dta_wsgi.socket
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=westfarn
|
||||
Group=www-data
|
||||
WorkingDirectory=/home/westfarn/Documents/django_live_sites/beta_dta_backend/dta_service
|
||||
ExecStart=/home/westfarn/Documents/django_live_sites/beta_dta_backend/venv/bin/gunicorn \
|
||||
--access-logfile - \
|
||||
--workers 3 \
|
||||
--bind unix:/run/beta_dta_wsgi.sock \
|
||||
dta_service.wsgi:application
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
8
systemd/beta_dta_wsgi.socket
Normal file
8
systemd/beta_dta_wsgi.socket
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Beta Ditch The Agent WSGI Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/beta_dta_wsgi.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
18
systemd/company.service
Normal file
18
systemd/company.service
Normal file
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Company Site daemon
|
||||
Requires=company.socket
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=westfarn
|
||||
Group=www-data
|
||||
WorkingDirectory=/home/westfarn/Documents/django_live_sites/Company_Site/company_site
|
||||
ExecStart=/home/westfarn/Documents/django_live_sites/Company_Site/venv/bin/gunicorn \
|
||||
--access-logfile - \
|
||||
--workers 3 \
|
||||
--bind unix:/run/company.sock \
|
||||
company_site.wsgi:application
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
8
systemd/company.socket
Normal file
8
systemd/company.socket
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Company Site Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/company.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
19
systemd/daphne.service
Normal file
19
systemd/daphne.service
Normal file
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Websocket Daphne Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=westfarn
|
||||
Group=www-data
|
||||
WorkingDirectory=/home/westfarn/Documents/django_live_sites/Chat_Bot_Backend/llm_be
|
||||
ExecStart=/home/westfarn/Documents/django_live_sites/Chat_Bot_Backend/venv/bin/python /home/westfarn/Documents/django_live_sites/Chat_Bot_Backend/venv/bin/daphne -b 0.0.0.0 -p 8001 -v 0 llm_be.asgi:application
|
||||
Restart=always
|
||||
StartLimitBurst=2
|
||||
|
||||
#StartLimitInterval=600
|
||||
# Restart, but not more than once every 30s (for testing purposes)
|
||||
StartLimitInterval=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
17
systemd/gunicorn.service
Normal file
17
systemd/gunicorn.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=gunicorn daemon
|
||||
Requires=gunicorn.socket
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=westfarn
|
||||
Group=www-data
|
||||
WorkingDirectory=/home/westfarn/Documents/django_live_sites/Chat_Bot_Backend/llm_be
|
||||
ExecStart=/home/westfarn/Documents/django_live_sites/Chat_Bot_Backend/venv/bin/gunicorn \
|
||||
--access-logfile - \
|
||||
--workers 3 \
|
||||
--bind unix:/run/gunicorn.sock \
|
||||
llm_be.wsgi:application
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
8
systemd/gunicorn.socket
Normal file
8
systemd/gunicorn.socket
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=gunicorn socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/gunicorn.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
18
systemd/prod_dta_wsgi.service
Normal file
18
systemd/prod_dta_wsgi.service
Normal file
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Prod Ditch The Agent WSGI daemon
|
||||
Requires=prod_dta_wsgi.socket
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=westfarn
|
||||
Group=www-data
|
||||
WorkingDirectory=/home/westfarn/Documents/django_live_sites/prod_dta_backend/dta_service
|
||||
ExecStart=/home/westfarn/Documents/django_live_sites/prod_dta_backend/venv/bin/gunicorn \
|
||||
--access-logfile - \
|
||||
--workers 3 \
|
||||
--bind unix:/run/prod_dta_wsgi.sock \
|
||||
dta_service.wsgi:application
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
8
systemd/prod_dta_wsgi.socket
Normal file
8
systemd/prod_dta_wsgi.socket
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Prod Ditch The Agent WSGI Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/prod_dta_wsgi.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
18
systemd/scha.service
Normal file
18
systemd/scha.service
Normal file
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=SCHA Site daemon
|
||||
Requires=scha.socket
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=westfarn
|
||||
Group=www-data
|
||||
WorkingDirectory=/home/westfarn/Documents/django_live_sites/SCHA/SCHA
|
||||
ExecStart=/home/westfarn/Documents/django_live_sites/SCHA/venv/bin/gunicorn \
|
||||
--access-logfile - \
|
||||
--workers 3 \
|
||||
--bind unix:/run/scha.sock \
|
||||
scha.wsgi:application
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
8
systemd/scha.socket
Normal file
8
systemd/scha.socket
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=SCHA Site Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/scha.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
Reference in New Issue
Block a user