mirror of
https://git.cloudron.io/cloudron/mastodon-app.git
synced 2024-11-23 08:10:59 +00:00
Allow to set cache retention days
This commit is contained in:
parent
4b80104980
commit
cef9a1bdbd
3 changed files with 21 additions and 4 deletions
|
@ -68,7 +68,7 @@ RUN ln -sf /run/mastodon/supervisord.log /var/log/supervisor/supervisord.log
|
|||
RUN ln -fs /app/data/env.production /app/code/.env.production
|
||||
RUN ln -fs /app/data/system /app/code/public/system
|
||||
|
||||
COPY start.sh cleanup.sh config.sh env.template /app/pkg/
|
||||
COPY start.sh cleanup.sh config.sh env.template cache-env.sh.template /app/pkg/
|
||||
|
||||
CMD [ "/app/pkg/start.sh" ]
|
||||
|
||||
|
|
4
cache-env.sh.template
Normal file
4
cache-env.sh.template
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# number of days to keep cache
|
||||
export CACHE_RETENTION_DAYS=2
|
19
cleanup.sh
19
cleanup.sh
|
@ -5,11 +5,24 @@ set -eu
|
|||
echo "=> Cleanup"
|
||||
cd /app/code
|
||||
|
||||
if [[ ! -f /app/data/cache-env.sh ]]; then
|
||||
echo "==> Createing initial cache-env.sh"
|
||||
cp /app/pkg/cache-env.sh.template /app/data/cache-env.sh
|
||||
fi
|
||||
|
||||
source /app/data/cache-env.sh
|
||||
|
||||
echo "==> media cache ..."
|
||||
./bin/tootctl media remove --days=1
|
||||
./bin/tootctl media remove --days=${CACHE_RETENTION_DAYS}
|
||||
|
||||
echo "==> orphaned media ..."
|
||||
./bin/tootctl media remove-orphans
|
||||
|
||||
echo "==> preview cards.."
|
||||
./bin/tootctl preview-cards remove --days=1
|
||||
echo "==> preview cards ..."
|
||||
./bin/tootctl preview-cards remove --days=${CACHE_RETENTION_DAYS}
|
||||
|
||||
echo "==> prune profiles ..."
|
||||
./bin/tootctl media remove --prune-profiles --days=${CACHE_RETENTION_DAYS}
|
||||
|
||||
echo "==> remove headers ..."
|
||||
./bin/tootctl media remove --remove-headers --days=${CACHE_RETENTION_DAYS}
|
||||
|
|
Loading…
Reference in a new issue