mirror of
https://github.com/getumbrel/umbrel-apps.git
synced 2026-12-05 02:44:39 +03:00
Co-authored-by: sharingiscaring42 <shopi.shopa.shopo@gmail.com> Co-authored-by: Nate <85373263+nmfretz@users.noreply.github.com>
401 lines
16 KiB
YAML
401 lines
16 KiB
YAML
x-logging: &logging
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-file: "5"
|
|
max-size: "10m"
|
|
|
|
x-appwrite-env: &appwrite-env
|
|
_APP_ENV: production
|
|
_APP_OPENSSL_KEY_V1: ${APP_APPWRITE_OPENSSL_KEY}
|
|
_APP_NOTIFICATIONS_TRACKING_SECRET: ${APP_APPWRITE_TRACKING_SECRET}
|
|
# Functions and Sites call the API at _APP_DOMAIN over plain HTTP on port 80,
|
|
# so it points at the internal API container. They run in the nested daemon,
|
|
# whose DNS only forwards dotted names, hence the alias on the appwrite
|
|
# service. The console is served on the Umbrel hostname below.
|
|
_APP_DOMAIN: appwrite-api.internal
|
|
_APP_CONSOLE_DOMAIN: ${DEVICE_DOMAIN_NAME}
|
|
_APP_CONSOLE_URL: http://${DEVICE_DOMAIN_NAME}:8197
|
|
_APP_CONSOLE_HOSTNAMES: ${DEVICE_DOMAIN_NAME}
|
|
_APP_DOMAIN_FUNCTIONS: functions.${DEVICE_DOMAIN_NAME}
|
|
_APP_DOMAIN_SITES: sites.${DEVICE_DOMAIN_NAME}
|
|
_APP_DOMAIN_TARGET_CNAME: ${DEVICE_DOMAIN_NAME}
|
|
_APP_DB_ADAPTER: postgresql
|
|
_APP_DB_HOST: appwrite_postgresql_1
|
|
_APP_DB_PORT: "5432"
|
|
_APP_DB_SCHEMA: appwrite
|
|
_APP_DB_USER: appwrite
|
|
_APP_DB_PASS: ${APP_APPWRITE_DB_PASSWORD}
|
|
# Upstream's installer writes these defaults; without them Appwrite falls
|
|
# back to https links for runtimes, a 0-byte upload limit, and a deletes
|
|
# worker that fails on every job for want of a certificates email.
|
|
_APP_OPTIONS_FORCE_HTTPS: disabled
|
|
_APP_SYSTEM_SECURITY_EMAIL_ADDRESS: certs@appwrite.io
|
|
_APP_STORAGE_LIMIT: "30000000"
|
|
_APP_COMPUTE_SIZE_LIMIT: "30000000"
|
|
_APP_COMPUTE_BUILD_TIMEOUT: "2700"
|
|
_APP_REDIS_HOST: appwrite_redis_1
|
|
_APP_REDIS_PORT: "6379"
|
|
_APP_USAGE_PASS: ${APP_APPWRITE_CLICKHOUSE_PASSWORD}
|
|
_APP_CONNECTIONS_DB_USAGE: http://appwrite:${APP_APPWRITE_CLICKHOUSE_PASSWORD}@appwrite_clickhouse_1:8123/appwrite
|
|
_APP_CONNECTIONS_DB_EXECUTIONS: http://appwrite:${APP_APPWRITE_CLICKHOUSE_PASSWORD}@appwrite_clickhouse_1:8123/appwrite
|
|
_APP_EXECUTOR_HOST: http://appwrite_docker_1/v1
|
|
_APP_EXECUTOR_SECRET: ${APP_APPWRITE_EXECUTOR_SECRET}
|
|
_APP_JOBS_HOST: http://appwrite_docker_1:8080
|
|
_APP_JOBS_SECRET: ${APP_APPWRITE_JOBS_SECRET}
|
|
_APP_JOBS_ENDPOINT: http://appwrite-api.internal
|
|
_APP_GEO_ENDPOINT: http://appwrite_appwrite-geo_1/v1
|
|
_APP_GEO_SECRET: ${APP_APPWRITE_GEO_SECRET}
|
|
_APP_EXIFTOOL_HOST: http://appwrite_appwrite-exiftool_1:8080
|
|
_APP_BROWSER_HOST: http://appwrite_appwrite-browser_1:3000/v1
|
|
_APP_WORKER_SCREENSHOTS_ROUTER: http://appwrite_appwrite_1
|
|
_APP_MIGRATION_HOST: appwrite_appwrite_1
|
|
_APP_EMBEDDING: disabled
|
|
_APP_FUNCTIONS_RUNTIMES: node-16.0,node-22,php-8.0,python-3.9,ruby-3.0
|
|
_APP_SITES_RUNTIMES: static-1,node-22,flutter-3.29
|
|
_APP_COMPUTE_RUNTIMES_NETWORK: runtimes
|
|
|
|
services:
|
|
app_proxy:
|
|
environment:
|
|
APP_HOST: appwrite_web_1
|
|
APP_PORT: 80
|
|
# Apps and SDKs call the Appwrite API directly; the console has its own login.
|
|
PROXY_AUTH_ADD: "false"
|
|
|
|
# Routes the console, the API and realtime the way upstream's Traefik labels do.
|
|
web:
|
|
image: nginx:1.30.8-alpine@sha256:8eb04fe3b385090e9aa02961f77398ad09b6bf33ab07f6669a5bb7acce22c0d3
|
|
<<: *logging
|
|
restart: on-failure
|
|
depends_on:
|
|
- appwrite
|
|
- appwrite-console
|
|
- appwrite-realtime
|
|
entrypoint: ["/bin/sh", "-ec"]
|
|
command:
|
|
- |
|
|
cat > /etc/nginx/conf.d/default.conf <<'EOF'
|
|
map $$http_upgrade $$connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
# Appwrite only trusts Origins it knows; a same-origin request (Origin
|
|
# host:port equals Host) carries no Origin, so any address works.
|
|
map "$$http_origin|$$http_host" $$appwrite_origin {
|
|
"~*^https?://([^|/]+)\|\1$$" "";
|
|
default $$http_origin;
|
|
}
|
|
# Site and function domains, and console previews, go to the API router.
|
|
map "$$host|$$http_x_appwrite_hostname" $$backend {
|
|
"~\.(sites|functions)\." http://appwrite_appwrite_1;
|
|
"~\|.+$$" http://appwrite_appwrite_1;
|
|
default http://appwrite_appwrite-console_1:3000;
|
|
}
|
|
server {
|
|
listen 80;
|
|
# Docker's DNS, for the proxy_pass that uses a variable.
|
|
resolver 127.0.0.11 valid=10s ipv6=off;
|
|
client_max_body_size 0;
|
|
proxy_read_timeout 3600s;
|
|
proxy_buffering off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $$http_host;
|
|
proxy_set_header Upgrade $$http_upgrade;
|
|
proxy_set_header Connection $$connection_upgrade;
|
|
proxy_set_header Origin $$appwrite_origin;
|
|
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $$scheme;
|
|
location /v1/realtime { proxy_pass http://appwrite_appwrite-realtime_1; }
|
|
location /v1 { proxy_pass http://appwrite_appwrite_1; }
|
|
location /.well-known { proxy_pass http://appwrite_appwrite_1; }
|
|
location / { proxy_pass $$backend; }
|
|
}
|
|
EOF
|
|
exec nginx -g 'daemon off;'
|
|
|
|
appwrite:
|
|
image: appwrite/appwrite:2.7.5@sha256:254e1d0a91b1642d72f259b2e939b140d426d1c65b891586e5092b11b0dcf56f
|
|
<<: *logging
|
|
restart: on-failure
|
|
depends_on:
|
|
- redis
|
|
- postgresql
|
|
- clickhouse
|
|
- appwrite-geo
|
|
- appwrite-exiftool
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/uploads:/storage/uploads
|
|
- ${APP_DATA_DIR}/data/imports:/storage/imports
|
|
- ${APP_DATA_DIR}/data/cache:/storage/cache
|
|
- ${APP_DATA_DIR}/data/config:/storage/config
|
|
- ${APP_DATA_DIR}/data/certificates:/storage/certificates
|
|
- ${APP_DATA_DIR}/data/functions:/storage/functions
|
|
- ${APP_DATA_DIR}/data/sites:/storage/sites
|
|
- ${APP_DATA_DIR}/data/builds:/storage/builds
|
|
environment: *appwrite-env
|
|
networks:
|
|
default:
|
|
aliases:
|
|
- appwrite-api.internal
|
|
|
|
appwrite-console:
|
|
image: appwrite/new:1.2.181-self-hosted@sha256:064f4d71dc6c74f59028db8bb6b219e13a466bb90287f91ed282eeccc3fe2e29
|
|
<<: *logging
|
|
restart: on-failure
|
|
environment:
|
|
VITE_CONSOLE_PROFILE: self-hosted
|
|
VITE_APPWRITE_VERSION: 2.7.5
|
|
APPWRITE_ENDPOINT_SAME_ORIGIN: "true"
|
|
|
|
appwrite-realtime:
|
|
image: appwrite/appwrite:2.7.5@sha256:254e1d0a91b1642d72f259b2e939b140d426d1c65b891586e5092b11b0dcf56f
|
|
<<: *logging
|
|
entrypoint: realtime
|
|
restart: on-failure
|
|
depends_on:
|
|
- redis
|
|
- postgresql
|
|
environment: *appwrite-env
|
|
|
|
# Runs every queue worker in one container, upstream's default "combined" setup.
|
|
appwrite-worker:
|
|
image: appwrite/appwrite:2.7.5@sha256:254e1d0a91b1642d72f259b2e939b140d426d1c65b891586e5092b11b0dcf56f
|
|
<<: *logging
|
|
entrypoint: worker
|
|
restart: on-failure
|
|
depends_on:
|
|
- redis
|
|
- postgresql
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/uploads:/storage/uploads
|
|
- ${APP_DATA_DIR}/data/imports:/storage/imports
|
|
- ${APP_DATA_DIR}/data/cache:/storage/cache
|
|
- ${APP_DATA_DIR}/data/config:/storage/config
|
|
- ${APP_DATA_DIR}/data/certificates:/storage/certificates
|
|
- ${APP_DATA_DIR}/data/functions:/storage/functions
|
|
- ${APP_DATA_DIR}/data/sites:/storage/sites
|
|
- ${APP_DATA_DIR}/data/builds:/storage/builds
|
|
environment: *appwrite-env
|
|
|
|
appwrite-task-scheduler:
|
|
image: appwrite/appwrite:2.7.5@sha256:254e1d0a91b1642d72f259b2e939b140d426d1c65b891586e5092b11b0dcf56f
|
|
<<: *logging
|
|
entrypoint: schedule
|
|
restart: on-failure
|
|
depends_on:
|
|
- redis
|
|
- postgresql
|
|
environment: *appwrite-env
|
|
|
|
appwrite-task-maintenance:
|
|
image: appwrite/appwrite:2.7.5@sha256:254e1d0a91b1642d72f259b2e939b140d426d1c65b891586e5092b11b0dcf56f
|
|
<<: *logging
|
|
entrypoint: maintenance
|
|
restart: on-failure
|
|
depends_on:
|
|
- redis
|
|
- postgresql
|
|
environment: *appwrite-env
|
|
|
|
appwrite-task-interval:
|
|
image: appwrite/appwrite:2.7.5@sha256:254e1d0a91b1642d72f259b2e939b140d426d1c65b891586e5092b11b0dcf56f
|
|
<<: *logging
|
|
entrypoint: interval
|
|
restart: on-failure
|
|
depends_on:
|
|
- redis
|
|
- postgresql
|
|
environment: *appwrite-env
|
|
|
|
appwrite-browser:
|
|
image: appwrite/browser:0.3.10@sha256:b8f46c59a23683c8afac4da4d1859fce632c8909e59ebb2e749d179bd1913b3a
|
|
<<: *logging
|
|
restart: on-failure
|
|
environment:
|
|
ALLOWED_HOSTS: appwrite_appwrite_1
|
|
|
|
appwrite-geo:
|
|
image: appwrite/geo:0.3.2@sha256:a6323c5e56e19685fb4550f7f5272b021f56d383fe55075a93f8d6242a02dbcb
|
|
<<: *logging
|
|
restart: on-failure
|
|
environment:
|
|
GEO_SECRET: ${APP_APPWRITE_GEO_SECRET}
|
|
|
|
appwrite-exiftool:
|
|
image: ghcr.io/appwrite/exiftool:0.1.1@sha256:1088a67df8639de033e7deeb66a24eb40bf4bfea1de041c5cd319da61c4f2fc9
|
|
<<: *logging
|
|
restart: on-failure
|
|
|
|
# Functions and Sites run in containers that the executor starts. A nested
|
|
# Docker daemon keeps them off Umbrel's own daemon: no host socket, no host
|
|
# network. The executor and the build orchestrator run inside it and are
|
|
# reached on this service's ports 80 and 8080.
|
|
docker:
|
|
image: docker:29.10.1-dind@sha256:788c403e819858c41171119a6fa32ac79431d3ea5b50596a9712a5a7db5a1679
|
|
<<: *logging
|
|
privileged: true
|
|
restart: on-failure
|
|
stop_grace_period: 1m
|
|
# Starting with "dockerd" keeps the image from also opening a TCP listener.
|
|
command:
|
|
- dockerd
|
|
- --host=unix:///run/dind/docker.sock
|
|
- --bip=10.36.0.1/24
|
|
- --default-address-pool=base=10.37.0.0/16,size=24
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/docker:/var/lib/docker
|
|
- ${APP_DATA_DIR}/data/docker-run:/run/dind
|
|
- ${APP_DATA_DIR}/data/functions:/storage/functions
|
|
- ${APP_DATA_DIR}/data/sites:/storage/sites
|
|
- ${APP_DATA_DIR}/data/builds:/storage/builds
|
|
healthcheck:
|
|
test: ["CMD", "docker", "--host=unix:///run/dind/docker.sock", "info"]
|
|
interval: 10s
|
|
timeout: 10s
|
|
retries: 12
|
|
start_period: 30s
|
|
|
|
# Keeps the executor running inside the nested daemon, attached to its own
|
|
# runtimes network as upstream expects.
|
|
openruntimes-executor:
|
|
image: docker:29.10.1-cli@sha256:4e60c31615e83523afbb59773b25d055c0da9edcd5f80a4c6a6eebad49de1a25
|
|
<<: *logging
|
|
restart: on-failure
|
|
stop_signal: SIGINT
|
|
stop_grace_period: 45s
|
|
depends_on:
|
|
docker:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/docker-run:/run/dind
|
|
environment:
|
|
DOCKER_HOST: unix:///run/dind/docker.sock
|
|
IMAGE: openruntimes/executor:1.3.7@sha256:510073849d19c783a83c64b57799c52ae0c2dfc4a348249c917628b48d4e16fd
|
|
OPR_EXECUTOR_ENV: production
|
|
OPR_EXECUTOR_SECRET: ${APP_APPWRITE_EXECUTOR_SECRET}
|
|
OPR_EXECUTOR_NETWORK: runtimes
|
|
OPR_EXECUTOR_RUNTIMES: node-16.0,node-22,php-8.0,python-3.9,ruby-3.0,static-1,node-22,flutter-3.29
|
|
OPR_EXECUTOR_RUNTIME_VERSIONS: v5
|
|
OPR_EXECUTOR_INACTIVE_THRESHOLD: "60"
|
|
OPR_EXECUTOR_MAINTENANCE_INTERVAL: "3600"
|
|
OPR_EXECUTOR_CONNECTION_STORAGE: local://localhost
|
|
# Pre-pulled into the nested daemon so the first build doesn't pull them
|
|
# inside Appwrite's 30-second request to the orchestrator.
|
|
OPR_EXECUTOR_IMAGES: openruntimes/node:v5-22,openruntimes/static:v5-1,ghcr.io/open-runtimes/orchestrator/job-sidecar:5.0.0
|
|
entrypoint: ["/bin/sh", "-ec"]
|
|
command:
|
|
- |
|
|
docker network inspect appwrite >/dev/null 2>&1 ||
|
|
docker network create appwrite
|
|
docker rm -f exc1 >/dev/null 2>&1 || true
|
|
exec docker run --rm --name exc1 --hostname exc1 --network appwrite \
|
|
--stop-signal SIGINT --publish 80:80 \
|
|
--volume /run/dind/docker.sock:/var/run/docker.sock \
|
|
--volume /storage/builds:/storage/builds \
|
|
--volume /storage/functions:/storage/functions \
|
|
--volume /storage/sites:/storage/sites \
|
|
--volume /tmp:/tmp \
|
|
--env OPR_EXECUTOR_ENV --env OPR_EXECUTOR_SECRET --env OPR_EXECUTOR_NETWORK \
|
|
--env OPR_EXECUTOR_RUNTIMES --env OPR_EXECUTOR_RUNTIME_VERSIONS \
|
|
--env OPR_EXECUTOR_INACTIVE_THRESHOLD --env OPR_EXECUTOR_MAINTENANCE_INTERVAL \
|
|
--env OPR_EXECUTOR_CONNECTION_STORAGE --env OPR_EXECUTOR_IMAGES \
|
|
"$$IMAGE"
|
|
|
|
# Builds function and site deployments, inside the nested daemon.
|
|
openruntimes-orchestrator:
|
|
image: docker:29.10.1-cli@sha256:4e60c31615e83523afbb59773b25d055c0da9edcd5f80a4c6a6eebad49de1a25
|
|
<<: *logging
|
|
restart: on-failure
|
|
stop_grace_period: 30s
|
|
depends_on:
|
|
docker:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/docker-run:/run/dind
|
|
environment:
|
|
DOCKER_HOST: unix:///run/dind/docker.sock
|
|
IMAGE: ghcr.io/open-runtimes/orchestrator/orchestrator:5.0.0@sha256:53cd007f3322d9b17f4f736af10894859e086abe0ceb57b1e09587d8fe667527
|
|
ORCHESTRATOR_BACKEND: docker
|
|
ORCHESTRATOR_NETWORK: appwrite
|
|
DOCKER_NETWORK: appwrite
|
|
ARTIFACT_ENDPOINT: http://orchestrator:8080
|
|
API_KEY: ${APP_APPWRITE_JOBS_SECRET}
|
|
ALLOWED_VOLUMES: appwrite-builds
|
|
entrypoint: ["/bin/sh", "-ec"]
|
|
command:
|
|
- |
|
|
docker network inspect appwrite >/dev/null 2>&1 ||
|
|
docker network create appwrite
|
|
# Build jobs mount subpaths of this named volume (_APP_BUILDS_VOLUME).
|
|
docker volume inspect appwrite-builds >/dev/null 2>&1 ||
|
|
docker volume create --opt type=none --opt o=bind \
|
|
--opt device=/storage/builds appwrite-builds
|
|
docker rm -f orchestrator >/dev/null 2>&1 || true
|
|
exec docker run --rm --name orchestrator --hostname orchestrator \
|
|
--network appwrite \
|
|
--user root --publish 8080:8080 \
|
|
--volume /run/dind/docker.sock:/var/run/docker.sock \
|
|
--env ORCHESTRATOR_BACKEND --env ORCHESTRATOR_NETWORK --env DOCKER_NETWORK \
|
|
--env ARTIFACT_ENDPOINT --env API_KEY --env ALLOWED_VOLUMES \
|
|
"$$IMAGE"
|
|
|
|
postgresql:
|
|
image: appwrite/postgres:0.1.0@sha256:77156232a16d80f5830d914edb44f52a0853058939f2365cc3301d08db9d05e9
|
|
<<: *logging
|
|
restart: on-failure
|
|
shm_size: 1g
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/postgresql:/var/lib/postgresql
|
|
environment:
|
|
POSTGRES_DB: appwrite
|
|
POSTGRES_USER: appwrite
|
|
POSTGRES_PASSWORD: ${APP_APPWRITE_DB_PASSWORD}
|
|
|
|
clickhouse:
|
|
image: clickhouse/clickhouse-server:26.4.3-alpine@sha256:128168041226ef603588377b42e07ab4afd7d8f87f59ea46558a69655ff5ad4b
|
|
<<: *logging
|
|
restart: on-failure
|
|
ulimits:
|
|
nofile:
|
|
soft: 262144
|
|
hard: 262144
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/clickhouse:/var/lib/clickhouse
|
|
environment:
|
|
CLICKHOUSE_DB: appwrite
|
|
CLICKHOUSE_USER: appwrite
|
|
CLICKHOUSE_PASSWORD: ${APP_APPWRITE_CLICKHOUSE_PASSWORD}
|
|
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: "1"
|
|
# Upstream's clickhouse-config.xml: keeps ClickHouse's own logs from filling the disk.
|
|
entrypoint: ["/bin/sh", "-ec"]
|
|
command:
|
|
- |
|
|
cat > /etc/clickhouse-server/config.d/appwrite.xml <<'EOF'
|
|
<clickhouse>
|
|
<asynchronous_metric_log remove="1"/>
|
|
<metric_log remove="1"/>
|
|
<histogram_metric_log remove="1"/>
|
|
<query_metric_log remove="1"/>
|
|
<processors_profile_log remove="1"/>
|
|
<trace_log remove="1"/>
|
|
<text_log remove="1"/>
|
|
<asynchronous_insert_log><ttl>event_date + INTERVAL 3 DAY DELETE</ttl></asynchronous_insert_log>
|
|
<query_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></query_log>
|
|
<query_views_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></query_views_log>
|
|
<query_thread_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></query_thread_log>
|
|
<part_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></part_log>
|
|
<background_schedule_pool_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></background_schedule_pool_log>
|
|
<error_log><ttl>event_date + INTERVAL 14 DAY DELETE</ttl></error_log>
|
|
</clickhouse>
|
|
EOF
|
|
exec /entrypoint.sh
|
|
|
|
redis:
|
|
image: redis:7.4.7-alpine@sha256:02f2cc4882f8bf87c79a220ac958f58c700bdec0dfb9b9ea61b62fb0e8f1bfcf
|
|
<<: *logging
|
|
restart: on-failure
|
|
command: redis-server --maxmemory 512mb --maxmemory-policy allkeys-lru --maxmemory-samples 5
|
|
volumes:
|
|
- ${APP_DATA_DIR}/data/redis:/data
|