✨ | refactor: clean up code, add systemd service, and write comprehensive README
This commit is contained in:
50
services/corsproxy.service
Normal file
50
services/corsproxy.service
Normal file
@@ -0,0 +1,50 @@
|
||||
# /etc/systemd/system/corsproxy.service
|
||||
#
|
||||
# Systemd unit for the Unsloth Studio CORS proxy.
|
||||
#
|
||||
# Installation:
|
||||
# sudo cp corsproxy.service /etc/systemd/system/
|
||||
# sudo systemctl daemon-reload
|
||||
# sudo systemctl enable corsproxy.service # start on boot
|
||||
# sudo systemctl start corsproxy.service # start now
|
||||
#
|
||||
# Management:
|
||||
# sudo systemctl status corsproxy.service # view status
|
||||
# sudo journalctl -u corsproxy.service -f # follow logs
|
||||
# sudo systemctl restart corsproxy.service # restart
|
||||
|
||||
[Unit]
|
||||
Description=Unsloth Studio CORS Proxy
|
||||
Documentation=https://github.com/NikkeDoy/CORSProxy
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python3 /opt/CORSProxy/main.py --target 127.0.0.1:8888 --listen 8080
|
||||
WorkingDirectory=/opt/CORSProxy
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
# --- Hardening ---
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
ReadWritePaths=/var/log/corsproxy
|
||||
CapabilityBoundingSet=
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
|
||||
# --- Tunable ---
|
||||
# Override by creating a drop-in:
|
||||
# sudo systemctl edit corsproxy.service
|
||||
#
|
||||
# Add:
|
||||
# [Service]
|
||||
# ExecStart=
|
||||
# ExecStart=/usr/bin/python3 /opt/CORSProxy/main.py --target 10.0.0.5:8000 --listen 9090
|
||||
|
||||
# --- Restart limiter ---
|
||||
StartLimitIntervalSec=300
|
||||
StartLimitBurst=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user