Delete old Mastodon media cache every day #593

Merged
raucao merged 2 commits from feature/533-delete_old_mastodon_cached_media into master 2025-05-17 07:06:37 +00:00
Showing only changes of commit 14687558fe - Show all commits

View File

@ -265,7 +265,11 @@ service "mastodon-streaming" do
action [:enable, :start]
end
# Delete old media cache
#
# Delete cached remote media older than 30 days
# Will be re-fetched if necessary
#
systemd_unit 'mastodon-delete-old-media-cache.service' do
content({
Unit: {
@ -273,12 +277,12 @@ systemd_unit 'mastodon-delete-old-media-cache.service' do
},
Service: {
Type: "oneshot",
WorkingDirectory: "#{mastodon_path}",
Environment: "\"RAILS_ENV=#{rails_env}\"",
WorkingDirectory: mastodon_path,
Environment: "RAILS_ENV=#{rails_env}",
ExecStart: "#{bundle_path} exec bin/tootctl media remove --days 30",
SyslogIdentifier: "mastodon-delete-old-media-cache"
}
})
triggers_reload true
action [:create]
end
@ -292,10 +296,9 @@ systemd_unit 'mastodon-delete-old-media-cache.timer' do
Persistent: 'true'
},
Install: {
WantedBy: 'timers.target'
WantedBy: 'timer.target'
}
})
triggers_reload true
action [:create, :enable, :start]
end