ansible-role-roundcube/templates/systemd/roundcube.service.j2

64 lines
2.9 KiB
Text
Raw Normal View History

2023-09-30 19:35:10 +00:00
#jinja2: lstrip_blocks: "True"
[Unit]
Description=Roundcube ({{ roundcube_identifier }})
{% for service in roundcube_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
DefaultDependencies=no
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill {{ roundcube_identifier }} 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ roundcube_identifier }} 2>/dev/null || true'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name={{ roundcube_identifier }} \
--user={{ roundcube_uid }}:{{ roundcube_gid }} \
--log-driver=none \
--cap-drop=ALL \
--cap-add=CHOWN \
--cap-add=FOWNER \
--cap-add=setgid \
--cap-add=setuid \
--network={{ roundcube_container_network }} \
--hostname={{ roundcube_container_hostname }} \
{% if roundcube_container_http_host_bind_port %}
-p {{ roundcube_container_http_host_bind_port }}:{{ roundcube_container_http_port }} \
{% endif %}
--env-file={{ roundcube_base_path }}/env \
--label-file={{ roundcube_base_path }}/labels \
--health-interval={{ roundcube_container_health_interval }} \
--mount type=bind,src={{ roundcube_config_path }},dst=/var/roundcube/config \
--mount type=bind,src={{ roundcube_install_path }},dst=/var/www/html \
--mount type=bind,src={{ roundcube_tmp_path }},dst=/tmp/roundcube-temp \
{% if roundcube_database_type == 'sqlite' %}
--mount type=bind,src={{ roundcube_sqlite_db_path }},dst=/var/roundcube/db \
{% endif %}
--tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
{% for volume in roundcube_container_additional_volumes %}
--mount type={{ volume.type | default('bind' if '/' in volume.src else 'volume') }},src={{ volume.src }},dst={{ volume.dst }}{{ (',' + volume.options) if volume.options | default('') else '' }} \
{% endfor %}
{% for arg in roundcube_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ roundcube_container_image }}
{% for network in roundcube_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ roundcube_identifier }}
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ roundcube_identifier }}
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill {{ roundcube_identifier }} 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ roundcube_identifier }} 2>/dev/null || true'
Restart=always
RestartSec=30
SyslogIdentifier={{ roundcube_identifier }}
[Install]
WantedBy=multi-user.target