adding the service files and and a script to gather them

This commit is contained in:
2025-10-21 21:02:17 -05:00
parent 3d1d8a12d5
commit 283acd26c4
12 changed files with 169 additions and 0 deletions

21
copy_systemd_files.py Normal file
View 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')

View 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

View 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
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1,8 @@
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target

View 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

View 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
View 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
View File

@@ -0,0 +1,8 @@
[Unit]
Description=SCHA Site Socket
[Socket]
ListenStream=/run/scha.sock
[Install]
WantedBy=sockets.target