Merge branch 'develop' into 'fix/extended-nickname-format-default-config'
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
31e57cd1b3
56 changed files with 631 additions and 404 deletions
|
@ -28,23 +28,6 @@ build:
|
||||||
- mix deps.get
|
- mix deps.get
|
||||||
- mix compile --force
|
- mix compile --force
|
||||||
|
|
||||||
docs-build:
|
|
||||||
stage: build
|
|
||||||
only:
|
|
||||||
- master@pleroma/pleroma
|
|
||||||
- develop@pleroma/pleroma
|
|
||||||
variables:
|
|
||||||
MIX_ENV: dev
|
|
||||||
PLEROMA_BUILD_ENV: prod
|
|
||||||
script:
|
|
||||||
- mix deps.get
|
|
||||||
- mix compile
|
|
||||||
- mix docs
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- priv/static/doc
|
|
||||||
|
|
||||||
|
|
||||||
unit-testing:
|
unit-testing:
|
||||||
stage: test
|
stage: test
|
||||||
services:
|
services:
|
||||||
|
@ -85,19 +68,14 @@ analysis:
|
||||||
|
|
||||||
docs-deploy:
|
docs-deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: alpine:3.9
|
image: alpine:latest
|
||||||
only:
|
only:
|
||||||
- master@pleroma/pleroma
|
- master@pleroma/pleroma
|
||||||
- develop@pleroma/pleroma
|
- develop@pleroma/pleroma
|
||||||
before_script:
|
before_script:
|
||||||
- apk update && apk add openssh-client rsync
|
- apk add curl
|
||||||
script:
|
script:
|
||||||
- mkdir -p ~/.ssh
|
- curl -X POST -F"token=$DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/673/trigger/pipeline
|
||||||
- echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
|
|
||||||
- eval $(ssh-agent -s)
|
|
||||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
|
||||||
- rsync -hrvz --delete -e "ssh -p ${SSH_PORT}" priv/static/doc/ "${SSH_USER_HOST_LOCATION}/${CI_COMMIT_REF_NAME}"
|
|
||||||
|
|
||||||
review_app:
|
review_app:
|
||||||
image: alpine:3.9
|
image: alpine:3.9
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|
|
@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- Refreshing poll results for remote polls
|
- Refreshing poll results for remote polls
|
||||||
|
- Job queue stats to the healthcheck page
|
||||||
- Admin API: Add ability to require password reset
|
- Admin API: Add ability to require password reset
|
||||||
- Mastodon API: Account entities now include `follow_requests_count` (planned Mastodon 3.x addition)
|
- Mastodon API: Account entities now include `follow_requests_count` (planned Mastodon 3.x addition)
|
||||||
- Pleroma API: `GET /api/v1/pleroma/accounts/:id/scrobbles` to get a list of recently scrobbled items
|
- Pleroma API: `GET /api/v1/pleroma/accounts/:id/scrobbles` to get a list of recently scrobbled items
|
||||||
|
@ -23,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Mastodon API: Fix private and direct statuses not being filtered out from the public timeline for an authenticated user (`GET /api/v1/timelines/public`)
|
- Mastodon API: Fix private and direct statuses not being filtered out from the public timeline for an authenticated user (`GET /api/v1/timelines/public`)
|
||||||
|
- Mastodon API: Inability to get some local users by nickname in `/api/v1/accounts/:id_or_nickname`
|
||||||
- Added `:instance, extended_nickname_format` setting to the default config
|
- Added `:instance, extended_nickname_format` setting to the default config
|
||||||
|
|
||||||
## [1.1.0] - 2019-??-??
|
## [1.1.0] - 2019-??-??
|
||||||
|
|
|
@ -124,7 +124,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
```
|
```
|
||||||
|
|
||||||
## `/api/pleroma/admin/`…
|
## `/api/pleroma/admin/`…
|
||||||
See [Admin-API](Admin-API.md)
|
See [Admin-API](admin_api.md)
|
||||||
|
|
||||||
## `/api/v1/pleroma/notifications/read`
|
## `/api/v1/pleroma/notifications/read`
|
||||||
### Mark notifications as read
|
### Mark notifications as read
|
||||||
|
@ -317,7 +317,8 @@ See [Admin-API](Admin-API.md)
|
||||||
"active": 0, # active processes
|
"active": 0, # active processes
|
||||||
"idle": 0, # idle processes
|
"idle": 0, # idle processes
|
||||||
"memory_used": 0.00, # Memory used
|
"memory_used": 0.00, # Memory used
|
||||||
"healthy": true # Instance state
|
"healthy": true, # Instance state
|
||||||
|
"job_queue_stats": {} # Job queue stats
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
19
docs/administration/CLI_tasks/config.md
Normal file
19
docs/administration/CLI_tasks/config.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Transfering the config to/from the database
|
||||||
|
|
||||||
|
!!! danger
|
||||||
|
This is a Work In Progress, not usable just yet.
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl config` and in case of source installs it's
|
||||||
|
`mix pleroma.config`.
|
||||||
|
|
||||||
|
## Transfer config from file to DB.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX migrate_to_db
|
||||||
|
```
|
||||||
|
|
||||||
|
## Transfer config from DB to `config/env.exported_from_db.secret.exs`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX migrate_from_db <env>
|
||||||
|
```
|
48
docs/administration/CLI_tasks/database.md
Normal file
48
docs/administration/CLI_tasks/database.md
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Database maintenance tasks
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl database` and in case of source installs it's `mix pleroma.database`.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
$PREFIX 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.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
The disk space will only be reclaimed after `VACUUM FULL`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX 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
|
||||||
|
$PREFIX bump_all_conversations
|
||||||
|
```
|
||||||
|
|
||||||
|
## Remove duplicated items from following and update followers count for all users
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX update_users_following_followers_counts
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fix the pre-existing "likes" collections for all objects
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX fix_likes_collections
|
||||||
|
```
|
13
docs/administration/CLI_tasks/digest.md
Normal file
13
docs/administration/CLI_tasks/digest.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Managing digest emails
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl digest` and in case of source installs it's `mix pleroma.digest`.
|
||||||
|
|
||||||
|
## Send digest email since given date (user registration date by default) ignoring user activity status.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX test <nickname> [<since_date>]
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```sh
|
||||||
|
$PREFIX test donaldtheduck 2019-05-20
|
||||||
|
```
|
30
docs/administration/CLI_tasks/emoji.md
Normal file
30
docs/administration/CLI_tasks/emoji.md
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Managing emoji packs
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl emoji` and in case of source installs it's `mix pleroma.emoji`.
|
||||||
|
|
||||||
|
## Lists emoji packs and metadata specified in the manifest
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX 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
|
||||||
|
$PREFIX 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
|
||||||
|
$PREFIX 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).
|
30
docs/administration/CLI_tasks/instance.md
Normal file
30
docs/administration/CLI_tasks/instance.md
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Managing instance configuration
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl instance` and in case of source installs it's `mix pleroma.instance`.
|
||||||
|
|
||||||
|
## Generate a new configuration file
|
||||||
|
```sh
|
||||||
|
$PREFIX 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
|
30
docs/administration/CLI_tasks/relay.md
Normal file
30
docs/administration/CLI_tasks/relay.md
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Managing relays
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl relay` and in case of source installs it's `mix pleroma.relay`.
|
||||||
|
|
||||||
|
## Follow a relay
|
||||||
|
```sh
|
||||||
|
$PREFIX follow <relay_url>
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```sh
|
||||||
|
$PREFIX follow https://example.org/relay
|
||||||
|
```
|
||||||
|
|
||||||
|
## Unfollow a remote relay
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX unfollow <relay_url>
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```sh
|
||||||
|
$PREFIX unfollow https://example.org/relay
|
||||||
|
```
|
||||||
|
|
||||||
|
## List relay subscriptions
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$PREFIX list
|
||||||
|
```
|
12
docs/administration/CLI_tasks/uploads.md
Normal file
12
docs/administration/CLI_tasks/uploads.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Managing uploads
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl uploads` and in case of source installs it's `mix pleroma.uploads`.
|
||||||
|
|
||||||
|
## Migrate uploads from local to remote storage
|
||||||
|
```sh
|
||||||
|
$PREFIX 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)
|
94
docs/administration/CLI_tasks/user.md
Normal file
94
docs/administration/CLI_tasks/user.md
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
# Managing users
|
||||||
|
|
||||||
|
Every command should be ran with a prefix, in case of OTP releases it is `./bin/pleroma_ctl user` and in case of source installs it's `mix pleroma.user`.
|
||||||
|
|
||||||
|
## Create a user
|
||||||
|
```sh
|
||||||
|
$PREFIX new <nickname> <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
|
||||||
|
|
||||||
|
## Generate an invite link
|
||||||
|
```sh
|
||||||
|
$PREFIX 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
|
||||||
|
$PREFIX invites
|
||||||
|
```
|
||||||
|
|
||||||
|
## Revoke invite
|
||||||
|
```sh
|
||||||
|
$PREFIX revoke_invite <token_or_id>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Delete a user
|
||||||
|
```sh
|
||||||
|
$PREFIX rm <nickname>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Delete user's posts and interactions
|
||||||
|
```sh
|
||||||
|
$PREFIX delete_activities <nickname>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sign user out from all applications (delete user's OAuth tokens and authorizations)
|
||||||
|
```sh
|
||||||
|
$PREFIX sign_out <nickname>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deactivate or activate a user
|
||||||
|
```sh
|
||||||
|
$PREFIX toggle_activated <nickname>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Unsubscribe local users from a user and deactivate the user
|
||||||
|
```sh
|
||||||
|
$PREFIX unsubscribe NICKNAME
|
||||||
|
```
|
||||||
|
|
||||||
|
## Unsubscribe local users from an instance and deactivate all accounts on it
|
||||||
|
```sh
|
||||||
|
$PREFIX unsubscribe_all_from_instance <instance>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Create a password reset link for user
|
||||||
|
```sh
|
||||||
|
$PREFIX reset_password <nickname>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Set the value of the given user's settings
|
||||||
|
```sh
|
||||||
|
$PREFIX 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
|
||||||
|
$PREFIX tag <nickname> <tags>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Delete tags from a user
|
||||||
|
```sh
|
||||||
|
$PREFIX untag <nickname> <tags>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Toggle confirmation status of the user
|
||||||
|
```sh
|
||||||
|
$PREFIX toggle_confirmed <nickname>
|
||||||
|
```
|
|
@ -1,17 +0,0 @@
|
||||||
# General tips for customizing Pleroma FE
|
|
||||||
There are some configuration scripts for Pleroma BE and FE:
|
|
||||||
|
|
||||||
1. `config/prod.secret.exs`
|
|
||||||
1. `config/config.exs`
|
|
||||||
1. `priv/static/static/config.json`
|
|
||||||
|
|
||||||
The `prod.secret.exs` affects first. `config.exs` is for fallback or default. `config.json` is for GNU-social-BE-Pleroma-FE instances.
|
|
||||||
|
|
||||||
Usually all you have to do is:
|
|
||||||
|
|
||||||
1. Copy the section in the `config/config.exs` which you want to activate.
|
|
||||||
1. Paste into `config/prod.secret.exs`.
|
|
||||||
1. Edit `config/prod.secret.exs`.
|
|
||||||
1. Restart the Pleroma daemon.
|
|
||||||
|
|
||||||
`prod.secret.exs` is for the `MIX_ENV=prod` environment. `dev.secret.exs` is for the `MIX_ENV=dev` environment respectively.
|
|
|
@ -1,12 +0,0 @@
|
||||||
# Small customizations
|
|
||||||
|
|
||||||
See also static_dir.md for visual settings.
|
|
||||||
|
|
||||||
## Theme
|
|
||||||
|
|
||||||
All users of your instance will be able to change the theme they use by going to the settings (the cog in the top-right hand corner). However, if you wish to change the default theme, you can do so by editing `theme` in `config/dev.secret.exs` accordingly.
|
|
||||||
|
|
||||||
## Message Visibility
|
|
||||||
|
|
||||||
To enable message visibility options when posting like in the Mastodon frontend, set
|
|
||||||
`scope_options_enabled` to `true` in `config/dev.secret.exs`.
|
|
|
@ -1,7 +1,11 @@
|
||||||
# Configuration
|
# Configuration Cheat Sheet
|
||||||
|
|
||||||
|
This is a cheat sheet for Pleroma configuration file, any setting possible to configure should be listed here.
|
||||||
|
|
||||||
|
Pleroma configuration works by first importing the base config (`config/config.exs` on source installs, compiled-in on OTP releases), then overriding it by the environment config (`config/$MIX_ENV.exs` on source installs, N/A to OTP releases) and then overriding it by user config (`config/$MIX_ENV.secret.exs` on source installs, typically `/etc/pleroma/config.exs` on OTP releases).
|
||||||
|
|
||||||
|
You shouldn't edit the base config directly to avoid breakages and merge conflicts, but it can be used as a reference if you don't understand how an option is supposed to be formatted, the latest version of it can be viewed [here](https://git.pleroma.social/pleroma/pleroma/blob/develop/config/config.exs).
|
||||||
|
|
||||||
This file describe the configuration, it is recommended to edit the relevant *.secret.exs file instead of the others founds in the ``config`` directory.
|
|
||||||
If you run Pleroma with ``MIX_ENV=prod`` the file is ``prod.secret.exs``, otherwise it is ``dev.secret.exs``.
|
|
||||||
|
|
||||||
## Pleroma.Upload
|
## Pleroma.Upload
|
||||||
* `uploader`: Select which `Pleroma.Uploaders` to use
|
* `uploader`: Select which `Pleroma.Uploaders` to use
|
||||||
|
@ -11,7 +15,8 @@ If you run Pleroma with ``MIX_ENV=prod`` the file is ``prod.secret.exs``, otherw
|
||||||
* `proxy_remote`: If you're using a remote uploader, Pleroma will proxy media requests instead of redirecting to it.
|
* `proxy_remote`: If you're using a remote uploader, Pleroma will proxy media requests instead of redirecting to it.
|
||||||
* `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation.
|
* `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation.
|
||||||
|
|
||||||
Note: `strip_exif` has been replaced by `Pleroma.Upload.Filter.Mogrify`.
|
!!! warning
|
||||||
|
`strip_exif` has been replaced by `Pleroma.Upload.Filter.Mogrify`.
|
||||||
|
|
||||||
## Pleroma.Uploaders.Local
|
## Pleroma.Uploaders.Local
|
||||||
* `uploads`: Which directory to store the user-uploads in, relative to pleroma’s working directory
|
* `uploads`: Which directory to store the user-uploads in, relative to pleroma’s working directory
|
||||||
|
@ -111,12 +116,6 @@ config :pleroma, Pleroma.Emails.Mailer,
|
||||||
* `allowed_post_formats`: MIME-type list of formats allowed to be posted (transformed into HTML)
|
* `allowed_post_formats`: MIME-type list of formats allowed to be posted (transformed into HTML)
|
||||||
* `mrf_transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo).
|
* `mrf_transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo).
|
||||||
* `mrf_transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value.
|
* `mrf_transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value.
|
||||||
* `scope_copy`: Copy the scope (private/unlisted/public) in replies to posts by default.
|
|
||||||
* `subject_line_behavior`: Allows changing the default behaviour of subject lines in replies. Valid values:
|
|
||||||
* "email": Copy and preprend re:, as in email.
|
|
||||||
* "masto": Copy verbatim, as in Mastodon.
|
|
||||||
* "noop": Don't copy the subject.
|
|
||||||
* `always_show_subject_input`: When set to false, auto-hide the subject field when it's empty.
|
|
||||||
* `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes). This will break federation with
|
* `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes). This will break federation with
|
||||||
older software for theses nicknames.
|
older software for theses nicknames.
|
||||||
* `max_pinned_statuses`: The maximum number of pinned statuses. `0` will disable the feature.
|
* `max_pinned_statuses`: The maximum number of pinned statuses. `0` will disable the feature.
|
||||||
|
@ -132,13 +131,17 @@ config :pleroma, Pleroma.Emails.Mailer,
|
||||||
* `user_name_length`: A user name maximum length (default: `100`)
|
* `user_name_length`: A user name maximum length (default: `100`)
|
||||||
* `skip_thread_containment`: Skip filter out broken threads. The default is `false`.
|
* `skip_thread_containment`: Skip filter out broken threads. The default is `false`.
|
||||||
* `limit_to_local_content`: Limit unauthenticated users to search for local statutes and users only. Possible values: `:unauthenticated`, `:all` and `false`. The default is `:unauthenticated`.
|
* `limit_to_local_content`: Limit unauthenticated users to search for local statutes and users only. Possible values: `:unauthenticated`, `:all` and `false`. The default is `:unauthenticated`.
|
||||||
* `dynamic_configuration`: Allow transferring configuration to DB with the subsequent customization from Admin api.
|
|
||||||
* `max_account_fields`: The maximum number of custom fields in the user profile (default: `10`)
|
* `max_account_fields`: The maximum number of custom fields in the user profile (default: `10`)
|
||||||
* `max_remote_account_fields`: The maximum number of custom fields in the remote user profile (default: `20`)
|
* `max_remote_account_fields`: The maximum number of custom fields in the remote user profile (default: `20`)
|
||||||
* `account_field_name_length`: An account field name maximum length (default: `512`)
|
* `account_field_name_length`: An account field name maximum length (default: `512`)
|
||||||
* `account_field_value_length`: An account field value maximum length (default: `2048`)
|
* `account_field_value_length`: An account field value maximum length (default: `2048`)
|
||||||
* `external_user_synchronization`: Enabling following/followers counters synchronization for external users.
|
* `external_user_synchronization`: Enabling following/followers counters synchronization for external users.
|
||||||
|
|
||||||
|
!!! danger
|
||||||
|
This is a Work In Progress, not usable just yet
|
||||||
|
|
||||||
|
* `dynamic_configuration`: Allow transferring configuration to DB with the subsequent customization from Admin api.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## :logger
|
## :logger
|
||||||
|
@ -186,7 +189,7 @@ See the [Quack Github](https://github.com/azohra/quack) for more details
|
||||||
|
|
||||||
## :frontend_configurations
|
## :frontend_configurations
|
||||||
|
|
||||||
This can be used to configure a keyword list that keeps the configuration data for any kind of frontend. By default, settings for `pleroma_fe` and `masto_fe` are configured.
|
This can be used to configure a keyword list that keeps the configuration data for any kind of frontend. By default, settings for `pleroma_fe` and `masto_fe` are configured. You can find the documentation for `pleroma_fe` configuration into [Pleroma-FE configuration and customization for instance administrators](/frontend/CONFIGURATION/#options).
|
||||||
|
|
||||||
Frontends can access these settings at `/api/pleroma/frontend_configurations`
|
Frontends can access these settings at `/api/pleroma/frontend_configurations`
|
||||||
|
|
||||||
|
@ -208,14 +211,15 @@ These settings **need to be complete**, they will override the defaults.
|
||||||
NOTE: for versions < 1.0, you need to set [`:fe`](#fe) to false, as shown a few lines below.
|
NOTE: for versions < 1.0, you need to set [`:fe`](#fe) to false, as shown a few lines below.
|
||||||
|
|
||||||
## :fe
|
## :fe
|
||||||
__THIS IS DEPRECATED__
|
!!! warning
|
||||||
|
__THIS IS DEPRECATED__
|
||||||
|
|
||||||
If you are using this method, please change it to the [`frontend_configurations`](#frontend_configurations) method.
|
If you are using this method, please change it to the [`frontend_configurations`](#frontend_configurations) method.
|
||||||
Please **set this option to false** in your config like this:
|
Please **set this option to false** in your config like this:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
config :pleroma, :fe, false
|
config :pleroma, :fe, false
|
||||||
```
|
```
|
||||||
|
|
||||||
This section is used to configure Pleroma-FE, unless ``:managed_config`` in ``:instance`` is set to false.
|
This section is used to configure Pleroma-FE, unless ``:managed_config`` in ``:instance`` is set to false.
|
||||||
|
|
||||||
|
@ -261,7 +265,7 @@ All criteria are configured as a map of regular expressions to lists of policy m
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```elixir
|
||||||
config :pleroma, :mrf_subchain,
|
config :pleroma, :mrf_subchain,
|
||||||
match_actor: %{
|
match_actor: %{
|
||||||
~r/https:\/\/example.com/s => [Pleroma.Web.ActivityPub.MRF.DropPolicy]
|
~r/https:\/\/example.com/s => [Pleroma.Web.ActivityPub.MRF.DropPolicy]
|
||||||
|
@ -301,7 +305,10 @@ config :pleroma, :mrf_subchain,
|
||||||
* `dstport`: Port advertised in urls (optional, defaults to `port`)
|
* `dstport`: Port advertised in urls (optional, defaults to `port`)
|
||||||
|
|
||||||
## Pleroma.Web.Endpoint
|
## Pleroma.Web.Endpoint
|
||||||
`Phoenix` endpoint configuration, all configuration options can be viewed [here](https://hexdocs.pm/phoenix/Phoenix.Endpoint.html#module-dynamic-configuration), only common options are listed here
|
|
||||||
|
!!! note
|
||||||
|
`Phoenix` endpoint configuration, all configuration options can be viewed [here](https://hexdocs.pm/phoenix/Phoenix.Endpoint.html#module-dynamic-configuration), only common options are listed here.
|
||||||
|
|
||||||
* `http` - a list containing http protocol configuration, all configuration options can be viewed [here](https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html#module-options), only common options are listed here. For deployment using docker, you need to set this to `[ip: {0,0,0,0}, port: 4000]` to make pleroma accessible from other containers (such as your nginx server).
|
* `http` - a list containing http protocol configuration, all configuration options can be viewed [here](https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html#module-options), only common options are listed here. For deployment using docker, you need to set this to `[ip: {0,0,0,0}, port: 4000]` to make pleroma accessible from other containers (such as your nginx server).
|
||||||
- `ip` - a tuple consisting of 4 integers
|
- `ip` - a tuple consisting of 4 integers
|
||||||
- `port`
|
- `port`
|
||||||
|
@ -314,7 +321,8 @@ config :pleroma, :mrf_subchain,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Important note**: if you modify anything inside these lists, default `config.exs` values will be overwritten, which may result in breakage, to make sure this does not happen please copy the default value for the list from `config.exs` and modify/add only what you need
|
!!! warning
|
||||||
|
If you modify anything inside these lists, default `config.exs` values will be overwritten, which may result in breakage, to make sure this does not happen please copy the default value for the list from `config.exs` and modify/add only what you need
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```elixir
|
```elixir
|
||||||
|
@ -440,11 +448,6 @@ This config contains two queues: `federator_incoming` and `federator_outgoing`.
|
||||||
|
|
||||||
`config :pleroma_job_queue, :queues` is replaced by `config :pleroma, Oban, :queues` and uses the same format (keys are queues' names, values are max concurrent jobs numbers).
|
`config :pleroma_job_queue, :queues` is replaced by `config :pleroma, Oban, :queues` and uses the same format (keys are queues' names, values are max concurrent jobs numbers).
|
||||||
|
|
||||||
### Note on running with PostgreSQL in silent mode
|
|
||||||
|
|
||||||
If you are running PostgreSQL in [`silent_mode`](https://postgresqlco.nf/en/doc/param/silent_mode?version=9.1), it's advised to set [`log_destination`](https://postgresqlco.nf/en/doc/param/log_destination?version=9.1) to `syslog`,
|
|
||||||
otherwise `postmaster.log` file may grow because of "you don't own a lock of type ShareLock" warnings (see https://github.com/sorentwo/oban/issues/52).
|
|
||||||
|
|
||||||
## :workers
|
## :workers
|
||||||
|
|
||||||
Includes custom worker options not interpretable directly by `Oban`.
|
Includes custom worker options not interpretable directly by `Oban`.
|
||||||
|
@ -552,7 +555,7 @@ The above example defines a single job which invokes `Pleroma.Web.Websub.refresh
|
||||||
|
|
||||||
## Pleroma.ActivityExpiration
|
## Pleroma.ActivityExpiration
|
||||||
|
|
||||||
# `enabled`: whether expired activities will be sent to the job queue to be deleted
|
* `enabled`: whether expired activities will be sent to the job queue to be deleted
|
||||||
|
|
||||||
## Pleroma.Web.Auth.Authenticator
|
## Pleroma.Web.Auth.Authenticator
|
||||||
|
|
||||||
|
@ -628,13 +631,14 @@ Email notifications settings.
|
||||||
OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.).
|
OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.).
|
||||||
Implementation is based on Ueberauth; see the list of [available strategies](https://github.com/ueberauth/ueberauth/wiki/List-of-Strategies).
|
Implementation is based on Ueberauth; see the list of [available strategies](https://github.com/ueberauth/ueberauth/wiki/List-of-Strategies).
|
||||||
|
|
||||||
Note: each strategy is shipped as a separate dependency; in order to get the strategies, run `OAUTH_CONSUMER_STRATEGIES="..." mix deps.get`,
|
!!! note
|
||||||
e.g. `OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft" mix deps.get`.
|
Each strategy is shipped as a separate dependency; in order to get the strategies, run `OAUTH_CONSUMER_STRATEGIES="..." mix deps.get`, e.g. `OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft" mix deps.get`. The server should also be started with `OAUTH_CONSUMER_STRATEGIES="..." mix phx.server` in case you enable any strategies.
|
||||||
The server should also be started with `OAUTH_CONSUMER_STRATEGIES="..." mix phx.server` in case you enable any strategies.
|
|
||||||
|
|
||||||
Note: each strategy requires separate setup (on external provider side and Pleroma side). Below are the guidelines on setting up most popular strategies.
|
!!! note
|
||||||
|
Each strategy requires separate setup (on external provider side and Pleroma side). Below are the guidelines on setting up most popular strategies.
|
||||||
|
|
||||||
Note: make sure that `"SameSite=Lax"` is set in `extra_cookie_attrs` when you have this feature enabled. OAuth consumer mode will not work with `"SameSite=Strict"`
|
!!! note
|
||||||
|
Make sure that `"SameSite=Lax"` is set in `extra_cookie_attrs` when you have this feature enabled. OAuth consumer mode will not work with `"SameSite=Strict"`
|
||||||
|
|
||||||
* For Twitter, [register an app](https://developer.twitter.com/en/apps), configure callback URL to https://<your_host>/oauth/twitter/callback
|
* For Twitter, [register an app](https://developer.twitter.com/en/apps), configure callback URL to https://<your_host>/oauth/twitter/callback
|
||||||
|
|
||||||
|
@ -739,8 +743,6 @@ A keyword list of rate limiters where a key is a limiter name and value is the l
|
||||||
|
|
||||||
It is also possible to have different limits for unauthenticated and authenticated users: the keyword value must be a list of two tuples where the first one is a config for unauthenticated users and the second one is for authenticated.
|
It is also possible to have different limits for unauthenticated and authenticated users: the keyword value must be a list of two tuples where the first one is a config for unauthenticated users and the second one is for authenticated.
|
||||||
|
|
||||||
See [`Pleroma.Plugs.RateLimiter`](Pleroma.Plugs.RateLimiter.html) documentation for examples.
|
|
||||||
|
|
||||||
Supported rate limiters:
|
Supported rate limiters:
|
||||||
|
|
||||||
* `:search` for the search requests (account & status search etc.)
|
* `:search` for the search requests (account & status search etc.)
|
||||||
|
@ -761,7 +763,8 @@ Available caches:
|
||||||
|
|
||||||
## Pleroma.Plugs.RemoteIp
|
## Pleroma.Plugs.RemoteIp
|
||||||
|
|
||||||
**If your instance is not behind at least one reverse proxy, you should not enable this plug.**
|
!!! warning
|
||||||
|
If your instance is not behind at least one reverse proxy, you should not enable this plug.
|
||||||
|
|
||||||
`Pleroma.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration.
|
`Pleroma.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration.
|
||||||
|
|
|
@ -4,6 +4,7 @@ Before you add your own custom emoji, check if they are available in an existing
|
||||||
See `Mix.Tasks.Pleroma.Emoji` for information about emoji packs.
|
See `Mix.Tasks.Pleroma.Emoji` for information about emoji packs.
|
||||||
|
|
||||||
To add custom emoji:
|
To add custom emoji:
|
||||||
|
|
||||||
* Create the `STATIC-DIR/emoji/` directory if it doesn't exist
|
* Create the `STATIC-DIR/emoji/` directory if it doesn't exist
|
||||||
(`STATIC-DIR` is configurable, `instance/static/` by default)
|
(`STATIC-DIR` is configurable, `instance/static/` by default)
|
||||||
* Create a directory with whatever name you want (custom is a good name to show the purpose of it).
|
* Create a directory with whatever name you want (custom is a good name to show the purpose of it).
|
|
@ -225,12 +225,10 @@ sudo -Hu pleroma MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress
|
||||||
|
|
||||||
#### Further reading
|
#### Further reading
|
||||||
|
|
||||||
* [Backup your instance](backup.html)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Configuration tips](general-tips-for-customizing-pleroma-fe.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [How to activate mediaproxy](howto_mediaproxy.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
* [Small Pleroma-FE customizations](small_customizations.html)
|
|
||||||
* [Updating your instance](updating.html)
|
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
|
|
|
@ -200,12 +200,10 @@ sudo -Hu pleroma MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress
|
||||||
|
|
||||||
#### Further reading
|
#### Further reading
|
||||||
|
|
||||||
* [Backup your instance](backup.html)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Configuration tips](general-tips-for-customizing-pleroma-fe.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [How to activate mediaproxy](howto_mediaproxy.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
* [Small Pleroma-FE customizations](small_customizations.html)
|
|
||||||
* [Updating your instance](updating.html)
|
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
|
|
|
@ -264,12 +264,10 @@ sudo -Hu pleroma MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress
|
||||||
|
|
||||||
#### Further reading
|
#### Further reading
|
||||||
|
|
||||||
* [Backup your instance](backup.html)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Configuration tips](general-tips-for-customizing-pleroma-fe.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [How to activate mediaproxy](howto_mediaproxy.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
* [Small Pleroma-FE customizations](small_customizations.html)
|
|
||||||
* [Updating your instance](updating.html)
|
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
|
|
|
@ -190,12 +190,10 @@ sudo -Hu pleroma MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress
|
||||||
|
|
||||||
#### Further reading
|
#### Further reading
|
||||||
|
|
||||||
* [Backup your instance](backup.html)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Configuration tips](general-tips-for-customizing-pleroma-fe.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [How to activate mediaproxy](howto_mediaproxy.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
* [Small Pleroma-FE customizations](small_customizations.html)
|
|
||||||
* [Updating your instance](updating.html)
|
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
|
|
|
@ -179,12 +179,10 @@ sudo -Hu pleroma MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress
|
||||||
|
|
||||||
#### その他の設定とカスタマイズ
|
#### その他の設定とカスタマイズ
|
||||||
|
|
||||||
* [Backup your instance](backup.html)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Configuration tips](general-tips-for-customizing-pleroma-fe.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [How to activate mediaproxy](howto_mediaproxy.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
* [Small Pleroma-FE customizations](small_customizations.html)
|
|
||||||
* [Updating your instance](updating.html)
|
|
||||||
|
|
||||||
## 質問ある?
|
## 質問ある?
|
||||||
|
|
||||||
|
|
|
@ -283,12 +283,10 @@ If you opted to allow sudo for the `pleroma` user but would like to remove the a
|
||||||
|
|
||||||
#### Further reading
|
#### Further reading
|
||||||
|
|
||||||
* [Backup your instance](backup.html)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Configuration tips](general-tips-for-customizing-pleroma-fe.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [How to activate mediaproxy](howto_mediaproxy.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
* [Small Pleroma-FE customizations](small_customizations.html)
|
|
||||||
* [Updating your instance](updating.html)
|
|
||||||
|
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ Benefits of OTP releases over from-source installs include:
|
||||||
* **Faster and less bug-prone mix tasks.** On a from-source install one has to wait untill a new Pleroma node is started for each mix task and they execute outside of the instance context (for example if a user was deleted via a mix task, the instance will have no knowledge of that and continue to display status count and follows before the cache expires). Mix tasks in OTP releases are executed by calling into a running instance via RPC, which solves both of these problems.
|
* **Faster and less bug-prone mix tasks.** On a from-source install one has to wait untill a new Pleroma node is started for each mix task and they execute outside of the instance context (for example if a user was deleted via a mix task, the instance will have no knowledge of that and continue to display status count and follows before the cache expires). Mix tasks in OTP releases are executed by calling into a running instance via RPC, which solves both of these problems.
|
||||||
|
|
||||||
### Sounds great, how do I switch?
|
### Sounds great, how do I switch?
|
||||||
Currently we support Linux machines with GNU (e.g. Debian, Ubuntu) or musl (e.g. Alpine) libc and `x86_64`, `aarch64` or `armv7l` CPUs. If you are unsure, check the [Detecting flavour](otp_en.html#detecting-flavour) section in OTP install guide. If your platform is supported, proceed with the guide, if not check the [My platform is not supported](#my-platform-is-not-supported) section.
|
Currently we support Linux machines with GNU (e.g. Debian, Ubuntu) or musl (e.g. Alpine) libc and `x86_64`, `aarch64` or `armv7l` CPUs. If you are unsure, check the [Detecting flavour](otp_en.md#detecting-flavour) section in OTP install guide. If your platform is supported, proceed with the guide, if not check the [My platform is not supported](#my-platform-is-not-supported) section.
|
||||||
### I don't think it is worth the effort, can I stay on a from-source install?
|
### I don't think it is worth the effort, can I stay on a from-source install?
|
||||||
Yes, currently there are no plans to deprecate them.
|
Yes, currently there are no plans to deprecate them.
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ and then copy custom emojis to `/var/lib/pleroma/static/emoji/custom`.
|
||||||
|
|
||||||
This is needed because storing custom emojis in the root directory is deprecated, but if you just move them to `/var/lib/pleroma/static/emoji/custom` it will break emoji urls on old posts.
|
This is needed because storing custom emojis in the root directory is deprecated, but if you just move them to `/var/lib/pleroma/static/emoji/custom` it will break emoji urls on old posts.
|
||||||
|
|
||||||
Note that globs have been replaced with `pack_extensions`, so if your emojis are not in png/gif you should [modify the default value](config.html#emoji).
|
Note that globs have been replaced with `pack_extensions`, so if your emojis are not in png/gif you should [modify the default value](../configuration/cheatsheet.md#emoji).
|
||||||
|
|
||||||
### Moving the config
|
### Moving the config
|
||||||
```sh
|
```sh
|
||||||
|
@ -86,7 +86,7 @@ mv ~pleroma/config/prod.secret.exs /etc/pleroma/config.exs
|
||||||
$EDITOR /etc/pleroma/config.exs
|
$EDITOR /etc/pleroma/config.exs
|
||||||
```
|
```
|
||||||
## Installing the release
|
## Installing the release
|
||||||
Before proceeding, get the flavour from [Detecting flavour](otp_en.html#detecting-flavour) section in OTP installation guide.
|
Before proceeding, get the flavour from [Detecting flavour](otp_en.md#detecting-flavour) section in OTP installation guide.
|
||||||
```sh
|
```sh
|
||||||
# Delete all files in pleroma user's directory
|
# Delete all files in pleroma user's directory
|
||||||
rm -r ~pleroma/*
|
rm -r ~pleroma/*
|
||||||
|
@ -148,6 +148,6 @@ cp -f ~pleroma/installation/init.d/pleroma /etc/init.d/pleroma
|
||||||
rc-service pleroma start
|
rc-service pleroma start
|
||||||
```
|
```
|
||||||
## Running mix tasks
|
## Running mix tasks
|
||||||
Refer to [Running mix tasks](otp_en.html#running-mix-tasks) section from OTP release installation guide.
|
Refer to [Running mix tasks](otp_en.md#running-mix-tasks) section from OTP release installation guide.
|
||||||
## Updating
|
## Updating
|
||||||
Refer to [Updating](otp_en.html#updating) section from OTP release installation guide.
|
Refer to [Updating](otp_en.md#updating) section from OTP release installation guide.
|
||||||
|
|
|
@ -42,7 +42,7 @@ apk add curl unzip ncurses postgresql postgresql-contrib nginx certbot
|
||||||
## Setup
|
## Setup
|
||||||
### Configuring PostgreSQL
|
### Configuring PostgreSQL
|
||||||
#### (Optional) Installing RUM indexes
|
#### (Optional) Installing RUM indexes
|
||||||
RUM indexes are an alternative indexing scheme that is not included in PostgreSQL by default. You can read more about them on the [Configuration page](config.html#rum-indexing-for-full-text-search). They are completely optional and most of the time are not worth it, especially if you are running a single user instance (unless you absolutely need ordered search results).
|
RUM indexes are an alternative indexing scheme that is not included in PostgreSQL by default. You can read more about them on the [Configuration page](../configuration/cheatsheet.md#rum-indexing-for-full-text-search). They are completely optional and most of the time are not worth it, especially if you are running a single user instance (unless you absolutely need ordered search results).
|
||||||
|
|
||||||
Debian/Ubuntu (available only on Buster/19.04):
|
Debian/Ubuntu (available only on Buster/19.04):
|
||||||
```sh
|
```sh
|
||||||
|
@ -262,8 +262,8 @@ su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"
|
||||||
But you should **always check the release notes/changelog** in case there are config deprecations, special update steps, etc.
|
But you should **always check the release notes/changelog** in case there are config deprecations, special update steps, etc.
|
||||||
|
|
||||||
## Further reading
|
## Further reading
|
||||||
* [Configuration](config.html)
|
|
||||||
* [Pleroma's base config.exs](https://git.pleroma.social/pleroma/pleroma/blob/master/config/config.exs)
|
* [Backup your instance](../administration/backup.md)
|
||||||
* [Hardening your instance](hardening.html)
|
* [Hardening your instance](../configuration/hardening.md)
|
||||||
* [Pleroma Clients](clients.html)
|
* [How to activate mediaproxy](../configuration/howto_mediaproxy.md)
|
||||||
* [Emoji pack manager](Mix.Tasks.Pleroma.Emoji.html)
|
* [Updating your instance](../administration/updating.md)
|
||||||
|
|
|
@ -8,18 +8,7 @@ defmodule Mix.Tasks.Pleroma.Config do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.Web.AdminAPI.Config
|
alias Pleroma.Web.AdminAPI.Config
|
||||||
@shortdoc "Manages the location of the config"
|
@shortdoc "Manages the location of the config"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/config.md")
|
||||||
Manages the location of the config.
|
|
||||||
|
|
||||||
## Transfers config from file to DB.
|
|
||||||
|
|
||||||
mix pleroma.config migrate_to_db
|
|
||||||
|
|
||||||
## Transfers config from DB to file `config/env.exported_from_db.secret.exs`
|
|
||||||
|
|
||||||
mix pleroma.config migrate_from_db ENV
|
|
||||||
"""
|
|
||||||
|
|
||||||
def run(["migrate_to_db"]) do
|
def run(["migrate_to_db"]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
|
|
|
@ -13,34 +13,8 @@ defmodule Mix.Tasks.Pleroma.Database do
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
@shortdoc "A collection of database related tasks"
|
@shortdoc "A collection of database related tasks"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/database.md")
|
||||||
A collection of database related tasks
|
|
||||||
|
|
||||||
## Replace embedded objects with their references
|
|
||||||
|
|
||||||
Replaces embedded objects with references to them in the `objects` table. Only needs to be ran once. 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.
|
|
||||||
|
|
||||||
mix pleroma.database remove_embedded_objects
|
|
||||||
|
|
||||||
Options:
|
|
||||||
- `--vacuum` - run `VACUUM FULL` after the embedded objects are replaced with their references
|
|
||||||
|
|
||||||
## Prune old objects from the database
|
|
||||||
|
|
||||||
mix pleroma.database prune_objects
|
|
||||||
|
|
||||||
## Create a conversation for all existing DMs. Can be safely re-run.
|
|
||||||
|
|
||||||
mix pleroma.database bump_all_conversations
|
|
||||||
|
|
||||||
## Remove duplicated items from following and update followers count for all users
|
|
||||||
|
|
||||||
mix pleroma.database update_users_following_followers_counts
|
|
||||||
|
|
||||||
## Fix the pre-existing "likes" collections for all objects
|
|
||||||
|
|
||||||
mix pleroma.database fix_likes_collections
|
|
||||||
"""
|
|
||||||
def run(["remove_embedded_objects" | args]) do
|
def run(["remove_embedded_objects" | args]) do
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
OptionParser.parse(
|
OptionParser.parse(
|
||||||
|
|
|
@ -2,16 +2,8 @@ defmodule Mix.Tasks.Pleroma.Digest do
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
@shortdoc "Manages digest emails"
|
@shortdoc "Manages digest emails"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/digest.md")
|
||||||
Manages digest emails
|
|
||||||
|
|
||||||
## Send digest email since given date (user registration date by default)
|
|
||||||
ignoring user activity status.
|
|
||||||
|
|
||||||
``mix pleroma.digest test <nickname> <since_date>``
|
|
||||||
|
|
||||||
Example: ``mix pleroma.digest test donaldtheduck 2019-05-20``
|
|
||||||
"""
|
|
||||||
def run(["test", nickname | opts]) do
|
def run(["test", nickname | opts]) do
|
||||||
Mix.Pleroma.start_pleroma()
|
Mix.Pleroma.start_pleroma()
|
||||||
|
|
||||||
|
|
|
@ -6,54 +6,7 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
@shortdoc "Manages emoji packs"
|
@shortdoc "Manages emoji packs"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/emoji.md")
|
||||||
Manages emoji packs
|
|
||||||
|
|
||||||
## ls-packs
|
|
||||||
|
|
||||||
mix pleroma.emoji ls-packs [OPTION...]
|
|
||||||
|
|
||||||
Lists the emoji packs and metadata specified in the manifest.
|
|
||||||
|
|
||||||
### 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
|
|
||||||
|
|
||||||
## get-packs
|
|
||||||
|
|
||||||
mix pleroma.emoji get-packs [OPTION...] PACKS
|
|
||||||
|
|
||||||
Fetches, verifies and installs the specified PACKS from the
|
|
||||||
manifest into the `STATIC-DIR/emoji/PACK-NAME`
|
|
||||||
|
|
||||||
### Options
|
|
||||||
|
|
||||||
- `-m, --manifest PATH/URL` - same as ls-packs
|
|
||||||
|
|
||||||
## gen-pack
|
|
||||||
|
|
||||||
mix pleroma.emoji gen-pack PACK-URL
|
|
||||||
|
|
||||||
Creates a new manifest entry and a file list from the specified
|
|
||||||
remote pack file. 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).
|
|
||||||
"""
|
|
||||||
|
|
||||||
def run(["ls-packs" | args]) do
|
def run(["ls-packs" | args]) do
|
||||||
Application.ensure_all_started(:hackney)
|
Application.ensure_all_started(:hackney)
|
||||||
|
|
|
@ -7,36 +7,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
|
||||||
import Mix.Pleroma
|
import Mix.Pleroma
|
||||||
|
|
||||||
@shortdoc "Manages Pleroma instance"
|
@shortdoc "Manages Pleroma instance"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/instance.md")
|
||||||
Manages Pleroma instance.
|
|
||||||
|
|
||||||
## Generate a new instance config.
|
|
||||||
|
|
||||||
mix pleroma.instance gen [OPTION...]
|
|
||||||
|
|
||||||
If any 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 ADMIN_EMAIL` - the email address of the instance admin
|
|
||||||
- `--notify-email NOTIFY_EMAIL` - email address for notifications
|
|
||||||
- `--dbhost HOSTNAME` - the hostname of the PostgreSQL database to use
|
|
||||||
- `--dbname DBNAME` - the name of the database to use
|
|
||||||
- `--dbuser DBUSER` - the user (aka role) to use for the database connection
|
|
||||||
- `--dbpass DBPASS` - 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` - the directory uploads go in when using a local uploader
|
|
||||||
- `--static-dir` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)
|
|
||||||
- `--listen-ip` - the ip the app should listen to, defaults to 127.0.0.1
|
|
||||||
- `--listen-port` - the port the app should listen to, defaults to 4000
|
|
||||||
"""
|
|
||||||
|
|
||||||
def run(["gen" | rest]) do
|
def run(["gen" | rest]) do
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
|
|
|
@ -9,25 +9,8 @@ defmodule Mix.Tasks.Pleroma.Relay do
|
||||||
alias Pleroma.Web.ActivityPub.Relay
|
alias Pleroma.Web.ActivityPub.Relay
|
||||||
|
|
||||||
@shortdoc "Manages remote relays"
|
@shortdoc "Manages remote relays"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/relay.md")
|
||||||
Manages remote relays
|
|
||||||
|
|
||||||
## Follow a remote relay
|
|
||||||
|
|
||||||
``mix pleroma.relay follow <relay_url>``
|
|
||||||
|
|
||||||
Example: ``mix pleroma.relay follow https://example.org/relay``
|
|
||||||
|
|
||||||
## Unfollow a remote relay
|
|
||||||
|
|
||||||
``mix pleroma.relay unfollow <relay_url>``
|
|
||||||
|
|
||||||
Example: ``mix pleroma.relay unfollow https://example.org/relay``
|
|
||||||
|
|
||||||
## List relay subscriptions
|
|
||||||
|
|
||||||
``mix pleroma.relay list``
|
|
||||||
"""
|
|
||||||
def run(["follow", target]) do
|
def run(["follow", target]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,8 @@ defmodule Mix.Tasks.Pleroma.Uploads do
|
||||||
@log_every 50
|
@log_every 50
|
||||||
|
|
||||||
@shortdoc "Migrates uploads from local to remote storage"
|
@shortdoc "Migrates uploads from local to remote storage"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/uploads.md")
|
||||||
Manages uploads
|
|
||||||
|
|
||||||
## Migrate uploads from local to remote storage
|
|
||||||
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 config.exs
|
|
||||||
"""
|
|
||||||
def run(["migrate_local", target_uploader | args]) do
|
def run(["migrate_local", target_uploader | args]) do
|
||||||
delete? = Enum.member?(args, "--delete")
|
delete? = Enum.member?(args, "--delete")
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
|
@ -10,86 +10,8 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
alias Pleroma.Web.OAuth
|
alias Pleroma.Web.OAuth
|
||||||
|
|
||||||
@shortdoc "Manages Pleroma users"
|
@shortdoc "Manages Pleroma users"
|
||||||
@moduledoc """
|
@moduledoc File.read!("docs/administration/CLI_tasks/user.md")
|
||||||
Manages Pleroma users.
|
|
||||||
|
|
||||||
## Create a new user.
|
|
||||||
|
|
||||||
mix pleroma.user new NICKNAME EMAIL [OPTION...]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
- `--name NAME` - the user's name (i.e., "Lain Iwakura")
|
|
||||||
- `--bio BIO` - the user's bio
|
|
||||||
- `--password PASSWORD` - the user's password
|
|
||||||
- `--moderator`/`--no-moderator` - whether the user is a moderator
|
|
||||||
- `--admin`/`--no-admin` - whether the user is an admin
|
|
||||||
- `-y`, `--assume-yes`/`--no-assume-yes` - whether to assume yes to all questions
|
|
||||||
|
|
||||||
## Generate an invite link.
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
mix pleroma.user invites
|
|
||||||
|
|
||||||
## Revoke invite
|
|
||||||
|
|
||||||
mix pleroma.user revoke_invite TOKEN OR TOKEN_ID
|
|
||||||
|
|
||||||
## Delete the user's account.
|
|
||||||
|
|
||||||
mix pleroma.user rm NICKNAME
|
|
||||||
|
|
||||||
## Delete the user's activities.
|
|
||||||
|
|
||||||
mix pleroma.user delete_activities NICKNAME
|
|
||||||
|
|
||||||
## Sign user out from all applications (delete user's OAuth tokens and authorizations).
|
|
||||||
|
|
||||||
mix pleroma.user sign_out NICKNAME
|
|
||||||
|
|
||||||
## Deactivate or activate the user's account.
|
|
||||||
|
|
||||||
mix pleroma.user toggle_activated NICKNAME
|
|
||||||
|
|
||||||
## Unsubscribe local users from user's account and deactivate it
|
|
||||||
|
|
||||||
mix pleroma.user unsubscribe NICKNAME
|
|
||||||
|
|
||||||
## Unsubscribe local users from an entire instance and deactivate all accounts
|
|
||||||
|
|
||||||
mix pleroma.user unsubscribe_all_from_instance INSTANCE
|
|
||||||
|
|
||||||
## Create a password reset link.
|
|
||||||
|
|
||||||
mix pleroma.user reset_password NICKNAME
|
|
||||||
|
|
||||||
## Set the value of the given user's settings.
|
|
||||||
|
|
||||||
mix pleroma.user set NICKNAME [OPTION...]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
- `--locked`/`--no-locked` - whether the user's account is locked
|
|
||||||
- `--moderator`/`--no-moderator` - whether the user is a moderator
|
|
||||||
- `--admin`/`--no-admin` - whether the user is an admin
|
|
||||||
|
|
||||||
## Add tags to a user.
|
|
||||||
|
|
||||||
mix pleroma.user tag NICKNAME TAGS
|
|
||||||
|
|
||||||
## Delete tags from a user.
|
|
||||||
|
|
||||||
mix pleroma.user untag NICKNAME TAGS
|
|
||||||
|
|
||||||
## Toggle confirmation of the user's account.
|
|
||||||
|
|
||||||
mix pleroma.user toggle_confirmed NICKNAME
|
|
||||||
"""
|
|
||||||
def run(["new", nickname, email | rest]) do
|
def run(["new", nickname, email | rest]) do
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
OptionParser.parse(
|
OptionParser.parse(
|
||||||
|
|
|
@ -42,6 +42,7 @@ defmodule Pleroma.Application do
|
||||||
hackney_pool_children() ++
|
hackney_pool_children() ++
|
||||||
[
|
[
|
||||||
Pleroma.Stats,
|
Pleroma.Stats,
|
||||||
|
Pleroma.JobQueueMonitor,
|
||||||
{Oban, Pleroma.Config.get(Oban)}
|
{Oban, Pleroma.Config.get(Oban)}
|
||||||
] ++
|
] ++
|
||||||
task_children(@env) ++
|
task_children(@env) ++
|
||||||
|
|
|
@ -14,6 +14,7 @@ defmodule Pleroma.Healthcheck do
|
||||||
active: 0,
|
active: 0,
|
||||||
idle: 0,
|
idle: 0,
|
||||||
memory_used: 0,
|
memory_used: 0,
|
||||||
|
job_queue_stats: nil,
|
||||||
healthy: true
|
healthy: true
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
|
@ -21,6 +22,7 @@ defmodule Pleroma.Healthcheck do
|
||||||
active: non_neg_integer(),
|
active: non_neg_integer(),
|
||||||
idle: non_neg_integer(),
|
idle: non_neg_integer(),
|
||||||
memory_used: number(),
|
memory_used: number(),
|
||||||
|
job_queue_stats: map(),
|
||||||
healthy: boolean()
|
healthy: boolean()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ defmodule Pleroma.Healthcheck do
|
||||||
memory_used: Float.round(:erlang.memory(:total) / 1024 / 1024, 2)
|
memory_used: Float.round(:erlang.memory(:total) / 1024 / 1024, 2)
|
||||||
}
|
}
|
||||||
|> assign_db_info()
|
|> assign_db_info()
|
||||||
|
|> assign_job_queue_stats()
|
||||||
|> check_health()
|
|> check_health()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,6 +58,11 @@ defmodule Pleroma.Healthcheck do
|
||||||
Map.merge(healthcheck, db_info)
|
Map.merge(healthcheck, db_info)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp assign_job_queue_stats(healthcheck) do
|
||||||
|
stats = Pleroma.JobQueueMonitor.stats()
|
||||||
|
Map.put(healthcheck, :job_queue_stats, stats)
|
||||||
|
end
|
||||||
|
|
||||||
@spec check_health(Healthcheck.t()) :: Healthcheck.t()
|
@spec check_health(Healthcheck.t()) :: Healthcheck.t()
|
||||||
def check_health(%{pool_size: pool_size, active: active} = check)
|
def check_health(%{pool_size: pool_size, active: active} = check)
|
||||||
when active >= pool_size do
|
when active >= pool_size do
|
||||||
|
|
78
lib/pleroma/job_queue_monitor.ex
Normal file
78
lib/pleroma/job_queue_monitor.ex
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.JobQueueMonitor do
|
||||||
|
use GenServer
|
||||||
|
|
||||||
|
@initial_state %{workers: %{}, queues: %{}, processed_jobs: 0}
|
||||||
|
@queue %{processed_jobs: 0, success: 0, failure: 0}
|
||||||
|
@operation %{processed_jobs: 0, success: 0, failure: 0}
|
||||||
|
|
||||||
|
def start_link(_) do
|
||||||
|
GenServer.start_link(__MODULE__, @initial_state, name: __MODULE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def init(state) do
|
||||||
|
:telemetry.attach("oban-monitor-failure", [:oban, :failure], &handle_event/4, nil)
|
||||||
|
:telemetry.attach("oban-monitor-success", [:oban, :success], &handle_event/4, nil)
|
||||||
|
|
||||||
|
{:ok, state}
|
||||||
|
end
|
||||||
|
|
||||||
|
def stats do
|
||||||
|
GenServer.call(__MODULE__, :stats)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event([:oban, status], %{duration: duration}, meta, _) do
|
||||||
|
GenServer.cast(__MODULE__, {:process_event, status, duration, meta})
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_call(:stats, _from, state) do
|
||||||
|
{:reply, state, state}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_cast({:process_event, status, duration, meta}, state) do
|
||||||
|
state =
|
||||||
|
state
|
||||||
|
|> Map.update!(:workers, fn workers ->
|
||||||
|
workers
|
||||||
|
|> Map.put_new(meta.worker, %{})
|
||||||
|
|> Map.update!(meta.worker, &update_worker(&1, status, meta, duration))
|
||||||
|
end)
|
||||||
|
|> Map.update!(:queues, fn workers ->
|
||||||
|
workers
|
||||||
|
|> Map.put_new(meta.queue, @queue)
|
||||||
|
|> Map.update!(meta.queue, &update_queue(&1, status, meta, duration))
|
||||||
|
end)
|
||||||
|
|> Map.update!(:processed_jobs, &(&1 + 1))
|
||||||
|
|
||||||
|
{:noreply, state}
|
||||||
|
end
|
||||||
|
|
||||||
|
defp update_worker(worker, status, meta, duration) do
|
||||||
|
worker
|
||||||
|
|> Map.put_new(meta.args["op"], @operation)
|
||||||
|
|> Map.update!(meta.args["op"], &update_op(&1, status, meta, duration))
|
||||||
|
end
|
||||||
|
|
||||||
|
defp update_op(op, :enqueue, _meta, _duration) do
|
||||||
|
op
|
||||||
|
|> Map.update!(:enqueued, &(&1 + 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
defp update_op(op, status, _meta, _duration) do
|
||||||
|
op
|
||||||
|
|> Map.update!(:processed_jobs, &(&1 + 1))
|
||||||
|
|> Map.update!(status, &(&1 + 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
defp update_queue(queue, status, _meta, _duration) do
|
||||||
|
queue
|
||||||
|
|> Map.update!(:processed_jobs, &(&1 + 1))
|
||||||
|
|> Map.update!(status, &(&1 + 1))
|
||||||
|
end
|
||||||
|
end
|
|
@ -583,7 +583,7 @@ defmodule Pleroma.User do
|
||||||
is_integer(nickname_or_id) or FlakeId.flake_id?(nickname_or_id) ->
|
is_integer(nickname_or_id) or FlakeId.flake_id?(nickname_or_id) ->
|
||||||
get_cached_by_id(nickname_or_id) || get_cached_by_nickname(nickname_or_id)
|
get_cached_by_id(nickname_or_id) || get_cached_by_nickname(nickname_or_id)
|
||||||
|
|
||||||
restrict_to_local == false ->
|
restrict_to_local == false or not String.contains?(nickname_or_id, "@") ->
|
||||||
get_cached_by_nickname(nickname_or_id)
|
get_cached_by_nickname(nickname_or_id)
|
||||||
|
|
||||||
restrict_to_local == :unauthenticated and match?(%User{}, opts[:for]) ->
|
restrict_to_local == :unauthenticated and match?(%User{}, opts[:for]) ->
|
||||||
|
|
|
@ -25,40 +25,44 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
|
||||||
parent_activity = Activity.get_create_by_object_ap_id(activity.data["object"])
|
parent_activity = Activity.get_create_by_object_ap_id(activity.data["object"])
|
||||||
mastodon_type = Activity.mastodon_notification_type(activity)
|
mastodon_type = Activity.mastodon_notification_type(activity)
|
||||||
|
|
||||||
response = %{
|
with %{id: _} = account <- AccountView.render("show.json", %{user: actor, for: user}) do
|
||||||
id: to_string(notification.id),
|
response = %{
|
||||||
type: mastodon_type,
|
id: to_string(notification.id),
|
||||||
created_at: CommonAPI.Utils.to_masto_date(notification.inserted_at),
|
type: mastodon_type,
|
||||||
account: AccountView.render("show.json", %{user: actor, for: user}),
|
created_at: CommonAPI.Utils.to_masto_date(notification.inserted_at),
|
||||||
pleroma: %{
|
account: account,
|
||||||
is_seen: notification.seen
|
pleroma: %{
|
||||||
|
is_seen: notification.seen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
case mastodon_type do
|
case mastodon_type do
|
||||||
"mention" ->
|
"mention" ->
|
||||||
response
|
response
|
||||||
|> Map.merge(%{
|
|> Map.merge(%{
|
||||||
status: StatusView.render("show.json", %{activity: activity, for: user})
|
status: StatusView.render("show.json", %{activity: activity, for: user})
|
||||||
})
|
})
|
||||||
|
|
||||||
"favourite" ->
|
"favourite" ->
|
||||||
response
|
response
|
||||||
|> Map.merge(%{
|
|> Map.merge(%{
|
||||||
status: StatusView.render("show.json", %{activity: parent_activity, for: user})
|
status: StatusView.render("show.json", %{activity: parent_activity, for: user})
|
||||||
})
|
})
|
||||||
|
|
||||||
"reblog" ->
|
"reblog" ->
|
||||||
response
|
response
|
||||||
|> Map.merge(%{
|
|> Map.merge(%{
|
||||||
status: StatusView.render("show.json", %{activity: parent_activity, for: user})
|
status: StatusView.render("show.json", %{activity: parent_activity, for: user})
|
||||||
})
|
})
|
||||||
|
|
||||||
"follow" ->
|
"follow" ->
|
||||||
response
|
response
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
nil
|
nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_ -> nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -460,7 +460,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Special case: Local MastodonFE
|
# Special case: Local MastodonFE
|
||||||
defp redirect_uri(%Plug.Conn{} = conn, "."), do: mastodon_api_url(conn, :login)
|
defp redirect_uri(%Plug.Conn{} = conn, "."), do: auth_url(conn, :login)
|
||||||
|
|
||||||
defp redirect_uri(%Plug.Conn{}, redirect_uri), do: redirect_uri
|
defp redirect_uri(%Plug.Conn{}, redirect_uri), do: redirect_uri
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,14 @@ defmodule Pleroma.HealthcheckTest do
|
||||||
test "system_info/0" do
|
test "system_info/0" do
|
||||||
result = Healthcheck.system_info() |> Map.from_struct()
|
result = Healthcheck.system_info() |> Map.from_struct()
|
||||||
|
|
||||||
assert Map.keys(result) == [:active, :healthy, :idle, :memory_used, :pool_size]
|
assert Map.keys(result) == [
|
||||||
|
:active,
|
||||||
|
:healthy,
|
||||||
|
:idle,
|
||||||
|
:job_queue_stats,
|
||||||
|
:memory_used,
|
||||||
|
:pool_size
|
||||||
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "check_health/1" do
|
describe "check_health/1" do
|
||||||
|
|
70
test/job_queue_monitor_test.exs
Normal file
70
test/job_queue_monitor_test.exs
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.JobQueueMonitorTest do
|
||||||
|
use ExUnit.Case, async: true
|
||||||
|
|
||||||
|
alias Pleroma.JobQueueMonitor
|
||||||
|
|
||||||
|
@success {:process_event, :success, 1337,
|
||||||
|
%{
|
||||||
|
args: %{"op" => "refresh_subscriptions"},
|
||||||
|
attempt: 1,
|
||||||
|
id: 339,
|
||||||
|
max_attempts: 5,
|
||||||
|
queue: "federator_outgoing",
|
||||||
|
worker: "Pleroma.Workers.SubscriberWorker"
|
||||||
|
}}
|
||||||
|
|
||||||
|
@failure {:process_event, :failure, 22_521_134,
|
||||||
|
%{
|
||||||
|
args: %{"op" => "force_password_reset", "user_id" => "9nJG6n6Nbu7tj9GJX6"},
|
||||||
|
attempt: 1,
|
||||||
|
error: %RuntimeError{message: "oops"},
|
||||||
|
id: 345,
|
||||||
|
kind: :exception,
|
||||||
|
max_attempts: 1,
|
||||||
|
queue: "background",
|
||||||
|
stack: [
|
||||||
|
{Pleroma.Workers.BackgroundWorker, :perform, 2,
|
||||||
|
[file: 'lib/pleroma/workers/background_worker.ex', line: 31]},
|
||||||
|
{Oban.Queue.Executor, :safe_call, 1,
|
||||||
|
[file: 'lib/oban/queue/executor.ex', line: 42]},
|
||||||
|
{:timer, :tc, 3, [file: 'timer.erl', line: 197]},
|
||||||
|
{Oban.Queue.Executor, :call, 2, [file: 'lib/oban/queue/executor.ex', line: 23]},
|
||||||
|
{Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 90]},
|
||||||
|
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}
|
||||||
|
],
|
||||||
|
worker: "Pleroma.Workers.BackgroundWorker"
|
||||||
|
}}
|
||||||
|
|
||||||
|
test "stats/0" do
|
||||||
|
assert %{processed_jobs: _, queues: _, workers: _} = JobQueueMonitor.stats()
|
||||||
|
end
|
||||||
|
|
||||||
|
test "handle_cast/2" do
|
||||||
|
state = %{workers: %{}, queues: %{}, processed_jobs: 0}
|
||||||
|
|
||||||
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@success, state)
|
||||||
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@failure, state)
|
||||||
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@success, state)
|
||||||
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@failure, state)
|
||||||
|
|
||||||
|
assert state == %{
|
||||||
|
processed_jobs: 4,
|
||||||
|
queues: %{
|
||||||
|
"background" => %{failure: 2, processed_jobs: 2, success: 0},
|
||||||
|
"federator_outgoing" => %{failure: 0, processed_jobs: 2, success: 2}
|
||||||
|
},
|
||||||
|
workers: %{
|
||||||
|
"Pleroma.Workers.BackgroundWorker" => %{
|
||||||
|
"force_password_reset" => %{failure: 2, processed_jobs: 2, success: 0}
|
||||||
|
},
|
||||||
|
"Pleroma.Workers.SubscriberWorker" => %{
|
||||||
|
"refresh_subscriptions" => %{failure: 0, processed_jobs: 2, success: 2}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
|
@ -1725,4 +1725,61 @@ defmodule Pleroma.UserTest do
|
||||||
assert %{info: %{hide_follows: true}} = Repo.get(User, user.id)
|
assert %{info: %{hide_follows: true}} = Repo.get(User, user.id)
|
||||||
assert {:ok, %{info: %{hide_follows: true}}} = Cachex.get(:user_cache, "ap_id:#{user.ap_id}")
|
assert {:ok, %{info: %{hide_follows: true}}} = Cachex.get(:user_cache, "ap_id:#{user.ap_id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "get_cached_by_nickname_or_id" do
|
||||||
|
setup do
|
||||||
|
limit_to_local_content = Pleroma.Config.get([:instance, :limit_to_local_content])
|
||||||
|
local_user = insert(:user)
|
||||||
|
remote_user = insert(:user, nickname: "nickname@example.com", local: false)
|
||||||
|
|
||||||
|
on_exit(fn ->
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], limit_to_local_content)
|
||||||
|
end)
|
||||||
|
|
||||||
|
[local_user: local_user, remote_user: remote_user]
|
||||||
|
end
|
||||||
|
|
||||||
|
test "allows getting remote users by id no matter what :limit_to_local_content is set to", %{
|
||||||
|
remote_user: remote_user
|
||||||
|
} do
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], false)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(remote_user.id)
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], true)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(remote_user.id)
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(remote_user.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "disallows getting remote users by nickname without authentication when :limit_to_local_content is set to :unauthenticated",
|
||||||
|
%{remote_user: remote_user} do
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated)
|
||||||
|
assert nil == User.get_cached_by_nickname_or_id(remote_user.nickname)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "allows getting remote users by nickname with authentication when :limit_to_local_content is set to :unauthenticated",
|
||||||
|
%{remote_user: remote_user, local_user: local_user} do
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(remote_user.nickname, for: local_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "disallows getting remote users by nickname when :limit_to_local_content is set to true",
|
||||||
|
%{remote_user: remote_user} do
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], true)
|
||||||
|
assert nil == User.get_cached_by_nickname_or_id(remote_user.nickname)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "allows getting local users by nickname no matter what :limit_to_local_content is set to",
|
||||||
|
%{local_user: local_user} do
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], false)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(local_user.nickname)
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], true)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(local_user.nickname)
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated)
|
||||||
|
assert %User{} = User.get_cached_by_nickname_or_id(local_user.nickname)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,5 +100,11 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
|
||||||
NotificationView.render("index.json", %{notifications: [notification], for: followed})
|
NotificationView.render("index.json", %{notifications: [notification], for: followed})
|
||||||
|
|
||||||
assert [expected] == result
|
assert [expected] == result
|
||||||
|
|
||||||
|
User.perform(:delete, follower)
|
||||||
|
notification = Notification |> Repo.one() |> Repo.preload(:activity)
|
||||||
|
|
||||||
|
assert [] ==
|
||||||
|
NotificationView.render("index.json", %{notifications: [notification], for: followed})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue