Matrix Docker Ansible eploy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 

32 行
1.2 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Backup service for Matrix Postgres Server
  4. [Service]
  5. {% if matrix_backup_bucket %}
  6. Environment=AWS_BUCKET={{ matrix_backup_bucket }}
  7. Environment=TMP_OUTPUT=/tmp/postgres-backup.sql.gz
  8. {% endif %}
  9. Type=oneshot
  10. ExecStartPre=/bin/sh -c '/usr/bin/docker run --rm \
  11. --network={{ matrix_docker_network }} \
  12. --env-file={{ matrix_postgres_base_path }}/env-postgres-psql \
  13. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  14. {{ matrix_postgres_docker_image_to_use }} \
  15. pg_dumpall -h matrix-postgres | gzip -c > ${TMP_OUTPUT}'
  16. {% if matrix_backup_bucket %}
  17. # Mounting files host files into amazon/aws-cli
  18. # The /aws working directory is user controlled.
  19. # The image will not write to this directory, unless instructed by the user in running a AWS CLI command.
  20. ExecStart=/bin/sh -c 'docker run --rm --name matrix-backup \
  21. --env-file={{ matrix_backup_base_path }}/env-backup \
  22. -v ${TMP_OUTPUT}:/aws/postgres.sql.gz \
  23. {{ matrix_backup_awscli_docker_image }} \
  24. s3 cp /aws/postgres.sql.gz ${AWS_BUCKET}$$(date +%%m-%%d-%%Y)/ \
  25. {% if matrix_backup_bucket_endpoint %}
  26. --endpoint-url {{ matrix_backup_bucket_endpoint }} \
  27. {% endif %} && rm ${TMP_OUTPUT}'
  28. {% endif %}
  29. Group=systemd-journal