Skip to content

Commit

Permalink
Update env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Dec 11, 2024
1 parent a7ce082 commit ec02226
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 31 deletions.
20 changes: 10 additions & 10 deletions .deploy/.env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export TAG=20241210-44aac5b0
export AGG_ADDRESS="0x8626a6940E2eb28930eFb4CeF49B2d1F2C9C1199"
export CN1_ADDRESS="0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"
export CN2_ADDRESS="0xdD2FD4581271e230360230F9337D5c0430Bf44C0"
export CN3_ADDRESS="0x2546BcD3c84621e976D8185a91A922aE77ECEc30"
TAG=20241210-44aac5b0
AGG_ADDRESS=0x8626a6940E2eb28930eFb4CeF49B2d1F2C9C1199
CN1_ADDRESS=0xbDA5747bFD65F08deb54cb465eB87D40e51B197E
CN2_ADDRESS=0xdD2FD4581271e230360230F9337D5c0430Bf44C0
CN3_ADDRESS=0x2546BcD3c84621e976D8185a91A922aE77ECEc30

export CN1_QUIC_PORT=9091
export CN2_QUIC_PORT=9092
export CN3_QUIC_PORT=9093
export AGG_QUIC_PORT=9094
export RPC_URL=wss://eth-sepolia.g.alchemy.com/v2/API_KEY
RPC_URL=wss://eth-sepolia.g.alchemy.com/v2/API_KEY

SEPOLIA_ENCLAVE_ADDRESS=0xCe087F31e20E2F76b6544A2E4A74D4557C8fDf77
SEPOLIA_CIPHERNODE_REGISTRY_ADDRESS=0x0952388f6028a9Eda93a5041a3B216Ea331d97Ab
SEPOLIA_FILTER_REGISTRY=0xcBaCE7C360b606bb554345b20884A28e41436934
4 changes: 2 additions & 2 deletions .deploy/agg.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
address: "${AGG_ADDRESS}"
quic_port: ${AGG_QUIC_PORT}
address: "${ADDRESS}"
quic_port: ${QUIC_PORT}
enable_mdns: false
chains:
- name: "sepolia"
Expand Down
4 changes: 2 additions & 2 deletions .deploy/cn2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
address: "${CN2_ADDRESS}"
quic_port: ${CN2_QUIC_PORT}
address: "${ADDRESS}"
quic_port: ${QUIC_PORT}
enable_mdns: false
chains:
- name: "sepolia"
Expand Down
4 changes: 2 additions & 2 deletions .deploy/cn3.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
address: "${CN3_ADDRESS}"
quic_port: ${CN3_QUIC_PORT}
address: "${ADDRESS}"
quic_port: ${QUIC_PORT}
enable_mdns: false
chains:
- name: "sepolia"
Expand Down
13 changes: 13 additions & 0 deletions .deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

if [ ! -f ".env" ]; then
echo "Environment file .env not found!"
exit 1
fi

# Source the environment file
set -a # automatically export all variables
source .deploy/.env
set +a # turn off auto-export

docker stack deploy -c .deploy/docker-compose.yml enclave-stack --detach=false
28 changes: 20 additions & 8 deletions .deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
services:
cn1:
image: ghcr.io/gnosisguild/ciphernode:${TAG}
image: ghcr.io/gnosisguild/ciphernode:${TAG:-latest}
volumes:
- ./cn1.yaml:/home/ciphernode/.config/enclave/config.yaml:ro
- cn1-data:/home/ciphernode/.local/share/enclave
secrets:
- source: secrets_cn1
target: secrets.json
env_file: .env
environment:
RUST_LOG: "info"
AGGREGATOR: "false"
ADDRESS: ${CN1_ADDRESS}
QUIC_PORT: 9091
ports:
- 9091:9091
- "9091:9091"
deploy:
replicas: 1
update_config:
Expand All @@ -25,7 +28,7 @@ services:


cn2:
image: ghcr.io/gnosisguild/ciphernode:${TAG}
image: ghcr.io/gnosisguild/ciphernode:${TAG:-latest}
depends_on:
- cn1
volumes:
Expand All @@ -34,11 +37,14 @@ services:
secrets:
- source: secrets_cn2
target: secrets.json
env_file: .env
environment:
RUST_LOG: "info"
AGGREGATOR: "false"
ADDRESS: ${CN2_ADDRESS}
QUIC_PORT: 9092
ports:
- 9092:9092
- "9092:9092"

deploy:
replicas: 1
Expand All @@ -52,7 +58,7 @@ services:
- global-network

cn3:
image: ghcr.io/gnosisguild/ciphernode:${TAG}
image: ghcr.io/gnosisguild/ciphernode:${TAG:-latest}
depends_on:
- cn1
volumes:
Expand All @@ -61,11 +67,14 @@ services:
secrets:
- source: secrets_cn3
target: secrets.json
env_file: .env
environment:
RUST_LOG: "info"
AGGREGATOR: "false"
ADDRESS: ${CN3_ADDRESS}
QUIC_PORT: 9093
ports:
- 9093:9093
- "9093:9093"
deploy:
replicas: 1
update_config:
Expand All @@ -79,7 +88,7 @@ services:


aggregator:
image: ghcr.io/gnosisguild/ciphernode:${TAG}
image: ghcr.io/gnosisguild/ciphernode:${TAG:-latest}
depends_on:
- cn1
volumes:
Expand All @@ -88,11 +97,14 @@ services:
secrets:
- source: secrets_agg
target: secrets.json
env_file: .env
environment:
RUST_LOG: "info"
AGGREGATOR: "true"
ADDRESS: ${AGG_ADDRESS}
QUIC_PORT: 9094
ports:
- 9094:9094
- "9094:9094"

deploy:
replicas: 1
Expand Down
5 changes: 0 additions & 5 deletions .deploy/run.sh

This file was deleted.

40 changes: 38 additions & 2 deletions .deploy/swarm_deployment.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Setup `.env` vars

Copy the `.env.example` file to `.env`

```
cp .env.example .env
```

Alter the variables to reflect the correct values required for the stack:

```
export TAG=latest
export AGG_ADDRESS=0x8626a6940E2eb28930eFb4CeF49B2d1F2C9C1199
export CN1_ADDRESS=0xbDA5747bFD65F08deb54cb465eB87D40e51B197E
export CN2_ADDRESS=0xdD2FD4581271e230360230F9337D5c0430Bf44C0
export CN3_ADDRESS=0x2546BcD3c84621e976D8185a91A922aE77ECEc30
export CN1_QUIC_PORT=9091
export CN2_QUIC_PORT=9092
export CN3_QUIC_PORT=9093
export AGG_QUIC_PORT=9094
export RPC_URL=wss://eth-sepolia.g.alchemy.com/v2/<SOME_API_KEY>
export SEPOLIA_ENCLAVE_ADDRESS=0xCe087F31e20E2F76b6544A2E4A74D4557C8fDf77
export SEPOLIA_CIPHERNODE_REGISTRY_ADDRESS=0x0952388f6028a9Eda93a5041a3B216Ea331d97Ab
export SEPOLIA_FILTER_REGISTRY=0xcBaCE7C360b606bb554345b20884A28e41436934
```

Pay special attention to the `TAG` and `RPC_URL` vars.

You can peruse the yaml config files for the nodes to see how the vars are used within the config.

# Secrets Setup Script

Expand All @@ -23,7 +54,7 @@ Skipping cn2.secrets.json - file already exists

Remember to modify any highlighted files before use.

# Run docker swarm
# Initialize docker swarm

First we need to initialize swarm.

Expand All @@ -37,7 +68,12 @@ If you get an error about not being able to choose between IP addresses choose t
docker swarm init --advertise-addr 10.49.x.x
```


# Deploy a version to the stack

To deploy

```
TAG=latest docker stack deploy -c .deploy/docker-compose.yml enclave-stack --detach=false
.deploy/deploy.sh
```

0 comments on commit ec02226

Please sign in to comment.