diff options
Diffstat (limited to 'docs/administration')
-rw-r--r-- | docs/administration/CLI_tasks/config.md | 28 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/database.md | 71 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/digest.md | 25 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/emoji.md | 46 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/general_cli_task_info.include | 5 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/instance.md | 35 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/relay.md | 33 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/uploads.md | 17 | ||||
-rw-r--r-- | docs/administration/CLI_tasks/user.md | 180 | ||||
-rw-r--r-- | docs/administration/backup.md | 17 | ||||
-rw-r--r-- | docs/administration/updating.md | 9 |
11 files changed, 466 insertions, 0 deletions
diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md new file mode 100644 index 000000000..2af51c247 --- /dev/null +++ b/docs/administration/CLI_tasks/config.md @@ -0,0 +1,28 @@ +# Transfering the config to/from the database + +!!! danger + This is a Work In Progress, not usable just yet. + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Transfer config from file to DB. + +```sh tab="OTP" + ./bin/pleroma_ctl config migrate_to_db +``` + +```sh tab="From Source" +mix pleroma.config migrate_to_db +``` + + +## Transfer config from DB to `config/env.exported_from_db.secret.exs` + +To delete transfered settings from database optional flag `-d` can be used. <env> is `prod` by default. +```sh tab="OTP" + ./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d] +``` + +```sh tab="From Source" +mix pleroma.config migrate_from_db [--env=<env>] [-d] +``` diff --git a/docs/administration/CLI_tasks/database.md b/docs/administration/CLI_tasks/database.md new file mode 100644 index 000000000..51c7484ba --- /dev/null +++ b/docs/administration/CLI_tasks/database.md @@ -0,0 +1,71 @@ +# Database maintenance tasks + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +!!! danger + These mix tasks can take a long time to complete. Many of them were written to address specific database issues that happened because of bugs in migrations or other specific scenarios. Do not run these tasks "just in case" if everything is fine your instance. + +## Replace embedded objects with their references + +Replaces embedded objects with references to them in the `objects` table. Only needs to be ran once if the instance was created before Pleroma 1.0.5. The reason why this is not a migration is because it could significantly increase the database size after being ran, however after this `VACUUM FULL` will be able to reclaim about 20% (really depends on what is in the database, your mileage may vary) of the db size before the migration. + +```sh tab="OTP" +./bin/pleroma_ctl database remove_embedded_objects [<options>] +``` + +```sh tab="From Source" +mix pleroma.database remove_embedded_objects [<options>] +``` + +### Options +- `--vacuum` - run `VACUUM FULL` after the embedded objects are replaced with their references + +## Prune old remote posts from the database + +This will prune remote posts older than 90 days (configurable with [`config :pleroma, :instance, remote_post_retention_days`](../../configuration/cheatsheet.md#instance)) from the database, they will be refetched from source when accessed. + +!!! danger + The disk space will only be reclaimed after `VACUUM FULL`. You may run out of disk space during the execution of the task or vacuuming if you don't have about 1/3rds of the database size free. + +```sh tab="OTP" +./bin/pleroma_ctl database prune_objects [<options>] +``` + +```sh tab="From Source" +mix pleroma.database prune_objects [<options>] +``` + +### Options +- `--vacuum` - run `VACUUM FULL` after the objects are pruned + +## Create a conversation for all existing DMs + +Can be safely re-run + +```sh tab="OTP" +./bin/pleroma_ctl database bump_all_conversations +``` + +```sh tab="From Source" +mix pleroma.database bump_all_conversations +``` + +## Remove duplicated items from following and update followers count for all users + +```sh tab="OTP" +./bin/pleroma_ctl database update_users_following_followers_counts +``` + +```sh tab="From Source" +mix pleroma.database update_users_following_followers_counts +``` + +## Fix the pre-existing "likes" collections for all objects + +```sh tab="OTP" +./bin/pleroma_ctl database fix_likes_collections +``` + +```sh tab="From Source" +mix pleroma.database fix_likes_collections +``` diff --git a/docs/administration/CLI_tasks/digest.md b/docs/administration/CLI_tasks/digest.md new file mode 100644 index 000000000..1badda8c3 --- /dev/null +++ b/docs/administration/CLI_tasks/digest.md @@ -0,0 +1,25 @@ +# Managing digest emails + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Send digest email since given date (user registration date by default) ignoring user activity status. + +```sh tab="OTP" + ./bin/pleroma_ctl digest test <nickname> [<since_date>] +``` + +```sh tab="From Source" +mix pleroma.digest test <nickname> [<since_date>] +``` + + +Example: + +```sh tab="OTP" +./bin/pleroma_ctl digest test donaldtheduck 2019-05-20 +``` + +```sh tab="From Source" +mix pleroma.digest test donaldtheduck 2019-05-20 +``` + diff --git a/docs/administration/CLI_tasks/emoji.md b/docs/administration/CLI_tasks/emoji.md new file mode 100644 index 000000000..a3207bc6c --- /dev/null +++ b/docs/administration/CLI_tasks/emoji.md @@ -0,0 +1,46 @@ +# Managing emoji packs + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Lists emoji packs and metadata specified in the manifest + +```sh tab="OTP" +./bin/pleroma_ctl emoji ls-packs [<options>] +``` + +```sh tab="From Source" +mix pleroma.emoji ls-packs [<options>] +``` + + +### Options +- `-m, --manifest PATH/URL` - path to a custom manifest, it can either be an URL starting with `http`, in that case the manifest will be fetched from that address, or a local path + +## Fetch, verify and install the specified packs from the manifest into `STATIC-DIR/emoji/PACK-NAME` + +```sh tab="OTP" +./bin/pleroma_ctl emoji get-packs [<options>] <packs> +``` + +```sh tab="From Source" +mix pleroma.emoji get-packs [<options>] <packs> +``` + +### Options +- `-m, --manifest PATH/URL` - same as [`ls-packs`](#ls-packs) + +## Create a new manifest entry and a file list from the specified remote pack file + +```sh tab="OTP" +./bin/pleroma_ctl emoji gen-pack PACK-URL +``` + +```sh tab="From Source" +mix pleroma.emoji gen-pack PACK-URL +``` + +Currently, only .zip archives are recognized as remote pack files and packs are therefore assumed to be zip archives. This command is intended to run interactively and will first ask you some basic questions about the pack, then download the remote file and generate an SHA256 checksum for it, then generate an emoji file list for you. + + The manifest entry will either be written to a newly created `index.json` file or appended to the existing one, *replacing* the old pack with the same name if it was in the file previously. + + The file list will be written to the file specified previously, *replacing* that file. You _should_ check that the file list doesn't contain anything you don't need in the pack, that is, anything that is not an emoji (the whole pack is downloaded, but only emoji files are extracted). diff --git a/docs/administration/CLI_tasks/general_cli_task_info.include b/docs/administration/CLI_tasks/general_cli_task_info.include new file mode 100644 index 000000000..a1ff1da12 --- /dev/null +++ b/docs/administration/CLI_tasks/general_cli_task_info.include @@ -0,0 +1,5 @@ +Every command should be ran as the `pleroma` user from it's home directory. For example if you are superuser, you would have to wrap the command in `su pleroma -s $SHELL -lc "$COMMAND"`. + +??? note "From source note about `MIX_ENV`" + + The `mix` command should be prefixed with the name of environment your Pleroma server is running in, usually it's `MIX_ENV=prod` diff --git a/docs/administration/CLI_tasks/instance.md b/docs/administration/CLI_tasks/instance.md new file mode 100644 index 000000000..1a3b268be --- /dev/null +++ b/docs/administration/CLI_tasks/instance.md @@ -0,0 +1,35 @@ +# Managing instance configuration + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Generate a new configuration file +```sh tab="OTP" + ./bin/pleroma_ctl instance gen [<options>] +``` + +```sh tab="From Source" +mix pleroma.instance gen [<options>] +``` + + +If any of the options are left unspecified, you will be prompted interactively. + +### Options +- `-f`, `--force` - overwrite any output files +- `-o <path>`, `--output <path>` - the output file for the generated configuration +- `--output-psql <path>` - the output file for the generated PostgreSQL setup +- `--domain <domain>` - the domain of your instance +- `--instance-name <instance_name>` - the name of your instance +- `--admin-email <email>` - the email address of the instance admin +- `--notify-email <email>` - email address for notifications +- `--dbhost <hostname>` - the hostname of the PostgreSQL database to use +- `--dbname <database_name>` - the name of the database to use +- `--dbuser <username>` - the user (aka role) to use for the database connection +- `--dbpass <password>` - the password to use for the database connection +- `--rum <Y|N>` - Whether to enable RUM indexes +- `--indexable <Y|N>` - Allow/disallow indexing site by search engines +- `--db-configurable <Y|N>` - Allow/disallow configuring instance from admin part +- `--uploads-dir <path>` - the directory uploads go in when using a local uploader +- `--static-dir <path>` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.) +- `--listen-ip <ip>` - the ip the app should listen to, defaults to 127.0.0.1 +- `--listen-port <port>` - the port the app should listen to, defaults to 4000 diff --git a/docs/administration/CLI_tasks/relay.md b/docs/administration/CLI_tasks/relay.md new file mode 100644 index 000000000..c4f078f4d --- /dev/null +++ b/docs/administration/CLI_tasks/relay.md @@ -0,0 +1,33 @@ +# Managing relays + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Follow a relay + +```sh tab="OTP" +./bin/pleroma_ctl relay follow <relay_url> +``` + +```sh tab="From Source" +mix pleroma.relay follow <relay_url> +``` + +## Unfollow a remote relay + +```sh tab="OTP" +./bin/pleroma_ctl relay unfollow <relay_url> +``` + +```sh tab="From Source" +mix pleroma.relay unfollow <relay_url> +``` + +## List relay subscriptions + +```sh tab="OTP" +./bin/pleroma_ctl relay list +``` + +```sh tab="From Source" +mix pleroma.relay list +``` diff --git a/docs/administration/CLI_tasks/uploads.md b/docs/administration/CLI_tasks/uploads.md new file mode 100644 index 000000000..e36c94c38 --- /dev/null +++ b/docs/administration/CLI_tasks/uploads.md @@ -0,0 +1,17 @@ +# Managing uploads + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Migrate uploads from local to remote storage +```sh tab="OTP" + ./bin/pleroma_ctl uploads migrate_local <target_uploader> [<options>] +``` + +```sh tab="From Source" +mix pleroma.uploads migrate_local <target_uploader> [<options>] +``` + +### Options +- `--delete` - delete local uploads after migrating them to the target uploader + +A list of available uploaders can be seen in [Configuration Cheat Sheet](../../configuration/cheatsheet.md#pleromaupload) diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md new file mode 100644 index 000000000..da8363131 --- /dev/null +++ b/docs/administration/CLI_tasks/user.md @@ -0,0 +1,180 @@ +# Managing users + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Create a user + +```sh tab="OTP" +./bin/pleroma_ctl user new <email> [<options>] +``` + +```sh tab="From Source" +mix pleroma.user new <email> [<options>] +``` + + +### Options +- `--name <name>` - the user's display name +- `--bio <bio>` - the user's bio +- `--password <password>` - the user's password +- `--moderator`/`--no-moderator` - whether the user should be a moderator +- `--admin`/`--no-admin` - whether the user should be an admin +- `-y`, `--assume-yes`/`--no-assume-yes` - whether to assume yes to all questions + +## List local users +```sh tab="OTP" + ./bin/pleroma_ctl user list +``` + +```sh tab="From Source" +mix pleroma.user list +``` + + +## Generate an invite link +```sh tab="OTP" + ./bin/pleroma_ctl user invite [<options>] +``` + +```sh tab="From Source" +mix pleroma.user invite [<options>] +``` + + +### Options +- `--expires-at DATE` - last day on which token is active (e.g. "2019-04-05") +- `--max-use NUMBER` - maximum numbers of token uses + +## List generated invites +```sh tab="OTP" + ./bin/pleroma_ctl user invites +``` + +```sh tab="From Source" +mix pleroma.user invites +``` + + +## Revoke invite +```sh tab="OTP" + ./bin/pleroma_ctl user revoke_invite <token_or_id> +``` + +```sh tab="From Source" +mix pleroma.user revoke_invite <token_or_id> +``` + + +## Delete a user +```sh tab="OTP" + ./bin/pleroma_ctl user rm <nickname> +``` + +```sh tab="From Source" +mix pleroma.user rm <nickname> +``` + + +## Delete user's posts and interactions +```sh tab="OTP" + ./bin/pleroma_ctl user delete_activities <nickname> +``` + +```sh tab="From Source" +mix pleroma.user delete_activities <nickname> +``` + + +## Sign user out from all applications (delete user's OAuth tokens and authorizations) +```sh tab="OTP" + ./bin/pleroma_ctl user sign_out <nickname> +``` + +```sh tab="From Source" +mix pleroma.user sign_out <nickname> +``` + + +## Deactivate or activate a user +```sh tab="OTP" + ./bin/pleroma_ctl user toggle_activated <nickname> +``` + +```sh tab="From Source" +mix pleroma.user toggle_activated <nickname> +``` + + +## Unsubscribe local users from a user and deactivate the user +```sh tab="OTP" + ./bin/pleroma_ctl user unsubscribe NICKNAME +``` + +```sh tab="From Source" +mix pleroma.user unsubscribe NICKNAME +``` + + +## Unsubscribe local users from an instance and deactivate all accounts on it +```sh tab="OTP" + ./bin/pleroma_ctl user unsubscribe_all_from_instance <instance> +``` + +```sh tab="From Source" +mix pleroma.user unsubscribe_all_from_instance <instance> +``` + + +## Create a password reset link for user +```sh tab="OTP" + ./bin/pleroma_ctl user reset_password <nickname> +``` + +```sh tab="From Source" +mix pleroma.user reset_password <nickname> +``` + + +## Set the value of the given user's settings +```sh tab="OTP" + ./bin/pleroma_ctl user set <nickname> [<options>] +``` + +```sh tab="From Source" +mix pleroma.user set <nickname> [<options>] +``` + +### Options +- `--locked`/`--no-locked` - whether the user should be locked +- `--moderator`/`--no-moderator` - whether the user should be a moderator +- `--admin`/`--no-admin` - whether the user should be an admin + +## Add tags to a user +```sh tab="OTP" + ./bin/pleroma_ctl user tag <nickname> <tags> +``` + +```sh tab="From Source" +mix pleroma.user tag <nickname> <tags> +``` + + +## Delete tags from a user +```sh tab="OTP" + ./bin/pleroma_ctl user untag <nickname> <tags> +``` + +```sh tab="From Source" +mix pleroma.user untag <nickname> <tags> +``` + + +## Toggle confirmation status of the user +```sh tab="OTP" + ./bin/pleroma_ctl user toggle_confirmed <nickname> +``` + +```sh tab="From Source" +mix pleroma.user toggle_confirmed <nickname> +``` + diff --git a/docs/administration/backup.md b/docs/administration/backup.md new file mode 100644 index 000000000..2c70e7bf8 --- /dev/null +++ b/docs/administration/backup.md @@ -0,0 +1,17 @@ +# Backup/Restore your instance + +## Backup + +1. Stop the Pleroma service. +2. Go to the working directory of Pleroma (default is `/opt/pleroma`) +3. Run `sudo -Hu postgres pg_dump -d <pleroma_db> --format=custom -f </path/to/backup_location/pleroma.pgdump>` +4. Copy `pleroma.pgdump`, `config/prod.secret.exs` and the `uploads` folder to your backup destination. If you have other modifications, copy those changes too. +5. Restart the Pleroma service. + +## Restore + +1. Stop the Pleroma service. +2. Go to the working directory of Pleroma (default is `/opt/pleroma`) +3. Copy the above mentioned files back to their original position. +4. Run `sudo -Hu postgres pg_restore -d <pleroma_db> -v -1 </path/to/backup_location/pleroma.pgdump>` +5. Restart the Pleroma service. diff --git a/docs/administration/updating.md b/docs/administration/updating.md new file mode 100644 index 000000000..84e6ef18d --- /dev/null +++ b/docs/administration/updating.md @@ -0,0 +1,9 @@ +# Updating your instance +1. Go to the working directory of Pleroma (default is `/opt/pleroma`) +2. Run `git pull`. This pulls the latest changes from upstream. +3. Run `mix deps.get`. This pulls in any new dependencies. +4. Stop the Pleroma service. +5. Run `mix ecto.migrate`[^1]. This task performs database migrations, if there were any. +6. Start the Pleroma service. + +[^1]: Prefix with `MIX_ENV=prod` to run it using the production config file. |