Merge branch 'develop' into gitlab-mr-iid-4315
This commit is contained in:
commit
b4c624911c
1163 changed files with 40459 additions and 6082 deletions
25
.forgejo/issue_template/bug.yaml
Normal file
25
.forgejo/issue_template/bug.yaml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
name: 'Bug report'
|
||||
about: 'Report a bug in Pleroma'
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
### Precheck
|
||||
|
||||
* For support use https://git.pleroma.social/pleroma/pleroma-support or [community channels](https://git.pleroma.social/pleroma/pleroma#community-channels).
|
||||
* Please do a quick search to ensure no similar bug has been reported before. If the bug has not been addressed after 2 weeks, it's fine to bump it.
|
||||
* Try to ensure that the bug is actually related to the Pleroma backend. For example, if a bug happens in Pleroma-FE but not in Mastodon-FE or mobile clients, it's likely that the bug should be filed in [Pleroma-FE](https://git.pleroma.social/pleroma/pleroma-fe/issues/new) repository.
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
value: |
|
||||
* Installation type (OTP or From Source):
|
||||
* Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE):
|
||||
* Elixir version (`elixir -v` for from source installations, N/A for OTP):
|
||||
* Operating system:
|
||||
* PostgreSQL version (`psql -V`):
|
||||
- type: textarea
|
||||
id: bug-description
|
||||
attributes:
|
||||
label: Bug description
|
||||
13
.forgejo/pull_request_template.md
Normal file
13
.forgejo/pull_request_template.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
### Checklist
|
||||
|
||||
- [ ] Adding a changelog: In the `changelog.d` directory, create a file named `<code>.<type>`.
|
||||
|
||||
<!--
|
||||
`<code>` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name.
|
||||
|
||||
`<type>` can be `add`, `change`, `remove`, `fix`, `security` or `skip`. `skip` is only used if there is no user-visible change in the PR (for example, only editing comments in the code). Otherwise, choose a type that corresponds to your change.
|
||||
|
||||
In the file, write the changelog entry. For example, if a PR adds group functionality, we can create a file named `group.add` and write `Add group functionality` in it.
|
||||
|
||||
If one changelog entry is not enough, you may add more. But that might mean you can split it into two PRs. Only use more than one changelog entry if you really need to (for example, when one change in the code fix two different bugs, or when refactoring).
|
||||
-->
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -56,6 +56,9 @@ pleroma.iml
|
|||
# asdf
|
||||
.tool-versions
|
||||
|
||||
# mise
|
||||
mise.toml
|
||||
|
||||
# Editor temp files
|
||||
*~
|
||||
*#
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.14.5-otp-25
|
||||
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.15.8-otp-26
|
||||
|
||||
variables: &global_variables
|
||||
# Only used for the release
|
||||
|
|
@ -14,9 +14,16 @@ variables: &global_variables
|
|||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
- if: $CI_COMMIT_BRANCH == "develop"
|
||||
- if: $CI_COMMIT_BRANCH == "stable"
|
||||
- if: $CI_PIPELINE_SOURCE == "web"
|
||||
- if: $CI_COMMIT_TAG
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
|
||||
# Default artifacts configuration
|
||||
.default_artifacts: &default_artifacts
|
||||
expire_in: 30 days
|
||||
|
||||
cache: &global_cache_policy
|
||||
key: $CI_JOB_IMAGE-$CI_COMMIT_SHORT_SHA
|
||||
|
|
@ -55,6 +62,7 @@ check-changelog:
|
|||
before_script: ''
|
||||
after_script: ''
|
||||
cache: {}
|
||||
artifacts: *default_artifacts
|
||||
script:
|
||||
- apk add git
|
||||
- sh ./tools/check-changelog
|
||||
|
|
@ -70,8 +78,9 @@ check-changelog:
|
|||
.using-ci-base:
|
||||
tags:
|
||||
- amd64
|
||||
artifacts: *default_artifacts
|
||||
|
||||
build-1.14.5-otp-25:
|
||||
build-1.15.8-otp-26:
|
||||
extends:
|
||||
- .build_changes_policy
|
||||
- .using-ci-base
|
||||
|
|
@ -79,12 +88,12 @@ build-1.14.5-otp-25:
|
|||
script:
|
||||
- mix compile --force
|
||||
|
||||
build-1.17.1-otp-26:
|
||||
build-1.18.3-otp-27:
|
||||
extends:
|
||||
- .build_changes_policy
|
||||
- .using-ci-base
|
||||
stage: build
|
||||
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.17.1-otp-26
|
||||
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.18.3-otp-27
|
||||
script:
|
||||
- mix compile --force
|
||||
|
||||
|
|
@ -100,8 +109,12 @@ spec-build:
|
|||
artifacts:
|
||||
paths:
|
||||
- spec.json
|
||||
reports:
|
||||
dotenv: build.env
|
||||
expire_in: 42 years
|
||||
script:
|
||||
- mix pleroma.openapi_spec spec.json
|
||||
- echo "SPEC_BUILD_JOB_ID=$CI_JOB_ID" >> build.env
|
||||
|
||||
benchmark:
|
||||
extends:
|
||||
|
|
@ -119,7 +132,7 @@ benchmark:
|
|||
- mix ecto.migrate
|
||||
- mix pleroma.load_testing
|
||||
|
||||
unit-testing-1.14.5-otp-25:
|
||||
unit-testing-1.15.8-otp-26:
|
||||
extends:
|
||||
- .build_changes_policy
|
||||
- .using-ci-base
|
||||
|
|
@ -131,29 +144,47 @@ unit-testing-1.14.5-otp-25:
|
|||
- name: postgres:13-alpine
|
||||
alias: postgres
|
||||
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
|
||||
before_script: &testing_before_script
|
||||
- echo $MIX_ENV
|
||||
- rm -rf _build/*/lib/pleroma
|
||||
# Create a non-root user for running tests
|
||||
- useradd -m -s /bin/bash testuser
|
||||
# Install dependencies as root first
|
||||
- mix deps.get
|
||||
# Set proper ownership for everything
|
||||
- chown -R testuser:testuser .
|
||||
- chown -R testuser:testuser /root/.mix || true
|
||||
- chown -R testuser:testuser /root/.hex || true
|
||||
# Create user-specific directories
|
||||
- su testuser -c "HOME=/home/testuser mix local.hex --force"
|
||||
- su testuser -c "HOME=/home/testuser mix local.rebar --force"
|
||||
script: &testing_script
|
||||
- mix ecto.create
|
||||
- mix ecto.migrate
|
||||
- mix pleroma.test_runner --cover --preload-modules
|
||||
# Run tests as non-root user
|
||||
- su testuser -c "HOME=/home/testuser mix ecto.create"
|
||||
- su testuser -c "HOME=/home/testuser mix ecto.migrate"
|
||||
- su testuser -c "HOME=/home/testuser mix pleroma.test_runner --cover --preload-modules"
|
||||
coverage: '/^Line total: ([^ ]*%)$/'
|
||||
artifacts:
|
||||
expire_in: 30 days
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: coverage.xml
|
||||
|
||||
unit-testing-1.17.1-otp-26:
|
||||
unit-testing-1.18.3-otp-27:
|
||||
extends:
|
||||
- .build_changes_policy
|
||||
- .using-ci-base
|
||||
stage: test
|
||||
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.17.1-otp-26
|
||||
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.18.3-otp-27
|
||||
cache: *testing_cache_policy
|
||||
services: *testing_services
|
||||
before_script: *testing_before_script
|
||||
script: *testing_script
|
||||
|
||||
formatting-1.15:
|
||||
extends: .build_changes_policy
|
||||
artifacts: *default_artifacts
|
||||
image: &formatting_elixir elixir:1.15-alpine
|
||||
stage: lint
|
||||
cache: *testing_cache_policy
|
||||
|
|
@ -168,6 +199,7 @@ formatting-1.15:
|
|||
|
||||
cycles-1.15:
|
||||
extends: .build_changes_policy
|
||||
artifacts: *default_artifacts
|
||||
image: *formatting_elixir
|
||||
stage: lint
|
||||
cache: {}
|
||||
|
|
@ -191,7 +223,7 @@ dialyzer:
|
|||
- .using-ci-base
|
||||
stage: lint
|
||||
allow_failure: true
|
||||
when: manual
|
||||
when: manual
|
||||
cache: *testing_cache_policy
|
||||
tags:
|
||||
- feld
|
||||
|
|
@ -200,15 +232,14 @@ dialyzer:
|
|||
|
||||
docs-deploy:
|
||||
stage: deploy
|
||||
cache: *testing_cache_policy
|
||||
image: alpine:latest
|
||||
trigger:
|
||||
project: pleroma/docs
|
||||
branch: master
|
||||
strategy: depend
|
||||
only:
|
||||
- stable@pleroma/pleroma
|
||||
- develop@pleroma/pleroma
|
||||
before_script:
|
||||
- apk add curl
|
||||
script:
|
||||
- curl --fail-with-body -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/673/trigger/pipeline
|
||||
|
||||
review_app:
|
||||
image: alpine:3.9
|
||||
stage: deploy
|
||||
|
|
@ -224,6 +255,7 @@ review_app:
|
|||
except:
|
||||
- master
|
||||
- develop
|
||||
artifacts: *default_artifacts
|
||||
script:
|
||||
- echo "$CI_ENVIRONMENT_SLUG"
|
||||
- mkdir -p ~/.ssh
|
||||
|
|
@ -240,21 +272,19 @@ review_app:
|
|||
|
||||
spec-deploy:
|
||||
stage: deploy
|
||||
artifacts:
|
||||
paths:
|
||||
- spec.json
|
||||
trigger:
|
||||
project: pleroma/api-docs
|
||||
branch: master
|
||||
strategy: depend
|
||||
only:
|
||||
- develop@pleroma/pleroma
|
||||
image: alpine:latest
|
||||
before_script:
|
||||
- apk add curl
|
||||
script:
|
||||
- curl --fail-with-body -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline
|
||||
|
||||
variables:
|
||||
SPEC_BUILD_JOB_ID: $SPEC_BUILD_JOB_ID
|
||||
|
||||
stop_review_app:
|
||||
image: alpine:3.9
|
||||
stage: deploy
|
||||
artifacts: *default_artifacts
|
||||
before_script:
|
||||
- apk update && apk add openssh-client git
|
||||
when: manual
|
||||
|
|
@ -273,7 +303,7 @@ stop_review_app:
|
|||
amd64:
|
||||
stage: release
|
||||
image:
|
||||
name: hexpm/elixir-amd64:1.17.3-erlang-26.2.5.6-ubuntu-focal-20241011
|
||||
name: hexpm/elixir-amd64:1.17.3-erlang-27.3.4.2-ubuntu-noble-20250716
|
||||
only: &release-only
|
||||
- stable@pleroma/pleroma
|
||||
- develop@pleroma/pleroma
|
||||
|
|
@ -300,7 +330,7 @@ amd64:
|
|||
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
before_script: &before-release
|
||||
- apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev git
|
||||
- apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev git build-essential
|
||||
- echo "import Config" > config/prod.secret.exs
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
|
|
@ -316,7 +346,7 @@ amd64-musl:
|
|||
artifacts: *release-artifacts
|
||||
only: *release-only
|
||||
image:
|
||||
name: hexpm/elixir-amd64:1.17.3-erlang-26.2.5.6-alpine-3.17.9
|
||||
name: hexpm/elixir-amd64:1.17.3-erlang-27.3.4.2-alpine-3.22.1
|
||||
tags:
|
||||
- amd64
|
||||
cache: *release-cache
|
||||
|
|
@ -360,7 +390,7 @@ arm64:
|
|||
tags:
|
||||
- arm
|
||||
image:
|
||||
name: hexpm/elixir-arm64:1.17.3-erlang-26.2.5.6-ubuntu-focal-20241011
|
||||
name: hexpm/elixir-arm64:1.17.3-erlang-27.3.4.2-ubuntu-noble-20250716
|
||||
cache: *release-cache
|
||||
variables: *release-variables
|
||||
before_script: *before-release
|
||||
|
|
@ -373,7 +403,7 @@ arm64-musl:
|
|||
tags:
|
||||
- arm
|
||||
image:
|
||||
name: hexpm/elixir-arm64:1.17.3-erlang-26.2.5.6-alpine-3.17.9
|
||||
name: hexpm/elixir-arm64:1.17.3-erlang-27.3.4.2-alpine-3.22.1
|
||||
cache: *release-cache
|
||||
variables: *release-variables
|
||||
before_script: *before-release-musl
|
||||
|
|
|
|||
20
.woodpecker/changelog.yaml
Normal file
20
.woodpecker/changelog.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
when:
|
||||
- event: pull_request
|
||||
evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate"'
|
||||
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
|
||||
steps:
|
||||
check-changelog:
|
||||
image: docker.io/alpine:3.23
|
||||
entrypoint: *script_file_entrypoint
|
||||
commands:
|
||||
- apk add --no-cache git
|
||||
- sh ./tools/check-changelog
|
||||
60
.woodpecker/docker-combine.yaml
Normal file
60
.woodpecker/docker-combine.yaml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
when:
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**", "Dockerfile" ]
|
||||
- event: tag
|
||||
- event: manual
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
branch: stable
|
||||
|
||||
depends_on:
|
||||
- docker
|
||||
|
||||
skip_clone: true
|
||||
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
steps:
|
||||
docker-develop-combine:
|
||||
image: git.fluffytail.org/phnt/wpc-docker-tagger:latest
|
||||
when:
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
settings: &docker_settings
|
||||
registry: "git.pleroma.social"
|
||||
image: "pleroma/pleroma"
|
||||
architectures: [amd64, arm64, armv7]
|
||||
tags:
|
||||
- latest
|
||||
- develop
|
||||
- ${CI_COMMIT_SHA:0:8}
|
||||
username:
|
||||
from_secret: pleroma-ci-user
|
||||
password:
|
||||
from_secret: pleroma-ci-password
|
||||
|
||||
docker-stable-combine:
|
||||
image: git.fluffytail.org/phnt/wpc-docker-tagger:latest
|
||||
when:
|
||||
- evaluate: 'CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||
settings:
|
||||
<<: *docker_settings
|
||||
tags: &stable_docker_tags
|
||||
- latest
|
||||
- stable
|
||||
- ${CI_COMMIT_SHA:0:8}
|
||||
|
||||
docker-stable-tag-combine:
|
||||
image: git.fluffytail.org/phnt/wpc-docker-tagger:latest
|
||||
when:
|
||||
- event: tag
|
||||
- evaluate: 'CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||
settings:
|
||||
<<: *docker_settings
|
||||
tags:
|
||||
- <<: *stable_docker_tags
|
||||
- ${CI_COMMIT_TAG}
|
||||
150
.woodpecker/docker.yaml
Normal file
150
.woodpecker/docker.yaml
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
when:
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**", "Dockerfile" ]
|
||||
- event: tag
|
||||
- event: manual
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
branch: stable
|
||||
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
- linux/arm
|
||||
|
||||
# This is needed for the when clauses below.
|
||||
labels:
|
||||
platform: ${platform}
|
||||
memory: 'high'
|
||||
|
||||
variables:
|
||||
docker_variables: &docker_variables
|
||||
repo: pleroma/pleroma
|
||||
registry: git.pleroma.social
|
||||
username:
|
||||
from_secret: pleroma-ci-user
|
||||
password:
|
||||
from_secret: pleroma-ci-password
|
||||
armv7_docker_variables: &armv7_docker_variables
|
||||
<<: *docker_variables
|
||||
build_args:
|
||||
- ELIXIR_IMG=docker.io/arm32v7/elixir
|
||||
- ELIXIR_TAG=1.17.3-otp-26-alpine
|
||||
- ALPINE_IMG=docker.io/arm32v7/alpine
|
||||
- ALPINE_VER=3.20
|
||||
extra_opts: --custom-platform=linux/arm/v7
|
||||
kaniko_image: &kaniko_image docker.io/woodpeckerci/plugin-kaniko:2.3.2
|
||||
|
||||
steps:
|
||||
docker-develop-amd64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
tags:
|
||||
- latest-amd64
|
||||
- develop-amd64
|
||||
- ${CI_COMMIT_SHA:0:8}-amd64
|
||||
|
||||
docker-develop-arm64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
tags:
|
||||
- latest-arm64
|
||||
- develop-arm64
|
||||
- ${CI_COMMIT_SHA:0:8}-arm64
|
||||
|
||||
docker-develop-armv7:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
settings:
|
||||
<<: *armv7_docker_variables
|
||||
tags:
|
||||
- latest-armv7
|
||||
- develop-armv7
|
||||
- ${CI_COMMIT_SHA:0:8}-armv7
|
||||
|
||||
docker-stable-amd64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
tags: &amd64_tags
|
||||
- latest-amd64
|
||||
- stable-amd64
|
||||
- ${CI_COMMIT_SHA:0:8}-amd64
|
||||
|
||||
# FE workflow runs only on linux/amd64
|
||||
docker-stable-e2e-amd64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
dockerfile: Dockerfile-e2e
|
||||
tags:
|
||||
- stable-e2e
|
||||
|
||||
docker-stable-tag-amd64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
tags:
|
||||
- <<: *amd64_tags
|
||||
- ${CI_COMMIT_TAG}-amd64
|
||||
|
||||
docker-stable-arm64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
tags: &arm64_tags
|
||||
- latest-arm64
|
||||
- stable-arm64
|
||||
- ${CI_COMMIT_SHA:0:8}-arm64
|
||||
|
||||
docker-stable-tag-arm64:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||
settings:
|
||||
<<: *docker_variables
|
||||
tags:
|
||||
- <<: *arm64_tags
|
||||
- ${CI_COMMIT_TAG}-arm64
|
||||
|
||||
docker-stable-armv7:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||
settings:
|
||||
<<: *armv7_docker_variables
|
||||
tags: &armv7_tags
|
||||
- latest-armv7
|
||||
- stable-armv7
|
||||
- ${CI_COMMIT_SHA:0:8}-armv7
|
||||
|
||||
docker-stable-tag-armv7:
|
||||
image: *kaniko_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||
settings:
|
||||
<<: *armv7_docker_variables
|
||||
tags:
|
||||
- <<: *armv7_tags
|
||||
- ${CI_COMMIT_TAG}-armv7
|
||||
78
.woodpecker/lint.yaml
Normal file
78
.woodpecker/lint.yaml
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
when:
|
||||
- event: pull_request
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate"'
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
|
||||
steps:
|
||||
mix-format:
|
||||
image: &elixir-image
|
||||
docker.io/elixir:1.15-alpine
|
||||
entrypoint: *script_file_entrypoint
|
||||
failure: ignore
|
||||
commands:
|
||||
- |
|
||||
if ! mix format --check-formatted; then
|
||||
touch fail.stamp
|
||||
exit 1
|
||||
fi
|
||||
|
||||
credo:
|
||||
image: *elixir-image
|
||||
entrypoint: *script_file_entrypoint
|
||||
failure: ignore
|
||||
environment:
|
||||
MIX_ENV: test
|
||||
commands:
|
||||
- apk add --no-cache build-base cmake exiftool ffmpeg file-dev git openssl
|
||||
- adduser -D -h /home/testuser testuser
|
||||
- mkdir -p /home/testuser/.mix /home/testuser/.hex
|
||||
- chown -R testuser:testuser . /home/testuser
|
||||
- su testuser -c "HOME=/home/testuser mix local.hex --force"
|
||||
- su testuser -c "HOME=/home/testuser mix local.rebar --force"
|
||||
- su testuser -c "HOME=/home/testuser mix deps.get"
|
||||
- |
|
||||
if ! su testuser -c "HOME=/home/testuser mix analyze"; then
|
||||
touch fail.stamp
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# cycles:
|
||||
# image: *elixir-image
|
||||
# failure: ignore
|
||||
# commands:
|
||||
# - apk add --no-cache build-base cmake exiftool ffmpeg file-dev git openssl
|
||||
# - adduser -D -h /home/testuser testuser
|
||||
# - mkdir -p /home/testuser/.mix /home/testuser/.hex
|
||||
# - chown -R testuser:testuser . /home/testuser
|
||||
# - su testuser -c "HOME=/home/testuser mix local.hex --force"
|
||||
# - su testuser -c "HOME=/home/testuser mix local.rebar --force"
|
||||
# - su testuser -c "HOME=/home/testuser mix compile"
|
||||
# - |
|
||||
# if ! su testuser -c "HOME=/home/testuser mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != \"No cycles found\")}'"; then
|
||||
# touch fail.stamp
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
ensure-status:
|
||||
image: *elixir-image
|
||||
entrypoint: *script_file_entrypoint
|
||||
commands: |
|
||||
if test -f fail.stamp; then
|
||||
echo "One or more previous steps fails. Failing workflow..."
|
||||
exit 1
|
||||
else
|
||||
echo "All steps passed"
|
||||
exit 0
|
||||
fi
|
||||
292
.woodpecker/otp-musl.yaml
Normal file
292
.woodpecker/otp-musl.yaml
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
when:
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
- event: tag
|
||||
- event: manual
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
branch: stable
|
||||
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm
|
||||
- linux/arm64
|
||||
|
||||
# This is needed for the when clauses below.
|
||||
# When the platform clause is fixed, this might not be needed anymore
|
||||
labels:
|
||||
platform: ${platform}
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
build_cmds: &build_cmds
|
||||
- apk add git build-base cmake file-dev openssl vips-dev zip
|
||||
- echo "import Config" > config/prod.secret.exs
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix deps.get --only prod
|
||||
- mkdir release
|
||||
- export PLEROMA_BUILD_BRANCH=${CI_COMMIT_BRANCH}
|
||||
- mix release --path release
|
||||
build_image_amd64: &build_image_amd64 docker.io/hexpm/elixir-amd64:1.17.3-erlang-27.3.4.2-alpine-3.22.1
|
||||
build_image_arm: &build_image_arm docker.io/arm32v7/elixir:1.17.3-alpine
|
||||
build_image_arm64: &build_image_arm64 docker.io/hexpm/elixir-arm64:1.17.3-erlang-27.3.4.2-alpine-3.22.1
|
||||
artifacts_uploader_image: &artifacts_uploader_image docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0
|
||||
artifacts_uploader_settings: &artifacts_uploader_settings
|
||||
user:
|
||||
from_secret: pleroma-ci-user
|
||||
password:
|
||||
from_secret: pleroma-ci-password
|
||||
owner: 'pleroma'
|
||||
env: &env
|
||||
MIX_ENV: prod
|
||||
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||
|
||||
steps:
|
||||
otp-develop-amd64-musl:
|
||||
image: *build_image_amd64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
environment: *env
|
||||
commands: &amd64_build
|
||||
- <<: *build_cmds
|
||||
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip release
|
||||
|
||||
otp-stable-amd64-musl:
|
||||
image: *build_image_amd64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
environment: *env
|
||||
commands: *amd64_build
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
otp-stable-tag-amd64-musl:
|
||||
image: *build_image_amd64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
environment: *env
|
||||
commands:
|
||||
- <<: *build_cmds
|
||||
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip release
|
||||
|
||||
otp-develop-arm-musl:
|
||||
image: *build_image_arm
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
environment: *env
|
||||
commands: &arm_build
|
||||
- <<: *build_cmds
|
||||
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip release
|
||||
|
||||
otp-stable-arm-musl:
|
||||
image: *build_image_arm
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
environment: *env
|
||||
commands: *arm_build
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
otp-stable-tag-arm-musl:
|
||||
image: *build_image_arm
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
environment: *env
|
||||
commands:
|
||||
- <<: *build_cmds
|
||||
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip release
|
||||
|
||||
otp-develop-arm64-musl:
|
||||
image: *build_image_arm64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
environment: *env
|
||||
commands: &arm64_build
|
||||
- <<: *build_cmds
|
||||
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip release
|
||||
|
||||
otp-stable-arm64-musl:
|
||||
image: *build_image_arm64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
environment: *env
|
||||
commands: *arm64_build
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
otp-stable-tag-arm64-musl:
|
||||
image: *build_image_arm64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
environment: *env
|
||||
commands:
|
||||
- <<: *build_cmds
|
||||
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip release
|
||||
|
||||
upload-artifacts-amd64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64-musl
|
||||
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||
update: 'true'
|
||||
|
||||
upload-latest-amd64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64-musl
|
||||
package_version: latest
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-artifacts-tag-amd64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-amd64-musl
|
||||
package_version: stable-${CI_COMMIT_SHA:0:8}-amd64-musl
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-latest-tag-amd64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-amd64-musl
|
||||
package_version: latest
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
upload-artifacts-arm-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm-musl
|
||||
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||
update: 'true'
|
||||
|
||||
upload-latest-arm-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm-musl
|
||||
package_version: latest
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-artifacts-tag-arm-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm-musl
|
||||
package_version: stable-${CI_COMMIT_SHA:0:8}-arm-musl
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-latest-tag-arm-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm-musl
|
||||
package_version: latest
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
upload-artifacts-arm64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64-musl
|
||||
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||
update: 'true'
|
||||
|
||||
upload-latest-arm64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64-musl
|
||||
package_version: latest
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-artifacts-tag-arm64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm64-musl
|
||||
package_version: stable-${CI_COMMIT_SHA:0:8}-arm64-musl
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-latest-tag-arm64-musl:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm64-musl
|
||||
package_version: latest
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
293
.woodpecker/otp.yaml
Normal file
293
.woodpecker/otp.yaml
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
when:
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
- event: tag
|
||||
- event: manual
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
- event: manual
|
||||
branch: stable
|
||||
|
||||
matrix:
|
||||
platform:
|
||||
- linux/amd64
|
||||
- linux/arm
|
||||
- linux/arm64
|
||||
|
||||
# This is needed for the when clauses below.
|
||||
# When the platform clause is fixed, this might not be needed anymore
|
||||
labels:
|
||||
platform: ${platform}
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
build_cmds: &build_cmds
|
||||
- apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev git build-essential zip
|
||||
- echo "import Config" > config/prod.secret.exs
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix deps.get --only prod
|
||||
- mkdir release
|
||||
- export PLEROMA_BUILD_BRANCH=${CI_COMMIT_BRANCH}
|
||||
- mix release --path release
|
||||
build_image_amd64: &build_image_amd64 docker.io/hexpm/elixir-amd64:1.17.3-erlang-27.3.4.2-ubuntu-noble-20250716
|
||||
build_image_arm: &build_image_arm docker.io/arm32v7/elixir:1.17.3
|
||||
build_image_arm64: &build_image_arm64 docker.io/hexpm/elixir-arm64:1.17.3-erlang-27.3.4.2-ubuntu-noble-20250716
|
||||
artifacts_uploader_image: &artifacts_uploader_image docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0
|
||||
artifacts_uploader_settings: &artifacts_uploader_settings
|
||||
user:
|
||||
from_secret: pleroma-ci-user
|
||||
password:
|
||||
from_secret: pleroma-ci-password
|
||||
owner: 'pleroma'
|
||||
env: &env
|
||||
MIX_ENV: prod
|
||||
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
steps:
|
||||
otp-develop-amd64:
|
||||
image: *build_image_amd64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
environment: *env
|
||||
commands: &amd64_build
|
||||
- <<: *build_cmds
|
||||
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip release
|
||||
|
||||
otp-stable-amd64:
|
||||
image: *build_image_amd64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
environment: *env
|
||||
commands: *amd64_build
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
otp-stable-tag-amd64:
|
||||
image: *build_image_amd64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
environment: *env
|
||||
commands:
|
||||
- <<: *build_cmds
|
||||
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-amd64.zip release
|
||||
|
||||
otp-develop-arm:
|
||||
image: *build_image_arm
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
environment: *env
|
||||
commands: &arm_build
|
||||
- <<: *build_cmds
|
||||
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip release
|
||||
|
||||
otp-stable-arm:
|
||||
image: *build_image_arm
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
environment: *env
|
||||
commands: *arm_build
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
otp-stable-tag-arm:
|
||||
image: *build_image_arm
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
environment: *env
|
||||
commands:
|
||||
- <<: *build_cmds
|
||||
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm.zip release
|
||||
|
||||
otp-develop-arm64:
|
||||
image: *build_image_arm64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
environment: *env
|
||||
commands: &arm64_build
|
||||
- <<: *build_cmds
|
||||
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip release
|
||||
|
||||
otp-stable-arm64:
|
||||
image: *build_image_arm64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||
environment: *env
|
||||
commands: *arm64_build
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
otp-stable-tag-arm64:
|
||||
image: *build_image_arm64
|
||||
entrypoint: *script_file_entrypoint
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
environment: *env
|
||||
commands:
|
||||
- <<: *build_cmds
|
||||
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm64.zip release
|
||||
|
||||
upload-artifacts-amd64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64
|
||||
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||
update: 'true'
|
||||
|
||||
upload-latest-amd64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64
|
||||
package_version: latest
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-artifacts-tag-amd64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-amd64
|
||||
package_version: stable-${CI_COMMIT_SHA:0:8}-amd64
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-latest-tag-amd64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-amd64
|
||||
package_version: latest
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
upload-artifacts-arm:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm
|
||||
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||
update: 'true'
|
||||
|
||||
upload-latest-arm:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm
|
||||
package_version: latest
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-artifacts-tag-arm:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm
|
||||
package_version: stable-${CI_COMMIT_SHA:0:8}-arm
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-latest-tag-arm:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm
|
||||
package_version: latest
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
upload-artifacts-arm64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64
|
||||
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||
update: 'true'
|
||||
|
||||
upload-latest-arm64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64
|
||||
package_version: latest
|
||||
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-artifacts-tag-arm64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm64
|
||||
package_version: stable-${CI_COMMIT_SHA:0:8}-arm64
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||
update: 'true'
|
||||
|
||||
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||
upload-latest-tag-arm64:
|
||||
image: *artifacts_uploader_image
|
||||
when:
|
||||
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||
settings:
|
||||
<<: *artifacts_uploader_settings
|
||||
package_name: pleroma-otp-stable-arm64
|
||||
package_version: latest
|
||||
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||
file_name: pleroma.zip
|
||||
update: 'true'
|
||||
64
.woodpecker/paradedb-integration.yaml
Normal file
64
.woodpecker/paradedb-integration.yaml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
when:
|
||||
- event: pull_request
|
||||
path:
|
||||
- ".woodpecker/**"
|
||||
- "lib/pleroma/search/**"
|
||||
- "test/pleroma/search/**"
|
||||
- "mix.exs"
|
||||
- "mix.lock"
|
||||
evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate"'
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path:
|
||||
- ".woodpecker/**"
|
||||
- "lib/pleroma/search/**"
|
||||
- "test/pleroma/search/**"
|
||||
- "mix.exs"
|
||||
- "mix.lock"
|
||||
|
||||
depends_on:
|
||||
- lint
|
||||
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
|
||||
steps:
|
||||
paradedb-integration:
|
||||
image: docker.io/elixir:1.19-otp-28-alpine
|
||||
entrypoint: *script_file_entrypoint
|
||||
environment:
|
||||
MIX_ENV: test
|
||||
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||
DB_HOST: postgres
|
||||
DB_PORT: 5432
|
||||
PARADEDB_TEST_URL: postgres://postgres:postgres@paradedb:5432/paradedb
|
||||
commands:
|
||||
- apk add --no-cache build-base cmake exiftool ffmpeg vips-dev file-dev git openssl postgresql-client
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix deps.get
|
||||
- timeout 60 sh -c 'until pg_isready -h postgres -U postgres -d pleroma_test; do sleep 1; done' || { echo "PostgreSQL did not become ready" >&2; exit 1; }
|
||||
- timeout 60 sh -c 'until pg_isready -h paradedb -U postgres -d paradedb; do sleep 1; done' || { echo "ParadeDB did not become ready" >&2; exit 1; }
|
||||
- mix ecto.create
|
||||
- mix ecto.migrate
|
||||
- mix test --include integration test/pleroma/search/parade_db_integration_test.exs
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: docker.io/postgres:13-alpine
|
||||
environment:
|
||||
POSTGRES_DB: pleroma_test
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
paradedb:
|
||||
image: docker.io/paradedb/paradedb:0.24.3-pg15@sha256:997d62f6c2605becb7c45878af3f8c8c698f355006b675b3ce212d4eb2d14f2e
|
||||
environment:
|
||||
POSTGRES_DB: paradedb
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
46
.woodpecker/unit-testing-elixir-1.15.yaml
Normal file
46
.woodpecker/unit-testing-elixir-1.15.yaml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
when:
|
||||
- event: pull_request
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate"'
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
|
||||
depends_on:
|
||||
- lint
|
||||
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
|
||||
steps:
|
||||
unit-testing-elixir-1.15:
|
||||
image: elixir:1.15-alpine
|
||||
entrypoint: *script_file_entrypoint
|
||||
environment:
|
||||
MIX_ENV: test
|
||||
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||
DB_HOST: postgres
|
||||
DB_PORT: 5432
|
||||
commands:
|
||||
- apk add --no-cache build-base cmake exiftool ffmpeg vips-dev file-dev git openssl
|
||||
- adduser -D -h /home/testuser testuser
|
||||
- mkdir -p /home/testuser/.mix /home/testuser/.hex
|
||||
- chown -R testuser:testuser . /home/testuser
|
||||
- su testuser -c "HOME=/home/testuser mix local.hex --force"
|
||||
- su testuser -c "HOME=/home/testuser mix local.rebar --force"
|
||||
- su testuser -c "HOME=/home/testuser mix deps.get"
|
||||
- su testuser -c "HOME=/home/testuser mix pleroma.test_runner --preload-modules"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:13-alpine
|
||||
environment:
|
||||
POSTGRES_DB: pleroma_test
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
46
.woodpecker/unit-testing-elixir-1.19.yaml
Normal file
46
.woodpecker/unit-testing-elixir-1.19.yaml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
when:
|
||||
- event: pull_request
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate"'
|
||||
- event: push
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||
|
||||
depends_on:
|
||||
- lint
|
||||
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
variables:
|
||||
script_file_entrypoint: &script_file_entrypoint
|
||||
- /bin/sh
|
||||
- -c
|
||||
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||
|
||||
steps:
|
||||
unit-testing-elixir-1.19:
|
||||
image: elixir:1.19-otp-28-alpine
|
||||
entrypoint: *script_file_entrypoint
|
||||
environment:
|
||||
MIX_ENV: test
|
||||
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||
DB_HOST: postgres
|
||||
DB_PORT: 5432
|
||||
commands:
|
||||
- apk add --no-cache build-base cmake exiftool ffmpeg vips-dev file-dev git openssl
|
||||
- adduser -D -h /home/testuser testuser
|
||||
- mkdir -p /home/testuser/.mix /home/testuser/.hex
|
||||
- chown -R testuser:testuser . /home/testuser
|
||||
- su testuser -c "HOME=/home/testuser mix local.hex --force"
|
||||
- su testuser -c "HOME=/home/testuser mix local.rebar --force"
|
||||
- su testuser -c "HOME=/home/testuser mix deps.get"
|
||||
- su testuser -c "HOME=/home/testuser mix pleroma.test_runner --preload-modules"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:13-alpine
|
||||
environment:
|
||||
POSTGRES_DB: pleroma_test
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
407
CHANGELOG.md
407
CHANGELOG.md
File diff suppressed because it is too large
Load diff
13
Dockerfile
13
Dockerfile
|
|
@ -1,10 +1,12 @@
|
|||
# https://hub.docker.com/r/hexpm/elixir/tags
|
||||
ARG ELIXIR_IMG=hexpm/elixir
|
||||
ARG ELIXIR_VER=1.14.5
|
||||
ARG ERLANG_VER=25.3.2.14
|
||||
ARG ALPINE_VER=3.17.9
|
||||
ARG ELIXIR_VER=1.17.3
|
||||
ARG ERLANG_VER=27.3.4.14
|
||||
ARG ALPINE_VER=3.23.5
|
||||
ARG ELIXIR_TAG=${ELIXIR_VER}-erlang-${ERLANG_VER}-alpine-${ALPINE_VER}
|
||||
ARG ALPINE_IMG=alpine
|
||||
|
||||
FROM ${ELIXIR_IMG}:${ELIXIR_VER}-erlang-${ERLANG_VER}-alpine-${ALPINE_VER} as build
|
||||
FROM ${ELIXIR_IMG}:${ELIXIR_TAG} AS build
|
||||
|
||||
COPY . .
|
||||
|
||||
|
|
@ -15,11 +17,12 @@ RUN apk add git gcc g++ musl-dev make cmake file-dev vips-dev &&\
|
|||
echo "import Config" > config/prod.secret.exs &&\
|
||||
mix local.hex --force &&\
|
||||
mix local.rebar --force &&\
|
||||
mix deps.clean --all &&\
|
||||
mix deps.get --only prod &&\
|
||||
mkdir release &&\
|
||||
mix release --path release
|
||||
|
||||
FROM alpine:${ALPINE_VER}
|
||||
FROM ${ALPINE_IMG}:${ALPINE_VER}
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
|
|
|
|||
61
Dockerfile-e2e
Normal file
61
Dockerfile-e2e
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# https://hub.docker.com/r/hexpm/elixir/tags
|
||||
ARG ELIXIR_IMG=docker.io/hexpm/elixir
|
||||
ARG ALPINE_IMG=docker.io/alpine
|
||||
ARG ELIXIR_VER=1.18.4
|
||||
ARG ERLANG_VER=27.3.4.11
|
||||
ARG ALPINE_VER=3.23.4
|
||||
|
||||
FROM ${ELIXIR_IMG}:${ELIXIR_VER}-erlang-${ERLANG_VER}-alpine-${ALPINE_VER} AS build
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV MIX_ENV=prod
|
||||
ENV VIX_COMPILATION_MODE=PLATFORM_PROVIDED_LIBVIPS
|
||||
|
||||
RUN apk add git gcc g++ musl-dev make cmake file-dev vips-dev &&\
|
||||
echo "import Config" > config/prod.secret.exs &&\
|
||||
mix local.hex --force &&\
|
||||
mix local.rebar --force &&\
|
||||
mix deps.clean --all &&\
|
||||
mix deps.get --only prod &&\
|
||||
mkdir release &&\
|
||||
mix release --path release
|
||||
|
||||
FROM ${ALPINE_IMG}:${ALPINE_VER}
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
|
||||
LABEL maintainer="ops@pleroma.social" \
|
||||
org.opencontainers.image.title="pleroma" \
|
||||
org.opencontainers.image.description="Pleroma FE E2E test image" \
|
||||
org.opencontainers.image.authors="ops@pleroma.social" \
|
||||
org.opencontainers.image.vendor="pleroma.social" \
|
||||
org.opencontainers.image.documentation="https://git.pleroma.social/pleroma/pleroma" \
|
||||
org.opencontainers.image.licenses="AGPL-3.0" \
|
||||
org.opencontainers.image.url="https://pleroma.social" \
|
||||
org.opencontainers.image.revision=$VCS_REF \
|
||||
org.opencontainers.image.created=$BUILD_DATE
|
||||
|
||||
ARG HOME=/opt/pleroma
|
||||
ARG DATA=/var/lib/pleroma
|
||||
|
||||
RUN apk update &&\
|
||||
apk add exiftool ffmpeg vips libmagic ncurses postgresql-client &&\
|
||||
adduser --system --shell /bin/false --home ${HOME} pleroma &&\
|
||||
mkdir -p ${DATA}/uploads &&\
|
||||
mkdir -p ${DATA}/static &&\
|
||||
chown -R pleroma ${DATA} &&\
|
||||
mkdir -p /etc/pleroma &&\
|
||||
chown -R pleroma /etc/pleroma
|
||||
|
||||
USER pleroma
|
||||
|
||||
COPY --from=build --chown=pleroma:0 /release ${HOME}
|
||||
|
||||
COPY --chown=pleroma --chmod=640 ./config/docker.exs /etc/pleroma/config.exs
|
||||
COPY ./docker-entrypoint-e2e.sh ${HOME}
|
||||
|
||||
EXPOSE 4000
|
||||
|
||||
ENTRYPOINT ["/opt/pleroma/docker-entrypoint-e2e.sh"]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<img src="https://git.pleroma.social/pleroma/pleroma/uploads/8cec84f5a084d887339f57deeb8a293e/pleroma-banner-vector-nopad-notext.svg" width="300px" />
|
||||
<img src="https://git.pleroma.social/pleroma/pleroma/raw/branch/develop/logo-with-name.png" width="300px" />
|
||||
|
||||
## About
|
||||
|
||||
|
|
@ -19,8 +19,6 @@ If you are running Linux (glibc or musl) on x86/arm, the recommended way to inst
|
|||
If your platform is not supported, or you just want to be able to edit the source code easily, you may install Pleroma from source.
|
||||
|
||||
- [Alpine Linux](https://docs-develop.pleroma.social/backend/installation/alpine_linux_en/)
|
||||
- [Arch Linux](https://docs-develop.pleroma.social/backend/installation/arch_linux_en/)
|
||||
- [CentOS 7](https://docs-develop.pleroma.social/backend/installation/centos7_en/)
|
||||
- [Debian-based](https://docs-develop.pleroma.social/backend/installation/debian_based_en/)
|
||||
- [Debian-based (jp)](https://docs-develop.pleroma.social/backend/installation/debian_based_jp/)
|
||||
- [FreeBSD](https://docs-develop.pleroma.social/backend/installation/freebsd_en/)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Performance: Use 301 (permanent) redirect instead of 302 (temporary) when redirecting small images in media proxy. This allows browsers to cache the redirect response.
|
||||
1
changelog.d/account-favourites-order.fix
Normal file
1
changelog.d/account-favourites-order.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed `/api/v1/pleroma/accounts/:id/favourites` ordering and pagination to use the favourite date.
|
||||
1
changelog.d/activitypub-bot-rfc9421-fallback.fix
Normal file
1
changelog.d/activitypub-bot-rfc9421-fallback.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Reject unsupported or ambiguous inbox signatures instead of queueing a doomed failed-signature retry, allowing clients to fall back to legacy HTTP Signatures.
|
||||
1
changelog.d/admin-api-passwordless-accounts.add
Normal file
1
changelog.d/admin-api-passwordless-accounts.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Allow creating accounts without a password in the AdminAPI
|
||||
|
|
@ -1 +0,0 @@
|
|||
Link to exported outbox/followers/following collections in backup actor.json
|
||||
1
changelog.d/captcha-package.fix
Normal file
1
changelog.d/captcha-package.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Switch native captcha to the published pleroma_captcha Hex package.
|
||||
1
changelog.d/context-cleanup.skip
Normal file
1
changelog.d/context-cleanup.skip
Normal file
|
|
@ -0,0 +1 @@
|
|||
litepub-0.1.jsonld cleanup
|
||||
1
changelog.d/disabling-chats.change
Normal file
1
changelog.d/disabling-chats.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Allow disabling Chats feature
|
||||
1
changelog.d/docker-baseimage-ssl.fix
Normal file
1
changelog.d/docker-baseimage-ssl.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Dockerfile: update base images to fix problems with SSL handshakes
|
||||
1
changelog.d/elixir-1-19.add
Normal file
1
changelog.d/elixir-1-19.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Implemented ConfigDB configuration blacklist and accompanying Mix task
|
||||
1
changelog.d/elixir-1-19.fix
Normal file
1
changelog.d/elixir-1-19.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed Elixir 1.19 warnings
|
||||
1
changelog.d/featured-collection-page.fix
Normal file
1
changelog.d/featured-collection-page.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Support fetching featured collection items from the first collection page
|
||||
1
changelog.d/fedidev-federation-compat.add
Normal file
1
changelog.d/fedidev-federation-compat.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Accept more real-world ActivityPub object shapes collected by fedidev.fun
|
||||
1
changelog.d/fix-preferred-frontend.fix
Normal file
1
changelog.d/fix-preferred-frontend.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix preferred frontend not working due to InstanceStatic plug prematurely returning HTTP 404
|
||||
1
changelog.d/grouped-notifications-api.add
Normal file
1
changelog.d/grouped-notifications-api.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Add Mastodon-compatible grouped notifications API endpoints under `/api/v2/notifications` for newly-created notifications
|
||||
0
changelog.d/grouped_notifications_flag.skip
Normal file
0
changelog.d/grouped_notifications_flag.skip
Normal file
1
changelog.d/gun-pool-rework.fix
Normal file
1
changelog.d/gun-pool-rework.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed Gun HTTP/1 concurrency, forwarding and authenticated proxy handling, tunnel requests, and streamed connection cleanup. Updated Gun and Cowlib for HTTP client security fixes.
|
||||
1
changelog.d/hashtag-timeline.fix
Normal file
1
changelog.d/hashtag-timeline.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix hashtag timeline query for additional tag handling
|
||||
1
changelog.d/host-header-verification.security
Normal file
1
changelog.d/host-header-verification.security
Normal file
|
|
@ -0,0 +1 @@
|
|||
Ensure Host header is present and matches instance URI
|
||||
1
changelog.d/http-signatures-0.1.3.fix
Normal file
1
changelog.d/http-signatures-0.1.3.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix compatibility with timestamped HTTP Signatures used by GoToSocial
|
||||
1
changelog.d/iceshrimpnet-reports-fix.fix
Normal file
1
changelog.d/iceshrimpnet-reports-fix.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Handle reports with just actor ap id as the object
|
||||
1
changelog.d/list-emoji.add
Normal file
1
changelog.d/list-emoji.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Allow attaching emojis to user lists
|
||||
1
changelog.d/logger-backends.change
Normal file
1
changelog.d/logger-backends.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Changed how Logger is configured due to changes in Elixir and added deprecation warnings for the old configuration format
|
||||
1
changelog.d/majic-1.2.0.change
Normal file
1
changelog.d/majic-1.2.0.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Update majic to 1.2.0.
|
||||
1
changelog.d/mastodon-admin.add
Normal file
1
changelog.d/mastodon-admin.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Implement basics of Mastodon admin API
|
||||
1
changelog.d/mastodon-websocket-protocol.fix
Normal file
1
changelog.d/mastodon-websocket-protocol.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Echo Mastodon-style `Sec-WebSocket-Protocol` tokens in streaming WebSocket handshakes.
|
||||
1
changelog.d/mediaproxy-content-type.fix
Normal file
1
changelog.d/mediaproxy-content-type.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Detect image content types for extensionless MediaProxy responses.
|
||||
1
changelog.d/mfm-backend.add
Normal file
1
changelog.d/mfm-backend.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Add backend support for Misskey Markdown (MFM) posts
|
||||
0
changelog.d/mfm-extend.skip
Normal file
0
changelog.d/mfm-extend.skip
Normal file
1
changelog.d/oauth-user-preload.change
Normal file
1
changelog.d/oauth-user-preload.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Avoid a duplicate user query during OAuth authentication.
|
||||
1
changelog.d/oban-plugins-lazarus-hex.change
Normal file
1
changelog.d/oban-plugins-lazarus-hex.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Use the Hex package for oban_plugins_lazarus.
|
||||
1
changelog.d/paradedb-search.add
Normal file
1
changelog.d/paradedb-search.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Add ParadeDB (pg_search) as an optional external search backend, indexing status content, content warnings, and attachment descriptions.
|
||||
1
changelog.d/phoenix-sec-websocket-headers.change
Normal file
1
changelog.d/phoenix-sec-websocket-headers.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Switch patched Phoenix 1.7.14 back to upstream with Phoenix 1.8.0+
|
||||
1
changelog.d/pleroma-fe-link.fix
Normal file
1
changelog.d/pleroma-fe-link.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Updated Pleroma-FE build URL after Forgejo migration
|
||||
1
changelog.d/poll-voters-count-inflation.fix
Normal file
1
changelog.d/poll-voters-count-inflation.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix votersCount inflation when same voter picks multiple options
|
||||
1
changelog.d/previewcard-void-fill.fix
Normal file
1
changelog.d/previewcard-void-fill.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Status: Fill all MastoAPI required values in preview cards
|
||||
1
changelog.d/publisher-worker-atoms.fix
Normal file
1
changelog.d/publisher-worker-atoms.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Avoid creating atoms from serialized PublisherWorker parameters.
|
||||
1
changelog.d/reject-third-party-reports.fix
Normal file
1
changelog.d/reject-third-party-reports.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Reject incoming reports when both the reporter and reported account are remote
|
||||
1
changelog.d/remote-ip-hex.change
Normal file
1
changelog.d/remote-ip-hex.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Use upstream Hex releases for the `remote_ip` dependency and expose client IP ranges for remote IP resolution.
|
||||
1
changelog.d/rss.fix
Normal file
1
changelog.d/rss.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix RSS feeds to be W3C compliant and render better in RSS readers
|
||||
1
changelog.d/stream-domain-block-following.fix
Normal file
1
changelog.d/stream-domain-block-following.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Keep followed users visible in streams when their domain is blocked.
|
||||
0
changelog.d/unit-testing-build-vix.skip
Normal file
0
changelog.d/unit-testing-build-vix.skip
Normal file
1
changelog.d/user-cache-keys.fix
Normal file
1
changelog.d/user-cache-keys.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix inconsistent User cache keys and invalidate numeric ID aliases.
|
||||
1
changelog.d/user-search-sorting.change
Normal file
1
changelog.d/user-search-sorting.change
Normal file
|
|
@ -0,0 +1 @@
|
|||
Improve user search / autocompletion ordering.
|
||||
1
changelog.d/webhooks.add
Normal file
1
changelog.d/webhooks.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Add support for Mastodon-compatible webhooks
|
||||
0
changelog.d/weblate-ci.skip
Normal file
0
changelog.d/weblate-ci.skip
Normal file
1
changelog.d/woodpecker-armv7-fixups.fix
Normal file
1
changelog.d/woodpecker-armv7-fixups.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Include arm32v7 in multi-arch Docker images
|
||||
1
changelog.d/wss-necroposts.fix
Normal file
1
changelog.d/wss-necroposts.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
RichMedia: Fix backfill causing old posts to show up on timelines by disabling it in MastoAPI StatusView
|
||||
8
ci/elixir-1.18.3-otp-27/Dockerfile
Normal file
8
ci/elixir-1.18.3-otp-27/Dockerfile
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
FROM elixir:1.18.3-otp-27
|
||||
|
||||
# Single RUN statement, otherwise intermediate images are created
|
||||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
|
||||
RUN apt-get update &&\
|
||||
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
|
||||
mix local.hex --force &&\
|
||||
mix local.rebar --force
|
||||
1
ci/elixir-1.18.3-otp-27/build_and_push.sh
Executable file
1
ci/elixir-1.18.3-otp-27/build_and_push.sh
Executable file
|
|
@ -0,0 +1 @@
|
|||
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.18.3-otp-27 --push .
|
||||
|
|
@ -48,7 +48,7 @@ config :pleroma, ecto_repos: [Pleroma.Repo]
|
|||
|
||||
config :pleroma, Pleroma.Repo,
|
||||
telemetry_event: [Pleroma.Repo.Instrumenter],
|
||||
migration_lock: nil
|
||||
migration_lock: :pg_advisory_lock
|
||||
|
||||
config :pleroma, Pleroma.Captcha,
|
||||
enabled: true,
|
||||
|
|
@ -65,7 +65,8 @@ config :pleroma, Pleroma.Upload,
|
|||
proxy_remote: false,
|
||||
filename_display_max_length: 30,
|
||||
default_description: nil,
|
||||
base_url: nil
|
||||
base_url: nil,
|
||||
allowed_mime_types: ["image", "audio", "video"]
|
||||
|
||||
config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
|
||||
|
||||
|
|
@ -132,13 +133,17 @@ config :pleroma, Pleroma.Web.Endpoint,
|
|||
]
|
||||
|
||||
# Configures Elixir's Logger
|
||||
config :logger, backends: [:console]
|
||||
# Primary config
|
||||
config :logger, level: :debug
|
||||
|
||||
config :logger, :console,
|
||||
level: :debug,
|
||||
# Console config
|
||||
config :logger, :default_handler, level: :debug
|
||||
|
||||
config :logger, :default_formatter,
|
||||
format: "\n$time $metadata[$level] $message\n",
|
||||
metadata: [:actor, :path, :type, :user]
|
||||
|
||||
# Syslog config
|
||||
config :logger, :ex_syslogger,
|
||||
level: :debug,
|
||||
ident: "pleroma",
|
||||
|
|
@ -150,7 +155,10 @@ config :mime, :types, %{
|
|||
"application/xrd+xml" => ["xrd+xml"],
|
||||
"application/jrd+json" => ["jrd+json"],
|
||||
"application/activity+json" => ["activity+json"],
|
||||
"application/ld+json" => ["activity+json"]
|
||||
"application/ld+json" => ["activity+json"],
|
||||
# Can be removed when bumping MIME past 2.0.5
|
||||
# see https://akkoma.dev/AkkomaGang/akkoma/issues/657
|
||||
"image/apng" => ["apng"]
|
||||
}
|
||||
|
||||
config :tesla, adapter: Tesla.Adapter.Hackney
|
||||
|
|
@ -190,7 +198,6 @@ config :pleroma, :instance,
|
|||
account_approval_required: false,
|
||||
federating: true,
|
||||
federation_incoming_replies_max_depth: 100,
|
||||
federation_reachability_timeout_days: 7,
|
||||
allow_relay: true,
|
||||
public: true,
|
||||
quarantined_instances: [],
|
||||
|
|
@ -200,7 +207,8 @@ config :pleroma, :instance,
|
|||
"text/plain",
|
||||
"text/html",
|
||||
"text/markdown",
|
||||
"text/bbcode"
|
||||
"text/bbcode",
|
||||
"text/x.misskeymarkdown"
|
||||
],
|
||||
autofollowed_nicknames: [],
|
||||
autofollowing_nicknames: [],
|
||||
|
|
@ -303,6 +311,7 @@ config :pleroma, :frontend_configurations,
|
|||
collapseMessageWithSubject: false,
|
||||
disableChat: false,
|
||||
greentext: false,
|
||||
embeddedToS: true,
|
||||
hideFilteredStatuses: false,
|
||||
hideMutedPosts: false,
|
||||
hidePostStats: false,
|
||||
|
|
@ -359,7 +368,10 @@ config :pleroma, :activitypub,
|
|||
follow_handshake_timeout: 500,
|
||||
note_replies_output_limit: 5,
|
||||
sign_object_fetches: true,
|
||||
authorized_fetch_mode: false
|
||||
authorized_fetch_mode: false,
|
||||
client_api_enabled: false,
|
||||
anonymize_reporter: false,
|
||||
anonymize_reporter_local_nickname: ""
|
||||
|
||||
config :pleroma, :streamer,
|
||||
workers: 3,
|
||||
|
|
@ -413,11 +425,6 @@ config :pleroma, :mrf_vocabulary,
|
|||
accept: [],
|
||||
reject: []
|
||||
|
||||
config :pleroma, :mrf_dnsrbl,
|
||||
nameserver: "127.0.0.1",
|
||||
port: 53,
|
||||
zone: "bl.pleroma.com"
|
||||
|
||||
# threshold of 7 days
|
||||
config :pleroma, :mrf_object_age,
|
||||
threshold: 604_800,
|
||||
|
|
@ -589,6 +596,7 @@ config :pleroma, Pleroma.User,
|
|||
# value or it cannot enforce uniqueness.
|
||||
config :pleroma, Oban,
|
||||
repo: Pleroma.Repo,
|
||||
notifier: Oban.Notifiers.PG,
|
||||
log: false,
|
||||
queues: [
|
||||
activity_expiration: 10,
|
||||
|
|
@ -599,7 +607,7 @@ config :pleroma, Oban,
|
|||
search_indexing: [limit: 10, paused: true],
|
||||
slow: 5
|
||||
],
|
||||
plugins: [{Oban.Plugins.Pruner, max_age: 900}],
|
||||
plugins: [Oban.Plugins.Lazarus, {Oban.Plugins.Pruner, max_age: 900}],
|
||||
crontab: [
|
||||
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
|
||||
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker},
|
||||
|
|
@ -734,6 +742,7 @@ config :pleroma, Pleroma.Workers.PurgeExpiredActivity, enabled: true, min_lifeti
|
|||
config :pleroma, Pleroma.Web.Plugs.RemoteIp,
|
||||
enabled: true,
|
||||
headers: ["x-forwarded-for"],
|
||||
clients: [],
|
||||
proxies: [],
|
||||
reserved: [
|
||||
"127.0.0.0/8",
|
||||
|
|
@ -772,7 +781,7 @@ config :pleroma, :frontends,
|
|||
"name" => "pleroma-fe",
|
||||
"git" => "https://git.pleroma.social/pleroma/pleroma-fe",
|
||||
"build_url" =>
|
||||
"https://git.pleroma.social/pleroma/pleroma-fe/-/jobs/artifacts/${ref}/download?job=build",
|
||||
"https://git.pleroma.social/api/packages/pleroma/generic/pleroma-fe-builds/${ref}/latest.zip",
|
||||
"ref" => "develop"
|
||||
},
|
||||
"fedi-fe" => %{
|
||||
|
|
@ -807,6 +816,13 @@ config :pleroma, :frontends,
|
|||
"https://lily-is.land/infra/glitch-lily/-/jobs/artifacts/${ref}/download?job=build",
|
||||
"ref" => "servant",
|
||||
"build_dir" => "public"
|
||||
},
|
||||
"pl-fe" => %{
|
||||
"name" => "pl-fe",
|
||||
"git" => "https://github.com/mkljczk/pl-fe",
|
||||
"build_url" => "https://pl.mkljczk.pl/pl-fe.zip",
|
||||
"ref" => "develop",
|
||||
"build_dir" => "."
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +932,8 @@ config :pleroma, Pleroma.User.Backup,
|
|||
timeout: :timer.minutes(30)
|
||||
|
||||
config :pleroma, ConcurrentLimiter, [
|
||||
{Pleroma.Search, [max_running: 30, max_waiting: 50]}
|
||||
{Pleroma.Search, [max_running: 30, max_waiting: 50]},
|
||||
{Pleroma.Webhook.Notify, [max_running: 5, max_waiting: 200]}
|
||||
]
|
||||
|
||||
config :pleroma, Pleroma.Web.WebFinger, domain: nil, update_nickname_on_user_fetch: true
|
||||
|
|
@ -928,6 +945,15 @@ config :pleroma, Pleroma.Search.Meilisearch,
|
|||
private_key: nil,
|
||||
initial_indexing_chunk_size: 100_000
|
||||
|
||||
config :pleroma, Pleroma.Search.ParadeDB,
|
||||
url: nil,
|
||||
table: "pleroma_search_documents",
|
||||
fuzzy_distance: 0
|
||||
|
||||
config :pleroma, Pleroma.Search.ParadeDB.Repo,
|
||||
pool_size: 2,
|
||||
prepare: :unnamed
|
||||
|
||||
config :pleroma, Pleroma.Application,
|
||||
background_migrators: true,
|
||||
internal_fetch: true,
|
||||
|
|
@ -950,6 +976,21 @@ config :pleroma, Pleroma.Search.QdrantSearch,
|
|||
vectors: %{size: 384, distance: "Cosine"}
|
||||
}
|
||||
|
||||
config :pleroma, :database_config_blacklist, [
|
||||
{:pleroma, :logger}
|
||||
]
|
||||
|
||||
config :pleroma, :database_config_whitelist, [
|
||||
{:pleroma},
|
||||
{:cors_plug},
|
||||
{:ex_aws, :s3},
|
||||
{:mime},
|
||||
{:prometheus, Pleroma.Web.Endpoint.MetricsExporter},
|
||||
{:web_push_encryption, :vapid_details}
|
||||
]
|
||||
|
||||
config :pleroma, Pleroma.Chat, enabled: true
|
||||
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
# of this file so it overrides the configuration defined above.
|
||||
import_config "#{Mix.env()}.exs"
|
||||
|
|
|
|||
|
|
@ -117,6 +117,19 @@ config :pleroma, :config_description, [
|
|||
key: :filename_display_max_length,
|
||||
type: :integer,
|
||||
description: "Set max length of a filename to display. 0 = no limit. Default: 30"
|
||||
},
|
||||
%{
|
||||
key: :allowed_mime_types,
|
||||
label: "Allowed MIME types",
|
||||
type: {:list, :string},
|
||||
description:
|
||||
"List of MIME (main) types uploads are allowed to identify themselves with. Other types may still be uploaded, but will identify as a generic binary to clients. WARNING: Loosening this over the defaults can lead to security issues. Removing types is safe, but only add to the list if you are sure you know what you are doing.",
|
||||
suggestions: [
|
||||
"image",
|
||||
"audio",
|
||||
"video",
|
||||
"font"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -802,7 +815,8 @@ config :pleroma, :config_description, [
|
|||
"text/plain",
|
||||
"text/html",
|
||||
"text/markdown",
|
||||
"text/bbcode"
|
||||
"text/bbcode",
|
||||
"text/x.misskeymarkdown"
|
||||
]
|
||||
},
|
||||
%{
|
||||
|
|
@ -1248,6 +1262,7 @@ config :pleroma, :config_description, [
|
|||
background: "/static/aurora_borealis.jpg",
|
||||
collapseMessageWithSubject: false,
|
||||
greentext: false,
|
||||
embeddedToS: true,
|
||||
hideFilteredStatuses: false,
|
||||
hideMutedPosts: false,
|
||||
hidePostStats: false,
|
||||
|
|
@ -1299,6 +1314,12 @@ config :pleroma, :config_description, [
|
|||
type: :boolean,
|
||||
description: "Enables green text on lines prefixed with the > character"
|
||||
},
|
||||
%{
|
||||
key: :embeddedToS,
|
||||
label: "Embedded ToS panel",
|
||||
type: :boolean,
|
||||
description: "Hide Terms of Service panel decorations on About and Registration pages"
|
||||
},
|
||||
%{
|
||||
key: :hideFilteredStatuses,
|
||||
label: "Hide Filtered Statuses",
|
||||
|
|
@ -1374,7 +1395,13 @@ config :pleroma, :config_description, [
|
|||
label: "Post Content Type",
|
||||
type: {:dropdown, :atom},
|
||||
description: "Default post formatting option",
|
||||
suggestions: ["text/plain", "text/html", "text/markdown", "text/bbcode"]
|
||||
suggestions: [
|
||||
"text/plain",
|
||||
"text/html",
|
||||
"text/markdown",
|
||||
"text/bbcode",
|
||||
"text/x.misskeymarkdown"
|
||||
]
|
||||
},
|
||||
%{
|
||||
key: :redirectRootNoLogin,
|
||||
|
|
@ -1772,6 +1799,28 @@ config :pleroma, :config_description, [
|
|||
type: :integer,
|
||||
description: "Following handshake timeout",
|
||||
suggestions: [500]
|
||||
},
|
||||
%{
|
||||
key: :client_api_enabled,
|
||||
type: :boolean,
|
||||
description: "Allow client to server ActivityPub interactions"
|
||||
},
|
||||
%{
|
||||
key: :anonymize_reporter,
|
||||
type: :boolean,
|
||||
label: "Anonymize local reports",
|
||||
description:
|
||||
"If true, replace local reporters with the designated local user for the copy to be sent to remote servers"
|
||||
},
|
||||
%{
|
||||
key: :anonymize_reporter_local_nickname,
|
||||
type: :string,
|
||||
label: "Anonymized reporter",
|
||||
description:
|
||||
"The nickname of the designated local user that replaces the actual reporter in the copy to be sent to remote servers",
|
||||
suggestions: [
|
||||
"lain"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -2089,6 +2138,11 @@ config :pleroma, :config_description, [
|
|||
description:
|
||||
"Amount of milliseconds after which the HTTP request is forcibly terminated.",
|
||||
suggestions: [5_000]
|
||||
},
|
||||
%{
|
||||
key: :user_agent,
|
||||
type: :string,
|
||||
description: "Custom User-Agent header to be used when fetching rich media content."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -2672,6 +2726,19 @@ config :pleroma, :config_description, [
|
|||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: Pleroma.Chat,
|
||||
type: :group,
|
||||
description: "Pleroma Chat settings",
|
||||
children: [
|
||||
%{
|
||||
key: :enabled,
|
||||
type: :boolean,
|
||||
description: "Enables the chats API."
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: :http,
|
||||
|
|
@ -2856,7 +2923,7 @@ config :pleroma, :config_description, [
|
|||
key: Pleroma.Web.Plugs.RemoteIp,
|
||||
type: :group,
|
||||
description: """
|
||||
`Pleroma.Web.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration.
|
||||
`Pleroma.Web.Plugs.RemoteIp` is a shim to call [`RemoteIp`](https://hex.pm/packages/remote_ip) but with runtime configuration.
|
||||
**If your instance is not behind at least one reverse proxy, you should not enable this plug.**
|
||||
""",
|
||||
children: [
|
||||
|
|
@ -2872,6 +2939,12 @@ config :pleroma, :config_description, [
|
|||
A list of strings naming the HTTP headers to use when deriving the true client IP. Default: `["x-forwarded-for"]`.
|
||||
"""
|
||||
},
|
||||
%{
|
||||
key: :clients,
|
||||
type: {:list, :string},
|
||||
description:
|
||||
"A list of client IPs or subnets in CIDR notation. These will not be treated as proxies or reserved ranges. Defaults to `[]`. IPv4 entries without a bitmask will be assumed to be /32 and IPv6 /128."
|
||||
},
|
||||
%{
|
||||
key: :proxies,
|
||||
type: {:list, :string},
|
||||
|
|
@ -3025,9 +3098,16 @@ config :pleroma, :config_description, [
|
|||
%{
|
||||
key: :max_connections,
|
||||
type: :integer,
|
||||
description: "Maximum number of connections in the pool. Default: 250 connections.",
|
||||
description:
|
||||
"Maximum total number of connections in the pool. HTTP/1 origins may use multiple connections within this limit, while HTTP/2 connections are multiplexed. Default: 250 connections.",
|
||||
suggestions: [250]
|
||||
},
|
||||
%{
|
||||
key: :max_idle_time,
|
||||
type: :integer,
|
||||
description: "Time before an unused connection is closed. Default: 30000ms.",
|
||||
suggestions: [30_000]
|
||||
},
|
||||
%{
|
||||
key: :connect_timeout,
|
||||
type: :integer,
|
||||
|
|
@ -3286,6 +3366,12 @@ config :pleroma, :config_description, [
|
|||
description:
|
||||
"A map containing available frontends and parameters for their installation.",
|
||||
children: frontend_options
|
||||
},
|
||||
%{
|
||||
key: :pickable,
|
||||
type: {:list, :string},
|
||||
description:
|
||||
"A list containing all frontends users can pick as their preference, format is :name/:ref, e.g pleroma-fe/stable."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -3302,8 +3388,7 @@ config :pleroma, :config_description, [
|
|||
suggestions: [
|
||||
Pleroma.Web.Preload.Providers.Instance,
|
||||
Pleroma.Web.Preload.Providers.User,
|
||||
Pleroma.Web.Preload.Providers.Timelines,
|
||||
Pleroma.Web.Preload.Providers.StatusNet
|
||||
Pleroma.Web.Preload.Providers.Timelines
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -3438,6 +3523,26 @@ config :pleroma, :config_description, [
|
|||
suggestion: [5]
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
key: Pleroma.Webhook.Notify,
|
||||
type: :keyword,
|
||||
description: "Concurrent limits configuration for webhooks.",
|
||||
suggestions: [max_running: 5, max_waiting: 200],
|
||||
children: [
|
||||
%{
|
||||
key: :max_running,
|
||||
type: :integer,
|
||||
description: "Max running concurrently jobs.",
|
||||
suggestion: [5]
|
||||
},
|
||||
%{
|
||||
key: :max_waiting,
|
||||
type: :integer,
|
||||
description: "Max waiting jobs.",
|
||||
suggestion: [200]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -3451,7 +3556,12 @@ config :pleroma, :config_description, [
|
|||
key: :module,
|
||||
type: :keyword,
|
||||
description: "Selected search module.",
|
||||
suggestion: [Pleroma.Search.DatabaseSearch, Pleroma.Search.Meilisearch]
|
||||
suggestion: [
|
||||
Pleroma.Search.DatabaseSearch,
|
||||
Pleroma.Search.Meilisearch,
|
||||
Pleroma.Search.QdrantSearch,
|
||||
Pleroma.Search.ParadeDB
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -3483,5 +3593,115 @@ config :pleroma, :config_description, [
|
|||
suggestion: [100_000]
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: Pleroma.Search.ParadeDB,
|
||||
type: :group,
|
||||
description: "ParadeDB settings.",
|
||||
children: [
|
||||
%{
|
||||
key: :url,
|
||||
type: :string,
|
||||
description:
|
||||
"ParadeDB database URL (separate Postgres instance). " <>
|
||||
"Can also be set via `PARADEDB_DATABASE_URL`.",
|
||||
suggestion: ["postgres://postgres:postgres@127.0.0.1:5432/paradedb"]
|
||||
},
|
||||
%{
|
||||
key: :table,
|
||||
type: :string,
|
||||
description: "Table name used for search documents.",
|
||||
suggestion: ["pleroma_search_documents"]
|
||||
},
|
||||
%{
|
||||
key: :fuzzy_distance,
|
||||
type: :integer,
|
||||
description: "Edit-distance used for fuzzy token matching (0 disables fuzziness, max 2).",
|
||||
suggestion: [0, 1, 2]
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: Pleroma.Language.LanguageDetector,
|
||||
type: :group,
|
||||
description: "Language detection providers",
|
||||
children: [
|
||||
%{
|
||||
key: :provider,
|
||||
type: :module,
|
||||
suggestions: {:list_behaviour_implementations, Pleroma.Language.LanguageDetector.Provider}
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.LanguageDetector.Fasttext},
|
||||
key: :model,
|
||||
label: "fastText language detection model",
|
||||
type: :string,
|
||||
suggestions: ["/usr/share/fasttext/lid.176.bin"]
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: Pleroma.Language.Translation,
|
||||
type: :group,
|
||||
description: "Translation providers",
|
||||
children: [
|
||||
%{
|
||||
key: :provider,
|
||||
type: :module,
|
||||
suggestions: {:list_behaviour_implementations, Pleroma.Language.Translation.Provider}
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.Deepl},
|
||||
key: :base_url,
|
||||
label: "DeepL base URL",
|
||||
type: :string,
|
||||
suggestions: ["https://api-free.deepl.com", "https://api.deepl.com"]
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.Deepl},
|
||||
key: :api_key,
|
||||
label: "DeepL API Key",
|
||||
type: :string,
|
||||
suggestions: ["YOUR_API_KEY"]
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.Libretranslate},
|
||||
key: :base_url,
|
||||
label: "LibreTranslate instance URL",
|
||||
type: :string,
|
||||
suggestions: ["https://libretranslate.com"]
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.Libretranslate},
|
||||
key: :api_key,
|
||||
label: "LibreTranslate API Key",
|
||||
type: :string,
|
||||
suggestions: ["YOUR_API_KEY"]
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.TranslateLocally},
|
||||
key: :intermediary_language,
|
||||
label:
|
||||
"translateLocally intermediary language (used when direct source->target model is not available)",
|
||||
type: :string,
|
||||
suggestions: ["en"]
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.Mozhi},
|
||||
key: :base_url,
|
||||
label: "Mozhi instance URL",
|
||||
type: :string
|
||||
},
|
||||
%{
|
||||
group: {:subgroup, Pleroma.Language.Translation.Mozhi},
|
||||
key: :engine,
|
||||
label: "Engine used for Mozhi",
|
||||
type: :string,
|
||||
suggestions: ["libretranslate"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Local
|
|||
# different ports.
|
||||
|
||||
# Do not include timestamps in development logs
|
||||
config :logger, Logger.Backends.Console, format: "$metadata[$level] $message\n"
|
||||
config :logger, :default_formatter, format: "$metadata[$level] $message\n"
|
||||
|
||||
# Set a higher stacktrace during development. Avoid configuring such
|
||||
# in production as building large stacktraces may be expensive.
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ config :pleroma, Pleroma.Web.Endpoint,
|
|||
config :phoenix, serve_endpoints: true
|
||||
|
||||
# Do not print debug messages in production
|
||||
config :logger, Logger.Backends.Console, level: :info
|
||||
config :logger, :console, level: :info
|
||||
config :logger, :default_handler, level: :info
|
||||
config :logger, :ex_syslogger, level: :info
|
||||
|
||||
# ## SSL Support
|
||||
|
|
|
|||
|
|
@ -15,9 +15,11 @@ config :pleroma, Pleroma.Captcha,
|
|||
method: Pleroma.Captcha.Mock
|
||||
|
||||
# Print only warnings and errors during test
|
||||
config :logger, :console,
|
||||
level: :warning,
|
||||
format: "\n[$level] $message\n"
|
||||
config :logger, :default_handler, level: :warning
|
||||
|
||||
config :logger, :default_formatter,
|
||||
format: "\n[$level] $message\n",
|
||||
colors: [enabled: false]
|
||||
|
||||
config :pleroma, :auth, oauth_consumer_strategies: []
|
||||
|
||||
|
|
@ -38,7 +40,10 @@ config :pleroma, :instance,
|
|||
external_user_synchronization: false,
|
||||
static_dir: "test/instance_static/"
|
||||
|
||||
config :pleroma, :activitypub, sign_object_fetches: false, follow_handshake_timeout: 0
|
||||
config :pleroma, :activitypub,
|
||||
sign_object_fetches: false,
|
||||
follow_handshake_timeout: 0,
|
||||
client_api_enabled: true
|
||||
|
||||
# Configure your database
|
||||
config :pleroma, Pleroma.Repo,
|
||||
|
|
@ -99,7 +104,6 @@ config :pleroma, :http, send_user_agent: false
|
|||
|
||||
rum_enabled = System.get_env("RUM_ENABLED") == "true"
|
||||
config :pleroma, :database, rum_enabled: rum_enabled
|
||||
IO.puts("RUM enabled: #{rum_enabled}")
|
||||
|
||||
config :joken, default_signer: "yU8uHKq+yyAkZ11Hx//jcdacWc8yQ1bxAAGrplzB0Zwwjkp35v0RK9SO8WTPr6QZ"
|
||||
|
||||
|
|
@ -144,6 +148,7 @@ config :pleroma, Pleroma.Search.Meilisearch, url: "http://127.0.0.1:7700/", priv
|
|||
config :phoenix, :plug_init_mode, :runtime
|
||||
|
||||
config :pleroma, :config_impl, Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, :datetime_impl, Pleroma.DateTimeMock
|
||||
|
||||
config :pleroma, Pleroma.PromEx, disabled: true
|
||||
|
||||
|
|
@ -152,13 +157,24 @@ config :pleroma, Pleroma.User.Backup, config_impl: Pleroma.UnstubbedConfigMock
|
|||
config :pleroma, Pleroma.Uploaders.S3, ex_aws_impl: Pleroma.Uploaders.S3.ExAwsMock
|
||||
config :pleroma, Pleroma.Uploaders.S3, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Language.LanguageDetector, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
config :pleroma, Pleroma.Uploaders.IPFS, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
config :pleroma, Pleroma.Web.Plugs.HTTPSignaturePlug, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
|
||||
config :pleroma, Pleroma.Upload.Filter.AnonymizeFilename,
|
||||
config_impl: Pleroma.StaticStubbedConfigMock
|
||||
|
||||
config :pleroma, Pleroma.Upload.Filter.Mogrify, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
config :pleroma, Pleroma.Upload.Filter.Mogrify, mogrify_impl: Pleroma.MogrifyMock
|
||||
|
||||
config :pleroma, Pleroma.Signature, http_signatures_impl: Pleroma.StubbedHTTPSignaturesMock
|
||||
config :pleroma, Pleroma.Web.ActivityPub.Publisher, signature_impl: Pleroma.SignatureMock
|
||||
|
||||
config :pleroma, Pleroma.Web.ActivityPub.Publisher,
|
||||
transmogrifier_impl: Pleroma.Web.ActivityPub.TransmogrifierMock
|
||||
|
||||
peer_module =
|
||||
if String.to_integer(System.otp_release()) >= 25 do
|
||||
|
|
@ -177,7 +193,7 @@ config :pleroma, Pleroma.Application,
|
|||
streamer_registry: false,
|
||||
test_http_pools: true
|
||||
|
||||
config :pleroma, Pleroma.Web.Streaming, sync_streaming: true
|
||||
config :pleroma, Pleroma.Web.Streamer, sync_streaming: true
|
||||
|
||||
config :pleroma, Pleroma.Uploaders.Uploader, timeout: 1_000
|
||||
|
||||
|
|
@ -192,8 +208,9 @@ config :pleroma, Pleroma.User.Backup, tempdir: "test/tmp"
|
|||
|
||||
if File.exists?("./config/test.secret.exs") do
|
||||
import_config "test.secret.exs"
|
||||
else
|
||||
IO.puts(
|
||||
"You may want to create test.secret.exs to declare custom database connection parameters."
|
||||
)
|
||||
end
|
||||
|
||||
# Avoid noisy shutdown logs from os_mon during tests.
|
||||
config :os_mon,
|
||||
start_cpu_sup: false,
|
||||
start_memsup: false
|
||||
|
|
|
|||
70
docker-entrypoint-e2e.sh
Executable file
70
docker-entrypoint-e2e.sh
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
#!/bin/ash
|
||||
set -eu
|
||||
|
||||
SEED_SENTINEL_PATH=/var/lib/pleroma/.e2e_seeded
|
||||
CONFIG_OVERRIDE_PATH=/var/lib/pleroma/config.exs
|
||||
|
||||
echo '-- Waiting for database...'
|
||||
while ! pg_isready -U "${DB_USER:-pleroma}" -d "postgres://${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-pleroma}" -t 1; do
|
||||
sleep 1s
|
||||
done
|
||||
|
||||
echo '-- Writing E2E config overrides...'
|
||||
cat > "$CONFIG_OVERRIDE_PATH" <<EOF
|
||||
import Config
|
||||
|
||||
config :pleroma, Pleroma.Captcha,
|
||||
enabled: false
|
||||
|
||||
config :pleroma, :instance,
|
||||
registrations_open: true,
|
||||
account_activation_required: false,
|
||||
account_approval_required: false
|
||||
EOF
|
||||
|
||||
echo '-- Running migrations...'
|
||||
/opt/pleroma/bin/pleroma_ctl migrate
|
||||
|
||||
if [ ! -f "$SEED_SENTINEL_PATH" ]; then
|
||||
if [ -n "${E2E_ADMIN_USERNAME:-}" ] && [ -n "${E2E_ADMIN_PASSWORD:-}" ] && [ -n "${E2E_ADMIN_EMAIL:-}" ]; then
|
||||
echo '-- Seeding admin user' "$E2E_ADMIN_USERNAME" '...'
|
||||
if ! PLEROMA_CTL_RPC_DISABLED=true /opt/pleroma/bin/pleroma_ctl user new "$E2E_ADMIN_USERNAME" "$E2E_ADMIN_EMAIL" --admin --password "$E2E_ADMIN_PASSWORD" -y; then
|
||||
echo '-- User already exists or creation failed, ensuring admin + confirmed...'
|
||||
PLEROMA_CTL_RPC_DISABLED=true /opt/pleroma/bin/pleroma_ctl user set "$E2E_ADMIN_USERNAME" --admin --confirmed
|
||||
fi
|
||||
else
|
||||
echo '-- Skipping admin seeding (missing E2E_ADMIN_* env)'
|
||||
fi
|
||||
|
||||
touch "$SEED_SENTINEL_PATH"
|
||||
fi
|
||||
|
||||
echo '-- Starting!'
|
||||
/opt/pleroma/bin/pleroma start &
|
||||
PLEROMA_PID=$!
|
||||
|
||||
cleanup() {
|
||||
if kill -0 "$PLEROMA_PID" 2>/dev/null; then
|
||||
kill -TERM "$PLEROMA_PID"
|
||||
wait "$PLEROMA_PID" || true
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup INT TERM
|
||||
|
||||
echo '-- Waiting for API...'
|
||||
api_ok=false
|
||||
for _i in $(seq 1 120); do
|
||||
if wget -qO- http://127.0.0.1:4000/api/v1/instance >/dev/null 2>&1; then
|
||||
api_ok=true
|
||||
break
|
||||
fi
|
||||
sleep 1s
|
||||
done
|
||||
|
||||
if [ "$api_ok" != true ]; then
|
||||
echo 'Timed out waiting for Pleroma API to become available'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wait "$PLEROMA_PID"
|
||||
|
|
@ -169,4 +169,18 @@ This forcibly removes any enabled MRF that does not exist and will fix the abili
|
|||
=== "From Source"
|
||||
```sh
|
||||
mix pleroma.config fix_mrf_policies
|
||||
```
|
||||
```
|
||||
|
||||
## Remove non-whitelisted configs from the database
|
||||
|
||||
This removes any configuration value that is not explicitly whitelisted by `:pleroma, :database_config_whitelist`. Might be useful after updating the whitelist.
|
||||
|
||||
=== "OTP"
|
||||
```sh
|
||||
./bin/pleroma_ctl config filter_whitelisted
|
||||
```
|
||||
|
||||
=== "From Source"
|
||||
```sh
|
||||
mix pleroma.config filter_whitelisted
|
||||
```
|
||||
|
|
|
|||
|
|
@ -2,28 +2,60 @@
|
|||
|
||||
## 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)
|
||||
1. Stop the Pleroma service:
|
||||
```
|
||||
# sudo systemctl stop pleroma
|
||||
```
|
||||
2. Go to the working directory of Pleroma (default is `/opt/pleroma`).
|
||||
3. Run (make sure the postgres user has write access to the destination file):
|
||||
```
|
||||
# sudo -Hu postgres pg_dump -d <pleroma_db> -v --format=custom --compress=9 -f </path/to/backup_location/pleroma.pgdump>
|
||||
```
|
||||
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.
|
||||
5. Restart the Pleroma service:
|
||||
```
|
||||
# sudo systemctl start pleroma
|
||||
```
|
||||
|
||||
## 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`)
|
||||
2. Stop the Pleroma service:
|
||||
```
|
||||
# sudo systemctl stop pleroma
|
||||
```
|
||||
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`.
|
||||
5. Drop the existing database and user if restoring in-place:
|
||||
```
|
||||
# sudo -Hu postgres dropdb <pleroma_db>
|
||||
# sudo -Hu postgres dropuser <pleroma_user>
|
||||
```
|
||||
6. Restore the database schema and pleroma database user 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.
|
||||
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 user and schema with 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.
|
||||
7. Now restore the Pleroma instance's schema into the empty database schema:
|
||||
```
|
||||
# sudo -Hu postgres pg_restore -d <pleroma_db> -v -s -1 </path/to/backup_location/pleroma.pgdump>
|
||||
```
|
||||
8. Now restore the Pleroma instance's data into the database:
|
||||
```
|
||||
# sudo -Hu postgres pg_restore -d <pleroma_db> -v -a -1 --disable-triggers </path/to/backup_location/pleroma.pgdump>
|
||||
```
|
||||
9. If you installed a newer Pleroma version, you should run `mix ecto.migrate`[^1]. This task performs database migrations, if there were any.
|
||||
10. Generate the statistics so that PostgreSQL can properly plan queries:
|
||||
```
|
||||
# sudo -Hu postgres vacuumdb -v --all --analyze-in-stages
|
||||
```
|
||||
11. Restart the Pleroma service:
|
||||
```
|
||||
# sudo systemctl start pleroma
|
||||
```
|
||||
12. If setting up on a new server, configure Nginx by using your original configuration or 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.
|
||||
|
||||
|
|
@ -32,10 +64,26 @@
|
|||
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 individually 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`
|
||||
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!
|
||||
5. Reload nginx now that the configuration is removed:
|
||||
```
|
||||
# systemctl reload nginx
|
||||
```
|
||||
6. Remove the database and database user:
|
||||
```
|
||||
# sudo -Hu postgres dropdb <pleroma_db>
|
||||
# sudo -Hu postgres dropuser <pleroma_user>
|
||||
```
|
||||
7. Remove the system user:
|
||||
```
|
||||
# userdel -r 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!**
|
||||
|
|
|
|||
47
docs/administration/dashboards.md
Normal file
47
docs/administration/dashboards.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# Dashboards
|
||||
|
||||
Pleroma comes with two types of backend dashboards viewable to instance administrators:
|
||||
|
||||
* [Phoenix LiveDashboard](https://hexdocs.pm/phoenix_live_dashboard/Phoenix.LiveDashboard.html) - A general system oriented dashboard for viewing statistics about Pleroma resource consumption, Pleroma's database and Pleroma's job processor (Oban).
|
||||
* [Oban Web](https://hexdocs.pm/oban_web/overview.html) - A dashboard specific to Oban for viewing Oban statistics, managing jobs and job queues.
|
||||
|
||||
!!! note
|
||||
Both dashboards require working Websockets.
|
||||
If your browser or web server don't support Websockets, both dashboards either won't update or will not display all information.
|
||||
|
||||
## Phoenix LiveDashboard
|
||||
|
||||
Instance administrators can access this dashboard at `/pleroma/live_dashboard`, giving a simple overview of software versions including Erlang and Elixir versions, instance uptime and resource consumption.
|
||||
|
||||
This dashboard gives insights into the current state of the BEAM VM running Pleroma code and database statistics including basic diagnostics.
|
||||
It can be useful for troubleshooting of some issues namely regarding database performance.
|
||||
|
||||
### Relevant dashboard tabs
|
||||
|
||||
* Home - A general overview of system information including software versions, uptime and memory BEAM memory consumption.
|
||||
* OS Data - Information about the OS and system such as CPU load, memory usage and disk usage.
|
||||
* Ecto Stats - Information about the Pleroma database.
|
||||
- Diagnose - Basic database diagnostics, including a `bloat` warning when an index or a table have excessive bloat, which can lead to bad database performance.
|
||||
- Bloat - A table showing size of "bloat" (unused wasted space) in database tables and indexes. Very high bloat size in the `activities` and `objects` tables can lead to bad performance especially on slower disks such as on most VPS providers.
|
||||
- Db settings - A small list of PostgreSQL settings mostly relevant to database performance.
|
||||
- Total table size - Shows sizes of all database tables including indexes sorted by size, useful for quickly checking overall database size.
|
||||
- Long running queries - A list of of slow database queries and their duration. Multiple entries with duration in multiple seconds indicate a slowly performing database.
|
||||
* Oban - Shows a list of all Oban jobs.
|
||||
|
||||
!!! note
|
||||
The DB bloat warning for `index 'oban_jobs::oban_jobs_args_index'` in Ecto Stats can be safely ignored.
|
||||
|
||||
## Oban Web
|
||||
|
||||
An advanced dashboard and management console viewable to instance administrators specifically for Oban, Pleroma's job processor.
|
||||
It allows managing jobs, including force retrying failed jobs and job deletion.
|
||||
It can be accessed at `/pleroma/oban`.
|
||||
|
||||
!!! danger
|
||||
This dashboard is very powerful! If you are unsure what a certain feature does, don't use it.
|
||||
Changing individual queue state/settings in the "Queues" view is heavily discouraged.
|
||||
|
||||
* Shows a real time chart of either a number of executed jobs, or job execution/wait time per a given time frame and the state/queue/worker.
|
||||
* Shows a list of jobs in each state, their argument, number of attempts and execution/scheduled time.
|
||||
* Selecting one or multiple jobs in the list allows performing actions like canceling/deleting and retrying.
|
||||
* Clicking on a job shows a detailed view including the full argument, when it was inserted, information about its attempts, and performing actions on it.
|
||||
|
|
@ -28,6 +28,7 @@ Feel free to contact us to be added to this list!
|
|||
### AndStatus
|
||||
- Homepage: <http://andstatus.org/>
|
||||
- Source Code: <https://github.com/andstatus/andstatus/>
|
||||
- Contact: [@AndStatus@mastodon.social](https://mastodon.social/@AndStatus)
|
||||
- Platforms: Android
|
||||
- Features: MastoAPI, ActivityPub (Client-to-Server)
|
||||
|
||||
|
|
@ -40,8 +41,8 @@ Feel free to contact us to be added to this list!
|
|||
|
||||
### Fedilab
|
||||
- Homepage: <https://fedilab.app/>
|
||||
- Source Code: <https://framagit.org/tom79/fedilab/>
|
||||
- Contact: [@fedilab@framapiaf.org](https://framapiaf.org/users/fedilab)
|
||||
- Source Code: <https://codeberg.org/tom79/Fedilab>
|
||||
- Contact: [@apps@toot.fedilab.app](https://toot.fedilab.app/@apps)
|
||||
- Platforms: Android
|
||||
- Features: MastoAPI, Streaming Ready, Moderation, Text Formatting
|
||||
|
||||
|
|
@ -51,8 +52,8 @@ Feel free to contact us to be added to this list!
|
|||
- Features: MastoAPI, No Streaming
|
||||
|
||||
### Husky
|
||||
- Source code: <https://git.mentality.rip/FWGS/Husky>
|
||||
- Contact: [@Husky@enigmatic.observer](https://enigmatic.observer/users/Husky)
|
||||
- Source code: <https://github.com/captainepoch/husky>
|
||||
- Contact: [@husky@stereophonic.space](https://stereophonic.space/users/husky)
|
||||
- Platforms: Android
|
||||
- Features: MastoAPI, No Streaming, Emoji Reactions, Text Formatting, FE Stickers
|
||||
|
||||
|
|
@ -65,7 +66,7 @@ Feel free to contact us to be added to this list!
|
|||
### Tusky
|
||||
- Homepage: <https://tuskyapp.github.io/>
|
||||
- Source Code: <https://github.com/tuskyapp/Tusky>
|
||||
- Contact: [@ConnyDuck@mastodon.social](https://mastodon.social/users/ConnyDuck)
|
||||
- Contact: [@Tusky@mastodon.social](https://mastodon.social/@Tusky)
|
||||
- Platforms: Android
|
||||
- Features: MastoAPI, No Streaming
|
||||
|
||||
|
|
@ -76,10 +77,10 @@ Feel free to contact us to be added to this list!
|
|||
- Platform: Android
|
||||
- Features: MastoAPI, No Streaming
|
||||
|
||||
### Indigenous
|
||||
- Homepage: <https://indigenous.realize.be/>
|
||||
- Source Code: <https://github.com/swentel/indigenous-android/>
|
||||
- Contact: [@swentel@realize.be](https://realize.be)
|
||||
### IndiePass
|
||||
- Homepage: <https://indiepass.app/>
|
||||
- Source Code: <https://github.com/IndiePass/indiepass-android>
|
||||
- Contact: [@marksuth@mastodon.social](https://mastodon.social/@marksuth)
|
||||
- Platforms: Android
|
||||
- Features: MastoAPI, No Streaming
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ To add configuration to your config file, you can copy it from the base config.
|
|||
* `moderator_privileges`: A list of privileges a moderator has (e.g. delete messages, manage reports...)
|
||||
* Possible values are the same as for `admin_privileges`
|
||||
|
||||
## :database
|
||||
## :features
|
||||
* `improved_hashtag_timeline`: Setting to force toggle / force disable improved hashtags timeline. `:enabled` forces hashtags to be fetched from `hashtags` table for hashtags timeline. `:disabled` forces object-embedded hashtags to be used (slower). Keep it `:auto` for automatic behaviour (it is auto-set to `:enabled` [unless overridden] when HashtagsTableMigrator completes).
|
||||
|
||||
## Background migrations
|
||||
|
|
@ -573,7 +573,8 @@ Settings for HTTP connection pool.
|
|||
|
||||
* `:connection_acquisition_wait` - Timeout to acquire a connection from pool.The total max time is this value multiplied by the number of retries.
|
||||
* `connection_acquisition_retries` - Number of attempts to acquire the connection from the pool if it is overloaded. Each attempt is timed `:connection_acquisition_wait` apart.
|
||||
* `:max_connections` - Maximum number of connections in the pool.
|
||||
* `:max_connections` - Maximum total number of connections in the pool. HTTP/1 origins may use multiple connections within this limit, while HTTP/2 connections are multiplexed.
|
||||
* `:max_idle_time` - Time before an unused connection is closed.
|
||||
* `:connect_timeout` - Timeout to connect to the host.
|
||||
* `:reclaim_multiplier` - Multiplied by `:max_connections` this will be the maximum number of idle connections that will be reclaimed in case the pool is overloaded.
|
||||
|
||||
|
|
@ -733,13 +734,11 @@ An example for SMTP adapter:
|
|||
```elixir
|
||||
config :pleroma, Pleroma.Emails.Mailer,
|
||||
enabled: true,
|
||||
adapter: Swoosh.Adapters.SMTP,
|
||||
adapter: Swoosh.Adapters.Mua,
|
||||
relay: "smtp.gmail.com",
|
||||
username: "YOUR_USERNAME@gmail.com",
|
||||
password: "YOUR_SMTP_PASSWORD",
|
||||
auth: [username: "YOUR_USERNAME@gmail.com", password: "YOUR_SMTP_PASSWORD"],
|
||||
port: 465,
|
||||
ssl: true,
|
||||
auth: :always
|
||||
protocol: :ssl
|
||||
```
|
||||
|
||||
An example for Mua adapter:
|
||||
|
|
@ -860,21 +859,23 @@ Web Push Notifications configuration. You can use the mix task `mix web_push.gen
|
|||
* ``private_key``: VAPID private key
|
||||
|
||||
## :logger
|
||||
* `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog
|
||||
* Logging to console/stdout is done by default, use `{ExSyslogger, :ex_syslogger}` to log to syslog
|
||||
|
||||
An example to enable ONLY ExSyslogger (f/ex in ``prod.secret.exs``) with info and debug suppressed:
|
||||
```elixir
|
||||
config :logger,
|
||||
config :pleroma, :logger,
|
||||
backends: [{ExSyslogger, :ex_syslogger}]
|
||||
|
||||
config :logger, default_handler: false
|
||||
|
||||
config :logger, :ex_syslogger,
|
||||
level: :warning
|
||||
```
|
||||
|
||||
Another example, keeping console output and adding the pid to syslog output:
|
||||
```elixir
|
||||
config :logger,
|
||||
backends: [:console, {ExSyslogger, :ex_syslogger}]
|
||||
config :pleroma, :logger,
|
||||
backends: [{ExSyslogger, :ex_syslogger}]
|
||||
|
||||
config :logger, :ex_syslogger,
|
||||
level: :warning,
|
||||
|
|
@ -885,42 +886,51 @@ See: [logger’s documentation](https://hexdocs.pm/logger/Logger.html) and [ex_s
|
|||
|
||||
An example of logging info to local syslog, but debug to console:
|
||||
```elixir
|
||||
config :logger,
|
||||
backends: [ {ExSyslogger, :ex_syslogger}, :console ],
|
||||
level: :info
|
||||
config :pleroma, :logger,
|
||||
backends: [{ExSyslogger, :ex_syslogger}]
|
||||
|
||||
config :logger, :ex_syslogger,
|
||||
level: :info,
|
||||
ident: "pleroma",
|
||||
format: "$metadata[$level] $message"
|
||||
|
||||
config :logger, :console,
|
||||
level: :debug,
|
||||
config :logger, :default_handler,
|
||||
level: :debug
|
||||
|
||||
config :logger, :default_formatter,
|
||||
format: "\n$time $metadata[$level] $message\n",
|
||||
metadata: [:request_id]
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Database options
|
||||
|
||||
### RUM indexing for full text search
|
||||
|
||||
!!! warning
|
||||
It is recommended to use PostgreSQL v11 or newer. We have seen some minor issues with lower PostgreSQL versions.
|
||||
|
||||
* `rum_enabled`: If RUM indexes should be used. Defaults to `false`.
|
||||
|
||||
RUM indexes are an alternative indexing scheme that is not included in PostgreSQL by default. While they may eventually be mainlined, for now they have to be installed as a PostgreSQL extension from https://github.com/postgrespro/rum.
|
||||
RUM indexes are an alternative indexing scheme that is not included in PostgreSQL by default. While they may eventually be mainlined, for now they have to be installed as a PostgreSQL extension from [https://github.com/postgrespro/rum](https://github.com/postgrespro/rum).
|
||||
|
||||
Their advantage over the standard GIN indexes is that they allow efficient ordering of search results by timestamp, which makes search queries a lot faster on larger servers, by one or two orders of magnitude. They take up around 3 times as much space as GIN indexes.
|
||||
Their advantage over the standard GIN indexes is that they allow efficient ordering of search results by timestamp, which makes search queries a lot faster on larger servers, by one or two orders of magnitude. They take up around 3-4 times as much space as GIN indexes.
|
||||
|
||||
To enable them, both the `rum_enabled` flag has to be set and the following special migration has to be run:
|
||||
|
||||
`mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/`
|
||||
* Source install:
|
||||
- Stop Pleroma
|
||||
- `mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/`
|
||||
* OTP install:
|
||||
- Stop Pleroma
|
||||
- `pleroma_ctl migrate --migrations-path priv/repo/optional_migrations/rum_indexing/`
|
||||
|
||||
This will probably take a long time.
|
||||
|
||||
!!! note
|
||||
It is recommended to `VACUUM FULL` the objects table after the migration has completed, to do that run:
|
||||
```
|
||||
# sudo -Hu postgres vacuumdb --full --analyze -t objects <pleroma DB name>
|
||||
```
|
||||
|
||||
Now you can start Pleroma back up.
|
||||
|
||||
## Alternative client protocols
|
||||
|
||||
### BBS / SSH access
|
||||
|
|
@ -1124,8 +1134,9 @@ Boolean, enables/disables in-database configuration. Read [Transferring the conf
|
|||
|
||||
List of valid configuration sections which are allowed to be configured from the
|
||||
database. Settings stored in the database before the whitelist is configured are
|
||||
still applied, so it is suggested to only use the whitelist on instances that
|
||||
have not migrated the config to the database.
|
||||
still applied. Consider running the `mix pleroma.config filter_whitelisted` task
|
||||
after updating the whitelist. Read [Remove non-whitelisted configs from the database](../administration/CLI_tasks/config.md#remove-non-whitelisted-configs-from-the-database)
|
||||
for more information.
|
||||
|
||||
Example:
|
||||
```elixir
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ location /proxy {
|
|||
```
|
||||
Also add the following on top of the configuration, outside of the `server` block:
|
||||
```
|
||||
proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g inactive=720m use_temp_path=off;
|
||||
# Note: The cache directory must exist and be writable by nginx.
|
||||
# If nginx runs in a chroot, create it inside the chroot.
|
||||
proxy_cache_path /var/tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g inactive=720m use_temp_path=off;
|
||||
```
|
||||
If you came here from one of the installation guides, take a look at the example configuration `/installation/pleroma.nginx`, where this part is already included.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,3 +10,6 @@ The other way to do it, for example, with Tor you would most likely add somethin
|
|||
```
|
||||
config :pleroma, :http, proxy_url: {:socks5, :localhost, 9050}
|
||||
```
|
||||
|
||||
The Gun HTTP adapter supports SOCKS5. SOCKS4 proxies require another HTTP adapter.
|
||||
For regular HTTP proxies, Gun forwards plain HTTP requests directly and uses CONNECT tunnels for HTTPS requests.
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ You will see a "Default Admin API Key", this is the key you actually put into yo
|
|||
|
||||
### Initial indexing
|
||||
|
||||
After setting up the configuration, you'll want to index all of your already existing posts. Only public posts are indexed. You'll only
|
||||
After setting up the configuration, you'll want to index all of your already existing posts. Only public/unlisted posts are indexed. You'll only
|
||||
have to do it one time, but it might take a while, depending on the amount of posts your instance has seen. This is also a fairly RAM
|
||||
consuming process for `meilisearch`, and it will take a lot of RAM when running if you have a lot of posts (seems to be around 5G for ~1.2
|
||||
million posts while idle and up to 7G while indexing initially, but your experience may be different).
|
||||
|
|
@ -145,3 +145,155 @@ This will clear **all** the posts from the search index. Note, that deleted post
|
|||
there is no need to actually clear the whole index, unless you want **all** of it gone. That said, the index does not hold any information
|
||||
that cannot be re-created from the database, it should also generally be a lot smaller than the size of your database. Still, the size
|
||||
depends on the amount of text in posts.
|
||||
|
||||
## ParadeDB
|
||||
|
||||
[ParadeDB](https://www.paradedb.com/) is a Postgres extension that provides BM25 full-text search. In Pleroma, it can be used as an
|
||||
external search backend by pointing Pleroma at a separate Postgres instance with the `pg_search` extension installed.
|
||||
Pleroma's integration suite tests `pg_search` 0.24.3 on PostgreSQL 15.
|
||||
|
||||
Pleroma will maintain a small `pleroma_search_documents` table in that database (via the existing search indexing queue) and run search
|
||||
queries against it.
|
||||
The indexed text includes status content, content warnings, and attachment descriptions.
|
||||
|
||||
### Configuration
|
||||
|
||||
Set the search module to `Pleroma.Search.ParadeDB` and configure the ParadeDB database URL. These settings must be in static/runtime config
|
||||
(or `PARADEDB_DATABASE_URL`) so the dedicated ParadeDB Repo is started with the application. They cannot be migrated to or changed through
|
||||
ConfigDB.
|
||||
|
||||
> config :pleroma, Pleroma.Search, module: Pleroma.Search.ParadeDB
|
||||
>
|
||||
> config :pleroma, Pleroma.Search.ParadeDB,
|
||||
> url: System.get_env("PARADEDB_DATABASE_URL"),
|
||||
> table: "pleroma_search_documents",
|
||||
> fuzzy_distance: 0
|
||||
>
|
||||
> config :pleroma, Pleroma.Search.ParadeDB.Repo,
|
||||
> pool_size: 2,
|
||||
> prepare: :unnamed
|
||||
|
||||
When connecting over an untrusted network, enable certificate verification in the Repo configuration. For example:
|
||||
|
||||
> config :pleroma, Pleroma.Search.ParadeDB.Repo,
|
||||
> ssl: [
|
||||
> verify: :verify_peer,
|
||||
> cacertfile: "/etc/pleroma/paradedb-ca.pem",
|
||||
> server_name_indication: ~c"paradedb.example.com"
|
||||
> ]
|
||||
|
||||
### Initial rollout
|
||||
|
||||
The `pg_search` extension must already be available in the database. Creating the extension normally requires an administrative database
|
||||
role. The Pleroma runtime role requires `CONNECT` on the database, `USAGE` on the table's schema and the `pdb` schema, and `SELECT`, `INSERT`, `UPDATE`,
|
||||
and `DELETE` on the generated table. For example, after creating the table as its owner:
|
||||
|
||||
```sql
|
||||
GRANT CONNECT ON DATABASE paradedb TO pleroma_search;
|
||||
GRANT USAGE ON SCHEMA public, pdb TO pleroma_search;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE pleroma_search_documents TO pleroma_search;
|
||||
```
|
||||
|
||||
Use this rollout order to prevent jobs from being handled by the previous backend:
|
||||
|
||||
1. Install `pg_search` 0.24.3 on PostgreSQL 15 or another deliberately tested combination.
|
||||
2. Stop Pleroma so no search indexing jobs are running.
|
||||
3. Put the ParadeDB backend in static configuration.
|
||||
4. Create the table and BM25 index in a one-shot offline process using `PARADEDB_DATABASE_URL` with the table owner/setup credential.
|
||||
5. Apply the runtime grants shown above, set the service's `PARADEDB_DATABASE_URL` to the restricted runtime credential, and start Pleroma.
|
||||
6. Start the initial backfill and monitor the `search_indexing` queue.
|
||||
|
||||
Create the table and BM25 index once with:
|
||||
|
||||
=== "OTP"
|
||||
```sh
|
||||
PARADEDB_DATABASE_URL='OWNER_URL' PLEROMA_CTL_RPC_DISABLED=true \
|
||||
./bin/pleroma_ctl search.indexer create_index
|
||||
```
|
||||
|
||||
=== "From Source"
|
||||
```sh
|
||||
PARADEDB_DATABASE_URL='OWNER_URL' mix pleroma.search.indexer create_index
|
||||
```
|
||||
|
||||
The task currently prints an error without returning a failing process status. Verify that it prints `Index created` before continuing.
|
||||
|
||||
### Backfill
|
||||
|
||||
Run an initial indexing pass to enqueue existing posts:
|
||||
|
||||
=== "OTP"
|
||||
```sh
|
||||
./bin/pleroma_ctl search.indexer index
|
||||
```
|
||||
|
||||
=== "From Source"
|
||||
```sh
|
||||
PARADEDB_DATABASE_URL='RUNTIME_URL' mix pleroma.search.indexer index
|
||||
```
|
||||
|
||||
The command enqueues up to 100,000 Create activities by default. It uses keyset pagination, so new activities arriving during the backfill
|
||||
do not shift the remaining pages. The defaults and accepted options are:
|
||||
|
||||
* `--limit`: maximum activities to enqueue in this run; defaults to `100000` and must be positive
|
||||
* `--step`: activities fetched from Pleroma's database per page; defaults to `1000` and must be positive
|
||||
* `--chunk`: jobs inserted into Oban per batch; defaults to `100` and must be positive
|
||||
* `--before`: resume before the checkpoint activity ID printed by an earlier run; the cursor is exclusive
|
||||
|
||||
The checkpoint is the last activity enqueued, not confirmation that its job succeeded. Repeat the command with its last `--before`
|
||||
checkpoint only when it reports that more activities remain. Inspect failed or discarded Oban jobs as well as waiting jobs before declaring
|
||||
the backfill complete.
|
||||
|
||||
The same operation can be run from an attached console while Pleroma is online:
|
||||
|
||||
```elixir
|
||||
Pleroma.Search.Backfill.run(limit: 10_000)
|
||||
```
|
||||
|
||||
The returned `next_cursor` can be supplied as `before` when `exhausted` is `false`. The attached API also accepts `limit: :infinity`, but this
|
||||
can create an unbounded number of Oban rows; bounded runs are safer on large instances. An `on_page` callback may be supplied for progress
|
||||
reporting.
|
||||
|
||||
Note: Like the other external search backends, only public/unlisted Notes are indexed.
|
||||
|
||||
Set `fuzzy_distance` to `1` or `2` to allow typo-tolerant matching (`2` is the maximum ParadeDB supports).
|
||||
|
||||
Indexing runs via the Oban `search_indexing` queue. Its stock configuration starts paused so the search health monitor can control it; verify
|
||||
that the queue is running before backfilling. A manually managed queue can be enabled with `search_indexing: 10` in the Oban `queues`
|
||||
configuration instead of a `paused: true` entry.
|
||||
Monitor that queue until the backfill jobs have drained before evaluating search completeness.
|
||||
|
||||
### Rebuilding
|
||||
|
||||
Stop Pleroma, or otherwise ensure no search indexing jobs are running, before rebuilding. While ParadeDB is still the configured backend,
|
||||
run `drop_index`, then `create_index` with the table owner/setup credential. Reapply runtime grants after recreating the table, restart
|
||||
Pleroma, and begin a new backfill. The DDL tasks print failures without returning a failing process status, so verify the exact `Index
|
||||
dropped` and `Index created` success messages. Dropping the table removes only derived search data; Pleroma activities remain in the primary
|
||||
database.
|
||||
|
||||
### Rolling back
|
||||
|
||||
To retain the ParadeDB table for a later retry, configure `Pleroma.Search.DatabaseSearch` (or the previous external backend) in static config
|
||||
and restart Pleroma.
|
||||
|
||||
Before switching backends, inspect the `search_indexing` queue. Drain or cancel pending backfill jobs, or explicitly accept that they will run
|
||||
against the newly configured backend after restart.
|
||||
|
||||
To remove the table during rollback, first stop Pleroma and run `drop_index` with the table owner/setup credential while ParadeDB is still
|
||||
configured:
|
||||
|
||||
=== "OTP"
|
||||
```sh
|
||||
PARADEDB_DATABASE_URL='OWNER_URL' PLEROMA_CTL_RPC_DISABLED=true \
|
||||
./bin/pleroma_ctl search.indexer drop_index
|
||||
```
|
||||
|
||||
=== "From Source"
|
||||
```sh
|
||||
PARADEDB_DATABASE_URL='OWNER_URL' mix pleroma.search.indexer drop_index
|
||||
```
|
||||
|
||||
Verify that the task prints `Index dropped`. Then change the backend in static config and restart. The ParadeDB environment variable may be
|
||||
removed after removing the ParadeDB stanza or switching to a backend that does not start its Repo. After switching away from ParadeDB, the
|
||||
generic `drop_index` task targets the newly configured backend and will not remove the ParadeDB table; remove it directly with the database
|
||||
owner instead.
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ The `/api/v1/pleroma/admin/*` path is backwards compatible with `/api/pleroma/ad
|
|||
- `nicknames`
|
||||
- Response: Array of user nicknames
|
||||
|
||||
## `POST /api/v1/pleroma/admin/users`
|
||||
|
||||
### Create a user
|
||||
|
||||
- Method: `POST`
|
||||
|
|
@ -78,10 +80,24 @@ The `/api/v1/pleroma/admin/*` path is backwards compatible with `/api/pleroma/ad
|
|||
{
|
||||
`nickname`,
|
||||
`email`,
|
||||
`password`
|
||||
`password` (optional; when provided, must not be empty)
|
||||
}
|
||||
]
|
||||
- Response: User’s nickname
|
||||
- Response: Array of user objects. When a user is created without a `password`, `data`
|
||||
object contains a `password_reset_link` the user can follow to set their own password.
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"data": {
|
||||
"nickname": string,
|
||||
"email": string,
|
||||
"password_reset_link": string (optional)
|
||||
},
|
||||
"type": "success"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## `POST /api/v1/pleroma/admin/users/follow`
|
||||
|
||||
|
|
@ -663,6 +679,7 @@ Status: 404
|
|||
- *optional* `limit`: **integer** the number of records to retrieve
|
||||
- *optional* `page`: **integer** page number
|
||||
- *optional* `page_size`: **integer** number of log entries per page (default is `50`)
|
||||
- *optional* `assigned_account`: **string** assigned account ID
|
||||
- Response:
|
||||
- On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin
|
||||
- On success: JSON, returns a list of reports, where:
|
||||
|
|
@ -747,6 +764,7 @@ Status: 404
|
|||
"url": "https://pleroma.example.org/users/lain",
|
||||
"username": "lain"
|
||||
},
|
||||
"assigned_account": null,
|
||||
"content": "Please delete it",
|
||||
"created_at": "2019-04-29T19:48:15.000Z",
|
||||
"id": "9iJGOv1j8hxuw19bcm",
|
||||
|
|
@ -866,6 +884,37 @@ Status: 404
|
|||
]
|
||||
```
|
||||
|
||||
- Response:
|
||||
- On failure:
|
||||
- 400 Bad Request, JSON:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
`id`, // report id
|
||||
`error` // error message
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
- On success: `204`, empty response
|
||||
|
||||
## `POST /api/v1/pleroma/admin/reports/assign_account`
|
||||
|
||||
### Assign account to one or multiple reports
|
||||
|
||||
- Params:
|
||||
|
||||
```json
|
||||
`reports`: [
|
||||
{
|
||||
`id`, // required, report id
|
||||
`nickname` // account nickname, use null to unassign account
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
- Response:
|
||||
- On failure:
|
||||
- 400 Bad Request, JSON:
|
||||
|
|
@ -1804,3 +1853,92 @@ Note that this differs from the Mastodon API variant: Mastodon API only returns
|
|||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
## `GET /api/v1/pleroma/admin/webhooks`
|
||||
|
||||
### List webhooks
|
||||
|
||||
- Method: `GET`
|
||||
- Response:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"enabled": true,
|
||||
"id": "2",
|
||||
"events": ["account.created"],
|
||||
"url": "https://webhook.example/",
|
||||
"secret": "eb85d4ccd8510e78f912743949dc354e8146987d",
|
||||
"updated_at": "2022-10-29T17:44:16.000Z",
|
||||
"created_at": "2022-10-29T17:44:13.000Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## `GET /api/v1/pleroma/admin/webhooks/:id`
|
||||
|
||||
### Get an individual webhook
|
||||
|
||||
- Method: `GET`
|
||||
- Params:
|
||||
- `id`: **string** Webhook ID
|
||||
- Response: A webhook
|
||||
|
||||
## `POST /api/v1/pleroma/admin/webhooks`
|
||||
|
||||
### Create a webhook
|
||||
|
||||
- Method: `POST`
|
||||
- Params:
|
||||
- `url`: **string** Webhook URL
|
||||
- `events`: **[string]** Types of events to trigger on (`account.created`, `report.created`)
|
||||
- *optional* `enabled`: **boolean** Whether webhook is enabled
|
||||
- Response: A webhook
|
||||
|
||||
## `PATCH /api/v1/pleroma/admin/webhooks/:id`
|
||||
|
||||
### Update a webhook
|
||||
|
||||
- Method: `PATCH`
|
||||
- Params:
|
||||
- `id`: **string** Webhook ID
|
||||
- *optional* `url`: **string** Webhook URL
|
||||
- *optional* `events`: **[string]** Types of events to trigger on (`account.created`, `report.created`)
|
||||
- *optional* `enabled`: **boolean** Whether webhook is enabled
|
||||
- Response: A webhook
|
||||
|
||||
## `DELETE /api/v1/pleroma/admin/webhooks/:id`
|
||||
|
||||
### Delete a webhook
|
||||
|
||||
- Method: `DELETE`
|
||||
- Params:
|
||||
- `id`: **string** Webhook ID
|
||||
- Response: A webhook
|
||||
|
||||
## `POST /api/v1/pleroma/admin/webhooks/:id/enable`
|
||||
|
||||
### Activate a webhook
|
||||
|
||||
- Method: `POST`
|
||||
- Params:
|
||||
- `id`: **string** Webhook ID
|
||||
- Response: A webhook
|
||||
|
||||
## `POST /api/v1/pleroma/admin/webhooks/:id/disable`
|
||||
|
||||
### Deactivate a webhook
|
||||
|
||||
- Method: `POST`
|
||||
- Params:
|
||||
- `id`: **string** Webhook ID
|
||||
- Response: A webhook
|
||||
|
||||
## `POST /api/v1/pleroma/admin/webhooks/:id/rotate_secret`
|
||||
|
||||
### Rotate webhook signing secret
|
||||
|
||||
- Method: `POST`
|
||||
- Params:
|
||||
- `id`: **string** Webhook ID
|
||||
- Response: A webhook
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ Returned data:
|
|||
"username": "somenick",
|
||||
...
|
||||
},
|
||||
"id" : "1",
|
||||
"unread" : 2,
|
||||
"last_message" : {...}, // The last message in that chat
|
||||
"id": "1",
|
||||
"unread": 2,
|
||||
"last_message": {...}, // The last message in that chat
|
||||
"updated_at": "2020-04-21T15:11:46.000Z"
|
||||
}
|
||||
```
|
||||
|
|
@ -93,8 +93,8 @@ Returned data:
|
|||
"username": "somenick",
|
||||
...
|
||||
},
|
||||
"id" : "1",
|
||||
"unread" : 0,
|
||||
"id": "1",
|
||||
"unread": 0,
|
||||
"updated_at": "2020-04-21T15:11:46.000Z"
|
||||
}
|
||||
```
|
||||
|
|
@ -111,7 +111,7 @@ The modified chat message
|
|||
|
||||
### Getting a list of Chats
|
||||
|
||||
`GET /api/v1/pleroma/chats`
|
||||
`GET /api/v2/pleroma/chats`
|
||||
|
||||
This will return a list of chats that you have been involved in, sorted by their
|
||||
last update (so new chats will be at the top).
|
||||
|
|
@ -119,6 +119,7 @@ last update (so new chats will be at the top).
|
|||
Parameters:
|
||||
|
||||
- with_muted: Include chats from muted users (boolean).
|
||||
- pinned: Include only pinned chats (boolean).
|
||||
|
||||
Returned data:
|
||||
|
||||
|
|
@ -130,16 +131,16 @@ Returned data:
|
|||
"username": "somenick",
|
||||
...
|
||||
},
|
||||
"id" : "1",
|
||||
"unread" : 2,
|
||||
"last_message" : {...}, // The last message in that chat
|
||||
"id": "1",
|
||||
"unread": 2,
|
||||
"last_message": {...}, // The last message in that chat
|
||||
"updated_at": "2020-04-21T15:11:46.000Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
The recipient of messages that are sent to this chat is given by their AP ID.
|
||||
No pagination is implemented for now.
|
||||
The usual pagination options are implemented.
|
||||
|
||||
### Getting the messages for a Chat
|
||||
|
||||
|
|
@ -226,6 +227,32 @@ Deleting a chat message for given Chat id works like this:
|
|||
|
||||
Returned data is the deleted message.
|
||||
|
||||
### Pinning a chat
|
||||
|
||||
Pinning a chat works like this:
|
||||
|
||||
`POST /api/v1/pleroma/chats/:id/pin`
|
||||
|
||||
Returned data:
|
||||
|
||||
```json
|
||||
{
|
||||
"account": {
|
||||
"id": "someflakeid",
|
||||
"username": "somenick",
|
||||
...
|
||||
},
|
||||
"id": "1",
|
||||
"unread": 0,
|
||||
"updated_at": "2020-04-21T15:11:46.000Z",
|
||||
"pinned": true,
|
||||
}
|
||||
```
|
||||
|
||||
To unpin a pinned chat, use:
|
||||
|
||||
`POST /api/v1/pleroma/chats/:id/unpin`
|
||||
|
||||
### Notifications
|
||||
|
||||
There's a new `pleroma:chat_mention` notification, which has this form. It is not given out in the notifications endpoint by default, you need to explicitly request it with `include_types[]=pleroma:chat_mention`:
|
||||
|
|
|
|||
|
|
@ -39,11 +39,13 @@ Has these additional fields under the `pleroma` object:
|
|||
- `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint.
|
||||
- `parent_visible`: If the parent of this post is visible to the user or not.
|
||||
- `pinned_at`: a datetime (iso8601) when status was pinned, `null` otherwise.
|
||||
- `quotes_count`: the count of status quotes.
|
||||
- `non_anonymous`: true if the source post specifies the poll results are not anonymous. Currently only implemented by Smithereen.
|
||||
- `bookmark_folder`: the ID of the folder bookmark is stored within (if any).
|
||||
- `list_id`: the ID of the list the post is addressed to (if any, only returned to author).
|
||||
|
||||
Has these additional fields under the `poll.pleroma` object:
|
||||
|
||||
- `non_anonymous`: true if the source post specifies the poll results are not anonymous. Currently only implemented by Smithereen.
|
||||
|
||||
The `GET /api/v1/statuses/:id/source` endpoint additionally has the following attributes:
|
||||
|
||||
- `content_type`: The content type of the status source.
|
||||
|
|
@ -72,7 +74,7 @@ Pleroma does not process remote images and therefore cannot include fields such
|
|||
|
||||
The `GET /api/v1/bookmarks` endpoint accepts optional parameter `folder_id` for bookmark folder ID.
|
||||
|
||||
The `POST /api/v1/statuses/:id/bookmark` endpoint accepts optional parameter `folder_id` for bookmark folder ID.
|
||||
The `POST /api/v1/statuses/:id/bookmark` endpoint accepts optional parameter `folder_id` for bookmark folder ID. Bookmarking an already bookmarked post will update the folder association, or remove it if `folder_id` is omitted or `null`.
|
||||
|
||||
## Accounts
|
||||
|
||||
|
|
@ -88,6 +90,7 @@ The `id` parameter can also be the `nickname` of the user. This only works in th
|
|||
- `only_media`: include only statuses with media attached
|
||||
- `with_muted`: include statuses/reactions from muted accounts
|
||||
- `exclude_reblogs`: exclude reblogs
|
||||
- `only_reblogs`: include only reblogs
|
||||
- `exclude_replies`: exclude replies
|
||||
- `exclude_visibilities`: exclude visibilities
|
||||
|
||||
|
|
@ -97,6 +100,9 @@ Endpoints which accept `with_relationships` parameter:
|
|||
- `/api/v1/accounts/:id/followers`
|
||||
- `/api/v1/accounts/:id/following`
|
||||
- `/api/v1/mutes`
|
||||
- `/api/v1/blocks`
|
||||
- `/api/v1/search`
|
||||
- `/api/v2/search`
|
||||
|
||||
Has these additional fields under the `pleroma` object:
|
||||
|
||||
|
|
@ -121,8 +127,6 @@ Has these additional fields under the `pleroma` object:
|
|||
- `notification_settings`: object, can be absent. See `/api/v1/pleroma/notification_settings` for the parameters/keys returned.
|
||||
- `accepts_chat_messages`: boolean, but can be null if we don't have that information about a user
|
||||
- `favicon`: nullable URL string, Favicon image of the user's instance
|
||||
- `avatar_description`: string, image description for user avatar, defaults to empty string
|
||||
- `header_description`: string, image description for user banner, defaults to empty string
|
||||
|
||||
### Source
|
||||
|
||||
|
|
|
|||
|
|
@ -671,6 +671,7 @@ Audio scrobbling in Pleroma is **deprecated**.
|
|||
"artist": "Some Artist",
|
||||
"album": "Some Album",
|
||||
"length": 180000,
|
||||
"external_link": "https://www.last.fm/music/Some+Artist/_/Some+Title",
|
||||
"created_at": "2019-09-28T12:40:45.000Z"
|
||||
}
|
||||
]
|
||||
|
|
@ -683,11 +684,13 @@ Audio scrobbling in Pleroma is **deprecated**.
|
|||
### Creates a new Listen activity for an account
|
||||
* Method `POST`
|
||||
* Authentication: required
|
||||
* OAuth scope: `write:scrobbles`
|
||||
* Params:
|
||||
* `title`: the title of the media playing
|
||||
* `album`: the album of the media playing [optional]
|
||||
* `artist`: the artist of the media playing [optional]
|
||||
* `length`: the length of the media playing [optional]
|
||||
* `external_link`: a URL referencing the media playing [optional]
|
||||
* Response: the newly created media metadata entity representing the Listen activity
|
||||
|
||||
# Emoji Reactions
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
This section contains notes and guidelines for developers.
|
||||
|
||||
- [Setting up a Pleroma development environment](setting_up_pleroma_dev.md)
|
||||
- [Setting up a Gitlab Runner](setting_up_a_gitlab_runner.md)
|
||||
- [Authentication & Authorization](authentication_authorization.md)
|
||||
- [ActivityPub Extensions](ap_extensions.md)
|
||||
- [Mox Testing Guide](mox_testing.md)
|
||||
|
|
|
|||
485
docs/development/mox_testing.md
Normal file
485
docs/development/mox_testing.md
Normal file
|
|
@ -0,0 +1,485 @@
|
|||
# Using Mox for Testing in Pleroma
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide explains how to use [Mox](https://hexdocs.pm/mox/Mox.html) for testing in Pleroma and how to migrate existing tests from Mock/meck to Mox. Mox is a library for defining concurrent mocks in Elixir that offers several key advantages:
|
||||
|
||||
- **Async-safe testing**: Mox supports concurrent testing with `async: true`
|
||||
- **Explicit contract through behaviors**: Enforces implementation of behavior callbacks
|
||||
- **No module redefinition**: Avoids runtime issues caused by redefining modules
|
||||
- **Expectations scoped to the current process**: Prevents test state from leaking between tests
|
||||
|
||||
## Why Migrate from Mock/meck to Mox?
|
||||
|
||||
### Problems with Mock/meck
|
||||
|
||||
1. **Not async-safe**: Tests using Mock/meck cannot safely run with `async: true`, which slows down the test suite
|
||||
2. **Global state**: Mocked functions are global, leading to potential cross-test contamination
|
||||
3. **No explicit contract**: No guarantee that mocked functions match the actual implementation
|
||||
4. **Module redefinition**: Can lead to hard-to-debug runtime issues
|
||||
|
||||
### Benefits of Mox
|
||||
|
||||
1. **Async-safe testing**: Tests can run concurrently with `async: true`, significantly speeding up the test suite
|
||||
2. **Process isolation**: Expectations are set per process, preventing leakage between tests
|
||||
3. **Explicit contracts via behaviors**: Ensures mocks implement all required functions
|
||||
4. **Compile-time checks**: Prevents mocking non-existent functions
|
||||
5. **No module redefinition**: Mocks are defined at compile time, not runtime
|
||||
|
||||
## Existing Mox Setup in Pleroma
|
||||
|
||||
Pleroma already has a basic Mox setup in the `Pleroma.DataCase` module, which handles some common mocking scenarios automatically. Here's what's included:
|
||||
|
||||
### Default Mox Configuration
|
||||
|
||||
The `setup` function in `DataCase` does the following:
|
||||
|
||||
1. Sets up Mox for either async or non-async tests
|
||||
2. Verifies all mock expectations on test exit
|
||||
3. Stubs common dependencies with their real implementations
|
||||
|
||||
```elixir
|
||||
# From test/support/data_case.ex
|
||||
setup tags do
|
||||
setup_multi_process_mode(tags)
|
||||
setup_streamer(tags)
|
||||
stub_pipeline()
|
||||
|
||||
Mox.verify_on_exit!()
|
||||
|
||||
:ok
|
||||
end
|
||||
```
|
||||
|
||||
### Async vs. Non-Async Test Setup
|
||||
|
||||
Pleroma configures Mox differently depending on whether your test is async or not:
|
||||
|
||||
```elixir
|
||||
def setup_multi_process_mode(tags) do
|
||||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
|
||||
|
||||
if tags[:async] do
|
||||
# For async tests, use process-specific mocks and stub CachexMock with NullCache
|
||||
Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache)
|
||||
Mox.set_mox_private()
|
||||
else
|
||||
# For non-async tests, use global mocks and stub CachexMock with CachexProxy
|
||||
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
|
||||
|
||||
Mox.set_mox_global()
|
||||
Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy)
|
||||
clear_cachex()
|
||||
end
|
||||
|
||||
:ok
|
||||
end
|
||||
```
|
||||
|
||||
### Default Pipeline Stubs
|
||||
|
||||
Pleroma automatically stubs several core components with their real implementations:
|
||||
|
||||
```elixir
|
||||
def stub_pipeline do
|
||||
Mox.stub_with(Pleroma.Web.ActivityPub.SideEffectsMock, Pleroma.Web.ActivityPub.SideEffects)
|
||||
Mox.stub_with(Pleroma.Web.ActivityPub.ObjectValidatorMock, Pleroma.Web.ActivityPub.ObjectValidator)
|
||||
Mox.stub_with(Pleroma.Web.ActivityPub.MRFMock, Pleroma.Web.ActivityPub.MRF)
|
||||
Mox.stub_with(Pleroma.Web.ActivityPub.ActivityPubMock, Pleroma.Web.ActivityPub.ActivityPub)
|
||||
Mox.stub_with(Pleroma.Web.FederatorMock, Pleroma.Web.Federator)
|
||||
Mox.stub_with(Pleroma.ConfigMock, Pleroma.Config)
|
||||
Mox.stub_with(Pleroma.StaticStubbedConfigMock, Pleroma.Test.StaticConfig)
|
||||
Mox.stub_with(Pleroma.StubbedHTTPSignaturesMock, Pleroma.Test.HTTPSignaturesProxy)
|
||||
end
|
||||
```
|
||||
|
||||
This means that by default, these mocks will behave like their real implementations unless you explicitly override them with expectations in your tests.
|
||||
|
||||
### Understanding Config Mock Types
|
||||
|
||||
Pleroma has three different Config mock implementations, each with a specific purpose and different characteristics regarding async test safety:
|
||||
|
||||
#### 1. ConfigMock
|
||||
|
||||
- Defined in `test/support/mocks.ex` as `Mox.defmock(Pleroma.ConfigMock, for: Pleroma.Config.Getting)`
|
||||
- It's stubbed with the real `Pleroma.Config` by default in `DataCase`: `Mox.stub_with(Pleroma.ConfigMock, Pleroma.Config)`
|
||||
- This means it falls back to the normal configuration behavior unless explicitly overridden
|
||||
- Used for general mocking of configuration in tests where you want most config to behave normally
|
||||
- ⚠️ **NOT ASYNC-SAFE**: Since it's stubbed with the real `Pleroma.Config`, it modifies global application state
|
||||
- Can not be used in tests with `async: true`
|
||||
|
||||
#### 2. StaticStubbedConfigMock
|
||||
|
||||
- Defined in `test/support/mocks.ex` as `Mox.defmock(Pleroma.StaticStubbedConfigMock, for: Pleroma.Config.Getting)`
|
||||
- It's stubbed with `Pleroma.Test.StaticConfig` (defined in `test/test_helper.exs`)
|
||||
- `Pleroma.Test.StaticConfig` creates a completely static configuration snapshot at the start of the test run:
|
||||
```elixir
|
||||
defmodule Pleroma.Test.StaticConfig do
|
||||
@moduledoc """
|
||||
This module provides a Config that is completely static, built at startup time from the environment.
|
||||
It's safe to use in testing as it will not modify any state.
|
||||
"""
|
||||
|
||||
@behaviour Pleroma.Config.Getting
|
||||
@config Application.get_all_env(:pleroma)
|
||||
|
||||
def get(path, default \\ nil) do
|
||||
get_in(@config, path) || default
|
||||
end
|
||||
end
|
||||
```
|
||||
- Configuration is frozen at startup time and doesn't change during the test run
|
||||
- ✅ **ASYNC-SAFE**: Never modifies global state since it uses a frozen snapshot of the configuration
|
||||
|
||||
#### 3. UnstubbedConfigMock
|
||||
|
||||
- Defined in `test/support/mocks.ex` as `Mox.defmock(Pleroma.UnstubbedConfigMock, for: Pleroma.Config.Getting)`
|
||||
- Unlike the other two mocks, it's not automatically stubbed with any implementation in `DataCase`
|
||||
- Starts completely "unstubbed" and requires tests to explicitly set expectations or stub it
|
||||
- The most commonly used configuration mock in the test suite
|
||||
- Often aliased as `ConfigMock` in individual test files: `alias Pleroma.UnstubbedConfigMock, as: ConfigMock`
|
||||
- Set as the default config implementation in `config/test.exs`: `config :pleroma, :config_impl, Pleroma.UnstubbedConfigMock`
|
||||
- Offers maximum flexibility for tests that need precise control over configuration values
|
||||
- ✅ **ASYNC-SAFE**: Safe if used with `expect()` to set up test-specific expectations (since expectations are process-scoped)
|
||||
|
||||
#### Configuring Components to Use Specific Mocks
|
||||
|
||||
In `config/test.exs`, different components can be configured to use different configuration mocks:
|
||||
|
||||
```elixir
|
||||
# Components using UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.User.Backup, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Uploaders.S3, config_impl: Pleroma.UnstubbedConfigMock
|
||||
|
||||
# Components using StaticStubbedConfigMock (async-safe)
|
||||
config :pleroma, Pleroma.Language.LanguageDetector, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
```
|
||||
|
||||
This allows different parts of the application to use the most appropriate configuration mocking strategy based on their specific needs.
|
||||
|
||||
#### When to Use Each Config Mock Type
|
||||
|
||||
- **ConfigMock**: ⚠️ For non-async tests only, when you want most configuration to behave normally with occasional overrides
|
||||
- **StaticStubbedConfigMock**: ✅ For async tests where modifying global state would be problematic and a static configuration is sufficient
|
||||
- **UnstubbedConfigMock**: ⚠️ Use carefully in async tests; set specific expectations rather than stubbing with implementations that modify global state
|
||||
|
||||
#### Summary of Async Safety
|
||||
|
||||
| Mock Type | Async-Safe? | Best Use Case |
|
||||
|-----------|-------------|--------------|
|
||||
| ConfigMock | ❌ No | Non-async tests that need minimal configuration overrides |
|
||||
| StaticStubbedConfigMock | ✅ Yes | Async tests that need configuration values without modification |
|
||||
| UnstubbedConfigMock | ⚠️ Depends | Any test with careful usage; set expectations rather than stubbing |
|
||||
|
||||
## Configuration in Async Tests
|
||||
|
||||
### Understanding `clear_config` Limitations
|
||||
|
||||
The `clear_config` helper is commonly used in Pleroma tests to modify configuration for specific tests. However, it's important to understand that **`clear_config` is not async-safe** and should not be used in tests with `async: true`.
|
||||
|
||||
Here's why:
|
||||
|
||||
```elixir
|
||||
# Implementation of clear_config in test/support/helpers.ex
|
||||
defmacro clear_config(config_path, temp_setting) do
|
||||
quote do
|
||||
clear_config(unquote(config_path)) do
|
||||
Config.put(unquote(config_path), unquote(temp_setting))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defmacro clear_config(config_path, do: yield) do
|
||||
quote do
|
||||
initial_setting = Config.fetch(unquote(config_path))
|
||||
|
||||
unquote(yield)
|
||||
|
||||
on_exit(fn ->
|
||||
case initial_setting do
|
||||
:error ->
|
||||
Config.delete(unquote(config_path))
|
||||
|
||||
{:ok, value} ->
|
||||
Config.put(unquote(config_path), value)
|
||||
end
|
||||
end)
|
||||
|
||||
:ok
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
The issue is that `clear_config`:
|
||||
1. Modifies the global application environment
|
||||
2. Uses `on_exit` to restore the original value after the test
|
||||
3. Can lead to race conditions when multiple async tests modify the same configuration
|
||||
|
||||
### Async-Safe Configuration Approaches
|
||||
|
||||
When writing async tests with Mox, use these approaches instead of `clear_config`:
|
||||
|
||||
1. **Dependency Injection with Module Attributes**:
|
||||
```elixir
|
||||
# In your module
|
||||
@config_impl Application.compile_env(:pleroma, [__MODULE__, :config_impl], Pleroma.Config)
|
||||
|
||||
def some_function do
|
||||
value = @config_impl.get([:some, :config])
|
||||
# ...
|
||||
end
|
||||
```
|
||||
|
||||
2. **Mock the Config Module**:
|
||||
```elixir
|
||||
# In your test
|
||||
Pleroma.ConfigMock
|
||||
|> expect(:get, fn [:some, :config] -> "test_value" end)
|
||||
```
|
||||
|
||||
3. **Use Test-Specific Implementations**:
|
||||
```elixir
|
||||
# Define a test-specific implementation
|
||||
defmodule TestConfig do
|
||||
def get([:some, :config]), do: "test_value"
|
||||
def get(_), do: nil
|
||||
end
|
||||
|
||||
# In your test
|
||||
Mox.stub_with(Pleroma.ConfigMock, TestConfig)
|
||||
```
|
||||
|
||||
4. **Pass Configuration as Arguments**:
|
||||
```elixir
|
||||
# Refactor functions to accept configuration as arguments
|
||||
def some_function(config \\ nil) do
|
||||
config = config || Pleroma.Config.get([:some, :config])
|
||||
# ...
|
||||
end
|
||||
|
||||
# In your test
|
||||
some_function("test_value")
|
||||
```
|
||||
|
||||
By using these approaches, you can safely run tests with `async: true` without worrying about configuration conflicts.
|
||||
|
||||
## Setting Up Mox in Pleroma
|
||||
|
||||
### Step 1: Define a Behavior
|
||||
|
||||
Start by defining a behavior for the module you want to mock. This specifies the contract that both the real implementation and mocks must follow.
|
||||
|
||||
```elixir
|
||||
# In your implementation module (e.g., lib/pleroma/uploaders/s3.ex)
|
||||
defmodule Pleroma.Uploaders.S3.ExAwsAPI do
|
||||
@callback request(op :: ExAws.Operation.t()) :: {:ok, ExAws.Operation.t()} | {:error, term()}
|
||||
end
|
||||
```
|
||||
|
||||
### Step 2: Make Your Implementation Configurable
|
||||
|
||||
Modify your module to use a configurable implementation. This allows for dependency injection and easier testing.
|
||||
|
||||
```elixir
|
||||
# In your implementation module
|
||||
@ex_aws_impl Application.compile_env(:pleroma, [__MODULE__, :ex_aws_impl], ExAws)
|
||||
@config_impl Application.compile_env(:pleroma, [__MODULE__, :config_impl], Pleroma.Config)
|
||||
|
||||
def put_file(%Pleroma.Upload{} = upload) do
|
||||
# Use @ex_aws_impl instead of ExAws directly
|
||||
case @ex_aws_impl.request(op) do
|
||||
{:ok, _} ->
|
||||
{:ok, {:file, s3_name}}
|
||||
|
||||
error ->
|
||||
Logger.error("#{__MODULE__}: #{inspect(error)}")
|
||||
error
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### Step 3: Define the Mock in test/support/mocks.ex
|
||||
|
||||
Add your mock definition in the central mocks file:
|
||||
|
||||
```elixir
|
||||
# In test/support/mocks.ex
|
||||
Mox.defmock(Pleroma.Uploaders.S3.ExAwsMock, for: Pleroma.Uploaders.S3.ExAwsAPI)
|
||||
```
|
||||
|
||||
### Step 4: Configure the Mock in Test Environment
|
||||
|
||||
In your test configuration (e.g., `config/test.exs`), specify which mock implementation to use:
|
||||
|
||||
```elixir
|
||||
config :pleroma, Pleroma.Uploaders.S3, ex_aws_impl: Pleroma.Uploaders.S3.ExAwsMock
|
||||
config :pleroma, Pleroma.Uploaders.S3, config_impl: Pleroma.UnstubbedConfigMock
|
||||
```
|
||||
|
||||
## Writing Tests with Mox
|
||||
|
||||
### Setting Up Your Test
|
||||
|
||||
```elixir
|
||||
defmodule Pleroma.Uploaders.S3Test do
|
||||
use Pleroma.DataCase, async: true # Note: async: true is now possible!
|
||||
|
||||
alias Pleroma.Uploaders.S3
|
||||
alias Pleroma.Uploaders.S3.ExAwsMock
|
||||
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
||||
|
||||
import Mox # Import Mox functions
|
||||
|
||||
# Note: verify_on_exit! is already called in DataCase setup
|
||||
# so you don't need to add it explicitly in your test module
|
||||
end
|
||||
```
|
||||
|
||||
### Setting Expectations with Mox
|
||||
|
||||
Mox uses an explicit expectation system. Here's how to use it:
|
||||
|
||||
```elixir
|
||||
# Basic expectation for a function call
|
||||
ExAwsMock
|
||||
|> expect(:request, fn _req -> {:ok, %{status_code: 200}} end)
|
||||
|
||||
# Expectation for multiple calls with same response
|
||||
ExAwsMock
|
||||
|> expect(:request, 3, fn _req -> {:ok, %{status_code: 200}} end)
|
||||
|
||||
# Expectation with specific arguments
|
||||
ExAwsMock
|
||||
|> expect(:request, fn %{bucket: "test_bucket"} -> {:ok, %{status_code: 200}} end)
|
||||
|
||||
# Complex configuration mocking
|
||||
ConfigMock
|
||||
|> expect(:get, fn key ->
|
||||
[
|
||||
{Pleroma.Upload, [uploader: Pleroma.Uploaders.S3, base_url: "https://s3.amazonaws.com"]},
|
||||
{Pleroma.Uploaders.S3, [bucket: "test_bucket"]}
|
||||
]
|
||||
|> get_in(key)
|
||||
end)
|
||||
```
|
||||
|
||||
### Understanding Mox Modes in Pleroma
|
||||
|
||||
Pleroma's DataCase automatically configures Mox differently based on whether your test is async or not:
|
||||
|
||||
1. **Async tests** (`async: true`):
|
||||
- Uses `Mox.set_mox_private()` - expectations are scoped to the current process
|
||||
- Stubs `Pleroma.CachexMock` with `Pleroma.NullCache`
|
||||
- Each test process has its own isolated mock expectations
|
||||
|
||||
2. **Non-async tests** (`async: false`):
|
||||
- Uses `Mox.set_mox_global()` - expectations are shared across processes
|
||||
- Stubs `Pleroma.CachexMock` with `Pleroma.CachexProxy`
|
||||
- Mock expectations can be set in one process and called from another
|
||||
|
||||
Choose the appropriate mode based on your test requirements. For most tests, async mode is preferred for better performance.
|
||||
|
||||
## Migrating from Mock/meck to Mox
|
||||
|
||||
Here's a step-by-step guide for migrating existing tests from Mock/meck to Mox:
|
||||
|
||||
### 1. Identify the Module to Mock
|
||||
|
||||
Look for `with_mock` or `test_with_mock` calls in your tests:
|
||||
|
||||
```elixir
|
||||
# Old approach with Mock
|
||||
with_mock ExAws, request: fn _ -> {:ok, :ok} end do
|
||||
assert S3.put_file(file_upload) == {:ok, {:file, "test_folder/image-tet.jpg"}}
|
||||
end
|
||||
```
|
||||
|
||||
### 2. Define a Behavior for the Module
|
||||
|
||||
Create a behavior that defines the functions you want to mock:
|
||||
|
||||
```elixir
|
||||
defmodule Pleroma.Uploaders.S3.ExAwsAPI do
|
||||
@callback request(op :: ExAws.Operation.t()) :: {:ok, ExAws.Operation.t()} | {:error, term()}
|
||||
end
|
||||
```
|
||||
|
||||
### 3. Update Your Implementation to Use a Configurable Dependency
|
||||
|
||||
```elixir
|
||||
# Old
|
||||
def put_file(%Pleroma.Upload{} = upload) do
|
||||
case ExAws.request(op) do
|
||||
# ...
|
||||
end
|
||||
end
|
||||
|
||||
# New
|
||||
@ex_aws_impl Application.compile_env(:pleroma, [__MODULE__, :ex_aws_impl], ExAws)
|
||||
|
||||
def put_file(%Pleroma.Upload{} = upload) do
|
||||
case @ex_aws_impl.request(op) do
|
||||
# ...
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### 4. Define the Mock in mocks.ex
|
||||
|
||||
```elixir
|
||||
Mox.defmock(Pleroma.Uploaders.S3.ExAwsMock, for: Pleroma.Uploaders.S3.ExAwsAPI)
|
||||
```
|
||||
|
||||
### 5. Configure the Test Environment
|
||||
|
||||
```elixir
|
||||
config :pleroma, Pleroma.Uploaders.S3, ex_aws_impl: Pleroma.Uploaders.S3.ExAwsMock
|
||||
```
|
||||
|
||||
### 6. Update Your Tests to Use Mox
|
||||
|
||||
```elixir
|
||||
# Old (with Mock)
|
||||
test_with_mock "save file", ExAws, request: fn _ -> {:ok, :ok} end do
|
||||
assert S3.put_file(file_upload) == {:ok, {:file, "test_folder/image-tet.jpg"}}
|
||||
assert_called(ExAws.request(:_))
|
||||
end
|
||||
|
||||
# New (with Mox)
|
||||
test "save file" do
|
||||
ExAwsMock
|
||||
|> expect(:request, fn _req -> {:ok, %{status_code: 200}} end)
|
||||
|
||||
assert S3.put_file(file_upload) == {:ok, {:file, "test_folder/image-tet.jpg"}}
|
||||
end
|
||||
```
|
||||
|
||||
### 7. Enable Async Testing
|
||||
|
||||
Now you can safely enable `async: true` in your test module:
|
||||
|
||||
```elixir
|
||||
use Pleroma.DataCase, async: true
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always define behaviors**: They serve as contracts and documentation
|
||||
2. **Keep mocks in a central location**: Use test/support/mocks.ex for all mock definitions
|
||||
3. **Use verify_on_exit!**: This is already set up in DataCase, ensuring all expected calls were made
|
||||
4. **Use specific expectations**: Be as specific as possible with your expectations
|
||||
5. **Enable async: true**: Take advantage of Mox's concurrent testing capability
|
||||
6. **Don't over-mock**: Only mock external dependencies that are difficult to test directly
|
||||
7. **Leverage existing stubs**: Use the default stubs provided by DataCase when possible
|
||||
8. **Avoid clear_config in async tests**: Use dependency injection and mocking instead
|
||||
|
||||
## Example: Complete Migration
|
||||
|
||||
For a complete example of migrating a test from Mock/meck to Mox, you can refer to commit `90a47ca050c5839e8b4dc3bac315dc436d49152d` in the Pleroma repository, which shows how the S3 uploader tests were migrated.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Migrating tests from Mock/meck to Mox provides significant benefits for the Pleroma test suite, including faster test execution through async testing, better isolation between tests, and more robust mocking through explicit contracts. By following this guide, you can successfully migrate existing tests and write new tests using Mox.
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
# Installing on Arch Linux
|
||||
|
||||
{! backend/installation/otp_vs_from_source_source.include !}
|
||||
|
||||
## Installation
|
||||
|
||||
This guide will assume that you have administrative rights, either as root or a user with [sudo permissions](https://wiki.archlinux.org/index.php/Sudo). If you want to run this guide with root, ignore the `sudo` at the beginning of the lines, unless it calls a user like `sudo -Hu pleroma`; in this case, use `su <username> -s $SHELL -c 'command'` instead.
|
||||
|
||||
### Required packages
|
||||
|
||||
* `postgresql`
|
||||
* `elixir`
|
||||
* `git`
|
||||
* `base-devel`
|
||||
* `cmake`
|
||||
* `file`
|
||||
|
||||
#### Optional packages used in this guide
|
||||
|
||||
* `nginx` (preferred, example configs for other reverse proxies can be found in the repo)
|
||||
* `certbot` (or any other ACME client for Let’s Encrypt certificates)
|
||||
* `ImageMagick`
|
||||
* `ffmpeg`
|
||||
* `exiftool`
|
||||
|
||||
### Prepare the system
|
||||
|
||||
* First update the system, if not already done:
|
||||
|
||||
```shell
|
||||
sudo pacman -Syu
|
||||
```
|
||||
|
||||
* Install some of the above mentioned programs:
|
||||
|
||||
```shell
|
||||
sudo pacman -S git base-devel elixir cmake file
|
||||
```
|
||||
|
||||
### Install PostgreSQL
|
||||
|
||||
[Arch Wiki article](https://wiki.archlinux.org/index.php/PostgreSQL)
|
||||
|
||||
* Install the `postgresql` package:
|
||||
|
||||
```shell
|
||||
sudo pacman -S postgresql
|
||||
```
|
||||
|
||||
* Initialize the database cluster:
|
||||
|
||||
```shell
|
||||
sudo -iu postgres initdb -D /var/lib/postgres/data
|
||||
```
|
||||
|
||||
* Start and enable the `postgresql.service`
|
||||
|
||||
```shell
|
||||
sudo systemctl enable --now postgresql.service
|
||||
```
|
||||
|
||||
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
|
||||
|
||||
```shell
|
||||
sudo pacman -S ffmpeg imagemagick perl-image-exiftool
|
||||
```
|
||||
|
||||
### Install PleromaBE
|
||||
|
||||
* Add a new system user for the Pleroma service:
|
||||
|
||||
```shell
|
||||
sudo useradd -r -s /bin/false -m -d /var/lib/pleroma -U pleroma
|
||||
```
|
||||
|
||||
**Note**: To execute a single command as the Pleroma system user, use `sudo -Hu pleroma command`. You can also switch to a shell by using `sudo -Hu pleroma $SHELL`. If you don’t have and want `sudo` on your system, you can use `su` as root user (UID 0) for a single command by using `su -l pleroma -s $SHELL -c 'command'` and `su -l pleroma -s $SHELL` for starting a shell.
|
||||
|
||||
* Git clone the PleromaBE repository and make the Pleroma user the owner of the directory:
|
||||
|
||||
```shell
|
||||
sudo mkdir -p /opt/pleroma
|
||||
sudo chown -R pleroma:pleroma /opt/pleroma
|
||||
sudo -Hu pleroma git clone -b stable https://git.pleroma.social/pleroma/pleroma /opt/pleroma
|
||||
```
|
||||
|
||||
* Change to the new directory:
|
||||
|
||||
```shell
|
||||
cd /opt/pleroma
|
||||
```
|
||||
|
||||
* Install the dependencies for Pleroma and answer with `yes` if it asks you to install `Hex`:
|
||||
|
||||
```shell
|
||||
sudo -Hu pleroma mix deps.get
|
||||
```
|
||||
|
||||
* Generate the configuration: `sudo -Hu pleroma MIX_ENV=prod mix pleroma.instance gen`
|
||||
* Answer with `yes` if it asks you to install `rebar3`.
|
||||
* This may take some time, because parts of pleroma get compiled first.
|
||||
* After that it will ask you a few questions about your instance and generates a configuration file in `config/generated_config.exs`.
|
||||
|
||||
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
||||
|
||||
```shell
|
||||
sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs}
|
||||
```
|
||||
|
||||
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
||||
|
||||
```shell
|
||||
sudo -Hu postgres psql -f config/setup_db.psql
|
||||
```
|
||||
|
||||
* Now run the database migration:
|
||||
|
||||
```shell
|
||||
sudo -Hu pleroma MIX_ENV=prod mix ecto.migrate
|
||||
```
|
||||
|
||||
* Now you can start Pleroma already
|
||||
|
||||
```shell
|
||||
sudo -Hu pleroma MIX_ENV=prod mix phx.server
|
||||
```
|
||||
|
||||
### Finalize installation
|
||||
|
||||
If you want to open your newly installed instance to the world, you should run nginx or some other webserver/proxy in front of Pleroma and you should consider to create a systemd service file for Pleroma.
|
||||
|
||||
#### Nginx
|
||||
|
||||
* Install nginx, if not already done:
|
||||
|
||||
```shell
|
||||
sudo pacman -S nginx
|
||||
```
|
||||
|
||||
* Create directories for available and enabled sites:
|
||||
|
||||
```shell
|
||||
sudo mkdir -p /etc/nginx/sites-{available,enabled}
|
||||
```
|
||||
|
||||
* Append the following line at the end of the `http` block in `/etc/nginx/nginx.conf`:
|
||||
|
||||
```Nginx
|
||||
include sites-enabled/*;
|
||||
```
|
||||
|
||||
* Setup your SSL cert, using your method of choice or certbot. If using certbot, first install it:
|
||||
|
||||
```shell
|
||||
sudo pacman -S certbot certbot-nginx
|
||||
```
|
||||
|
||||
and then set it up:
|
||||
|
||||
```shell
|
||||
sudo mkdir -p /var/lib/letsencrypt/
|
||||
sudo certbot certonly --email <your@emailaddress> -d <yourdomain> --standalone
|
||||
```
|
||||
|
||||
If that doesn’t work, make sure, that nginx is not already running. If it still doesn’t work, try setting up nginx first (change ssl “on” to “off” and try again).
|
||||
|
||||
---
|
||||
|
||||
* Copy the example nginx configuration and activate it:
|
||||
|
||||
```shell
|
||||
sudo cp /opt/pleroma/installation/pleroma.nginx /etc/nginx/sites-available/pleroma.nginx
|
||||
sudo ln -s /etc/nginx/sites-available/pleroma.nginx /etc/nginx/sites-enabled/pleroma.nginx
|
||||
```
|
||||
|
||||
* Before starting nginx edit the configuration and change it to your needs (e.g. change servername, change cert paths)
|
||||
|
||||
* (Strongly recommended) serve media on another domain
|
||||
|
||||
Refer to the [Hardening your instance](../configuration/hardening.md) document on how to serve media on another domain. We STRONGLY RECOMMEND you to do this to minimize attack vectors.
|
||||
|
||||
* Enable and start nginx:
|
||||
|
||||
```shell
|
||||
sudo systemctl enable --now nginx.service
|
||||
```
|
||||
|
||||
If you need to renew the certificate in the future, uncomment the relevant location block in the nginx config and run:
|
||||
|
||||
```shell
|
||||
sudo certbot certonly --email <your@emailaddress> -d <yourdomain> --webroot -w /var/lib/letsencrypt/
|
||||
```
|
||||
|
||||
#### Other webserver/proxies
|
||||
|
||||
You can find example configurations for them in `/opt/pleroma/installation/`.
|
||||
|
||||
#### Systemd service
|
||||
|
||||
* Copy example service file
|
||||
|
||||
```shell
|
||||
sudo cp /opt/pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
|
||||
```
|
||||
|
||||
* Edit the service file and make sure that all paths fit your installation
|
||||
* Enable and start `pleroma.service`:
|
||||
|
||||
```shell
|
||||
sudo systemctl enable --now pleroma.service
|
||||
```
|
||||
|
||||
#### Create your first user
|
||||
|
||||
If your instance is up and running, you can create your first user with administrative rights with the following task:
|
||||
|
||||
```shell
|
||||
sudo -Hu pleroma MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress> --admin
|
||||
```
|
||||
|
||||
#### Further reading
|
||||
|
||||
{! backend/installation/further_reading.include !}
|
||||
|
||||
## Questions
|
||||
|
||||
Questions about the installation or didn’t it work as it should be, ask in [#pleroma:libera.chat](https://matrix.to/#/#pleroma:libera.chat) via Matrix or **#pleroma** on **libera.chat** via IRC.
|
||||
|
|
@ -72,7 +72,7 @@ sudo -Hu pleroma mix deps.get
|
|||
* Generate the configuration:
|
||||
|
||||
```shell
|
||||
sudo -Hu pleroma MIX_ENV=prod mix pleroma.instance gen`
|
||||
sudo -Hu pleroma MIX_ENV=prod mix pleroma.instance gen
|
||||
```
|
||||
|
||||
* During this process:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Note: This article is potentially outdated because at this time we may not have
|
|||
|
||||
- PostgreSQL 11.0以上 (Ubuntu16.04では9.5しか提供されていないので,[](https://www.postgresql.org/download/linux/ubuntu/)こちらから新しいバージョンを入手してください)
|
||||
- `postgresql-contrib` 11.0以上 (同上)
|
||||
- Elixir 1.14 以上 ([Debianのリポジトリからインストールしないこと!!! ここからインストールすること!](https://elixir-lang.org/install.html#unix-and-unix-like)。または [asdf](https://github.com/asdf-vm/asdf) をpleromaユーザーでインストールしてください)
|
||||
- Elixir 1.15 以上 ([Debianのリポジトリからインストールしないこと!!! ここからインストールすること!](https://elixir-lang.org/install.html#unix-and-unix-like)。または [asdf](https://github.com/asdf-vm/asdf) をpleromaユーザーでインストールしてください)
|
||||
- `erlang-dev`
|
||||
- `erlang-nox`
|
||||
- `git`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
## Required dependencies
|
||||
|
||||
* PostgreSQL >=11.0
|
||||
* Elixir >=1.14.0 <1.17
|
||||
* Erlang OTP >=23.0.0 (supported: <27)
|
||||
* Elixir >=1.15.0, <1.20
|
||||
* Erlang OTP >=24.0.0 (supported: <29)
|
||||
* git
|
||||
* file / libmagic
|
||||
* gcc or clang
|
||||
|
|
|
|||
|
|
@ -1,294 +0,0 @@
|
|||
# Installing on NetBSD
|
||||
|
||||
{! backend/installation/generic_dependencies.include !}
|
||||
|
||||
# Installation options
|
||||
|
||||
Currently there are two options available for NetBSD: manual installation (from source) or using experimental package from [pkgsrc-wip](https://github.com/NetBSD/pkgsrc-wip/tree/master/pleroma).
|
||||
|
||||
WIP package can be installed via pkgsrc and can be crosscompiled for easier binary distribution. Source installation most probably will be restricted to a single machine.
|
||||
|
||||
## pkgsrc installation
|
||||
|
||||
WIP package creates Mix.Release (similar to how Docker images are built) but doesn't bundle Erlang runtime, listing it as a dependency instead. This allows for easier and more modular installations, especially on weaker machines. Currently this method also does not support all features of `pleroma_ctl` command (like changing installation type or managing frontends) as NetBSD is not yet a supported binary flavour of Pleroma's CI.
|
||||
|
||||
In any case, you can install it the same way as any other `pkgsrc-wip` package:
|
||||
|
||||
```
|
||||
cd /usr/pkgsrc
|
||||
git clone --depth 1 git://wip.pkgsrc.org/pkgsrc-wip.git wip
|
||||
cp -rf wip/pleroma www
|
||||
cp -rf wip/libvips graphics
|
||||
cd /usr/pkgsrc/www/pleroma
|
||||
bmake && bmake install
|
||||
```
|
||||
|
||||
Use `bmake package` to create a binary package. This can come especially handy if you're targeting embedded or low-power systems and are crosscompiling on a more powerful machine.
|
||||
|
||||
> Note: Elixir has [endianness bug](https://github.com/elixir-lang/elixir/issues/2785) which requires it to be compiled on a machine with the same endianness. In other words, package crosscompiled on amd64 (little endian) won't work on powerpc or sparc machines (big endian). While _in theory™_ nothing catastrophic should happen, one can see that for example regexes won't work properly. Some distributions just strip this warning away, so it doesn't bother the users... anyway, you've been warned.
|
||||
|
||||
## Source installation
|
||||
|
||||
pkgin should have been installed by the NetBSD installer if you selected
|
||||
the right options. If it isn't installed, install it using `pkg_add`.
|
||||
|
||||
Note that `postgresql11-contrib` is needed for the Postgres extensions
|
||||
Pleroma uses.
|
||||
|
||||
> Note: you can use modern versions of PostgreSQL. In this case, just use `postgresql16-contrib` and so on.
|
||||
|
||||
The `mksh` shell is needed to run the Elixir `mix` script.
|
||||
|
||||
`# pkgin install acmesh elixir git-base git-docs mksh nginx postgresql11-server postgresql11-client postgresql11-contrib sudo ffmpeg4 ImageMagick`
|
||||
|
||||
You can also build these packages using pkgsrc:
|
||||
```
|
||||
databases/postgresql11-contrib
|
||||
databases/postgresql11-client
|
||||
databases/postgresql11-server
|
||||
devel/git-base
|
||||
devel/git-docs
|
||||
devel/cmake
|
||||
lang/elixir
|
||||
security/acmesh
|
||||
security/sudo
|
||||
shells/mksh
|
||||
www/nginx
|
||||
```
|
||||
|
||||
Create a user for Pleroma:
|
||||
|
||||
```
|
||||
# groupadd pleroma
|
||||
# useradd -d /home/pleroma -m -g pleroma -s /usr/pkg/bin/mksh pleroma
|
||||
# echo 'export LC_ALL="en_GB.UTF-8"' >> /home/pleroma/.profile
|
||||
# su -l pleroma -c $SHELL
|
||||
```
|
||||
|
||||
Clone the repository:
|
||||
|
||||
```
|
||||
$ cd /home/pleroma
|
||||
$ git clone -b stable https://git.pleroma.social/pleroma/pleroma.git
|
||||
```
|
||||
|
||||
Get deps and compile:
|
||||
|
||||
```
|
||||
$ cd /home/pleroma/pleroma
|
||||
$ export MIX_ENV=prod
|
||||
$ mix deps.get
|
||||
$ mix compile
|
||||
```
|
||||
|
||||
## Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
|
||||
|
||||
`# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
|
||||
|
||||
or via pkgsrc:
|
||||
|
||||
```
|
||||
graphics/p5-Image-ExifTool
|
||||
graphics/ImageMagick
|
||||
multimedia/ffmpeg4
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
## Understanding $PREFIX
|
||||
|
||||
From now on, you may encounter `$PREFIX` variable in the paths. This variable indicates your current local pkgsrc prefix. Usually it's `/usr/pkg` unless you configured it otherwise. Translating to pkgsrc's lingo, it's called `LOCALBASE`, which essentially means the same this. You may want to set it up for your local shell session (this uses `mksh` which should already be installed as one of the required dependencies):
|
||||
|
||||
```
|
||||
$ export PREFIX=$(pkg_info -Q LOCALBASE mksh)
|
||||
$ echo $PREFIX
|
||||
/usr/pkg
|
||||
```
|
||||
|
||||
## Setting up your instance
|
||||
|
||||
Now, you need to configure your instance. During this initial configuration, you will be asked some questions about your server. You will need a domain name at this point; it doesn't have to be deployed, but changing it later will be very cumbersome.
|
||||
|
||||
If you've installed via pkgsrc, `pleroma_ctl` should already be in your `PATH`; if you've installed from source, it's located at `/home/pleroma/pleroma/release/bin/pleroma_ctl`.
|
||||
|
||||
```
|
||||
$ su -l pleroma
|
||||
$ pleroma_ctl instance gen --output $PREFIX/etc/pleroma/config.exs --output-psql /tmp/setup_db.psql
|
||||
```
|
||||
|
||||
During installation, you will be asked about static and upload directories. Don't forget to create them and update permissions:
|
||||
|
||||
```
|
||||
mkdir -p /var/lib/pleroma/uploads
|
||||
chown -R pleroma:pleroma /var/lib/pleroma
|
||||
```
|
||||
|
||||
## Setting up the database
|
||||
|
||||
First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
|
||||
|
||||
We can now initialize the database. You'll need to edit generated SQL file from the previous step. It's located at `/tmp/setup_db.psql`.
|
||||
|
||||
Edit this file, and *change the password* to a password of your choice. Make sure it is secure, since
|
||||
it'll be protecting your database. Now initialize the database:
|
||||
|
||||
```
|
||||
$ sudo -Hu pgsql -g pgsql psql -f /tmp/setup_db.psql
|
||||
```
|
||||
|
||||
Postgres allows connections from all users without a password by default. To
|
||||
fix this, edit `$PREFIX/pgsql/data/pg_hba.conf`. Change every `trust` to
|
||||
`password`.
|
||||
|
||||
Once this is done, restart Postgres with `# /etc/rc.d/pgsql restart`.
|
||||
|
||||
Run the database migrations.
|
||||
|
||||
### pkgsrc installation
|
||||
|
||||
```
|
||||
pleroma_ctl migrate
|
||||
```
|
||||
|
||||
### Source installation
|
||||
|
||||
You will need to do this whenever you update with `git pull`:
|
||||
|
||||
```
|
||||
$ cd /home/pleroma/pleroma
|
||||
$ MIX_ENV=prod mix ecto.migrate
|
||||
```
|
||||
|
||||
## Configuring nginx
|
||||
|
||||
Install the example configuration file
|
||||
(`$PREFIX/share/examples/pleroma/pleroma.nginx` or `/home/pleroma/pleroma/installation/pleroma.nginx`) to
|
||||
`$PREFIX/etc/nginx.conf`.
|
||||
|
||||
Note that it will need to be wrapped in a `http {}` block. You should add
|
||||
settings for the nginx daemon outside of the http block, for example:
|
||||
|
||||
```
|
||||
user nginx nginx;
|
||||
error_log /var/log/nginx/error.log;
|
||||
worker_processes 4;
|
||||
|
||||
events {
|
||||
}
|
||||
```
|
||||
|
||||
Edit the defaults:
|
||||
|
||||
* Change `ssl_certificate` and `ssl_trusted_certificate` to
|
||||
`/etc/nginx/tls/fullchain`.
|
||||
* Change `ssl_certificate_key` to `/etc/nginx/tls/key`.
|
||||
* Change `example.tld` to your instance's domain name.
|
||||
|
||||
### (Strongly recommended) serve media on another domain
|
||||
|
||||
Refer to the [Hardening your instance](../configuration/hardening.md) document on how to serve media on another domain. We STRONGLY RECOMMEND you to do this to minimize attack vectors.
|
||||
|
||||
## Configuring acme.sh
|
||||
|
||||
We'll be using acme.sh in Stateless Mode for TLS certificate renewal.
|
||||
|
||||
First, get your account fingerprint:
|
||||
|
||||
```
|
||||
$ sudo -Hu nginx -g nginx acme.sh --register-account
|
||||
```
|
||||
|
||||
You need to add the following to your nginx configuration for the server
|
||||
running on port 80:
|
||||
|
||||
```
|
||||
location ~ ^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)$ {
|
||||
default_type text/plain;
|
||||
return 200 "$1.6fXAG9VyG0IahirPEU2ZerUtItW2DHzDzD9wZaEKpqd";
|
||||
}
|
||||
```
|
||||
|
||||
Replace the string after after `$1.` with your fingerprint.
|
||||
|
||||
Start nginx:
|
||||
|
||||
```
|
||||
# /etc/rc.d/nginx start
|
||||
```
|
||||
|
||||
It should now be possible to issue a cert (replace `example.com`
|
||||
with your domain name):
|
||||
|
||||
```
|
||||
$ sudo -Hu nginx -g nginx acme.sh --issue -d example.com --stateless
|
||||
```
|
||||
|
||||
Let's add auto-renewal to `/etc/daily.local`
|
||||
(replace `example.com` with your domain):
|
||||
|
||||
```
|
||||
/usr/pkg/bin/sudo -Hu nginx -g nginx \
|
||||
/usr/pkg/sbin/acme.sh -r \
|
||||
-d example.com \
|
||||
--cert-file /etc/nginx/tls/cert \
|
||||
--key-file /etc/nginx/tls/key \
|
||||
--ca-file /etc/nginx/tls/ca \
|
||||
--fullchain-file /etc/nginx/tls/fullchain \
|
||||
--stateless
|
||||
```
|
||||
|
||||
## Autostart
|
||||
|
||||
For properly functioning instance, you will need pleroma (backend service), nginx (reverse proxy) and postgresql (database) services running. There's no requirement for them to reside on the same machine, but you have to provide autostart for each of them.
|
||||
|
||||
### nginx
|
||||
```
|
||||
# cp $PREFIX/share/examples/rc.d/nginx /etc/rc.d
|
||||
# echo "nginx=YES" >> /etc/rc.conf
|
||||
```
|
||||
|
||||
### postgresql
|
||||
|
||||
```
|
||||
# cp $PREFIX/share/examples/rc.d/pgsql /etc/rc.d
|
||||
# echo "pgsql=YES" >> /etc/rc.conf
|
||||
```
|
||||
|
||||
### pleroma
|
||||
|
||||
First, copy the script (pkgsrc variant)
|
||||
```
|
||||
# cp $PREFIX/share/examples/pleroma/pleroma.rc /etc/rc.d/pleroma
|
||||
```
|
||||
|
||||
or source variant
|
||||
```
|
||||
# cp /home/pleroma/pleroma/installation/netbsd/rc.d/pleroma /etc/rc.d/pleroma
|
||||
# chmod +x /etc/rc.d/pleroma
|
||||
```
|
||||
|
||||
Then, add the following to `/etc/rc.conf`:
|
||||
|
||||
```
|
||||
pleroma=YES
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
Run `# /etc/rc.d/pleroma start` to start Pleroma.
|
||||
Restart nginx with `# /etc/rc.d/nginx restart` and you should be up and running.
|
||||
|
||||
Make sure your time is in sync, or other instances will receive your posts with
|
||||
incorrect timestamps. You should have ntpd running.
|
||||
|
||||
## Instances running NetBSD
|
||||
|
||||
* <https://catgirl.science>
|
||||
|
||||
#### Further reading
|
||||
|
||||
{! backend/installation/further_reading.include !}
|
||||
|
||||
## Questions
|
||||
|
||||
Questions about the installation or didn’t it work as it should be, ask in [#pleroma:libera.chat](https://matrix.to/#/#pleroma:libera.chat) via Matrix or **#pleroma** on **libera.chat** via IRC.
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# Installing on NixOS
|
||||
|
||||
NixOS contains a source build package of pleroma and a NixOS module to install it.
|
||||
For installation add this to your configuration.nix and add a config.exs next to it:
|
||||
```nix
|
||||
services.pleroma = {
|
||||
enable = true;
|
||||
configs = [ (lib.fileContents ./config.exs) ];
|
||||
secretConfigFile = "/var/lib/pleroma/secret.exs";
|
||||
};
|
||||
```
|
||||
|
||||
## Questions
|
||||
The nix community uses matrix for communication: [#nix:nixos.org](https://matrix.to/#/#nix:nixos.org)
|
||||
|
||||
|
|
@ -1,25 +1,29 @@
|
|||
# Installing on OpenBSD
|
||||
|
||||
This guide describes the installation and configuration of pleroma (and the required software to run it) on a single OpenBSD 6.6 server.
|
||||
{! backend/installation/otp_vs_from_source_source.include !}
|
||||
|
||||
This guide describes the installation and configuration of Pleroma (and the required software to run it) on a single OpenBSD 7.7 server.
|
||||
|
||||
For any additional information regarding commands and configuration files mentioned here, check the man pages [online](https://man.openbsd.org/) or directly on your server with the man command.
|
||||
|
||||
{! backend/installation/generic_dependencies.include !}
|
||||
|
||||
## Installation
|
||||
|
||||
### Preparing the system
|
||||
#### Required software
|
||||
|
||||
To install them, run the following command (with doas or as root):
|
||||
To install required packages, run the following command:
|
||||
|
||||
```
|
||||
pkg_add elixir gmake git postgresql-server postgresql-contrib cmake ffmpeg ImageMagick libvips
|
||||
# pkg_add elixir gmake git postgresql-server postgresql-contrib cmake libmagic libvips
|
||||
```
|
||||
|
||||
Pleroma requires a reverse proxy, OpenBSD has relayd in base (and is used in this guide) and packages/ports are available for nginx (www/nginx) and apache (www/apache-httpd). Independently of the reverse proxy, [acme-client(1)](https://man.openbsd.org/acme-client) can be used to get a certificate from Let's Encrypt.
|
||||
Pleroma requires a reverse proxy, OpenBSD has relayd in base (and is used in this guide) and packages/ports are available for nginx (www/nginx) and apache (www/apache-httpd).
|
||||
Independently of the reverse proxy, [acme-client(1)](https://man.openbsd.org/acme-client) can be used to get a certificate from Let's Encrypt.
|
||||
|
||||
#### Optional software
|
||||
|
||||
Per [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md):
|
||||
* ImageMagick
|
||||
* ffmpeg
|
||||
* exiftool
|
||||
|
|
@ -27,234 +31,351 @@ Per [`docs/installation/optional/media_graphics_packages.md`](../installation/op
|
|||
To install the above:
|
||||
|
||||
```
|
||||
pkg_add ImageMagick ffmpeg p5-Image-ExifTool
|
||||
# pkg_add ImageMagick ffmpeg p5-Image-ExifTool
|
||||
```
|
||||
|
||||
#### Creating the pleroma user
|
||||
Pleroma will be run by a dedicated user, \_pleroma. Before creating it, insert the following lines in login.conf:
|
||||
For more information read [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md):
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
Switch to the \_postgresql user and initialize PostgreSQL:
|
||||
|
||||
```
|
||||
# su _postgresql
|
||||
$ initdb -D /var/postgresql/data -U postgres --encoding=utf-8 --lc-collate=C
|
||||
```
|
||||
|
||||
Running PostgreSQL in a different directory than `/var/postgresql/data` requires changing the `daemon_flags` variable in the `/etc/rc.d/postgresql` script.
|
||||
|
||||
For security reasons it is recommended to change the authentication method for `local` and `host` connections with the localhost address to `scram-sha-256`.<br>
|
||||
Do not forget to set a password for the `postgres` user before doing so, otherwise you won't be able to log back in unless you change the authentication method back to `trust`.<br>
|
||||
Changing the password hashing algorithm is not needed.<br>
|
||||
For more information [read](https://www.postgresql.org/docs/16/auth-pg-hba-conf.html) the PostgreSQL documentation.
|
||||
|
||||
Enable and start the postgresql service:
|
||||
|
||||
```
|
||||
# rcctl enable postgresql
|
||||
# rcctl start postgresql
|
||||
```
|
||||
|
||||
To check that PostgreSQL started properly and didn't fail right after starting, run `# rcctl check postgresql` which should return `postgresql(ok)`.
|
||||
|
||||
### Configuring Pleroma
|
||||
|
||||
Pleroma will be run by a dedicated \_pleroma user. Before creating it, insert the following lines in `/etc/login.conf`:
|
||||
|
||||
```
|
||||
pleroma:\
|
||||
:datasize-max=1536M:\
|
||||
:datasize-cur=1536M:\
|
||||
:openfiles-max=4096
|
||||
:datasize=1536M:\
|
||||
:openfiles-max=4096:\
|
||||
:openfiles-cur=1024:\
|
||||
:setenv=LC_ALL=en_US.UTF-8,VIX_COMPILATION_MODE=PLATFORM_PROVIDED_LIBVIPS,MIX_ENV=prod:\
|
||||
:tc=daemon:
|
||||
```
|
||||
This creates a "pleroma" login class and sets higher values than default for datasize and openfiles (see [login.conf(5)](https://man.openbsd.org/login.conf)), this is required to avoid having pleroma crash some time after starting.
|
||||
|
||||
Create the \_pleroma user, assign it the pleroma login class and create its home directory (/home/\_pleroma/): `useradd -m -L pleroma _pleroma`
|
||||
This creates a "pleroma" login class and sets higher values than default for datasize and openfiles (see [login.conf(5)](https://man.openbsd.org/login.conf)), this is required to avoid having Pleroma crash some time after starting.
|
||||
|
||||
#### Clone pleroma's directory
|
||||
Enter a shell as the \_pleroma user. As root, run `su _pleroma -;cd`. Then clone the repository with `git clone -b stable https://git.pleroma.social/pleroma/pleroma.git`. Pleroma is now installed in /home/\_pleroma/pleroma/, it will be configured and started at the end of this guide.
|
||||
|
||||
#### PostgreSQL
|
||||
Start a shell as the \_postgresql user (as root run `su _postgresql -` then run the `initdb` command to initialize postgresql:
|
||||
You will need to specify pgdata directory to the default (/var/postgresql/data) with the `-D <path>` and set the user to postgres with the `-U <username>` flag. This can be done as follows:
|
||||
Create the \_pleroma user, assign it the pleroma login class and create its home directory (/home/\_pleroma/):
|
||||
|
||||
```
|
||||
initdb -D /var/postgresql/data -U postgres
|
||||
# useradd -m -L pleroma _pleroma
|
||||
```
|
||||
If you are not using the default directory, you will have to update the `datadir` variable in the /etc/rc.d/postgresql script.
|
||||
|
||||
When this is done, enable postgresql so that it starts on boot and start it. As root, run:
|
||||
Switch to the _pleroma user:
|
||||
|
||||
```
|
||||
rcctl enable postgresql
|
||||
rcctl start postgresql
|
||||
# su -l _pleroma
|
||||
```
|
||||
|
||||
Clone the Pleroma repository:
|
||||
|
||||
```
|
||||
$ git clone -b stable https://git.pleroma.social/pleroma/pleroma.git
|
||||
$ cd pleroma
|
||||
```
|
||||
|
||||
Pleroma is now installed in /home/\_pleroma/pleroma/. To configure it run:
|
||||
|
||||
```
|
||||
$ mix deps.get
|
||||
$ MIX_ENV=prod mix pleroma.instance gen # You will be asked a few questions here.
|
||||
$ cp config/generated_config.exs config/prod.secret.exs
|
||||
```
|
||||
|
||||
Note: Answer yes when asked to install Hex and rebar3. This step might take some time as Pleroma gets compiled first.
|
||||
|
||||
Create the Pleroma database:
|
||||
|
||||
```
|
||||
$ psql -U postgres -f config/setup_db.psql
|
||||
```
|
||||
|
||||
Apply database migrations:
|
||||
|
||||
```
|
||||
$ MIX_ENV=prod mix ecto.migrate
|
||||
```
|
||||
|
||||
Note: You will need to run this step again when updating your instance to a newer version with `git pull` or `git checkout tags/NEW_VERSION`.
|
||||
|
||||
As \_pleroma in /home/\_pleroma/pleroma, you can now run `MIX_ENV=prod mix phx.server` to start your instance.
|
||||
In another SSH session or a tmux window, check that it is working properly by running `ftp -MVo - http://127.0.0.1:4000/api/v1/instance`, you should get json output.
|
||||
Double-check that the *uri* value near the bottom is your instance's domain name and the instance *title* are correct.
|
||||
|
||||
### Configuring acme-client
|
||||
|
||||
acme-client is used to get SSL/TLS certificates from Let's Encrypt.
|
||||
Insert the following configuration in `/etc/acme-client.conf` and replace `example.tld` with your domain:
|
||||
|
||||
```
|
||||
#
|
||||
# $OpenBSD: acme-client.conf,v 1.5 2023/05/10 07:34:57 tb Exp $
|
||||
#
|
||||
|
||||
authority letsencrypt {
|
||||
api url "https://acme-v02.api.letsencrypt.org/directory"
|
||||
account key "/etc/acme/letsencrypt-privkey.pem"
|
||||
}
|
||||
|
||||
domain example.tld {
|
||||
# Adds alternative names to the certificate. Useful when serving media on another domain. Comma or space separated list.
|
||||
# alternative names { }
|
||||
|
||||
domain key "/etc/ssl/private/example.tld.key"
|
||||
domain certificate "/etc/ssl/example.tld_cert-only.crt"
|
||||
domain full chain certificate "/etc/ssl/example.tld.crt"
|
||||
sign with letsencrypt
|
||||
}
|
||||
```
|
||||
|
||||
Check the configuration:
|
||||
|
||||
```
|
||||
# acme-client -n
|
||||
```
|
||||
|
||||
### Configuring the Web server
|
||||
|
||||
Pleroma supports two Web servers:
|
||||
|
||||
* nginx (recommended for most users)
|
||||
* OpenBSD's httpd and relayd (ONLY for advanced users, media proxy cache is NOT supported and will NOT work properly)
|
||||
|
||||
#### nginx
|
||||
|
||||
Since nginx is not installed by default, install it by running:
|
||||
|
||||
```
|
||||
# pkg_add nginx
|
||||
```
|
||||
|
||||
Add the following to `/etc/nginx/nginx.conf`, within the `server {}` block listening on port 80 and change `server_name`, as follows:
|
||||
|
||||
```
|
||||
http {
|
||||
...
|
||||
|
||||
server {
|
||||
...
|
||||
server_name localhost; # Replace with your domain
|
||||
|
||||
location /.well-known/acme-challenge {
|
||||
rewrite ^/\.well-known/acme-challenge/(.*) /$1 break;
|
||||
root /var/www/acme;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Start the nginx service and acquire certificates:
|
||||
|
||||
```
|
||||
# rcctl start nginx
|
||||
# acme-client example.tld
|
||||
```
|
||||
|
||||
Add certificate auto-renewal by adding acme-client to `/etc/weekly.local`, replace `example.tld` with your domain:
|
||||
|
||||
```
|
||||
# echo "acme-client example.tld && rcctl reload nginx" >> /etc/weekly.local
|
||||
```
|
||||
|
||||
OpenBSD's default nginx configuration does not contain an include directive, which is typically used for multiple sites.
|
||||
Therefore, you will need to first create the required directory as follows:
|
||||
|
||||
```
|
||||
# mkdir /etc/nginx/sites-available
|
||||
# mkdir /etc/nginx/sites-enabled
|
||||
```
|
||||
|
||||
Next add the `include` directive to `/etc/nginx/nginx.conf`, within the `http {}` block, as follows:
|
||||
|
||||
```
|
||||
http {
|
||||
...
|
||||
|
||||
server {
|
||||
...
|
||||
}
|
||||
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
```
|
||||
|
||||
As root, copy `/home/_pleroma/pleroma/installation/pleroma.nginx` to `/etc/nginx/sites-available/pleroma.nginx`.
|
||||
|
||||
Edit default `/etc/nginx/sites-available/pleroma.nginx` settings and replace `example.tld` with your domain:
|
||||
|
||||
* Uncomment the location block for `~ /\.well-known/acme-challenge` in the server block listening on port 80
|
||||
- add `rewrite ^/\.well-known/acme-challenge/(.*) /$1 break;` above the `root` location
|
||||
- change the `root` location to `/var/www/acme;`
|
||||
* Change `ssl_trusted_certificate` to `/etc/ssl/example.tld_cert-only.crt`
|
||||
* Change `ssl_certificate` to `/etc/ssl/example.tld.crt`
|
||||
* Change `ssl_certificate_key` to `/etc/ssl/private/example.tld.key`
|
||||
|
||||
Remove the following `location {}` block from `/etc/nginx/nginx.conf`, that was previously added for acquiring certificates and change `server_name` back to `localhost`:
|
||||
|
||||
```
|
||||
http {
|
||||
...
|
||||
|
||||
server {
|
||||
...
|
||||
server_name example.tld; # Change back to localhost
|
||||
|
||||
# Delete this block
|
||||
location /.well-known/acme-challenge {
|
||||
rewrite ^/\.well-known/acme-challenge/(.*) /$1 break;
|
||||
root /var/www/acme;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Symlink the Pleroma configuration to the enabled sites:
|
||||
|
||||
```
|
||||
# ln -s /etc/nginx/sites-available/pleroma.nginx /etc/nginx/sites-enabled
|
||||
```
|
||||
|
||||
Check nginx configuration syntax by running:
|
||||
|
||||
```
|
||||
# nginx -t
|
||||
```
|
||||
|
||||
Note: If the above command complains about a `conflicting server name`, check again that the `location {}` block for acquiring certificates has been removed from `/etc/nginx/nginx.conf` and that the `server_name` has been reverted back to `localhost`.
|
||||
After doing so run `# nginx -t` again.
|
||||
|
||||
If the configuration is correct, you can now enable and reload the nginx service:
|
||||
|
||||
```
|
||||
# rcctl enable nginx
|
||||
# rcctl reload nginx
|
||||
```
|
||||
To check that it started properly and didn't fail right after starting, you can run `ps aux | grep postgres`, there should be multiple lines of output.
|
||||
|
||||
#### httpd
|
||||
httpd will have three functions:
|
||||
|
||||
***Skip this section when using nginx***
|
||||
|
||||
httpd will have two functions:
|
||||
|
||||
* redirect requests trying to reach the instance over http to the https URL
|
||||
* serve a robots.txt file
|
||||
* get Let's Encrypt certificates, with acme-client
|
||||
|
||||
Insert the following config in httpd.conf:
|
||||
As root, copy `/home/_pleroma/pleroma/installation/openbsd/httpd.conf` to `/etc/httpd.conf`, or modify the existing one.
|
||||
|
||||
Edit `/etc/httpd.conf` settings and change:
|
||||
|
||||
* `<ipaddr>` with your instance's IPv4 address
|
||||
* All occurrences of `example.tld` with your instance's domain name
|
||||
* When using IPv6 also change:
|
||||
- Uncomment the `ext_inet6="<ip6addr>"` line near the beginning of the file and change `<ip6addr` to your instance's IPv6 address
|
||||
- Uncomment the line starting with `listen on $ext_inet6` in the `server` block
|
||||
|
||||
Check the configuration by running:
|
||||
```
|
||||
# $OpenBSD: httpd.conf,v 1.17 2017/04/16 08:50:49 ajacoutot Exp $
|
||||
|
||||
ext_inet="<IPv4 address>"
|
||||
ext_inet6="<IPv6 address>"
|
||||
|
||||
server "default" {
|
||||
listen on $ext_inet port 80 # Comment to disable listening on IPv4
|
||||
listen on $ext_inet6 port 80 # Comment to disable listening on IPv6
|
||||
listen on 127.0.0.1 port 80 # Do NOT comment this line
|
||||
|
||||
log syslog
|
||||
directory no index
|
||||
|
||||
location "/.well-known/acme-challenge/*" {
|
||||
root "/acme"
|
||||
request strip 2
|
||||
}
|
||||
|
||||
location "/robots.txt" { root "/htdocs/local/" }
|
||||
location "/*" { block return 302 "https://$HTTP_HOST$REQUEST_URI" }
|
||||
}
|
||||
|
||||
types {
|
||||
}
|
||||
```
|
||||
Do not forget to change *<IPv4/6 address\>* to your server's address(es). If httpd should only listen on one protocol family, comment one of the two first *listen* options.
|
||||
|
||||
Create the /var/www/htdocs/local/ folder and write the content of your robots.txt in /var/www/htdocs/local/robots.txt.
|
||||
Check the configuration with `httpd -n`, if it is OK enable and start httpd (as root):
|
||||
```
|
||||
rcctl enable httpd
|
||||
rcctl start httpd
|
||||
# httpd -n
|
||||
```
|
||||
|
||||
#### acme-client
|
||||
acme-client is used to get SSL/TLS certificates from Let's Encrypt.
|
||||
Insert the following configuration in /etc/acme-client.conf:
|
||||
```
|
||||
#
|
||||
# $OpenBSD: acme-client.conf,v 1.4 2017/03/22 11:14:14 benno Exp $
|
||||
#
|
||||
If the configuration is correct, enable and start the `httpd` service:
|
||||
|
||||
authority letsencrypt-<domain name> {
|
||||
#agreement url "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf"
|
||||
api url "https://acme-v02.api.letsencrypt.org/directory"
|
||||
account key "/etc/acme/letsencrypt-privkey-<domain name>.pem"
|
||||
}
|
||||
```
|
||||
# rcctl enable httpd
|
||||
# rcctl start httpd
|
||||
```
|
||||
|
||||
domain <domain name> {
|
||||
domain key "/etc/ssl/private/<domain name>.key"
|
||||
domain certificate "/etc/ssl/<domain name>.crt"
|
||||
domain full chain certificate "/etc/ssl/<domain name>.fullchain.pem"
|
||||
sign with letsencrypt-<domain name>
|
||||
challengedir "/var/www/acme/"
|
||||
}
|
||||
```
|
||||
Replace *<domain name\>* by the domain name you'll use for your instance. As root, run `acme-client -n` to check the config, then `acme-client -ADv <domain name>` to create account and domain keys, and request a certificate for the first time.
|
||||
Make acme-client run everyday by adding it in /etc/daily.local. As root, run the following command: `echo "acme-client <domain name>" >> /etc/daily.local`.
|
||||
Acquire certificate:
|
||||
|
||||
Relayd will look for certificates and keys based on the address it listens on (see next part), the easiest way to make them available to relayd is to create a link, as root run:
|
||||
```
|
||||
ln -s /etc/ssl/<domain name>.fullchain.pem /etc/ssl/<IP address>.crt
|
||||
ln -s /etc/ssl/private/<domain name>.key /etc/ssl/private/<IP address>.key
|
||||
# acme-client example.tld
|
||||
```
|
||||
This will have to be done for each IPv4 and IPv6 address relayd listens on.
|
||||
|
||||
#### relayd
|
||||
|
||||
***Skip this section when using nginx***
|
||||
|
||||
relayd will be used as the reverse proxy sitting in front of pleroma.
|
||||
Insert the following configuration in /etc/relayd.conf:
|
||||
|
||||
As root, copy `/home/_pleroma/pleroma/installation/openbsd/relayd.conf` to `/etc/relayd.conf`, or modify the existing one.
|
||||
|
||||
Edit `/etc/relayd.conf` settings and change:
|
||||
|
||||
* `<ipaddr>` with your instance's IPv4 address
|
||||
* All occurrences of `example.tld` with your instance's domain name
|
||||
* When using IPv6 also change:
|
||||
- Uncomment the `ext_inet6="<ip6addr>"` line near the beginning of the file and change `<ip6addr>` to your instance's IPv6 address
|
||||
- Uncomment the line starting with `listen on $ext_inet6` in the `relay wwwtls` block
|
||||
|
||||
Check the configuration by running:
|
||||
```
|
||||
# $OpenBSD: relayd.conf,v 1.4 2018/03/23 09:55:06 claudio Exp $
|
||||
|
||||
ext_inet="<IPv4 address>"
|
||||
ext_inet6="<IPv6 address>"
|
||||
|
||||
table <pleroma_server> { 127.0.0.1 }
|
||||
table <httpd_server> { 127.0.0.1 }
|
||||
|
||||
http protocol plerup { # Protocol for upstream pleroma server
|
||||
#tcp { nodelay, sack, socket buffer 65536, backlog 128 } # Uncomment and adjust as you see fit
|
||||
tls ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305"
|
||||
tls ecdhe secp384r1
|
||||
|
||||
# Forward some paths to the local server (as pleroma won't respond to them as you might want)
|
||||
pass request quick path "/robots.txt" forward to <httpd_server>
|
||||
|
||||
# Append a bunch of headers
|
||||
match request header append "X-Forwarded-For" value "$REMOTE_ADDR" # This two header and the next one are not strictly required by pleroma but adding them won't hurt
|
||||
match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"
|
||||
|
||||
match response header append "X-XSS-Protection" value "1; mode=block"
|
||||
match response header append "X-Permitted-Cross-Domain-Policies" value "none"
|
||||
match response header append "X-Frame-Options" value "DENY"
|
||||
match response header append "X-Content-Type-Options" value "nosniff"
|
||||
match response header append "Referrer-Policy" value "same-origin"
|
||||
match response header append "X-Download-Options" value "noopen"
|
||||
match response header append "Content-Security-Policy" value "default-src 'none'; base-uri 'self'; form-action 'self'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; connect-src 'self' wss://CHANGEME.tld; upgrade-insecure-requests;" # Modify "CHANGEME.tld" and set your instance's domain here
|
||||
match request header append "Connection" value "upgrade"
|
||||
#match response header append "Strict-Transport-Security" value "max-age=31536000; includeSubDomains" # Uncomment this only after you get HTTPS working.
|
||||
|
||||
# If you do not want remote frontends to be able to access your Pleroma backend server, comment these lines
|
||||
match response header append "Access-Control-Allow-Origin" value "*"
|
||||
match response header append "Access-Control-Allow-Methods" value "POST, PUT, DELETE, GET, PATCH, OPTIONS"
|
||||
match response header append "Access-Control-Allow-Headers" value "Authorization, Content-Type, Idempotency-Key"
|
||||
match response header append "Access-Control-Expose-Headers" value "Link, X-RateLimit-Reset, X-RateLimit-Limit, X-RateLimit-Remaining, X-Request-Id"
|
||||
# Stop commenting lines here
|
||||
}
|
||||
|
||||
relay wwwtls {
|
||||
listen on $ext_inet port https tls # Comment to disable listening on IPv4
|
||||
listen on $ext_inet6 port https tls # Comment to disable listening on IPv6
|
||||
|
||||
protocol plerup
|
||||
|
||||
forward to <pleroma_server> port 4000 check http "/" code 200
|
||||
forward to <httpd_server> port 80 check http "/robots.txt" code 200
|
||||
}
|
||||
```
|
||||
Again, change *<IPv4/6 address\>* to your server's address(es) and comment one of the two *listen* options if needed. Also change *wss://CHANGEME.tld* to *wss://<your instance's domain name\>*.
|
||||
Check the configuration with `relayd -n`, if it is OK enable and start relayd (as root):
|
||||
```
|
||||
rcctl enable relayd
|
||||
rcctl start relayd
|
||||
# relayd -n
|
||||
```
|
||||
|
||||
##### (Strongly recommended) serve media on another domain
|
||||
If the configuration is correct, enable and start the `relayd` service:
|
||||
|
||||
```
|
||||
# rcctl enable relayd
|
||||
# rcctl start relayd
|
||||
```
|
||||
|
||||
Add certificate auto-renewal by adding acme-client to `/etc/weekly.local`, replace `example.tld` with your domain:
|
||||
|
||||
```
|
||||
# echo "acme-client example.tld && rcctl reload relayd" >> /etc/weekly.local
|
||||
```
|
||||
|
||||
#### (Strongly recommended) serve media on another domain
|
||||
|
||||
Refer to the [Hardening your instance](../configuration/hardening.md) document on how to serve media on another domain. We STRONGLY RECOMMEND you to do this to minimize attack vectors.
|
||||
|
||||
#### pf
|
||||
Enabling and configuring pf is highly recommended.
|
||||
In /etc/pf.conf, insert the following configuration:
|
||||
### Starting pleroma at boot
|
||||
|
||||
Copy the startup script and make sure it's executable:
|
||||
|
||||
```
|
||||
# Macros
|
||||
if="<network interface>"
|
||||
authorized_ssh_clients="any"
|
||||
|
||||
# Skip traffic on loopback interface
|
||||
set skip on lo
|
||||
|
||||
# Default behavior
|
||||
set block-policy drop
|
||||
block in log all
|
||||
pass out quick
|
||||
|
||||
# Security features
|
||||
match in all scrub (no-df random-id)
|
||||
block in log from urpf-failed
|
||||
|
||||
# Rules
|
||||
pass in quick on $if inet proto icmp to ($if) icmp-type { echoreq unreach paramprob trace } # ICMP
|
||||
pass in quick on $if inet6 proto icmp6 to ($if) icmp6-type { echoreq unreach paramprob timex toobig } # ICMPv6
|
||||
pass in quick on $if proto tcp to ($if) port { http https } # relayd/httpd
|
||||
pass in quick on $if proto tcp from $authorized_ssh_clients to ($if) port ssh
|
||||
```
|
||||
Replace *<network interface\>* by your server's network interface name (which you can get with ifconfig). Consider replacing the content of the authorized\_ssh\_clients macro by, for example, your home IP address, to avoid SSH connection attempts from bots.
|
||||
|
||||
Check pf's configuration by running `pfctl -nf /etc/pf.conf`, load it with `pfctl -f /etc/pf.conf` and enable pf at boot with `rcctl enable pf`.
|
||||
|
||||
#### Configure and start pleroma
|
||||
Enter a shell as \_pleroma (as root `su _pleroma -`) and enter pleroma's installation directory (`cd ~/pleroma/`).
|
||||
|
||||
Then follow the main installation guide:
|
||||
|
||||
* run `mix deps.get`
|
||||
* run `MIX_ENV=prod mix pleroma.instance gen` and enter your instance's information when asked
|
||||
* copy config/generated\_config.exs to config/prod.secret.exs. The default values should be sufficient but you should edit it and check that everything seems OK.
|
||||
* exit your current shell back to a root one and run `psql -U postgres -f /home/_pleroma/pleroma/config/setup_db.psql` to setup the database.
|
||||
* return to a \_pleroma shell into pleroma's installation directory (`su _pleroma -;cd ~/pleroma`) and run `MIX_ENV=prod mix ecto.migrate`
|
||||
|
||||
As \_pleroma in /home/\_pleroma/pleroma, you can now run `LC_ALL=en_US.UTF-8 MIX_ENV=prod mix phx.server` to start your instance.
|
||||
In another SSH session/tmux window, check that it is working properly by running `ftp -MVo - http://127.0.0.1:4000/api/v1/instance`, you should get json output. Double-check that *uri*'s value is your instance's domain name.
|
||||
|
||||
##### Starting pleroma at boot
|
||||
An rc script to automatically start pleroma at boot hasn't been written yet, it can be run in a tmux session (tmux is in base).
|
||||
|
||||
|
||||
#### Create administrative user
|
||||
|
||||
If your instance is up and running, you can create your first user with administrative rights with the following command as the \_pleroma user.
|
||||
```
|
||||
LC_ALL=en_US.UTF-8 MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress> --admin
|
||||
# cp /home/_pleroma/pleroma/installation/openbsd/rc.d/pleroma /etc/rc.d/pleroma
|
||||
# chmod 555 /etc/rc.d/pleroma
|
||||
```
|
||||
|
||||
#### Further reading
|
||||
Enable and start the pleroma service:
|
||||
|
||||
```
|
||||
# rcctl enable pleroma
|
||||
# rcctl start pleroma
|
||||
```
|
||||
|
||||
### Create administrative user
|
||||
|
||||
If your instance is up and running, you can create your first user with administrative rights with the following commands as the \_pleroma user:
|
||||
|
||||
```
|
||||
$ cd pleroma
|
||||
$ MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress> --admin
|
||||
```
|
||||
|
||||
### Further reading
|
||||
|
||||
{! backend/installation/further_reading.include !}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Note: This article is potentially outdated because at this time we may not have
|
|||
|
||||
Tarvitset:
|
||||
* Oman domainin
|
||||
* OpenBSD 6.3 -serverin
|
||||
* OpenBSD 7.5 -serverin
|
||||
* Auttavan ymmärryksen unix-järjestelmistä
|
||||
|
||||
Komennot, joiden edessä on '#', tulee ajaa käyttäjänä `root`. Tämä on
|
||||
|
|
@ -18,7 +18,7 @@ Matrix-kanava #pleroma:libera.chat ovat hyviä paikkoja löytää apua
|
|||
|
||||
Asenna tarvittava ohjelmisto:
|
||||
|
||||
`# pkg_add git elixir gmake postgresql-server-10.3 postgresql-contrib-10.3 cmake ffmpeg ImageMagick libvips`
|
||||
`# pkg_add git elixir gmake postgresql-server postgresql-contrib cmake libmagic libvips`
|
||||
|
||||
#### Optional software
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Note: the packages are not required with the current default settings of Pleroma
|
|||
|
||||
It is required for the following Pleroma features:
|
||||
|
||||
* `Pleroma.Upload.Filters.Mogrify`, `Pleroma.Upload.Filters.Mogrifun` upload filters (related config: `Plaroma.Upload/filters` in `config/config.exs`)
|
||||
* `Pleroma.Upload.Filters.Mogrify`, `Pleroma.Upload.Filters.Mogrifun` upload filters (related config: `Pleroma.Upload/filters` in `config/config.exs`)
|
||||
* Media preview proxy for still images (related config: `media_preview_proxy/enabled` in `config/config.exs`)
|
||||
|
||||
## `ffmpeg`
|
||||
|
|
@ -33,5 +33,5 @@ It is required for the following Pleroma features:
|
|||
|
||||
It is required for the following Pleroma features:
|
||||
|
||||
* `Pleroma.Upload.Filters.Exiftool.StripLocation` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`)
|
||||
* `Pleroma.Upload.Filters.Exiftool.ReadDescription` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`)
|
||||
* `Pleroma.Upload.Filters.Exiftool.StripLocation` upload filter (related config: `Pleroma.Upload/filters` in `config/config.exs`)
|
||||
* `Pleroma.Upload.Filters.Exiftool.ReadDescription` upload filter (related config: `Pleroma.Upload/filters` in `config/config.exs`)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ You will be running commands as root. If you aren't root already, please elevate
|
|||
|
||||
Similarly to other binaries, OTP releases tend to be only compatible with the distro they are built on, as such this guide focuses only on Debian/Ubuntu and Alpine.
|
||||
|
||||
!!! note
|
||||
If you get `GLIBC_... not found` errors on Debian/Ubuntu, you can run the OTP release from `/opt/pleroma` inside a newer distro container without upgrading the host. See [`release_to_docker_en.md`](release_to_docker_en.md).
|
||||
|
||||
### Detecting flavour
|
||||
|
||||
Paste the following into the shell:
|
||||
|
|
|
|||
61
docs/installation/release_to_docker_en.md
Normal file
61
docs/installation/release_to_docker_en.md
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# Running OTP releases via Docker (glibc shim)
|
||||
|
||||
Pleroma OTP releases are built on specific distros. If your host OS is older than
|
||||
the build environment, you may hit runtime linker errors such as:
|
||||
|
||||
```
|
||||
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found
|
||||
```
|
||||
|
||||
If you don't want to upgrade your host OS, you can run the existing OTP release
|
||||
from `/opt/pleroma` inside an Ubuntu 24.04 container while keeping your existing
|
||||
host config and data directories.
|
||||
|
||||
This approach uses a small "shim" container image to provide a newer `glibc`.
|
||||
It is **not** the official Pleroma Docker image.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker Engine + the Docker Compose plugin on the host
|
||||
- Root access (or equivalent access to the Docker socket)
|
||||
- Existing OTP release in `/opt/pleroma`
|
||||
- Existing config in `/etc/pleroma` and data in `/var/lib/pleroma`
|
||||
|
||||
## Setup
|
||||
|
||||
1. Copy the provided templates:
|
||||
|
||||
```sh
|
||||
mkdir -p /etc/pleroma/container
|
||||
cp -a /opt/pleroma/installation/release-to-docker/* /etc/pleroma/container/
|
||||
```
|
||||
|
||||
2. Build the shim image:
|
||||
|
||||
```sh
|
||||
cd /etc/pleroma/container
|
||||
docker compose build
|
||||
```
|
||||
|
||||
3. Replace your systemd unit:
|
||||
|
||||
```sh
|
||||
cp /etc/pleroma/container/pleroma.service /etc/systemd/system/pleroma.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now pleroma
|
||||
journalctl -u pleroma -f
|
||||
```
|
||||
|
||||
## Running migrations / `pleroma_ctl`
|
||||
|
||||
Migrations are run automatically by default when the container starts. You can
|
||||
disable this by setting `PLEROMA_RUN_MIGRATIONS=0` in
|
||||
`/etc/pleroma/container/docker-compose.yml`.
|
||||
|
||||
To run admin commands inside the container:
|
||||
|
||||
```sh
|
||||
cd /etc/pleroma/container
|
||||
docker compose exec pleroma /opt/pleroma/bin/pleroma_ctl status
|
||||
docker compose run --rm --no-deps pleroma /opt/pleroma/bin/pleroma_ctl migrate
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue