From f8386a5d1e1eee8dd301df58b0c7c1b39f348d54 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 25 Jul 2017 18:04:45 +0200 Subject: [PATCH] Update list of rake tasks (#347) --- Running-Mastodon/List-of-Rake-tasks.md | 169 ++++++------------------- 1 file changed, 38 insertions(+), 131 deletions(-) diff --git a/Running-Mastodon/List-of-Rake-tasks.md b/Running-Mastodon/List-of-Rake-tasks.md index 4721a9a..15cdc09 100644 --- a/Running-Mastodon/List-of-Rake-tasks.md +++ b/Running-Mastodon/List-of-Rake-tasks.md @@ -7,146 +7,53 @@ If you want to confirm all Rake tasks from command line interface, you can run t bundle exec rails rake -T ``` -## mastodon:daily -Execute daily tasks. +**General usage note:** Remember that each command will be invoked in a particular environment (configuration, database). The default environment when nothing is specified is "development". In production, you usually prepend all commands with `RAILS_ENV=production` to opt into the production environment. This is not necessary if you're using the Docker images, because that environment variable is set in the image for you. Similarly, prepending `bundle exec` is not necessary when using Docker. The following invocations are equivalent: -```sh -bundle exec rails mastodon:daily -``` +Standalone: `RAILS_ENV=production bundle exec rake mastodon:users:admins` +Docker: `docker-compose run --rm web rake mastodon:users:admins` -## mastodon:make_admin -Turn a user into an admin, identified by the USERNAME environment variable. +Furthermore, in the command, `rake` is interchangeable with `rails` -```sh -bundle exec rails mastodon:make_admin USERNAME=alice -``` +#### Administrative -In the example above, the user `alice` is turned into an admin. +|Task|Description|Usage| +|----|-----------|-----| +|mastodon:make_admin|Turn a user into an admin|USERNAME=yourname| +|mastodon:confirm_email|Confirm a user manually|USER_EMAIL=your@email| +|mastodon:add_user|Create new user|(Interactive)| +|mastodon:users:admins|List e-mails of all admins| +|mastodon:settings:open_registrations|Open up registrations| +|mastodon:settings:close_registrations|Close down registrations| -## mastodon:confirm_email -Manually confirms a user with associated user email address stored in USER_EMAIL environment variable. +#### Media Storage -```sh -bundle exec rails mastodon:confirm_email USER_EMAIL=alice@alice.com -``` +|Task|Description|Usage| +|----|-----------|-----| +|mastodon:media:remove_silenced|Purge all media uploads by silenced accounts. Completely removes records, as if their statuses never had attachments| +|mastodon:media:remove_remote|Remove local cache of remote media attachments older than some time period (defaults to 7 days). Removes only cache, record of an attachment existing remains|NUM_DAYS=7| -In the example above, the registration of the user with the email `alice@alice.com` is completed. +#### E-mails -## mastodon:add_user -Add a user by providing their email, username and initial password. The user will receive a confirmation email, then they must reset their password before logging in. +|Task|Description|Usage| +|----|-----------|-----| +|mastodon:emails:digest|Sends out a personal digest to all eligible inactive users. Digest includes mentions since the last time the user was active. No e-mail is sent if there is no new content since last digest or user activity| -```sh -bundle exec rails mastodon:add_user -``` +#### Misc -## mastodon:media:clear -Removes media attachments that have not been assigned to any status for longer than a day. +|Task|Description|Usage| +|----|-----------|-----| +|mastodon:push:clear| Normally, a subscription to a once-followed user remains forever, in case the user gets re-followed later. You can purge such subscriptions with 0 followers if you wish| +|mastodon:feeds:clear_all|Purge all home timelines from redis. Useful only for troubleshooting, when e.g. resetting database during development| +|mastodon:feeds:build|Regenerates home timelines for all active users. Useful only for troubleshooting, e.g. if you lost your redis database| +|mastodon:webpush:generate_vapid_key|Generates secrets for WebPush notifications| + +#### Data migrations -```sh -bundle exec rails mastodon:media:clear -``` +These are one-off tasks for updating from one version of Mastodon to another. They are noted in the particular release's upgrade notes and are not relevant outside of that. -## mastodon:media:remove_silenced -Remove media attachments attributed to silenced accounts. - -```sh -bundle exec rails mastodon:media:remove_silenced -``` - -## mastodon:media:remove_remote -Remove cached remote media attachments that are older than a week. - -```sh -bundle exec rails mastodon:media:remove_remote -``` - -## mastodon:media:set_unknown -Set unknown attachment type for remote-only attachments. - -```sh -bundle exec rails mastodon:media:set_unknown -``` - -## mastodon:push:clear -Unsubscribes from PuSH updates of feeds nobody follows locally. - -```sh -bundle exec rails mastodon:push:clear -``` - -## mastodon:push:refresh -Re-subscribes to soon expiring PuSH subscriptions. - -```sh -bundle exec rails mastodon:push:refresh -``` - -## mastodon:feeds:clear -Clear timelines of inactive users. - -```sh -bundle exec rails mastodon:feeds:clear -``` - -## mastodon:feeds:clear_all -Clears all timelines. - -```sh -bundle exec rails mastodon:feeds:clear_all -``` - -## mastodon:emails:digest -Send out digest e-mails. - -```sh -bundle exec rails mastodon:emails:digest -``` - -## mastodon:users:clear -Clear out unconfirmed users. - -```sh -bundle exec rails mastodon:users:clear -``` - -## mastodon:users:admins -List all admin users. - -```sh -bundle exec rails mastodon:users:admins -``` - -## mastodon:settings:open_registrations -Open registrations on this instance. - -```sh -bundle exec rails mastodon:settings:open_registrations -``` - -## mastodon:settings:close_registrations -Close registrations on this instance. - -```sh -bundle exec rails mastodon:settings:close_registrations -``` - -## mastodon:maintenance:update_counter_caches -Update counter caches. - -```sh -bundle exec rails mastodon:maintenance:update_counter_caches -``` - -## mastodon:maintenance:add_static_avatars -Generate static versions of GIF avatars/headers. - -```sh -bundle exec rails mastodon:maintenance:add_static_avatars -``` - -## mastodon:maintenance:prepare_for_foreign_keys -Ensure referencial integrity. - -```sh -bundle exec rails mastodon:maintenance:prepare_for_foreign_keys -``` +|Task|Description|Usage| +|----|-----------|-----| +|mastodon:media:set_unknown|Only relevant for a past release| +|mastodon:maintenance:update_counter_caches|Only relevant for a past release| +|mastodon:maintenance:add_static_avatars|Only relevant for a past release| +|mastodon:maintenance:prepare_for_foreign_keys|Only relevant for a past release|