[Unit]
Description=Freva Web app
After={{web_cache_name}}.service {{web_proxy_name}}.service
Requires={{web_cache_name}}.service {{web_proxy_name}}.service

[Service]
Type=simple
PermissionsStartOnly=true
NoNewPrivileges=true
KillSignal=SIGTERM
ExecStart={{ bash_cmd }} init_django.sh
WorkingDirectory={{ data_dir }}/app
EnvironmentFile={{ data_dir }}/config/service-web.env
Environment="PATH={{conda_path}}/bin:{{ ansible_env.PATH }}"
StandardOutput=journal
StandardError=journal
Restart=on-failure
RestartSec=5
StartLimitBurst=5
UMask=007
ReadWritePaths={{conda_path }}
{% if (ansible_become == true and ansible_become_user == 'root') or ansible_user == 'root' %}
ProtectHome=true
ProtectSystem=full
User={{uid}}
Group={{gid}}
{% endif %}
[Install]
WantedBy=multi-user.target
