1
0
Fork 0
mirror of https://github.com/anyproto/any-sync-dockercompose.git synced 2025-06-08 14:07:02 +09:00

Merge pull request #14 from anyproto/issues-10

fix issue-10
This commit is contained in:
Grigory Efimov 2024-01-15 17:33:00 -03:00 committed by GitHub
commit e8922b5676
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 55 additions and 15 deletions

2
.env
View file

@ -11,6 +11,8 @@ MONGO_VERSION=7.0.2
REDIS_VERSION=7.2.0-v6 REDIS_VERSION=7.2.0-v6
S3_EMULATOR_VERSION=0.0.1 S3_EMULATOR_VERSION=0.0.1
EXTERNAL_LISTEN_HOST="127.0.0.1"
ANY_SYNC_NODE_1_HOST=any-sync-node-1 ANY_SYNC_NODE_1_HOST=any-sync-node-1
ANY_SYNC_NODE_1_PORT=1001 ANY_SYNC_NODE_1_PORT=1001
ANY_SYNC_NODE_1_ADDRESSES=${ANY_SYNC_NODE_1_HOST}:${ANY_SYNC_NODE_1_PORT} ANY_SYNC_NODE_1_ADDRESSES=${ANY_SYNC_NODE_1_HOST}:${ANY_SYNC_NODE_1_PORT}

View file

@ -6,11 +6,11 @@ COPY --chmod=777 docker-generateconfig/generate_config.sh .env .
RUN ./generate_config.sh RUN ./generate_config.sh
FROM alpine:3.18.4 FROM alpine:3.18.4
RUN apk add --no-cache bash perl RUN apk add --no-cache bash yq perl python3 py3-yaml
WORKDIR /opt/processing WORKDIR /opt/processing
COPY docker-generateconfig/etc/ tmp-etc/ COPY docker-generateconfig/etc/ tmp-etc/
COPY --chmod=777 docker-generateconfig/processing.sh . COPY --chmod=777 docker-generateconfig/processing.sh .
COPY --chmod=777 docker-generateconfig/setListenIp.py .
COPY --from=generator /opt/generateconfig/ generateconfig/ COPY --from=generator /opt/generateconfig/ generateconfig/
CMD ./processing.sh CMD ./processing.sh

View file

@ -19,6 +19,8 @@ pull:
down: down:
docker compose down docker compose down
logs:
docker compose logs -f
# build with "plain" log for debug # build with "plain" log for debug
build: build:

View file

@ -65,9 +65,18 @@ Self-host for any-sync, designed for review and testing purposes.
db.getMongo().setReadPref('primaryPreferred'); db.nodeConf.find().sort( { _id: -1 } ).limit(1) db.getMongo().setReadPref('primaryPreferred'); db.nodeConf.find().sort( { _id: -1 } ).limit(1)
``` ```
## Set specific versions * run client
```
# macos example
ANYTYPE_LOG_LEVEL="*=DEBUG" ANYPROF=:6060 ANY_SYNC_NETWORK=<pathToRepo>/any-sync-dockercompose/etc/client.yml /Applications/Anytype.app/Contents/MacOS/Anytype
```
## configuration
Use file .env Use file .env
### Compatible versions * Set specific versions: find and edit variables with suffix "_VERSION"
* Set external listen host: default 127.0.0.1, for change you need edit variable "EXTERNAL_LISTEN_HOST"
## Compatible versions
You can find compatible versions on these pages: You can find compatible versions on these pages:
* stable versions, used in [production](https://puppetdoc.anytype.io/api/v1/prod-any-sync-compatible-versions/) * stable versions, used in [production](https://puppetdoc.anytype.io/api/v1/prod-any-sync-compatible-versions/)
* unstable versions, used in [test stand](https://puppetdoc.anytype.io/api/v1/stage1-any-sync-compatible-versions/) * unstable versions, used in [test stand](https://puppetdoc.anytype.io/api/v1/stage1-any-sync-compatible-versions/)

View file

@ -1,10 +0,0 @@
version: "3.9"
services:
generateconfig:
image: generateconfig
build:
context: .
dockerfile: Dockerfile-generateconfig
volumes:
- ./tmp/generateconfig/:/generateconfig/
command: /gen.sh

View file

@ -33,7 +33,7 @@ services:
container_name: redis container_name: redis
image: "redis/redis-stack-server:${REDIS_VERSION}" image: "redis/redis-stack-server:${REDIS_VERSION}"
restart: always restart: always
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy noeviction --protected-mode no --loadmodule /opt/redis-stack/lib/redisbloom.so command: redis-server --dir /data/ --appendonly yes --maxmemory 256mb --maxmemory-policy noeviction --protected-mode no --loadmodule /opt/redis-stack/lib/redisbloom.so
ports: ports:
- "${REDIS_PORT}:${REDIS_PORT}" - "${REDIS_PORT}:${REDIS_PORT}"
volumes: volumes:
@ -45,6 +45,10 @@ services:
- "${AWS_PORT}:4569" - "${AWS_PORT}:4569"
volumes: volumes:
- ./storage/s3_root:/s3_root - ./storage/s3_root:/s3_root
networks:
default:
aliases:
- s3-emulator.s3-emulator
any-sync-coordinator_bootstrap: any-sync-coordinator_bootstrap:
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}" image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"

View file

@ -24,3 +24,8 @@ quic:
- %ANY_SYNC_COORDINATOR_QUIC_ADDRESSES% - %ANY_SYNC_COORDINATOR_QUIC_ADDRESSES%
writeTimeoutSec: 10 writeTimeoutSec: 10
dialTimeoutSec: 10 dialTimeoutSec: 10
fileLimit:
limitDefault: 1099511627776
limitAlphaUsers: 1099511627776
limitNightlyUsers: 1099511627776

View file

@ -39,6 +39,7 @@ if ! [[ -s account0.yml ]]; then
fi fi
fi fi
yq --indent 4 --inplace 'del(.creationTime)' nodes.yml
yq --indent 4 --inplace ".networkId |= \"${NETWORK_ID}\"" nodes.yml yq --indent 4 --inplace ".networkId |= \"${NETWORK_ID}\"" nodes.yml
yq --indent 4 --inplace ".account.signingKey |= \"${NETWORK_SIGNING_KEY}\"" account3.yml yq --indent 4 --inplace ".account.signingKey |= \"${NETWORK_SIGNING_KEY}\"" account3.yml
yq --indent 4 --inplace ".account.signingKey |= \"${NETWORK_SIGNING_KEY}\"" account5.yml yq --indent 4 --inplace ".account.signingKey |= \"${NETWORK_SIGNING_KEY}\"" account5.yml

View file

@ -16,6 +16,12 @@ for node_type in filenode coordinator consensusnode; do
mkdir -p "${dest_path}/any-sync-${node_type}" mkdir -p "${dest_path}/any-sync-${node_type}"
done done
# add external listen host
./setListenIp.py "${EXTERNAL_LISTEN_HOST}" "generateconfig/nodes.yml"
# create config for clients
cp "generateconfig/nodes.yml" "${dest_path}/client.yml"
# Generate network file # Generate network file
sed 's|^| |; 1s|^|network:\n|' "generateconfig/nodes.yml" > "${network_file}" sed 's|^| |; 1s|^|network:\n|' "generateconfig/nodes.yml" > "${network_file}"

View file

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import yaml
listenHost = sys.argv[1]
yamlFile = sys.argv[2]
with open(yamlFile, 'r') as file:
config = yaml.load(file,Loader=yaml.Loader)
for index, nodes in enumerate(config['nodes']):
addresses = nodes['addresses']
port = addresses[0].split(':')[1]
listenAddress = listenHost +':'+ port
if listenAddress not in addresses:
addresses.append(listenAddress)
with open(yamlFile, 'w') as file:
yaml.dump(config, file)