diff --git a/systemd/admin-portal.service b/systemd/admin-portal.service new file mode 100644 index 0000000..f2f8225 --- /dev/null +++ b/systemd/admin-portal.service @@ -0,0 +1,29 @@ +[Unit] +Description=Admin Portal (Django/Gunicorn) +After=network.target postgresql.service redis-server.service +Wants=postgresql.service redis-server.service + +[Service] +Type=simple +User=adminportal +Group=adminportal +WorkingDirectory=/opt/admin-portal/django_app +EnvironmentFile=/etc/admin-portal/admin-portal.env +ExecStart=/opt/admin-portal/venv/bin/gunicorn \ + config.wsgi:application \ + --bind 127.0.0.1:8000 \ + --workers 3 \ + --timeout 30 \ + --access-logfile - \ + --error-logfile - +Restart=on-failure +RestartSec=3 + +# Базовое ужесточение — при необходимости ослабить под конкретный дистрибутив +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=full +ReadWritePaths=/opt/admin-portal/django_app/staticfiles + +[Install] +WantedBy=multi-user.target