mirror of
https://github.com/anyproto/any-sync-dockercompose.git
synced 2025-06-08 05:47:03 +09:00
added consensusnode
This commit is contained in:
parent
89a56087d1
commit
6598910062
8 changed files with 93 additions and 14 deletions
1
.env
1
.env
|
@ -4,3 +4,4 @@ AWS_SECRET_ACCESS_KEY=testkey
|
||||||
ANY_SYNC_NODE_VERSION=latest
|
ANY_SYNC_NODE_VERSION=latest
|
||||||
ANY_SYNC_FILENODE_VERSION=latest
|
ANY_SYNC_FILENODE_VERSION=latest
|
||||||
ANY_SYNC_COORDINATOR_VERSION=latest
|
ANY_SYNC_COORDINATOR_VERSION=latest
|
||||||
|
ANY_SYNC_CONSENSUSNODE_VERSION=latest
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -5,12 +5,14 @@ generate_etc:
|
||||||
install -d \
|
install -d \
|
||||||
tmp/etc/any-sync-node-{1..3}/ \
|
tmp/etc/any-sync-node-{1..3}/ \
|
||||||
tmp/etc/any-sync-filenode/ \
|
tmp/etc/any-sync-filenode/ \
|
||||||
tmp/etc/any-sync-coordinator/
|
tmp/etc/any-sync-coordinator/ \
|
||||||
|
tmp/etc/any-sync-consensusnode/
|
||||||
cat etc/{network,common,node-1}.yml > tmp/etc/any-sync-node-1/config.yml
|
cat etc/{network,common,node-1}.yml > tmp/etc/any-sync-node-1/config.yml
|
||||||
cat etc/{network,common,node-2}.yml > tmp/etc/any-sync-node-2/config.yml
|
cat etc/{network,common,node-2}.yml > tmp/etc/any-sync-node-2/config.yml
|
||||||
cat etc/{network,common,node-3}.yml > tmp/etc/any-sync-node-3/config.yml
|
cat etc/{network,common,node-3}.yml > tmp/etc/any-sync-node-3/config.yml
|
||||||
cat etc/{network,common,filenode}.yml > tmp/etc/any-sync-filenode/config.yml
|
cat etc/{network,common,filenode}.yml > tmp/etc/any-sync-filenode/config.yml
|
||||||
cat etc/{network,common,coordinator}.yml > tmp/etc/any-sync-coordinator/config.yml
|
cat etc/{network,common,coordinator}.yml > tmp/etc/any-sync-coordinator/config.yml
|
||||||
|
cat etc/{network,common,consensusnode}.yml > tmp/etc/any-sync-consensusnode/config.yml
|
||||||
cat etc/network.yml | grep -v '^network:' > tmp/etc/any-sync-coordinator/network.yml
|
cat etc/network.yml | grep -v '^network:' > tmp/etc/any-sync-coordinator/network.yml
|
||||||
|
|
||||||
start: generate_etc
|
start: generate_etc
|
||||||
|
|
|
@ -50,17 +50,24 @@
|
||||||
docker compose exec any-sync-coordinator bash
|
docker compose exec any-sync-coordinator bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* get current network config
|
||||||
|
```
|
||||||
|
docker compose exec mongo mongosh coordinator
|
||||||
|
db.nodeConf.find().sort( { _id: -1 } ).limit(1)
|
||||||
|
```
|
||||||
|
|
||||||
## set specific versions
|
## set specific versions
|
||||||
use file .env
|
use file .env
|
||||||
### minimal versions
|
### minimal versions
|
||||||
* any-sync-coordinator v0.0.10
|
* any-sync-coordinator v0.0.10
|
||||||
* any-sync-filenode v0.1.5
|
* any-sync-filenode v0.1.5
|
||||||
* any-sync-node v0.0.31
|
* any-sync-node v0.0.31
|
||||||
|
* any-sync-consensusnode v0.0.4
|
||||||
|
|
||||||
## usage "local build" images
|
## usage "local build" images
|
||||||
* clone repos
|
* clone repos
|
||||||
```
|
```
|
||||||
install -d repos && for REPO in any-sync-{node,filenode,coordinator}; do if [[ ! -d repos/$REPO ]]; then git clone git@github.com:anyproto/${REPO}.git repos/$REPO; fi; done
|
install -d repos && for REPO in any-sync-{node,filenode,coordinator,consensusnode}; do if [[ ! -d repos/$REPO ]]; then git clone git@github.com:anyproto/${REPO}.git repos/$REPO; fi; done
|
||||||
```
|
```
|
||||||
* create a symlink to the "override file" you need (or you can create docker-compose.override.yml by your self)
|
* create a symlink to the "override file" you need (or you can create docker-compose.override.yml by your self)
|
||||||
```
|
```
|
||||||
|
|
11
docker-compose.any-sync-consensusnode.yml
Normal file
11
docker-compose.any-sync-consensusnode.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
any-sync-consensusnode:
|
||||||
|
image: localbuild-consensusnode
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ssh:
|
||||||
|
- default
|
||||||
|
args:
|
||||||
|
REPO_DIR: repos/any-sync-consensusnode/
|
|
@ -1,11 +1,30 @@
|
||||||
version: "3.9"
|
version: "3.9"
|
||||||
services:
|
services:
|
||||||
mongo:
|
mongo-1:
|
||||||
image: mongo
|
image: mongo
|
||||||
|
command: --replSet rs0
|
||||||
ports:
|
ports:
|
||||||
- 27017:27017
|
- 27010:27017
|
||||||
volumes:
|
volumes:
|
||||||
- ./tmp/mongo/:/data/db
|
- ./tmp/mongo-1/:/data/db
|
||||||
|
healthcheck:
|
||||||
|
test: test $$(echo "rs.initiate({_id:'rs0',members:[{_id:0,host:\"mongo-1:27017\"},{_id:1,host:\"mongo-2:27017\"},{_id:2,host:\"mongo-3:27017\"}]}).ok || rs.status().ok" | mongosh --port 27017 --quiet) -eq 1
|
||||||
|
interval: 10s
|
||||||
|
start_period: 30s
|
||||||
|
mongo-2:
|
||||||
|
image: mongo
|
||||||
|
command: --replSet rs0
|
||||||
|
ports:
|
||||||
|
- 27011:27017
|
||||||
|
volumes:
|
||||||
|
- ./tmp/mongo-2/:/data/db
|
||||||
|
mongo-3:
|
||||||
|
image: mongo
|
||||||
|
command: --replSet rs0
|
||||||
|
ports:
|
||||||
|
- 27012:27017
|
||||||
|
volumes:
|
||||||
|
- ./tmp/mongo-3/:/data/db
|
||||||
redis:
|
redis:
|
||||||
container_name: redis
|
container_name: redis
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
|
@ -23,15 +42,15 @@ services:
|
||||||
- ./tmp/s3_root:/s3_root
|
- ./tmp/s3_root:/s3_root
|
||||||
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}"
|
||||||
depends_on: [mongo]
|
depends_on: [mongo-1]
|
||||||
restart: "no"
|
restart: "no"
|
||||||
volumes:
|
volumes:
|
||||||
- ./tmp/etc/any-sync-coordinator/:/etc/any-sync-coordinator/
|
- ./tmp/etc/any-sync-coordinator/:/etc/any-sync-coordinator/
|
||||||
command: /bin/any-sync-confapply -c /etc/any-sync-coordinator/config.yml -n /etc/any-sync-coordinator/network.yml -e
|
command: bash -c "sleep 10; /bin/any-sync-confapply -c /etc/any-sync-coordinator/config.yml -n /etc/any-sync-coordinator/network.yml -e"
|
||||||
any-sync-coordinator:
|
any-sync-coordinator:
|
||||||
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"
|
image: "ghcr.io/anyproto/any-sync-coordinator:${ANY_SYNC_COORDINATOR_VERSION}"
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongo
|
- mongo-1
|
||||||
- any-sync-coordinator_bootstrap
|
- any-sync-coordinator_bootstrap
|
||||||
ports:
|
ports:
|
||||||
- 4435:443
|
- 4435:443
|
||||||
|
@ -43,7 +62,7 @@ services:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 500M
|
memory: 500M
|
||||||
command: bash -c "sleep 5; /bin/any-sync-coordinator -c /etc/any-sync-coordinator/config.yml"
|
command: bash -c "sleep 10; /bin/any-sync-coordinator -c /etc/any-sync-coordinator/config.yml"
|
||||||
any-sync-filenode:
|
any-sync-filenode:
|
||||||
image: "ghcr.io/anyproto/any-sync-filenode:${ANY_SYNC_FILENODE_VERSION}"
|
image: "ghcr.io/anyproto/any-sync-filenode:${ANY_SYNC_FILENODE_VERSION}"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -61,7 +80,7 @@ services:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 500M
|
memory: 500M
|
||||||
command: bash -c "sleep 10; /bin/any-sync-filenode -c /etc/any-sync-filenode/config.yml"
|
command: bash -c "sleep 15; /bin/any-sync-filenode -c /etc/any-sync-filenode/config.yml"
|
||||||
any-sync-node-1:
|
any-sync-node-1:
|
||||||
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
|
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
|
||||||
depends_on: [any-sync-coordinator]
|
depends_on: [any-sync-coordinator]
|
||||||
|
@ -77,7 +96,7 @@ services:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 500M
|
memory: 500M
|
||||||
command: bash -c "sleep 10; /bin/any-sync-node -c /etc/any-sync-node/config.yml"
|
command: bash -c "sleep 15; /bin/any-sync-node -c /etc/any-sync-node/config.yml"
|
||||||
any-sync-node-2:
|
any-sync-node-2:
|
||||||
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
|
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
|
||||||
depends_on: [any-sync-coordinator]
|
depends_on: [any-sync-coordinator]
|
||||||
|
@ -93,7 +112,7 @@ services:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 500M
|
memory: 500M
|
||||||
command: bash -c "sleep 10; /bin/any-sync-node -c /etc/any-sync-node/config.yml"
|
command: bash -c "sleep 15; /bin/any-sync-node -c /etc/any-sync-node/config.yml"
|
||||||
any-sync-node-3:
|
any-sync-node-3:
|
||||||
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
|
image: "ghcr.io/anyproto/any-sync-node:${ANY_SYNC_NODE_VERSION}"
|
||||||
depends_on: [any-sync-coordinator]
|
depends_on: [any-sync-coordinator]
|
||||||
|
@ -109,4 +128,18 @@ services:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 500M
|
memory: 500M
|
||||||
command: bash -c "sleep 10; /bin/any-sync-node -c /etc/any-sync-node/config.yml"
|
command: bash -c "sleep 15; /bin/any-sync-node -c /etc/any-sync-node/config.yml"
|
||||||
|
any-sync-consensusnode:
|
||||||
|
image: "ghcr.io/anyproto/any-sync-consensusnode:${ANY_SYNC_CONSENSUSNODE_VERSION}"
|
||||||
|
depends_on: [any-sync-coordinator]
|
||||||
|
ports:
|
||||||
|
- 4436:443
|
||||||
|
- 8006:8000
|
||||||
|
volumes:
|
||||||
|
- ./tmp/etc/any-sync-consensusnode/:/etc/any-sync-consensusnode/
|
||||||
|
- ./tmp/networkStore/any-sync-consensusnode/:/networkStore/
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 500M
|
||||||
|
command: bash -c "sleep 15; /bin/any-sync-consensusnode -c /etc/any-sync-consensusnode/config.yml"
|
||||||
|
|
22
etc/consensusnode.yml
Normal file
22
etc/consensusnode.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
account:
|
||||||
|
peerId: 12D3KooWNT4hbNKXeFuDtdQ13ZbhQ1oJJ2AVWgAQVRrCj6Zb5wxk
|
||||||
|
peerKey: 5Btn70kUmMokNhSDhu3GzuFcbLxK9aRnoyb/zPWkLvu7svtWJZxQDJ5AWYZ4TxGhgb/GbZB1nPjp7Kz+V+J4OQ==
|
||||||
|
signingKey: 0ojibPdVZUL9hJmaQHpRBJYjH0Y0MuoLL+Lc2hFchorGS26RaLuUVs36ikGDDRi39BlzafEDNomB+IrBt8HCdA==
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
connect: mongodb://mongo-1:27017,mongo-2:27017,mongo-3:27017/?w=majority
|
||||||
|
database: consensus
|
||||||
|
log: log
|
||||||
|
|
||||||
|
drpc:
|
||||||
|
stream:
|
||||||
|
timeoutMilliseconds: 1000
|
||||||
|
maxMsgSizeMb: 256
|
||||||
|
|
||||||
|
yamux:
|
||||||
|
listenAddrs:
|
||||||
|
- any-sync-consensusnode:443
|
||||||
|
writeTimeoutSec: 10
|
||||||
|
dialTimeoutSec: 10
|
||||||
|
|
|
@ -5,7 +5,7 @@ account:
|
||||||
signingKey: 0ojibPdVZUL9hJmaQHpRBJYjH0Y0MuoLL+Lc2hFchorGS26RaLuUVs36ikGDDRi39BlzafEDNomB+IrBt8HCdA==
|
signingKey: 0ojibPdVZUL9hJmaQHpRBJYjH0Y0MuoLL+Lc2hFchorGS26RaLuUVs36ikGDDRi39BlzafEDNomB+IrBt8HCdA==
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
connect: mongodb://mongo:27017
|
connect: mongodb://mongo-1:27017,mongo-2:27017,mongo-3:27017/
|
||||||
database: coordinator
|
database: coordinator
|
||||||
log: log
|
log: log
|
||||||
spaces: spaces
|
spaces: spaces
|
||||||
|
|
|
@ -16,3 +16,6 @@ network:
|
||||||
- peerId: 12D3KooWMwE15iEG51Sewt2zYqwgbrBz6QMuFVdWLBMes1SADtCh
|
- peerId: 12D3KooWMwE15iEG51Sewt2zYqwgbrBz6QMuFVdWLBMes1SADtCh
|
||||||
addresses: [ "any-sync-filenode:443" ]
|
addresses: [ "any-sync-filenode:443" ]
|
||||||
types: [file]
|
types: [file]
|
||||||
|
- peerId: 12D3KooWNT4hbNKXeFuDtdQ13ZbhQ1oJJ2AVWgAQVRrCj6Zb5wxk
|
||||||
|
addresses: [ "any-sync-consensusnode:443" ]
|
||||||
|
types: [consensus]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue