diff options
author | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-06-13 08:48:44 -0400 |
---|---|---|
committer | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-06-13 08:48:44 -0400 |
commit | e1c8fbfd6c62d63f638317bc05aa66cec060ec4c (patch) | |
tree | d95c27ecf5d5d47995b717d6d736f51983541101 | |
parent | 3a04278e4750ae0a5ec6703829d0bc151ddbf4e5 (diff) | |
download | selfhosted-e1c8fbfd6c62d63f638317bc05aa66cec060ec4c.tar.gz selfhosted-e1c8fbfd6c62d63f638317bc05aa66cec060ec4c.zip |
mastodon: add archive job
-rw-r--r-- | playbooks/mastodon.yml | 6 | ||||
-rw-r--r-- | roles/mastodon/README.md | 1 | ||||
-rw-r--r-- | roles/mastodon/vars/main.yml | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/playbooks/mastodon.yml b/playbooks/mastodon.yml index 8c7b381..e5c5e4f 100644 --- a/playbooks/mastodon.yml +++ b/playbooks/mastodon.yml @@ -15,3 +15,9 @@ apache_document_root: '{{ mastodon_webroot }}' apache_config: '{{ mastodon_apache_config }}' tags: apache + + - role: archive_job + archive_name: mastodon + archive_user: '{{ mastodon_user }}' + archive_shell: '{{ mastodon_archive_shell }}' + tags: archive diff --git a/roles/mastodon/README.md b/roles/mastodon/README.md index 3effd2f..d75d2d6 100644 --- a/roles/mastodon/README.md +++ b/roles/mastodon/README.md @@ -60,6 +60,7 @@ Variable | Description -------------------------|------------ `mastodon_webroot` | Path to Mastodon public web directory `mastodon_apache_config` | Apache config block for reverse proxy +`mastodon_archive_shell` | Shell command for generating tarball of Mastodon media files Usage diff --git a/roles/mastodon/vars/main.yml b/roles/mastodon/vars/main.yml index cede4a0..082d234 100644 --- a/roles/mastodon/vars/main.yml +++ b/roles/mastodon/vars/main.yml @@ -19,6 +19,7 @@ mastodon_home: /opt/mastodon mastodon_user: mastodon mastodon_install_dir: '{{ mastodon_home }}/mastodon' mastodon_webroot: '{{ mastodon_install_dir }}/public' +mastodon_media_dir: '{{ mastodon_install_dir }}/public/system' mastodon_git_repo: https://github.com/mastodon/mastodon mastodon_apache_config: | @@ -56,3 +57,8 @@ mastodon_apache_config: | ErrorDocument 502 /500.html ErrorDocument 503 /500.html ErrorDocument 504 /500.html + +mastodon_archive_shell: >- + TIMESTAMP=$(date +%Y%m%d%H%M%S); + tar czf "mastodon-${TIMESTAMP}.tar.gz" + --transform "s|^\.|mastodon-${TIMESTAMP}|" -C {{ mastodon_media_dir }} . |