You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

  1. [Unit]
  2. Description=etcd docker wrapper
  3. Wants=docker.socket
  4. After=docker.service
  5. [Service]
  6. User=root
  7. PermissionsStartOnly=true
  8. ExecStart={{ docker_bin_dir }}/docker run --restart=on-failure:5 \
  9. --env-file=/etc/etcd.env \
  10. {# TODO(mattymo): Allow docker IP binding and disable in envfile
  11. -p 2380:2380 -p 2379:2379 #}
  12. --net=host \
  13. -v /etc/ssl/certs:/etc/ssl/certs:ro \
  14. -v {{ etcd_cert_dir }}:{{ etcd_cert_dir }}:ro \
  15. -v {{ etcd_data_dir }}:/var/lib/etcd:rw \
  16. {% if etcd_memory_limit is defined %}
  17. --memory={{ etcd_memory_limit|regex_replace('Mi', 'M') }} \
  18. {% endif %}
  19. {% if etcd_cpu_limit is defined %}
  20. --cpu-shares={{ etcd_cpu_limit|regex_replace('m', '') }} \
  21. {% endif %}
  22. --name={{ etcd_member_name | default("etcd") }} \
  23. {{ etcd_image_repo }}:{{ etcd_image_tag }} \
  24. {% if etcd_after_v3 %}
  25. {{ etcd_container_bin_dir }}etcd
  26. {% endif %}
  27. ExecStartPre=-{{ docker_bin_dir }}/docker rm -f {{ etcd_member_name | default("etcd") }}
  28. ExecReload={{ docker_bin_dir }}/docker restart {{ etcd_member_name | default("etcd") }}
  29. ExecStop={{ docker_bin_dir }}/docker stop {{ etcd_member_name | default("etcd") }}
  30. Restart=always
  31. RestartSec=15s
  32. [Install]
  33. WantedBy=multi-user.target