1
0
Fork 0
ansible-role-forgejo/templates/forgejo.service.j2

54 lines
2.3 KiB
Text
Raw Permalink Normal View History

2023-09-04 19:32:42 +02:00
[Unit]
Description=Forgejo ({{ forgejo_identifier }})
{% for service in forgejo_systemd_required_systemd_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 {{ forgejo_identifier }} 2>/dev/null'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ forgejo_identifier }} 2>/dev/null'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name={{ forgejo_identifier }} \
--log-driver=none \
--network={{ forgejo_container_network }} \
--user={{ forgejo_uid }}:{{ forgejo_gid }} \
--cap-drop=ALL \
--read-only \
--hostname={{ forgejo_hostname }} \
{% if forgejo_http_bind_port != '' %}
-p {{ forgejo_http_bind_port }}:3000 \
{% endif %}
{% if forgejo_ssh_bind_port != '' %}
-p {{ forgejo_ssh_bind_port }}:2222 \
{% endif %}
{% if forgejo_container_add_host_domain_name %}
--add-host {{ forgejo_container_add_host_domain_name }}:{{ forgejo_container_add_host_domain_ip_address }} \
{% endif %}
2023-09-04 19:32:42 +02:00
--env-file={{ forgejo_base_path }}/env \
--label-file={{ forgejo_base_path }}/labels \
2023-09-06 07:04:30 +02:00
--mount type=bind,src={{ forgejo_data_dir_path }},dst=/var/lib/gitea \
--mount type=bind,src={{ forgejo_config_dir_path }},dst=/etc/gitea \
2023-09-04 19:32:42 +02:00
--tmpfs=/tmp:rw,noexec,nosuid,size=128m \
{{ forgejo_container_image }}
{% for network in forgejo_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ forgejo_identifier }}
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ forgejo_identifier }}
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill {{ forgejo_identifier }} 2>/dev/null'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ forgejo_identifier }} 2>/dev/null'
Restart=always
RestartSec=30
SyslogIdentifier={{ forgejo_identifier }}
[Install]
WantedBy=multi-user.target