Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

53 строки
2.6 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Matrix ma1sd Identity server
  4. {% for service in matrix_ma1sd_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_ma1sd_systemd_wanted_services_list %}
  9. Wants={{ service }}
  10. {% endfor %}
  11. DefaultDependencies=no
  12. [Service]
  13. Type=simple
  14. Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
  15. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-ma1sd 2>/dev/null || true'
  16. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-ma1sd 2>/dev/null || true'
  17. # ma1sd writes an SQLite shared library (libsqlitejdbc.so) to /tmp and executes it from there,
  18. # so /tmp needs to be mounted with an exec option.
  19. ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-ma1sd \
  20. --log-driver=none \
  21. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  22. --cap-drop=ALL \
  23. --read-only \
  24. --tmpfs=/tmp:rw,exec,nosuid,size=10m \
  25. --network={{ matrix_docker_network }} \
  26. {% if matrix_ma1sd_container_http_host_bind_port %}
  27. -p {{ matrix_ma1sd_container_http_host_bind_port }}:{{ matrix_ma1sd_container_port }} \
  28. {% endif %}
  29. {% if matrix_ma1sd_verbose_logging %}
  30. -e MA1SD_LOG_LEVEL=debug \
  31. {% endif %}
  32. --mount type=bind,src={{ matrix_ma1sd_config_path }},dst=/etc/ma1sd,ro \
  33. --mount type=bind,src={{ matrix_ma1sd_data_path }},dst=/var/ma1sd \
  34. {% for arg in matrix_ma1sd_container_extra_arguments %}
  35. {{ arg }} \
  36. {% endfor %}
  37. {{ matrix_ma1sd_docker_image }}
  38. {% for network in matrix_ma1sd_container_additional_networks %}
  39. ExecStartPost={{ devture_systemd_docker_base_host_command_sh }} -c 'container_name=matrix-ma1sd; network_name={{ network }}; attempt=0; while [ $attempt -le 29 ]; do attempt=$(( $attempt + 1 )); if [ "`{{ devture_systemd_docker_base_host_command_docker }} inspect -f {{ '{{.State.Running}}' }} $container_name 2> /dev/null`" = "true" ]; then break; fi; sleep 1; done; {{ devture_systemd_docker_base_host_command_docker }} network connect $network_name $container_name'
  40. {% endfor %}
  41. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-ma1sd 2>/dev/null || true'
  42. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-ma1sd 2>/dev/null || true'
  43. Restart=always
  44. RestartSec=30
  45. SyslogIdentifier=matrix-ma1sd
  46. [Install]
  47. WantedBy=multi-user.target