59 lines
1.1 KiB
Desktop File
59 lines
1.1 KiB
Desktop File
[Unit]
|
|
Description=Sistema de ADAN - API Backend
|
|
Documentation=https://github.com/tuorganizacion/adan
|
|
After=network.target postgresql.service redis.service
|
|
Wants=postgresql.service redis.service
|
|
|
|
[Service]
|
|
Type=exec
|
|
User=root
|
|
Group=root
|
|
WorkingDirectory=/opt/adan/backend
|
|
|
|
# Cargar variables de entorno
|
|
EnvironmentFile=/opt/adan/.env
|
|
|
|
# Comando de inicio
|
|
# Uvicorn con multiples workers para produccion
|
|
ExecStart=/opt/adan/backend/venv/bin/uvicorn \
|
|
app.main:app \
|
|
--host 0.0.0.0 \
|
|
--port 8000 \
|
|
--workers 4 \
|
|
--loop uvloop \
|
|
--http httptools \
|
|
--proxy-headers \
|
|
--forwarded-allow-ips='*' \
|
|
--access-log \
|
|
--log-level info
|
|
|
|
# Reinicio automatico
|
|
Restart=always
|
|
RestartSec=5
|
|
|
|
# Timeouts
|
|
TimeoutStartSec=30
|
|
TimeoutStopSec=30
|
|
|
|
# Limites de recursos
|
|
LimitNOFILE=65535
|
|
LimitNPROC=4096
|
|
|
|
# Seguridad
|
|
NoNewPrivileges=true
|
|
PrivateTmp=true
|
|
ProtectSystem=strict
|
|
ProtectHome=true
|
|
ReadWritePaths=/opt/adan /var/log/adan /tmp
|
|
|
|
# Logging
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=adan-api
|
|
|
|
# Health check (systemd 253+)
|
|
# WatchdogSec=30
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|