From 199be204f5b4c33b52eb7b5d38244a993163fcf3 Mon Sep 17 00:00:00 2001 From: Kirill Shklyaev Date: Tue, 23 Jan 2024 19:55:48 +0000 Subject: [PATCH 1/4] Added new variables for coordinator, filenode and minio s3 --- .aws/credentials | 4 ++-- .env | 13 +++++++++---- docker-generateconfig/etc/coordinator.yml | 6 +++--- docker-generateconfig/etc/filenode.yml | 9 +++++---- docker-generateconfig/processing.sh | 2 +- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.aws/credentials b/.aws/credentials index f27a32e..8c674e8 100644 --- a/.aws/credentials +++ b/.aws/credentials @@ -1,3 +1,3 @@ [default] -aws_access_key_id=testid -aws_secret_access_key=testkey +aws_access_key_id=minio_access_key +aws_secret_access_key=minio_secret_key diff --git a/.env b/.env index bb9fd08..3c63642 100644 --- a/.env +++ b/.env @@ -1,6 +1,8 @@ -AWS_ACCESS_KEY_ID=testid -AWS_SECRET_ACCESS_KEY=testkey -AWS_PORT=4569 +AWS_ACCESS_KEY_ID=minio_access_key +AWS_SECRET_ACCESS_KEY=minio_secret_key +MINIO_BUCKET=minio-bucket +MINIO_PORT=9000 +MINIO_WEB_PORT=9001 ANY_SYNC_NODE_VERSION=latest ANY_SYNC_FILENODE_VERSION=latest @@ -9,7 +11,7 @@ ANY_SYNC_CONSENSUSNODE_VERSION=latest MONGO_VERSION=7.0.2 REDIS_VERSION=7.2.0-v6 -S3_EMULATOR_VERSION=0.0.1 +MINIO_VERSION=RELEASE.2024-01-16T16-07-38Z EXTERNAL_LISTEN_HOST="127.0.0.1" @@ -36,6 +38,9 @@ ANY_SYNC_COORDINATOR_PORT=1004 ANY_SYNC_COORDINATOR_ADDRESSES=${ANY_SYNC_COORDINATOR_HOST}:${ANY_SYNC_COORDINATOR_PORT} ANY_SYNC_COORDINATOR_QUIC_PORT=1014 ANY_SYNC_COORDINATOR_QUIC_ADDRESSES=${ANY_SYNC_COORDINATOR_HOST}:${ANY_SYNC_COORDINATOR_QUIC_PORT} +ANY_SYNC_COORDINATOR_FILE_LIMIT_DEFAULT=1099511627776 +ANY_SYNC_COORDINATOR_FILE_LIMIT_ALPHA_USERS=1099511627776 +ANY_SYNC_COORDINATOR_FILE_LIMIT_NIGHTLY_USERS=1099511627776 ANY_SYNC_FILENODE_HOST=any-sync-filenode ANY_SYNC_FILENODE_PORT=1005 diff --git a/docker-generateconfig/etc/coordinator.yml b/docker-generateconfig/etc/coordinator.yml index 2ce93a4..ba82432 100644 --- a/docker-generateconfig/etc/coordinator.yml +++ b/docker-generateconfig/etc/coordinator.yml @@ -26,6 +26,6 @@ quic: dialTimeoutSec: 10 fileLimit: - limitDefault: 1099511627776 - limitAlphaUsers: 1099511627776 - limitNightlyUsers: 1099511627776 + limitDefault: %ANY_SYNC_COORDINATOR_FILE_LIMIT_DEFAULT% + limitAlphaUsers: %ANY_SYNC_COORDINATOR_FILE_LIMIT_ALPHA_USERS% + limitNightlyUsers: %ANY_SYNC_COORDINATOR_FILE_LIMIT_NIGHTLY_USERS% diff --git a/docker-generateconfig/etc/filenode.yml b/docker-generateconfig/etc/filenode.yml index 3aa71e3..d342ac8 100644 --- a/docker-generateconfig/etc/filenode.yml +++ b/docker-generateconfig/etc/filenode.yml @@ -1,10 +1,11 @@ s3Store: - bucket: s3-emulator - indexBucket: s3-emulator + bucket: %MINIO_BUCKET% + indexBucket: %MINIO_BUCKET% maxThreads: 16 profile: default - region: eu-central-1 - endpoint: http://s3-emulator:%AWS_PORT% + region: us-east-1 + endpoint: http://minio:%MINIO_PORT% + forcePathStyle: true # 'true' for self-hosted S3 Object Storage redis: isCluster: false diff --git a/docker-generateconfig/processing.sh b/docker-generateconfig/processing.sh index c8f7eef..c231b59 100755 --- a/docker-generateconfig/processing.sh +++ b/docker-generateconfig/processing.sh @@ -48,7 +48,7 @@ for node_type in node_1 node_2 node_3 coordinator filenode consensusnode; do done # Replace other placeholders -placeholders=( "MONGO_CONNECT" "REDIS_URL" "AWS_PORT" ) +placeholders=( "MONGO_CONNECT" "REDIS_URL" "MINIO_PORT" "MINIO_BUCKET" "ANY_SYNC_COORDINATOR_FILE_LIMIT_DEFAULT" "ANY_SYNC_COORDINATOR_FILE_LIMIT_ALPHA_USERS" "ANY_SYNC_COORDINATOR_FILE_LIMIT_NIGHTLY_USERS") for placeholder in "${placeholders[@]}"; do perl -i -pe "s|%${placeholder}%|${!placeholder}|g" "${network_file}" "${dest_path}/"/*/*.yml done From 4c9ed0d7644ccac482a0aed05a0c99b687356666 Mon Sep 17 00:00:00 2001 From: Kirill Shklyaev Date: Tue, 23 Jan 2024 19:58:58 +0000 Subject: [PATCH 2/4] Added information on how to use config file --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index c4a1e23..19b0036 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ generate_config: start: generate_config docker compose up -d + @echo "Done! Upload your self-hosted network configuration file ${CURDIR}/etc/client.yml into the client app" + @echo "See: https://doc.anytype.io/anytype-docs/data-and-security/self-hosting#switching-between-networks" stop: docker compose stop From 0716d8b60c2f6f5e94831b3a4c9230e0bb888c2b Mon Sep 17 00:00:00 2001 From: Kirill Shklyaev Date: Tue, 23 Jan 2024 20:00:19 +0000 Subject: [PATCH 3/4] Added new s3 backend: minio, added health checks for services --- docker-compose.yml | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f0563da..aeb86ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,17 +38,46 @@ services: - "${REDIS_PORT}:${REDIS_PORT}" volumes: - ./storage/redis/:/data/ + healthcheck: + test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] + interval: 10s + timeout: 30s + retries: 3 - s3-emulator: - image: "stanislavt/s3-emulator:${S3_EMULATOR_VERSION}" + minio: + container_name: minio + image: "minio/minio:${MINIO_VERSION}" + restart: always + command: server /data --console-address ":9001" + environment: + MINIO_ROOT_USER: "${AWS_ACCESS_KEY_ID}" + MINIO_ROOT_PASSWORD: "${AWS_SECRET_ACCESS_KEY}" ports: - - "${AWS_PORT}:4569" + - "${MINIO_PORT}:9000" + - "${MINIO_WEB_PORT}:9001" volumes: - - ./storage/s3_root:/s3_root + - ./storage/minio:/data + healthcheck: + test: bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1 + interval: 5s + timeout: 10s + retries: 3 networks: default: aliases: - - s3-emulator.s3-emulator + - "${MINIO_BUCKET}.minio" # . + + create-bucket: + image: minio/mc:latest + environment: + MC_HOST_minio: http://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@minio:${MINIO_PORT} + restart: no + depends_on: + - minio + entrypoint: + - sh + - -c + - mc mb minio/${MINIO_BUCKET} any-sync-coordinator_bootstrap: image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}" @@ -81,7 +110,7 @@ services: image: "ghcr.io/anyproto/any-sync-filenode:${ANY_SYNC_FILENODE_VERSION}" depends_on: - redis - - s3-emulator + - minio - any-sync-coordinator ports: - "${ANY_SYNC_FILENODE_PORT}:${ANY_SYNC_FILENODE_PORT}" From 383177a7c5ac6289dcae50b3cb3b966e77b64022 Mon Sep 17 00:00:00 2001 From: Kirill Shklyaev Date: Tue, 23 Jan 2024 20:00:55 +0000 Subject: [PATCH 4/4] Added warning about switching to new s3 backend --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6995e58..11b2aa9 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ Self-host for any-sync, designed for review and testing purposes. > [!IMPORTANT] > please don't use it for production! +> [!WARNING] +> Starting from release version v2.0.1, we have transitioned from the **s3-emulator** to **minio** as the data storage for any-sync-filenode. Please note that this change will result in the loss of any-sync-filenode data (stored at the path `./storage/s3_root`). + ## Prepare * install docker and docker-compose https://docs.docker.com/compose/install/linux/