feat(labrinth): add config to run it with Compose, alongside services (#4153)

This commit is contained in:
Alejandro González
2025-08-09 23:04:31 +02:00
committed by GitHub
parent 58645b9ba9
commit 80eb297284
3 changed files with 159 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ The majority of configuration is done at runtime using [dotenvy](https://crates.
During development, you might notice that changes made directly to entities in the PostgreSQL database do not seem to take effect. This is often because the Redis cache still holds outdated data. To ensure your updates are reflected, clear the cache by e.g. running `redis-cli FLUSHALL`, which will force labrinth to fetch the latest data from the database the next time it is needed.
You can also start labrinth and its backing services at once using `docker compose --profile with-labrinth up`, which will build and start labrinth through its Docker image as if it was yet another service container. To have that container be automatically rebuilt during development as changes to the source code are made, add the `--watch` flag, which enables [Compose Watch](https://docs.docker.com/compose/how-tos/file-watch/). Keep in mind, however, that Compose Watch is bound to be slower than other similar solutions that work outside of a container, particularly on Windows or macOS, where Docker runs in a virtual machine.
<details>
<summary>.env variables & command line options</summary>

View File

@@ -0,0 +1,129 @@
DEBUG=true
RUST_LOG=info,sqlx::query=warn
SENTRY_DSN=none
SITE_URL=http://localhost:3000
# This CDN URL matches the local storage backend set below, which uses MOCK_FILE_PATH
CDN_URL=file:///tmp/modrinth
LABRINTH_ADMIN_KEY=feedbeef
RATE_LIMIT_IGNORE_KEY=feedbeef
DATABASE_URL=postgresql://labrinth:labrinth@labrinth-postgres/labrinth
DATABASE_MIN_CONNECTIONS=0
DATABASE_MAX_CONNECTIONS=16
MEILISEARCH_ADDR=http://labrinth-meilisearch:7700
MEILISEARCH_KEY=modrinth
REDIS_URL=redis://labrinth-redis
REDIS_MAX_CONNECTIONS=10000
BIND_ADDR=0.0.0.0:8000
SELF_ADDR=http://labrinth:8000
MODERATION_SLACK_WEBHOOK=
PUBLIC_DISCORD_WEBHOOK=
CLOUDFLARE_INTEGRATION=false
STORAGE_BACKEND=local
MOCK_FILE_PATH=/tmp/modrinth
S3_PUBLIC_BUCKET_NAME=none
S3_PUBLIC_USES_PATH_STYLE_BUCKET=false
S3_PUBLIC_REGION=none
S3_PUBLIC_URL=none
S3_PUBLIC_ACCESS_TOKEN=none
S3_PUBLIC_SECRET=none
S3_PRIVATE_BUCKET_NAME=none
S3_PRIVATE_USES_PATH_STYLE_BUCKET=false
S3_PRIVATE_REGION=none
S3_PRIVATE_URL=none
S3_PRIVATE_ACCESS_TOKEN=none
S3_PRIVATE_SECRET=none
# 1 hour
LOCAL_INDEX_INTERVAL=3600
# 30 minutes
VERSION_INDEX_INTERVAL=1800
RATE_LIMIT_IGNORE_IPS='["127.0.0.1"]'
WHITELISTED_MODPACK_DOMAINS='["cdn.modrinth.com", "github.com", "raw.githubusercontent.com"]'
ALLOWED_CALLBACK_URLS='["localhost", ".modrinth.com", "127.0.0.1"]'
GITHUB_CLIENT_ID=none
GITHUB_CLIENT_SECRET=none
GITLAB_CLIENT_ID=none
GITLAB_CLIENT_SECRET=none
DISCORD_CLIENT_ID=none
DISCORD_CLIENT_SECRET=none
MICROSOFT_CLIENT_ID=none
MICROSOFT_CLIENT_SECRET=none
GOOGLE_CLIENT_ID=none
GOOGLE_CLIENT_SECRET=none
PAYPAL_API_URL=https://api-m.sandbox.paypal.com/v1/
PAYPAL_WEBHOOK_ID=none
PAYPAL_CLIENT_ID=none
PAYPAL_CLIENT_SECRET=none
PAYPAL_NVP_USERNAME=none
PAYPAL_NVP_PASSWORD=none
PAYPAL_NVP_SIGNATURE=none
STEAM_API_KEY=none
TREMENDOUS_API_URL=https://testflight.tremendous.com/api/v2/
TREMENDOUS_API_KEY=none
TREMENDOUS_PRIVATE_KEY=none
TREMENDOUS_CAMPAIGN_ID=none
HCAPTCHA_SECRET=none
SMTP_FROM_NAME=Modrinth
SMTP_FROM_ADDRESS=no-reply@mail.modrinth.com
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_HOST=labrinth-mail
SMTP_PORT=1025
SMTP_TLS=none
SITE_VERIFY_EMAIL_PATH=auth/verify-email
SITE_RESET_PASSWORD_PATH=auth/reset-password
SITE_BILLING_PATH=none
SENDY_URL=none
SENDY_LIST_ID=none
SENDY_API_KEY=none
ANALYTICS_ALLOWED_ORIGINS='["http://127.0.0.1:3000", "http://localhost:3000", "https://modrinth.com", "https://www.modrinth.com", "*"]'
CLICKHOUSE_REPLICATED=false
CLICKHOUSE_URL=http://labrinth-clickhouse:8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=default
CLICKHOUSE_DATABASE=staging_ariadne
MAXMIND_LICENSE_KEY=none
FLAME_ANVIL_URL=none
STRIPE_API_KEY=none
STRIPE_WEBHOOK_SECRET=none
ADITUDE_API_KEY=none
PYRO_API_KEY=none
BREX_API_URL=https://platform.brexapis.com/v2/
BREX_API_KEY=none
DELPHI_URL=none
DELPHI_SLACK_WEBHOOK=none
ARCHON_URL=none

View File

@@ -58,7 +58,35 @@ services:
interval: 3s
timeout: 5s
retries: 3
labrinth:
profiles:
- with-labrinth
build:
context: .
dockerfile: ./apps/labrinth/Dockerfile
container_name: labrinth
ports:
- '8000:8000'
env_file: ./apps/labrinth/.env.docker-compose
volumes:
- labrinth-cdn-data:/tmp/modrinth
depends_on:
postgres_db:
condition: service_healthy
meilisearch:
condition: service_healthy
redis:
condition: service_healthy
clickhouse:
condition: service_healthy
mail:
condition: service_healthy
develop:
watch:
- path: ./apps/labrinth
action: rebuild
volumes:
meilisearch-data:
db-data:
redis-data:
labrinth-cdn-data: