23 lines
600 B
SYSTEMD
23 lines
600 B
SYSTEMD
[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
|
|
|