diff options
Diffstat (limited to 'docs/administration')
| -rw-r--r-- | docs/administration/CLI_tasks/config.md | 157 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/database.md | 161 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/digest.md | 33 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/email.md | 45 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/emoji.md | 61 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/frontend.md | 96 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/general_cli_task_info.include | 5 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/instance.md | 45 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/oauth_app.md | 20 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/relay.md | 45 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/robots_txt.md | 21 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/uploads.md | 21 | ||||
| -rw-r--r-- | docs/administration/CLI_tasks/user.md | 302 | ||||
| -rw-r--r-- | docs/administration/backup.md | 41 | ||||
| -rw-r--r-- | docs/administration/updating.md | 27 |
15 files changed, 1080 insertions, 0 deletions
diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md new file mode 100644 index 0000000..fc9f3cb --- /dev/null +++ b/docs/administration/CLI_tasks/config.md @@ -0,0 +1,157 @@ +# Transfering the config to/from the database + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Transfer config from file to DB. + +!!! note + You need to add the following to your config before executing this command: + + ```elixir + config :pleroma, configurable_from_database: true + ``` + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config migrate_to_db + ``` + +=== "From Source" + + ```sh + mix pleroma.config migrate_to_db + ``` + +## Transfer config from DB to `config/env.exported_from_db.secret.exs` + +!!! note + In-Database configuration will still be applied after executing this command unless you set the following in your config: + + ```elixir + config :pleroma, configurable_from_database: false + ``` + +Options: + +- `<path>` - where to save migrated config. E.g. `--path=/tmp`. If file saved into non standart folder, you must manually copy file into directory where Pleroma can read it. For OTP install path will be `PLEROMA_CONFIG_PATH` or `/etc/pleroma`. For installation from source - `config` directory in the pleroma folder. +- `<env>` - environment, for which is migrated config. By default is `prod`. +- To delete transferred settings from database optional flag `-d` can be used + +=== "OTP" + ```sh + ./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d] [--path=<path>] + ``` + +=== "From Source" + ```sh + mix pleroma.config migrate_from_db [--env=<env>] [-d] [--path=<path>] + ``` + +## Dump all of the config settings defined in the database + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config dump + ``` + +=== "From Source" + + ```sh + mix pleroma.config dump + ``` + +## List individual configuration groups in the database + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config groups + ``` + +=== "From Source" + + ```sh + mix pleroma.config groups + ``` + +## Dump the saved configuration values for a specific group or key + +e.g., this shows all the settings under `config :pleroma` + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config dump pleroma + ``` + +=== "From Source" + + ```sh + mix pleroma.config dump pleroma + ``` + +To get values under a specific key: + +e.g., this shows all the settings under `config :pleroma, :instance` + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config dump pleroma instance + ``` + +=== "From Source" + + ```sh + mix pleroma.config dump pleroma instance + ``` + +## Delete the saved configuration values for a specific group or key + +e.g., this deletes all the settings under `config :tesla` + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config delete [--force] tesla + ``` + +=== "From Source" + + ```sh + mix pleroma.config delete [--force] tesla + ``` + +To delete values under a specific key: + +e.g., this deletes all the settings under `config :phoenix, :stacktrace_depth` + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config delete [--force] phoenix stacktrace_depth + ``` + +=== "From Source" + + ```sh + mix pleroma.config delete [--force] phoenix stacktrace_depth + ``` + +## Remove all settings from the database + +This forcibly removes all saved values in the database. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl config [--force] reset + ``` + +=== "From Source" + + ```sh + mix pleroma.config [--force] reset + ``` diff --git a/docs/administration/CLI_tasks/database.md b/docs/administration/CLI_tasks/database.md new file mode 100644 index 0000000..c53c499 --- /dev/null +++ b/docs/administration/CLI_tasks/database.md @@ -0,0 +1,161 @@ +# 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. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database remove_embedded_objects [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.database remove_embedded_objects [option ...] + ``` + + +### 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. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database prune_objects [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.database prune_objects [option ...] + ``` + +### Options +- `--vacuum` - run `VACUUM FULL` after the objects are pruned + +## Create a conversation for all existing DMs + +Can be safely re-run + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database bump_all_conversations + ``` + +=== "From Source" + + ```sh + mix pleroma.database bump_all_conversations + ``` + +## Remove duplicated items from following and update followers count for all users + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database update_users_following_followers_counts + ``` + +=== "From Source" + + ```sh + mix pleroma.database update_users_following_followers_counts + ``` + +## Fix the pre-existing "likes" collections for all objects + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database fix_likes_collections + ``` + +=== "From Source" + + ```sh + mix pleroma.database fix_likes_collections + ``` + +## Vacuum the database + +### Analyze + +Running an `analyze` vacuum job can improve performance by updating statistics used by the query planner. **It is safe to cancel this.** + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database vacuum analyze + ``` + +=== "From Source" + + ```sh + mix pleroma.database vacuum analyze + ``` + +### Full + +Running a `full` vacuum job rebuilds your entire database by reading all of the data and rewriting it into smaller +and more compact files with an optimized layout. This process will take a long time and use additional disk space as +it builds the files side-by-side the existing database files. It can make your database faster and use less disk space, +but should only be run if necessary. **It is safe to cancel this.** + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database vacuum full + ``` + +=== "From Source" + + ```sh + mix pleroma.database vacuum full + ``` + +## Add expiration to all local statuses + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database ensure_expiration + ``` + +=== "From Source" + + ```sh + mix pleroma.database ensure_expiration + ``` + +## Change Text Search Configuration + +Change `default_text_search_config` for database and (if necessary) text_search_config used in index, then rebuild index (it may take time). + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database set_text_search_config english + ``` + +=== "From Source" + + ```sh + mix pleroma.database set_text_search_config english + ``` + +See [PostgreSQL documentation](https://www.postgresql.org/docs/current/textsearch-configuration.html) and `docs/configuration/howto_search_cjk.md` for more detail. diff --git a/docs/administration/CLI_tasks/digest.md b/docs/administration/CLI_tasks/digest.md new file mode 100644 index 0000000..a590581 --- /dev/null +++ b/docs/administration/CLI_tasks/digest.md @@ -0,0 +1,33 @@ +# 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. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl digest test <nickname> [since_date] + ``` + +=== "From Source" + + ```sh + mix pleroma.digest test <nickname> [since_date] + ``` + + +Example: + +=== "OTP" + + ```sh + ./bin/pleroma_ctl digest test donaldtheduck 2019-05-20 + ``` + +=== "From Source" + + ```sh + mix pleroma.digest test donaldtheduck 2019-05-20 + ``` + diff --git a/docs/administration/CLI_tasks/email.md b/docs/administration/CLI_tasks/email.md new file mode 100644 index 0000000..2bb57be --- /dev/null +++ b/docs/administration/CLI_tasks/email.md @@ -0,0 +1,45 @@ +# EMail administration tasks + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Send test email (instance email by default) + +=== "OTP" + + ```sh + ./bin/pleroma_ctl email test [--to <destination email address>] + ``` + +=== "From Source" + + ```sh + mix pleroma.email test [--to <destination email address>] + ``` + +Example: + +=== "OTP" + + ```sh + ./bin/pleroma_ctl email test --to root@example.org + ``` + +=== "From Source" + + ```sh + mix pleroma.email test --to root@example.org + ``` + +## Send confirmation emails to all unconfirmed user accounts + +=== "OTP" + + ```sh + ./bin/pleroma_ctl email resend_confirmation_emails + ``` + +=== "From Source" + + ```sh + mix pleroma.email resend_confirmation_emails + ``` diff --git a/docs/administration/CLI_tasks/emoji.md b/docs/administration/CLI_tasks/emoji.md new file mode 100644 index 0000000..e3d1b21 --- /dev/null +++ b/docs/administration/CLI_tasks/emoji.md @@ -0,0 +1,61 @@ +# Managing emoji packs + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Lists emoji packs and metadata specified in the manifest + +=== "OTP" + ```sh + ./bin/pleroma_ctl emoji ls-packs [option ...] + ``` + +=== "From Source" + ```sh + mix pleroma.emoji ls-packs [option ...] + ``` + + +### 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` + +=== "OTP" + ```sh + ./bin/pleroma_ctl emoji get-packs [option ...] <pack ...> + ``` + +=== "From Source" + ```sh + mix pleroma.emoji get-packs [option ...] <pack ...> + ``` + +### 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 + +=== "OTP" + ```sh + ./bin/pleroma_ctl emoji gen-pack PACK-URL + ``` + +=== "From Source" + ```sh + 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 `pack_name.json` file (pack name is asked in questions) 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). + +## Reload emoji packs + +=== "OTP" + ```sh + ./bin/pleroma_ctl emoji reload + ``` + +This command only works with OTP releases. diff --git a/docs/administration/CLI_tasks/frontend.md b/docs/administration/CLI_tasks/frontend.md new file mode 100644 index 0000000..4e9d9ee --- /dev/null +++ b/docs/administration/CLI_tasks/frontend.md @@ -0,0 +1,96 @@ +# Managing frontends + +=== "OTP" + + ```sh + ./bin/pleroma_ctl frontend install <frontend> [--ref <ref>] [--file <file>] [--build-url <build-url>] [--path <path>] [--build-dir <build-dir>] + ``` + +=== "From Source" + + ```sh + mix pleroma.frontend install <frontend> [--ref <ref>] [--file <file>] [--build-url <build-url>] [--path <path>] [--build-dir <build-dir>] + ``` + +Frontend can be installed either from local zip file, or automatically downloaded from the web. + +You can give all the options directly on the command line, but missing information will be filled out by looking at the data configured under `frontends.available` in the config files. + +Currently, known `<frontend>` values are: + +- [admin-fe](https://git.pleroma.social/pleroma/admin-fe) +- [kenoma](http://git.pleroma.social/lambadalambda/kenoma) +- [pleroma-fe](http://git.pleroma.social/pleroma/pleroma-fe) +- [fedi-fe](https://git.pleroma.social/pleroma/fedi-fe) +- [soapbox](https://gitlab.com/soapbox-pub/soapbox) + +You can still install frontends that are not configured, see below. + +## Example installations for a known frontend + +For a frontend configured under the `available` key, it's enough to install it by name. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl frontend install pleroma + ``` + +=== "From Source" + + ```sh + mix pleroma.frontend install pleroma + ``` + +This will download the latest build for the pre-configured `ref` and install it. It can then be configured as the one of the served frontends in the config file (see `primary` or `admin`). + +You can override any of the details. To install a pleroma build from a different URL, you could do this: + +=== "OTP" + + ```sh + ./bin/pleroma_ctl frontend install pleroma --ref 2hu_edition --build-url https://example.org/raymoo.zip + ``` + +=== "From Source" + + ```sh + mix pleroma.frontend install pleroma --ref 2hu_edition --build-url https://example.org/raymoo.zip + ``` + +Similarly, you can also install from a local zip file. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl frontend install pleroma --ref mybuild --file ~/Downloads/doomfe.zip + ``` + +=== "From Source" + + ```sh + mix pleroma.frontend install pleroma --ref mybuild --file ~/Downloads/doomfe.zip + ``` + +The resulting frontend will always be installed into a folder of this template: `${instance_static}/frontends/${name}/${ref}`. + +Careful: This folder will be completely replaced on installation. + +## Example installation for an unknown frontend + +The installation process is the same, but you will have to give all the needed options on the command line. For example: + +=== "OTP" + + ```sh + ./bin/pleroma_ctl frontend install gensokyo --ref master --build-url https://gensokyo.2hu/builds/marisa.zip + ``` + +=== "From Source" + + ```sh + mix pleroma.frontend install gensokyo --ref master --build-url https://gensokyo.2hu/builds/marisa.zip + ``` + +If you don't have a zip file but just want to install a frontend from a local path, you can simply copy the files over a folder of this template: `${instance_static}/frontends/${name}/${ref}`. + 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 0000000..a1ff1da --- /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 0000000..88509cf --- /dev/null +++ b/docs/administration/CLI_tasks/instance.md @@ -0,0 +1,45 @@ +# Managing instance configuration + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Generate a new configuration file +=== "OTP" + + ```sh + ./bin/pleroma_ctl instance gen [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.instance gen [option ...] + ``` + + +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 +- `--strip-uploads-location <Y|N>` - use ExifTool to strip uploads of sensitive location data +- `--read-uploads-description <Y|N>` - use ExifTool to read image descriptions from uploads +- `--anonymize-uploads <Y|N>` - randomize uploaded filenames +- `--dedupe-uploads <Y|N>` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames +- `--skip-release-env` - skip generation the release environment file +- `--release-env-file` - release environment file path diff --git a/docs/administration/CLI_tasks/oauth_app.md b/docs/administration/CLI_tasks/oauth_app.md new file mode 100644 index 0000000..f056849 --- /dev/null +++ b/docs/administration/CLI_tasks/oauth_app.md @@ -0,0 +1,20 @@ +# Creating trusted OAuth App + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Create trusted OAuth App. + +Optional params: + * `-s SCOPES` - scopes for app, e.g. `read,write,follow,push`. + +=== "OTP" + + ```sh + ./bin/pleroma_ctl app create -n APP_NAME -r REDIRECT_URI + ``` + +=== "From Source" + + ```sh + mix pleroma.app create -n APP_NAME -r REDIRECT_URI + ```
\ No newline at end of file diff --git a/docs/administration/CLI_tasks/relay.md b/docs/administration/CLI_tasks/relay.md new file mode 100644 index 0000000..bdd7e8b --- /dev/null +++ b/docs/administration/CLI_tasks/relay.md @@ -0,0 +1,45 @@ +# Managing relays + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Follow a relay + +=== "OTP" + + ```sh + ./bin/pleroma_ctl relay follow <relay_url> + ``` + +=== "From Source" + + ```sh + mix pleroma.relay follow <relay_url> + ``` + +## Unfollow a remote relay + +=== "OTP" + + ```sh + ./bin/pleroma_ctl relay unfollow <relay_url> + ``` + +=== "From Source" + + ```sh + mix pleroma.relay unfollow <relay_url> + ``` + +## List relay subscriptions + +=== "OTP" + + ```sh + ./bin/pleroma_ctl relay list + ``` + +=== "From Source" + + ```sh + mix pleroma.relay list + ``` diff --git a/docs/administration/CLI_tasks/robots_txt.md b/docs/administration/CLI_tasks/robots_txt.md new file mode 100644 index 0000000..7eeedf5 --- /dev/null +++ b/docs/administration/CLI_tasks/robots_txt.md @@ -0,0 +1,21 @@ +# Managing robots.txt + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Generate a new robots.txt file and add it to the static directory + +The `robots.txt` that ships by default is permissive. It allows well-behaved search engines to index all of your instance's URIs. + +If you want to generate a restrictive `robots.txt`, you can run the following mix task. The generated `robots.txt` will be written in your instance [static directory](../../../configuration/static_dir/). + +=== "OTP" + + ```sh + ./bin/pleroma_ctl robots_txt disallow_all + ``` + +=== "From Source" + + ```sh + mix pleroma.robots_txt disallow_all + ``` diff --git a/docs/administration/CLI_tasks/uploads.md b/docs/administration/CLI_tasks/uploads.md new file mode 100644 index 0000000..8585ec7 --- /dev/null +++ b/docs/administration/CLI_tasks/uploads.md @@ -0,0 +1,21 @@ +# Managing uploads + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Migrate uploads from local to remote storage +=== "OTP" + + ```sh + ./bin/pleroma_ctl uploads migrate_local <target_uploader> [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.uploads migrate_local <target_uploader> [option ...] + ``` + +### 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 0000000..24fdaea --- /dev/null +++ b/docs/administration/CLI_tasks/user.md @@ -0,0 +1,302 @@ +# Managing users + +{! backend/administration/CLI_tasks/general_cli_task_info.include !} + +## Create a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user new <nickname> <email> [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.user new <nickname> <email> [option ...] + ``` + + +### 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 + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user list + ``` + +=== "From Source" + + ```sh + mix pleroma.user list + ``` + + +## Generate an invite link + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user invite [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.user invite [option ...] + ``` + + +### 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 + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user invites + ``` + +=== "From Source" + + ```sh + mix pleroma.user invites + ``` + + +## Revoke invite + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user revoke_invite <token> + ``` + +=== "From Source" + + ```sh + mix pleroma.user revoke_invite <token> + ``` + + +## Delete a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user rm <nickname> + ``` + +=== "From Source" + + ```sh + mix pleroma.user rm <nickname> + ``` + + +## Delete user's posts and interactions + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user delete_activities <nickname> + ``` + +=== "From Source" + + ```sh + mix pleroma.user delete_activities <nickname> + ``` + + +## Sign user out from all applications (delete user's OAuth tokens and authorizations) + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user sign_out <nickname> + ``` + +=== "From Source" + + ```sh + mix pleroma.user sign_out <nickname> + ``` + +## Activate a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user activate NICKNAME + ``` + +=== "From Source" + + ```sh + mix pleroma.user activate NICKNAME + ``` + +## Deactivate a user and unsubscribes local users from the user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user deactivate NICKNAME + ``` + +=== "From Source" + + ```sh + mix pleroma.user deactivate NICKNAME + ``` + + +## Deactivate all accounts from an instance and unsubscribe local users on it + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user deactivate_all_from_instance <instance> + ``` + +=== "From Source" + + ```sh + mix pleroma.user deactivate_all_from_instance <instance> + ``` + + +## Create a password reset link for user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user reset_password <nickname> + ``` + +=== "From Source" + + ```sh + mix pleroma.user reset_password <nickname> + ``` + + +## Disable Multi Factor Authentication (MFA/2FA) for a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user reset_mfa <nickname> + ``` + +=== "From Source" + + ```sh + mix pleroma.user reset_mfa <nickname> + ``` + + +## Set the value of the given user's settings + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user set <nickname> [option ...] + ``` + +=== "From Source" + + ```sh + mix pleroma.user set <nickname> [option ...] + ``` + +### Options +- `--admin`/`--no-admin` - whether the user should be an admin +- `--confirmed`/`--no-confirmed` - whether the user account is confirmed +- `--locked`/`--no-locked` - whether the user should be locked +- `--moderator`/`--no-moderator` - whether the user should be a moderator + +## Add tags to a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user tag <nickname> <tags> + ``` + +=== "From Source" + + ```sh + mix pleroma.user tag <nickname> <tags> + ``` + + +## Delete tags from a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user untag <nickname> <tags> + ``` + +=== "From Source" + + ```sh + mix pleroma.user untag <nickname> <tags> + ``` + + +## Toggle confirmation status of the user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user confirm <nickname> + ``` + +=== "From Source" + + ```sh + mix pleroma.user confirm <nickname> + ``` + +## Set confirmation status for all regular active users +*Admins and moderators are excluded* + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user confirm_all + ``` + +=== "From Source" + + ```sh + mix pleroma.user confirm_all + ``` + +## Revoke confirmation status for all regular active users +*Admins and moderators are excluded* + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user unconfirm_all + ``` + +=== "From Source" + + ```sh + mix pleroma.user unconfirm_all + ``` diff --git a/docs/administration/backup.md b/docs/administration/backup.md new file mode 100644 index 0000000..5f279ab --- /dev/null +++ b/docs/administration/backup.md @@ -0,0 +1,41 @@ +# Backup/Restore/Move/Remove 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>` (make sure the postgres user has write access to the destination file) +4. Copy `pleroma.pgdump`, `config/prod.secret.exs`, `config/setup_db.psql` (if still available) and the `uploads` folder to your backup destination. If you have other modifications, copy those changes too. +5. Restart the Pleroma service. + +## Restore/Move + +1. Optionally reinstall Pleroma (either on the same server or on another server if you want to move servers). +2. Stop the Pleroma service. +3. Go to the working directory of Pleroma (default is `/opt/pleroma`) +4. Copy the above mentioned files back to their original position. +5. Drop the existing database and user if restoring in-place. `sudo -Hu postgres psql -c 'DROP DATABASE <pleroma_db>;';` `sudo -Hu postgres psql -c 'DROP USER <pleroma_db>;'` +6. Restore the database schema and pleroma postgres role the with the original `setup_db.psql` if you have it: `sudo -Hu postgres psql -f config/setup_db.psql`. + + Alternatively, run the `mix pleroma.instance gen` task again. You can ignore most of the questions, but make the database user, name, and password the same as found in your backup of `config/prod.secret.exs`. Then run the restoration of the pleroma role and schema with of the generated `config/setup_db.psql` as instructed above. You may delete the `config/generated_config.exs` file as it is not needed. + +7. Now restore the Pleroma instance's data into the empty database schema: `sudo -Hu postgres pg_restore -d <pleroma_db> -v -1 </path/to/backup_location/pleroma.pgdump>` +8. If you installed a newer Pleroma version, you should run `mix ecto.migrate`[^1]. This task performs database migrations, if there were any. +9. Restart the Pleroma service. +10. Run `sudo -Hu postgres vacuumdb --all --analyze-in-stages`. This will quickly generate the statistics so that postgres can properly plan queries. +11. If setting up on a new server configure Nginx by using the `installation/pleroma.nginx` config sample or reference the Pleroma installation guide for your OS which contains the Nginx configuration instructions. + +[^1]: Prefix with `MIX_ENV=prod` to run it using the production config file. + +## Remove + +1. Optionally you can remove the users of your instance. This will trigger delete requests for their accounts and posts. Note that this is 'best effort' and doesn't mean that all traces of your instance will be gone from the fediverse. + * You can do this from the admin-FE where you can select all local users and delete the accounts using the *Moderate multiple users* dropdown. + * You can also list local users and delete them individualy using the CLI tasks for [Managing users](./CLI_tasks/user.md). +2. Stop the Pleroma service `systemctl stop pleroma` +3. Disable pleroma from systemd `systemctl disable pleroma` +4. Remove the files and folders you created during installation (see installation guide). This includes the pleroma, nginx and systemd files and folders. +5. Reload nginx now that the configuration is removed `systemctl reload nginx` +6. Remove the database and database user `sudo -Hu postgres psql -c 'DROP DATABASE <pleroma_db>;';` `sudo -Hu postgres psql -c 'DROP USER <pleroma_db>;'` +7. Remove the system user `userdel pleroma` +8. Remove the dependencies that you don't need anymore (see installation guide). Make sure you don't remove packages that are still needed for other software that you have running! diff --git a/docs/administration/updating.md b/docs/administration/updating.md new file mode 100644 index 0000000..00eca36 --- /dev/null +++ b/docs/administration/updating.md @@ -0,0 +1,27 @@ +# Updating your instance + +You should **always check the [release notes/changelog](https://git.pleroma.social/pleroma/pleroma/-/releases)** in case there are config deprecations, special update steps, etc. + +Besides that, doing the following is generally enough: + +## For OTP installations + +```sh +# Download the new release +su pleroma -s $SHELL -lc "./bin/pleroma_ctl update" + +# Migrate the database, you are advised to stop the instance before doing that +su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate" +``` + +## For from source installations (using git) + +1. Go to the working directory of Pleroma (default is `/opt/pleroma`) +2. Run `git checkout <tagged release>` [^1]. e.g. `git checkout v2.4.5` This pulls the [tagged release](https://git.pleroma.social/pleroma/pleroma/-/releases) from upstream. +3. Run `mix deps.get` [^1]. This pulls in any new dependencies. +4. Stop the Pleroma service. +5. Run `mix ecto.migrate` [^1] [^2]. This task performs database migrations, if there were any. +6. Start the Pleroma service. + +[^1]: Depending on which install guide you followed (for example on Debian/Ubuntu), you want to run `git` and `mix` tasks as `pleroma` user by adding `sudo -Hu pleroma` before the command. +[^2]: Prefix with `MIX_ENV=prod` to run it using the production config file. |
