Skip to content

[SOLVED] Lifecycle hooks: rails db:migrate (Mastodon), docker-compose.yml #1873

Answered by Sieboldianus
Sieboldianus asked this question in Q&A
Discussion options

You must be logged in to vote

I finally decided to include a simply cron job, instead of Watchtower:

sudo nano /etc/cron.daily/mastodon_auto_cleanup
#!/bin/sh

# If started as root, then re-start as user "mastodon":
if [ "$(id -u)" -eq 0 ]; then
    exec sudo -H -u mastodon $0 "$@"
    echo "This is never reached.";
fi

echo "This runs as user $(id -un)";
# prints "mastodon"

# upgrade
docker compose -f /srv/mastodon/docker/docker-compose.yml pull
docker compose -f /srv/mastodon/docker/docker-compose.yml run --rm web rails db:migrate
docker compose -f /srv/mastodon/docker/docker-compose.yml up -d

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Sieboldianus
Comment options

@Sieboldianus
Comment options

@Sieboldianus
Comment options

@Sieboldianus
Comment options

Answer selected by Sieboldianus
@Sieboldianus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants