mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 11:12:44 +00:00
151 lines
3.8 KiB
YAML
151 lines
3.8 KiB
YAML
x-server-discovery: &server-discovery
|
|
NOTESNOOK_SERVER_PORT: 80
|
|
NOTESNOOK_SERVER_HOST: notesnook-server
|
|
IDENTITY_SERVER_PORT: 80
|
|
IDENTITY_SERVER_HOST: identity-server
|
|
SSE_SERVER_PORT: 80
|
|
SSE_SERVER_HOST: sse-server
|
|
SELF_HOSTED: 1
|
|
|
|
x-env-files: &env-files
|
|
- .env
|
|
|
|
services:
|
|
notesnook-db:
|
|
image: mongo:7.0.12
|
|
networks:
|
|
- notesnook
|
|
command: --replSet rs0 --bind_ip_all
|
|
|
|
# the notesnook sync server requires transactions which only work
|
|
# with a MongoDB replica set.
|
|
# This job just runs `rs.initiate()` on our mongodb instance
|
|
# upgrading it to a replica set. This is only required once but we running
|
|
# it multiple times is no issue.
|
|
initiate-rs0:
|
|
image: mongo:7.0.12
|
|
networks:
|
|
- notesnook
|
|
depends_on:
|
|
- notesnook-db
|
|
entrypoint: /bin/sh
|
|
command:
|
|
- -c
|
|
- |
|
|
mongosh mongodb://notesnook-db:27017 <<EOF
|
|
rs.initiate();
|
|
rs.status();
|
|
EOF
|
|
|
|
notesnook-s3:
|
|
image: minio/minio:RELEASE.2024-07-29T22-14-52Z
|
|
ports:
|
|
- 9000:9000
|
|
networks:
|
|
- notesnook
|
|
volumes:
|
|
- ${HOME}/.notesnook/s3:/data/s3
|
|
environment:
|
|
MINIO_BROWSER: "on"
|
|
env_file: *env-files
|
|
command: server /data/s3 --console-address :9090
|
|
|
|
# There's no way to specify a default bucket in Minio so we have to
|
|
# set it up ourselves.
|
|
setup-s3:
|
|
image: minio/mc:RELEASE.2024-07-26T13-08-44Z
|
|
depends_on:
|
|
- notesnook-s3
|
|
networks:
|
|
- notesnook
|
|
entrypoint: /bin/bash
|
|
env_file: *env-files
|
|
command:
|
|
- -c
|
|
- |
|
|
until mc alias set minio http://notesnook-s3:9000 ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin}; do
|
|
sleep 1;
|
|
done;
|
|
mc mb minio/attachments -p
|
|
|
|
identity-server:
|
|
image: streetwriters/identity:latest
|
|
ports:
|
|
- 8264:80
|
|
networks:
|
|
- notesnook
|
|
env_file: *env-files
|
|
depends_on:
|
|
- notesnook-db
|
|
healthcheck:
|
|
test: curl --fail http://localhost:8264/health || exit 1
|
|
interval: 40s
|
|
timeout: 30s
|
|
retries: 3
|
|
start_period: 60s
|
|
environment:
|
|
<<: *server-discovery
|
|
MONGODB_CONNECTION_STRING: mongodb://notesnook-db:27017/identity?replSet=rs0
|
|
MONGODB_DATABASE_NAME: identity
|
|
|
|
notesnook-server:
|
|
image: streetwriters/notesnook-sync:latest
|
|
ports:
|
|
- 5264:80
|
|
networks:
|
|
- notesnook
|
|
env_file: *env-files
|
|
depends_on:
|
|
- notesnook-s3
|
|
- setup-s3
|
|
- identity-server
|
|
healthcheck:
|
|
test: curl --fail http://localhost:5264/health || exit 1
|
|
interval: 40s
|
|
timeout: 30s
|
|
retries: 3
|
|
start_period: 60s
|
|
environment:
|
|
<<: *server-discovery
|
|
MONGODB_CONNECTION_STRING: mongodb://notesnook-db:27017/?replSet=rs0
|
|
MONGODB_DATABASE_NAME: notesnook
|
|
S3_INTERNAL_SERVICE_URL: "${S3_SERVICE_URL:-http://notesnook-s3:9000}"
|
|
S3_INTERNAL_BUCKET_NAME: "attachments"
|
|
S3_ACCESS_KEY_ID: "${MINIO_ROOT_USER:-minioadmin}"
|
|
S3_ACCESS_KEY: "${MINIO_ROOT_PASSWORD:-minioadmin}"
|
|
S3_SERVICE_URL: "${S3_SERVICE_URL:-http://localhost:9000}"
|
|
S3_REGION: "us-east-1"
|
|
S3_BUCKET_NAME: "attachments"
|
|
|
|
sse-server:
|
|
image: streetwriters/sse:latest
|
|
ports:
|
|
- 7264:80
|
|
env_file: *env-files
|
|
depends_on:
|
|
- identity-server
|
|
- notesnook-server
|
|
networks:
|
|
- notesnook
|
|
healthcheck:
|
|
test: curl --fail http://localhost:7264/health || exit 1
|
|
interval: 40s
|
|
timeout: 30s
|
|
retries: 3
|
|
start_period: 60s
|
|
environment:
|
|
<<: *server-discovery
|
|
|
|
autoheal:
|
|
image: willfarrell/autoheal:latest
|
|
tty: true
|
|
restart: always
|
|
environment:
|
|
- AUTOHEAL_INTERVAL=60
|
|
- AUTOHEAL_START_PERIOD=300
|
|
- AUTOHEAL_DEFAULT_STOP_TIMEOUT=10
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
networks:
|
|
notesnook:
|