Add deploy script

This commit is contained in:
Digital Studium 2025-05-20 14:59:39 +03:00
parent c97f7ef2f3
commit 03a502b6e2
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,22 @@
[Unit]
Description=TLS cert decoder application
After=network.target
[Service]
WorkingDirectory=/srv/useful_web_tools/cert_decoder/
# Create venv and install deps if not already done
ExecStartPre=/bin/bash -c '[ -d ".venv" ] || python3 -m venv .venv'
ExecStartPre=/bin/bash -c 'source .venv/bin/activate && pip install -r requirements.txt'
# Activate venv and run the app
ExecStart=/bin/bash -c 'source .venv/bin/activate && python main.py --port 5001'
Restart=always
Environment="PYTHONUNBUFFERED=1"
StandardOutput=journal
StandardError=journal
SyslogIdentifier=cert-decoder
[Install]
WantedBy=multi-user.target

5
deploy.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
cp cert_decoder/cert-decoder.service /lib/systemd/system/
cp diff/diff-tool.service /lib/systemd/system/
systemctl enable --now cert-decoder
systemctl enable --now diff-tool

22
diff/diff-tool.service Normal file
View File

@ -0,0 +1,22 @@
[Unit]
Description=Diff tool application
After=network.target
[Service]
WorkingDirectory=/srv/useful_web_tools/diff/
# Create venv and install deps if not already done
ExecStartPre=/bin/bash -c '[ -d ".venv" ] || python3 -m venv .venv'
ExecStartPre=/bin/bash -c 'source .venv/bin/activate && pip install -r requirements.txt'
# Activate venv and run the app
ExecStart=/bin/bash -c 'source .venv/bin/activate && python main.py --port 5002'
Restart=always
Environment="PYTHONUNBUFFERED=1"
StandardOutput=journal
StandardError=journal
SyslogIdentifier=diff-tool
[Install]
WantedBy=multi-user.target