mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2026-02-15 17:16:57 +00:00
fedbox: add federation-in-a-box docker tests
This commit is contained in:
parent
cb78699a3b
commit
2999724924
12 changed files with 2133 additions and 0 deletions
30
docker/federation/Caddyfile
Normal file
30
docker/federation/Caddyfile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
auto_https disable_redirects
|
||||
}
|
||||
|
||||
http://pleroma1.test {
|
||||
reverse_proxy pleroma1_web:4000
|
||||
}
|
||||
|
||||
https://pleroma1.test {
|
||||
tls internal
|
||||
reverse_proxy pleroma1_web:4000
|
||||
}
|
||||
|
||||
http://pleroma2.test {
|
||||
reverse_proxy pleroma2_web:4000
|
||||
}
|
||||
|
||||
https://pleroma2.test {
|
||||
tls internal
|
||||
reverse_proxy pleroma2_web:4000
|
||||
}
|
||||
|
||||
http://mastodon.test {
|
||||
reverse_proxy mastodon_web:3000
|
||||
}
|
||||
|
||||
https://mastodon.test {
|
||||
tls internal
|
||||
reverse_proxy mastodon_web:3000
|
||||
}
|
||||
34
docker/federation/README.md
Normal file
34
docker/federation/README.md
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Federation-in-a-box (Pleroma)
|
||||
|
||||
This is a repo-local Docker Compose setup that runs **two Pleroma instances + Mastodon** in a private
|
||||
container network and executes a small **federation smoke test suite**.
|
||||
|
||||
This environment is intentionally **not production-like**:
|
||||
|
||||
- It runs behind an internal Caddy reverse proxy (`gateway`) with **HTTP and internal TLS (HTTPS)**.
|
||||
- It uses a private internal CA (from Caddy) and configures clients to trust it so federation can
|
||||
happen over HTTPS inside the Docker network.
|
||||
|
||||
## Usage
|
||||
|
||||
From the Pleroma repo root:
|
||||
|
||||
```bash
|
||||
docker compose -f docker/federation/compose.yml up -d --build
|
||||
docker compose -f docker/federation/compose.yml --profile fedtest run --rm fedtest
|
||||
```
|
||||
|
||||
Cleanup:
|
||||
|
||||
```bash
|
||||
docker compose -f docker/federation/compose.yml down -v
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The test runner lives in `docker/federation/test_runner/` and is an **ExUnit** project using **Req**.
|
||||
- Mastodon uses `${MASTODON_IMAGE}` (defaults to `ghcr.io/mastodon/mastodon:v4.5.3`).
|
||||
- Pleroma is built from this repo via `../..` (the repo root).
|
||||
- Default domains are `pleroma1.test`, `pleroma2.test`, `mastodon.test`.
|
||||
- Seeded users are `alice@pleroma1.test`, `bob@pleroma2.test`, `carol@mastodon.test` with password `password`.
|
||||
- The smoke tests cover follow, post delivery, favourites, boosts, and deletes across Pleroma↔Pleroma and Pleroma↔Mastodon.
|
||||
433
docker/federation/compose.yml
Normal file
433
docker/federation/compose.yml
Normal file
|
|
@ -0,0 +1,433 @@
|
|||
services:
|
||||
gateway:
|
||||
image: caddy:2.8
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy_fed_data:/data/caddy
|
||||
networks:
|
||||
federation:
|
||||
aliases:
|
||||
- pleroma1.test
|
||||
- pleroma2.test
|
||||
- mastodon.test
|
||||
|
||||
gateway_certs:
|
||||
image: caddy:2.8
|
||||
restart: "no"
|
||||
depends_on:
|
||||
gateway:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- caddy_fed_data:/data/caddy
|
||||
command:
|
||||
- sh
|
||||
- -lc
|
||||
- |
|
||||
set -eu
|
||||
|
||||
while [ ! -f /data/caddy/pki/authorities/local/root.crt ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
chmod 755 /data/caddy/pki /data/caddy/pki/authorities /data/caddy/pki/authorities/local
|
||||
chmod 644 /data/caddy/pki/authorities/local/root.crt
|
||||
networks:
|
||||
- federation
|
||||
|
||||
pleroma1_db:
|
||||
image: postgres:16
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: pleroma
|
||||
POSTGRES_PASSWORD: pleroma
|
||||
POSTGRES_DB: pleroma1
|
||||
volumes:
|
||||
- pleroma1_fed_db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U pleroma"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- federation
|
||||
|
||||
pleroma1_web:
|
||||
build:
|
||||
context: ../..
|
||||
image: pleroma-fedbox
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
pleroma1_db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DOMAIN: pleroma1.test
|
||||
INSTANCE_NAME: Pleroma 1 (fedbox)
|
||||
ADMIN_EMAIL: admin@pleroma1.test
|
||||
NOTIFY_EMAIL: notify@pleroma1.test
|
||||
DB_HOST: pleroma1_db
|
||||
DB_PORT: 5432
|
||||
DB_NAME: pleroma1
|
||||
DB_USER: pleroma
|
||||
DB_PASS: pleroma
|
||||
FEDBOX_CACERTFILE: /caddy/pki/authorities/local/root.crt
|
||||
SSL_CERT_FILE: /caddy/pki/authorities/local/root.crt
|
||||
volumes:
|
||||
- pleroma1_fed_data:/var/lib/pleroma
|
||||
- ./pleroma/config.exs:/var/lib/pleroma/config.exs:ro
|
||||
- caddy_fed_data:/caddy:ro
|
||||
expose:
|
||||
- "4000"
|
||||
healthcheck:
|
||||
test:
|
||||
["CMD-SHELL", "wget -qO- http://127.0.0.1:4000/api/v1/instance >/dev/null || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
networks:
|
||||
- federation
|
||||
|
||||
pleroma1_seed:
|
||||
image: pleroma-fedbox
|
||||
restart: "no"
|
||||
depends_on:
|
||||
pleroma1_web:
|
||||
condition: service_healthy
|
||||
entrypoint: []
|
||||
environment:
|
||||
DOMAIN: pleroma1.test
|
||||
FEDBOX_SEED_USERS: "alice"
|
||||
volumes:
|
||||
- ./pleroma/config.exs:/var/lib/pleroma/config.exs:ro
|
||||
command:
|
||||
- sh
|
||||
- -lc
|
||||
- |
|
||||
set -euo pipefail
|
||||
|
||||
password="$${FEDBOX_SEED_PASSWORD:-password}"
|
||||
|
||||
app=$$(
|
||||
wget -qO- \
|
||||
--post-data "client_name=fedbox&redirect_uris=urn:ietf:wg:oauth:2.0:oob&scopes=read+write+follow&website=" \
|
||||
"http://pleroma1_web:4000/api/v1/apps"
|
||||
)
|
||||
client_id=$$(echo "$$app" | sed -n 's/.*"client_id":"\([^"]*\)".*/\1/p')
|
||||
client_secret=$$(echo "$$app" | sed -n 's/.*"client_secret":"\([^"]*\)".*/\1/p')
|
||||
|
||||
token=$$(
|
||||
wget -qO- \
|
||||
--post-data "client_id=$$client_id&client_secret=$$client_secret&grant_type=client_credentials&scope=read+write+follow" \
|
||||
"http://pleroma1_web:4000/oauth/token"
|
||||
)
|
||||
access_token=$$(echo "$$token" | sed -n 's/.*"access_token":"\([^"]*\)".*/\1/p')
|
||||
|
||||
for username in $${FEDBOX_SEED_USERS}; do
|
||||
if wget -qO- "http://pleroma1_web:4000/.well-known/webfinger?resource=acct:$$username@$${DOMAIN}" >/dev/null; then
|
||||
echo "[fedbox] pleroma1: $$username already exists"
|
||||
continue
|
||||
fi
|
||||
|
||||
wget -qO- \
|
||||
--header "Authorization: Bearer $$access_token" \
|
||||
--header "Content-Type: application/json" \
|
||||
--post-data "{\"username\":\"$$username\",\"email\":\"$$username@$${DOMAIN}\",\"password\":\"$$password\",\"agreement\":true,\"locale\":\"en\"}" \
|
||||
"http://pleroma1_web:4000/api/v1/accounts" >/dev/null || true
|
||||
|
||||
tries=0
|
||||
until wget -qO- "http://pleroma1_web:4000/.well-known/webfinger?resource=acct:$$username@$${DOMAIN}" >/dev/null; do
|
||||
tries=$$((tries + 1))
|
||||
|
||||
if [ "$$tries" -ge 30 ]; then
|
||||
echo "[fedbox] pleroma1: timeout waiting for webfinger $$username" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
networks:
|
||||
- federation
|
||||
|
||||
pleroma2_db:
|
||||
image: postgres:16
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: pleroma
|
||||
POSTGRES_PASSWORD: pleroma
|
||||
POSTGRES_DB: pleroma2
|
||||
volumes:
|
||||
- pleroma2_fed_db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U pleroma"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- federation
|
||||
|
||||
pleroma2_web:
|
||||
image: pleroma-fedbox
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
pleroma2_db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DOMAIN: pleroma2.test
|
||||
INSTANCE_NAME: Pleroma 2 (fedbox)
|
||||
ADMIN_EMAIL: admin@pleroma2.test
|
||||
NOTIFY_EMAIL: notify@pleroma2.test
|
||||
DB_HOST: pleroma2_db
|
||||
DB_PORT: 5432
|
||||
DB_NAME: pleroma2
|
||||
DB_USER: pleroma
|
||||
DB_PASS: pleroma
|
||||
FEDBOX_CACERTFILE: /caddy/pki/authorities/local/root.crt
|
||||
SSL_CERT_FILE: /caddy/pki/authorities/local/root.crt
|
||||
volumes:
|
||||
- pleroma2_fed_data:/var/lib/pleroma
|
||||
- ./pleroma/config.exs:/var/lib/pleroma/config.exs:ro
|
||||
- caddy_fed_data:/caddy:ro
|
||||
expose:
|
||||
- "4000"
|
||||
healthcheck:
|
||||
test:
|
||||
["CMD-SHELL", "wget -qO- http://127.0.0.1:4000/api/v1/instance >/dev/null || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
networks:
|
||||
- federation
|
||||
|
||||
pleroma2_seed:
|
||||
image: pleroma-fedbox
|
||||
restart: "no"
|
||||
depends_on:
|
||||
pleroma2_web:
|
||||
condition: service_healthy
|
||||
entrypoint: []
|
||||
environment:
|
||||
DOMAIN: pleroma2.test
|
||||
FEDBOX_SEED_USERS: "bob"
|
||||
volumes:
|
||||
- ./pleroma/config.exs:/var/lib/pleroma/config.exs:ro
|
||||
command:
|
||||
- sh
|
||||
- -lc
|
||||
- |
|
||||
set -euo pipefail
|
||||
|
||||
password="$${FEDBOX_SEED_PASSWORD:-password}"
|
||||
|
||||
app=$$(
|
||||
wget -qO- \
|
||||
--post-data "client_name=fedbox&redirect_uris=urn:ietf:wg:oauth:2.0:oob&scopes=read+write+follow&website=" \
|
||||
"http://pleroma2_web:4000/api/v1/apps"
|
||||
)
|
||||
client_id=$$(echo "$$app" | sed -n 's/.*"client_id":"\([^"]*\)".*/\1/p')
|
||||
client_secret=$$(echo "$$app" | sed -n 's/.*"client_secret":"\([^"]*\)".*/\1/p')
|
||||
|
||||
token=$$(
|
||||
wget -qO- \
|
||||
--post-data "client_id=$$client_id&client_secret=$$client_secret&grant_type=client_credentials&scope=read+write+follow" \
|
||||
"http://pleroma2_web:4000/oauth/token"
|
||||
)
|
||||
access_token=$$(echo "$$token" | sed -n 's/.*"access_token":"\([^"]*\)".*/\1/p')
|
||||
|
||||
for username in $${FEDBOX_SEED_USERS}; do
|
||||
if wget -qO- "http://pleroma2_web:4000/.well-known/webfinger?resource=acct:$$username@$${DOMAIN}" >/dev/null; then
|
||||
echo "[fedbox] pleroma2: $$username already exists"
|
||||
continue
|
||||
fi
|
||||
|
||||
wget -qO- \
|
||||
--header "Authorization: Bearer $$access_token" \
|
||||
--header "Content-Type: application/json" \
|
||||
--post-data "{\"username\":\"$$username\",\"email\":\"$$username@$${DOMAIN}\",\"password\":\"$$password\",\"agreement\":true,\"locale\":\"en\"}" \
|
||||
"http://pleroma2_web:4000/api/v1/accounts" >/dev/null || true
|
||||
|
||||
tries=0
|
||||
until wget -qO- "http://pleroma2_web:4000/.well-known/webfinger?resource=acct:$$username@$${DOMAIN}" >/dev/null; do
|
||||
tries=$$((tries + 1))
|
||||
|
||||
if [ "$$tries" -ge 30 ]; then
|
||||
echo "[fedbox] pleroma2: timeout waiting for webfinger $$username" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
networks:
|
||||
- federation
|
||||
|
||||
mastodon_db:
|
||||
image: postgres:16
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: mastodon
|
||||
POSTGRES_PASSWORD: mastodon
|
||||
POSTGRES_DB: mastodon
|
||||
volumes:
|
||||
- mastodon_fed_db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U mastodon"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- federation
|
||||
|
||||
mastodon_redis:
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- mastodon_fed_redis:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- federation
|
||||
|
||||
mastodon_init:
|
||||
image: ${MASTODON_IMAGE:-ghcr.io/mastodon/mastodon:v4.5.3}
|
||||
restart: "no"
|
||||
depends_on:
|
||||
gateway_certs:
|
||||
condition: service_completed_successfully
|
||||
mastodon_db:
|
||||
condition: service_healthy
|
||||
mastodon_redis:
|
||||
condition: service_healthy
|
||||
environment: &mastodon_env
|
||||
RAILS_ENV: production
|
||||
NODE_ENV: production
|
||||
PORT: 3000
|
||||
LOCAL_DOMAIN: mastodon.test
|
||||
WEB_DOMAIN: mastodon.test
|
||||
ANNOTATERB_SKIP_ON_DB_TASKS: "true"
|
||||
REDIS_HOST: mastodon_redis
|
||||
REDIS_PORT: 6379
|
||||
DB_HOST: mastodon_db
|
||||
DB_PORT: 5432
|
||||
DB_NAME: mastodon
|
||||
DB_USER: mastodon
|
||||
DB_PASS: mastodon
|
||||
# Production Mastodon blocks private-network federation by default.
|
||||
# Allow common Docker/private ranges for federation-in-a-box.
|
||||
ALLOWED_PRIVATE_ADDRESSES: "10.0.0.0/8 172.16.0.0/12 192.168.0.0/16"
|
||||
SSL_CERT_FILE: /caddy/pki/authorities/local/root.crt
|
||||
OTP_SECRET: "fedbox_otp_secret_mastodon"
|
||||
SECRET_KEY_BASE: "fca7fa5fe8ca9b7bbcaa442535b973e772e6392f46aab7fb3ec227ef5eb8d8c6605b921f7af4c2cc41f19a20633334e11c6012d6de958d0b14c4c2aa24a294ab"
|
||||
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY: "ZVdBBUYdAX9il2dZ3mwVRv1h7bDnRlH9oybCdHautQUNIhSBoV7wdpKm+ByScMaeEChmrmxIhIMBujlnikHUqA=="
|
||||
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY: "82yPOOdC5iAbaCU7ck0hsWP1kJqMH8g7v/vtzS+AlWBFsVvcuzGYBg888Oa+vBkhXY8Xr1jE03WbSwVwHDR3Aw=="
|
||||
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT: "6UZS4kC1TsljaOCidkEGQHqnIIcN0zqayJu2ANKYAHsLtKnjZOvcEvhDehRaf0LfQNHim/9asXmILvVukOuw0w=="
|
||||
command:
|
||||
- sh
|
||||
- -lc
|
||||
- |
|
||||
set -euo pipefail
|
||||
|
||||
bundle exec rails db:prepare
|
||||
|
||||
# Create an initial user for API-driven smoke tests.
|
||||
bin/tootctl accounts create carol --email carol@mastodon.test --confirmed --approve --role Owner || true
|
||||
|
||||
# Ensure a stable password for the OAuth authorization code flow.
|
||||
bundle exec rails runner 'u = User.find_by(email: "carol@mastodon.test"); raise "carol missing" unless u; u.mark_email_as_confirmed! unless u.confirmed?; u.approve! unless u.approved?; u.change_password!("password");'
|
||||
volumes:
|
||||
- mastodon_fed_system:/mastodon/public/system
|
||||
- ./mastodon/initializers/00_letter_opener_web_stub.rb:/opt/mastodon/config/initializers/00_letter_opener_web_stub.rb:ro
|
||||
- ./mastodon/initializers/01_fedbox_settings.rb:/opt/mastodon/config/initializers/01_fedbox_settings.rb:ro
|
||||
- caddy_fed_data:/caddy:ro
|
||||
networks:
|
||||
- federation
|
||||
|
||||
mastodon_web:
|
||||
image: ${MASTODON_IMAGE:-ghcr.io/mastodon/mastodon:v4.5.3}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mastodon_init:
|
||||
condition: service_completed_successfully
|
||||
environment: *mastodon_env
|
||||
command: bundle exec puma -C config/puma.rb
|
||||
expose:
|
||||
- "3000"
|
||||
volumes:
|
||||
- mastodon_fed_system:/mastodon/public/system
|
||||
- ./mastodon/initializers/00_letter_opener_web_stub.rb:/opt/mastodon/config/initializers/00_letter_opener_web_stub.rb:ro
|
||||
- ./mastodon/initializers/01_fedbox_settings.rb:/opt/mastodon/config/initializers/01_fedbox_settings.rb:ro
|
||||
- caddy_fed_data:/caddy:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -s --noproxy localhost localhost:3000/health | grep -q 'OK' || exit 1"]
|
||||
interval: 15s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
networks:
|
||||
- federation
|
||||
|
||||
mastodon_sidekiq:
|
||||
image: ${MASTODON_IMAGE:-ghcr.io/mastodon/mastodon:v4.5.3}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mastodon_init:
|
||||
condition: service_completed_successfully
|
||||
environment: *mastodon_env
|
||||
command: bundle exec sidekiq
|
||||
volumes:
|
||||
- mastodon_fed_system:/mastodon/public/system
|
||||
- ./mastodon/initializers/00_letter_opener_web_stub.rb:/opt/mastodon/config/initializers/00_letter_opener_web_stub.rb:ro
|
||||
- ./mastodon/initializers/01_fedbox_settings.rb:/opt/mastodon/config/initializers/01_fedbox_settings.rb:ro
|
||||
- caddy_fed_data:/caddy:ro
|
||||
networks:
|
||||
- federation
|
||||
|
||||
fedtest:
|
||||
profiles: ["fedtest"]
|
||||
build:
|
||||
context: ./test_runner
|
||||
image: pleroma-fedbox-test-runner
|
||||
depends_on:
|
||||
gateway_certs:
|
||||
condition: service_completed_successfully
|
||||
pleroma1_seed:
|
||||
condition: service_completed_successfully
|
||||
pleroma2_seed:
|
||||
condition: service_completed_successfully
|
||||
pleroma1_web:
|
||||
condition: service_healthy
|
||||
pleroma2_web:
|
||||
condition: service_healthy
|
||||
mastodon_web:
|
||||
condition: service_healthy
|
||||
mastodon_sidekiq:
|
||||
condition: service_started
|
||||
environment:
|
||||
FEDTEST_PLEROMA1_HANDLE: "@alice@pleroma1.test"
|
||||
FEDTEST_PLEROMA2_HANDLE: "@bob@pleroma2.test"
|
||||
FEDTEST_MASTODON_HANDLE: "@carol@mastodon.test"
|
||||
FEDTEST_PASSWORD: "password"
|
||||
FEDTEST_SCHEME: https
|
||||
FEDTEST_CACERTFILE: /caddy/pki/authorities/local/root.crt
|
||||
networks:
|
||||
- federation
|
||||
volumes:
|
||||
- caddy_fed_data:/caddy:ro
|
||||
|
||||
volumes:
|
||||
caddy_fed_data:
|
||||
pleroma1_fed_db:
|
||||
pleroma1_fed_data:
|
||||
pleroma2_fed_db:
|
||||
pleroma2_fed_data:
|
||||
mastodon_fed_db:
|
||||
mastodon_fed_redis:
|
||||
mastodon_fed_system:
|
||||
|
||||
networks:
|
||||
federation:
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# The official Mastodon docker image installs production-only gems.
|
||||
# When running Mastodon in development mode (needed for HTTP in fedbox),
|
||||
# some initializers reference LetterOpenerWeb, which isn't present.
|
||||
#
|
||||
# This stub keeps Mastodon bootable for federation smoke tests.
|
||||
module LetterOpenerWeb
|
||||
# Used in config/routes.rb in development mode:
|
||||
# mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
||||
# For fedbox we don't need the UI, but routes need this constant to exist.
|
||||
class Engine
|
||||
def self.call(_env)
|
||||
[404, {"content-type" => "text/plain"}, ["Not Found"]]
|
||||
end
|
||||
end
|
||||
|
||||
class LettersController
|
||||
def self.content_security_policy(&_block)
|
||||
end
|
||||
|
||||
def self.after_action(&_block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# The official Mastodon docker image runs as a non-root user, and `/opt/mastodon/db`
|
||||
# is not writable in the image. Rails defaults to dumping `db/schema.rb` after
|
||||
# migrations, but for the federation-in-a-box smoke tests we don't need schema
|
||||
# dumps, so disable them to keep `rails db:prepare` working.
|
||||
|
||||
Rails.application.config.active_record.dump_schema_after_migration = false
|
||||
|
||||
if defined?(ActiveRecord)
|
||||
ActiveRecord.dump_schema_after_migration = false
|
||||
end
|
||||
28
docker/federation/pleroma/config.exs
Normal file
28
docker/federation/pleroma/config.exs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import Config
|
||||
|
||||
# Advertise the instance as HTTPS via the Caddy gateway.
|
||||
config :pleroma, Pleroma.Web.Endpoint,
|
||||
url: [host: System.get_env("DOMAIN", "pleroma.test"), scheme: "https", port: 443]
|
||||
|
||||
# Trust the fedbox Caddy internal CA so federation over HTTPS works inside the
|
||||
# docker network (Pleroma <-> Pleroma <-> Mastodon).
|
||||
cacertfile = System.get_env("FEDBOX_CACERTFILE", "/caddy/pki/authorities/local/root.crt")
|
||||
|
||||
config :pleroma, :http,
|
||||
adapter: [
|
||||
ssl_options: [
|
||||
verify: :verify_peer,
|
||||
cacertfile: cacertfile,
|
||||
depth: 20,
|
||||
reuse_sessions: false,
|
||||
log_level: :warning,
|
||||
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
|
||||
]
|
||||
]
|
||||
|
||||
# Keep it permissive for local testing.
|
||||
config :pleroma, :instance,
|
||||
registrations_open: true
|
||||
|
||||
# Disable CAPTCHA for fedbox user seeding / smoke tests.
|
||||
config :pleroma, Pleroma.Captcha, enabled: false
|
||||
2
docker/federation/test_runner/.gitignore
vendored
Normal file
2
docker/federation/test_runner/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/_build
|
||||
/deps
|
||||
20
docker/federation/test_runner/Dockerfile
Normal file
20
docker/federation/test_runner/Dockerfile
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG ELIXIR_IMAGE=elixir:1.19.0-otp-28
|
||||
|
||||
FROM ${ELIXIR_IMAGE}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV MIX_ENV=test
|
||||
|
||||
RUN mix local.hex --force && mix local.rebar --force
|
||||
|
||||
COPY mix.exs mix.lock ./
|
||||
|
||||
RUN mix deps.get --only test
|
||||
RUN mix deps.compile
|
||||
|
||||
COPY test test
|
||||
|
||||
CMD ["mix", "test", "--color", "--trace"]
|
||||
26
docker/federation/test_runner/mix.exs
Normal file
26
docker/federation/test_runner/mix.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
defmodule PleromaFedboxTestRunner.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :pleroma_fedbox_test_runner,
|
||||
version: "0.1.0",
|
||||
elixir: "~> 1.15",
|
||||
start_permanent: Mix.env() == :prod,
|
||||
deps: deps()
|
||||
]
|
||||
end
|
||||
|
||||
def application do
|
||||
[
|
||||
extra_applications: [:logger]
|
||||
]
|
||||
end
|
||||
|
||||
defp deps do
|
||||
[
|
||||
{:jason, "1.4.4"},
|
||||
{:req, "0.5.16"}
|
||||
]
|
||||
end
|
||||
end
|
||||
11
docker/federation/test_runner/mix.lock
Normal file
11
docker/federation/test_runner/mix.lock
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
%{
|
||||
"finch": {:hex, :finch, "0.20.0", "5330aefb6b010f424dcbbc4615d914e9e3deae40095e73ab0c1bb0968933cadf", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2658131a74d051aabfcba936093c903b8e89da9a1b63e430bee62045fa9b2ee2"},
|
||||
"hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"},
|
||||
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
|
||||
"mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"},
|
||||
"mint": {:hex, :mint, "1.7.1", "113fdb2b2f3b59e47c7955971854641c61f378549d73e829e1768de90fc1abf1", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "fceba0a4d0f24301ddee3024ae116df1c3f4bb7a563a731f45fdfeb9d39a231b"},
|
||||
"nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
|
||||
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
|
||||
"req": {:hex, :req, "0.5.16", "99ba6a36b014458e52a8b9a0543bfa752cb0344b2a9d756651db1281d4ba4450", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "974a7a27982b9b791df84e8f6687d21483795882a7840e8309abdbe08bb06f09"},
|
||||
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
|
||||
}
|
||||
1511
docker/federation/test_runner/test/federation_box_test.exs
Normal file
1511
docker/federation/test_runner/test/federation_box_test.exs
Normal file
File diff suppressed because it is too large
Load diff
1
docker/federation/test_runner/test/test_helper.exs
Normal file
1
docker/federation/test_runner/test/test_helper.exs
Normal file
|
|
@ -0,0 +1 @@
|
|||
ExUnit.start(timeout: 120_000)
|
||||
Loading…
Add table
Add a link
Reference in a new issue