mirror of
https://git.cloudron.io/cloudron/mastodon-app.git
synced 2024-11-27 02:31:03 +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/env.production /app/code/.env.production
|
||||||
RUN ln -fs /app/data/system /app/code/public/system
|
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" ]
|
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"
|
echo "=> Cleanup"
|
||||||
cd /app/code
|
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 ..."
|
echo "==> media cache ..."
|
||||||
./bin/tootctl media remove --days=1
|
./bin/tootctl media remove --days=${CACHE_RETENTION_DAYS}
|
||||||
|
|
||||||
echo "==> orphaned media ..."
|
echo "==> orphaned media ..."
|
||||||
./bin/tootctl media remove-orphans
|
./bin/tootctl media remove-orphans
|
||||||
|
|
||||||
echo "==> preview cards.."
|
echo "==> preview cards ..."
|
||||||
./bin/tootctl preview-cards remove --days=1
|
./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