Skip to content

improved config generation method; added saving of current account an… #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile-generate-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# syntax=docker/dockerfile:1
FROM python:3.13-alpine
WORKDIR /code
COPY docker-generateconfig/env-requirements.txt .
RUN pip install --no-cache-dir -r env-requirements.txt
ENTRYPOINT ["sh", "-c", "python docker-generateconfig/env.py && python docker-generateconfig/generateTemplate.py"]
19 changes: 19 additions & 0 deletions Dockerfile-generateconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ghcr.io/anyproto/any-sync-tools:latest

WORKDIR /code

RUN apt update && \
apt install -y python3 python3-pip && \
pip3 install --no-cache-dir pyyaml && \
apt clean && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["sh", "-c", \
"if grep -q 'networkId' /code/etc/client.yml && [ ! -f /code/etc/ids.yml ]; then \
python3 /code/docker-generateconfig/persistentAccount.py && \
any-sync-network create --auto --c /code/etc/defaultTemplate.yml && \
python3 /code/docker-generateconfig/persistentAccount.py; \
else \
any-sync-network create --auto --c /code/etc/defaultTemplate.yml && \
python3 /code/docker-generateconfig/persistentAccount.py; \
fi"]
6 changes: 0 additions & 6 deletions Dockerfile-generateconfig-anyconf

This file was deleted.

6 changes: 0 additions & 6 deletions Dockerfile-generateconfig-env

This file was deleted.

5 changes: 0 additions & 5 deletions Dockerfile-generateconfig-processing

This file was deleted.

8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ endif
# targets
generate_env:
ifeq ($(QUIET_MODE),true)
docker buildx build --quiet --load --tag generateconfig-env --file Dockerfile-generateconfig-env . >/dev/null
docker buildx build --quiet --load --tag generate-env --file Dockerfile-generate-env . >/dev/null
else
docker buildx build --load --tag generateconfig-env --file Dockerfile-generateconfig-env .
docker buildx build --load --tag generate-env --file Dockerfile-generate-env .
endif
docker run --rm \
--volume ${CURDIR}/:/code/:Z \
generateconfig-env
docker run --detach --rm --volume ${CURDIR}/:/code/ generate-env

start: generate_env
$(DOCKER_COMPOSE) up --detach --remove-orphans --quiet-pull
Expand Down
36 changes: 12 additions & 24 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
services:
# generate configs using the anyconf utility
generateconfig-anyconf:
# generate configs using the any-sync-network tool
generateconfig:
build:
context: .
dockerfile: Dockerfile-generateconfig-anyconf
dockerfile: Dockerfile-generateconfig
volumes:
- ./:/code:Z
- "${STORAGE_DIR}:/code/storage:Z"

# processing any-sync-* configs
generateconfig-processing:
depends_on:
generateconfig-anyconf:
condition: service_completed_successfully
build:
context: .
dockerfile: Dockerfile-generateconfig-processing
volumes:
- ./:/code:Z
- "${STORAGE_DIR}:/code/storage:Z"

mongo-1:
depends_on:
generateconfig-processing:
generateconfig:
condition: service_completed_successfully
image: "mongo:${MONGO_VERSION}"
restart: unless-stopped
Expand All @@ -38,7 +25,7 @@ services:

redis:
depends_on:
generateconfig-processing:
generateconfig:
condition: service_completed_successfully
image: "redis/redis-stack-server:${REDIS_VERSION}"
restart: unless-stopped
Expand Down Expand Up @@ -88,7 +75,7 @@ services:
any-sync-coordinator_bootstrap:
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"
depends_on:
generateconfig-processing:
generateconfig:
condition: service_completed_successfully
mongo-1:
condition: service_healthy
Expand All @@ -100,7 +87,7 @@ services:
any-sync-coordinator:
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"
depends_on:
generateconfig-processing:
generateconfig:
condition: service_completed_successfully
mongo-1:
condition: service_healthy
Expand Down Expand Up @@ -134,7 +121,7 @@ services:
- "${ANY_SYNC_FILENODE_METRIC_ADDR}:8000"
volumes:
- ./etc/any-sync-filenode:/etc/any-sync-filenode:Z
- ./etc/.aws:/root/.aws:ro
- ./etc/awsCredentials:/root/.aws/credentials:ro
- "${STORAGE_DIR}/networkStore/any-sync-filenode:/networkStore:Z"
deploy:
resources:
Expand Down Expand Up @@ -202,6 +189,7 @@ services:
memory: ${ANY_SYNC_DAEMONS_MEMORY_LIMIT:-}
restart: unless-stopped


any-sync-consensusnode:
image: "ghcr.io/anyproto/any-sync-consensusnode:${ANY_SYNC_CONSENSUSNODE_VERSION}"
depends_on:
Expand Down Expand Up @@ -233,11 +221,11 @@ services:
- any-sync-node-2
- any-sync-node-3
volumes:
- "${STORAGE_DIR}:/code/storage:Z"
- ./etc/nodes.yml:/nodes.yml:Z
command: ["tail", "-f", "/dev/null"]
stop_signal: SIGKILL
tty: true
healthcheck:
test: any-sync-netcheck -c /code/storage/docker-generateconfig/nodes.yml 2>&1| grep -E 'netcheck\s+success'
test: any-sync-netcheck -c /nodes.yml 2>&1| grep -E 'netcheck\s+success'
interval: 10s
start_period: 5s
start_period: 5s
58 changes: 0 additions & 58 deletions docker-generateconfig/anyconf.sh

This file was deleted.

1 change: 1 addition & 0 deletions docker-generateconfig/env-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests==2.32.2
python-dotenv
4 changes: 0 additions & 4 deletions docker-generateconfig/etc/aws-credentials

This file was deleted.

9 changes: 0 additions & 9 deletions docker-generateconfig/etc/common.yml

This file was deleted.

21 changes: 0 additions & 21 deletions docker-generateconfig/etc/consensusnode.yml

This file was deleted.

31 changes: 0 additions & 31 deletions docker-generateconfig/etc/coordinator.yml

This file was deleted.

31 changes: 0 additions & 31 deletions docker-generateconfig/etc/filenode.yml

This file was deleted.

29 changes: 0 additions & 29 deletions docker-generateconfig/etc/node-1.yml

This file was deleted.

29 changes: 0 additions & 29 deletions docker-generateconfig/etc/node-2.yml

This file was deleted.

Loading