services: validate: image:vandot/alpine-bash entrypoint:/bin/bash env_file:*env-files command: --c -| # List of required environment variables required_vars=( "INSTANCE_NAME" "NOTESNOOK_API_SECRET" "DISABLE_SIGNUPS" "SMTP_USERNAME" "SMTP_PASSWORD" "SMTP_HOST" "SMTP_PORT" "AUTH_SERVER_PUBLIC_URL" "NOTESNOOK_APP_PUBLIC_URL" "MONOGRAPH_PUBLIC_URL" "ATTACHMENTS_SERVER_PUBLIC_URL" ) # Check each required environment variable forvarin"$${required_vars[@]}";do if [ -z"$${!var}" ];then echo"Error: Required environment variable $$var is not set." exit1 fi done
echo"All required environment variables are set." # Ensure the validate service runs first restart:"no"
notesnook-db: image:mongo:7.0.12 hostname:notesnook-db volumes: -dbdata:/data/db -dbdata:/data/configdb networks: -notesnook command:--replSetrs0--bind_ip_all depends_on: validate: condition:service_completed_successfully healthcheck: test:echo'db.runCommand("ping").ok'|mongoshmongodb://localhost:27017--quiet interval:40s timeout:30s retries:3 start_period:60s # 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: -s3data:/data/s3 environment: MINIO_BROWSER:"on" depends_on: validate: condition:service_completed_successfully env_file:*env-files command:server/data/s3--console-address:9090 healthcheck: test:timeout5sbash-c':> /dev/tcp/127.0.0.1/9000'||exit1 interval:40s timeout:30s retries:3 start_period:60s
# 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:8264 networks: -notesnook env_file:*env-files depends_on: -notesnook-db healthcheck: test:wget--tries=1-nv-qhttp://localhost:8264/health-O-||exit1 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
Sync server URL: https://notes.example.io Auth server URL: https://auth.example.io Events server URL: https://events.example.io Monograph server URL: https:mono.example.io