-
Notifications
You must be signed in to change notification settings - Fork 1k
/
rbd-target-gw.service.j2
56 lines (54 loc) · 1.81 KB
/
rbd-target-gw.service.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[Unit]
Description=RBD Target Gateway Service
{% if container_binary == 'docker' %}
After=docker.service
Requires=docker.service
{% else %}
After=network.target
{% endif %}
[Service]
EnvironmentFile=-/etc/environment
{% if container_binary == 'podman' %}
ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
ExecStartPre=-/usr/bin/{{ container_binary }} rm --storage rbd-target-gw
ExecStartPre=-/usr/bin/mkdir -p /var/log/rbd-target-gw
{% else %}
ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-gw
{% endif %}
ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-gw
ExecStart=/usr/bin/{{ container_binary }} run --rm \
{% if container_binary == 'podman' %}
-d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
{% endif %}
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
--memory={{ ceph_rbd_target_gw_docker_memory_limit }} \
--cpus={{ ceph_rbd_target_gw_docker_cpu_limit }} \
-v /etc/localtime:/etc/localtime:ro \
--privileged \
--net=host \
-v /dev:/dev \
-v /dev/log:/dev/log \
-v /lib/modules:/lib/modules \
-v /etc/ceph:/etc/ceph \
-v /var/log/rbd-target-gw:/var/log/rbd-target-gw:z \
-e CLUSTER={{ cluster }} \
-e CEPH_DAEMON=RBD_TARGET_GW \
-e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
--name=rbd-target-gw \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
{% if container_binary == 'podman' %}
ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`"
{% else %}
ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-gw
{% endif %}
KillMode=none
Restart=always
RestartSec=10s
TimeoutStartSec=120
TimeoutStopSec=15
{% if container_binary == 'podman' %}
Type=forking
PIDFile=/%t/%n-pid
{% endif %}
[Install]
WantedBy=multi-user.target