Set-OPS-Public/roles/app_python/templates/app.service.j2
Daniel Allaire 77d6cbc269 app_python : une application cliente recoit sa base PostgreSQL (285)
etat.base: postgresql se declare au registre des bases du plan (portee application) ;
resoudre_base vise une application ; la connexion arrive dans l'environnement (variables
libpq et DATABASE_URL, verify-full avec la racine de client_pki) ; huit noms reserves au
contrat ; flux serveur_web_dorsal -> serveur_postgresql:5432. Au passage, le rendu texte
du devis Proxmox ne s'arrete plus sur une regle ICMP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:25:58 -05:00

30 lines
1.4 KiB
Django/Jinja

# Application {{ app_python_application.nom }} — unite generee par Set-OPS (role app_python). Ne pas editer.
# Source : {{ app_python_application.source }} a {{ app_python_application.version }} ({{ app_python_application.commit }})
[Unit]
Description=Application {{ app_python_application.nom }} ({{ app_python_application.noms | join(' ') }})
After=network.target
[Service]
Type=simple
User={{ app_python_utilisateur }}
Group={{ app_python_utilisateur }}
WorkingDirectory={{ app_python_application.dossier }}
Environment="PATH={{ (app_python_venv ~ '/bin:') if (app_python_livrees | bool) else '' }}/usr/bin:/bin"
Environment=PYTHONDONTWRITEBYTECODE=1
{% if app_python_environnement | bool %}
EnvironmentFile={{ app_python_secrets_racine }}/{{ app_python_application.nom }}.env
{% endif %}
{% if app_python_dossier_etat | length > 0 %}
# L'etat vit hors du code ; il apparait a l'application la ou son contrat le place.
BindPaths={{ app_python_etat_racine }}/{{ app_python_application.nom }}:{{ app_python_application.dossier }}/{{ app_python_dossier_etat }}
{% endif %}
# `env` cherche la commande dans le PATH ci-dessus : le python des roues livrees, sinon Debian.
ExecStart=/usr/bin/env {{ app_python_contrat.demarrer | replace('{port}', app_python_application.port | string) | replace('%', '%%') }}
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
PrivateTmp=true
ProtectHome=true
[Install]
WantedBy=multi-user.target