Use env variables for ipld-eth-server endpoints
This commit is contained in:
parent
ddf756c68c
commit
3e8b87c3a7
@ -29,12 +29,16 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/azimuth-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/azimuth-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/azimuth-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/azimuth-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/azimuth-watcher/start-server.sh
|
||||
ports:
|
||||
@ -55,14 +59,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/censures-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/censures-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/censures-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/censures-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/censures-watcher/start-server.sh
|
||||
ports:
|
||||
- "3002"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3002"]
|
||||
interval: 20s
|
||||
@ -79,14 +89,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/claims-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/claims-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/claims-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/claims-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/claims-watcher/start-server.sh
|
||||
ports:
|
||||
- "3003"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3003"]
|
||||
interval: 20s
|
||||
@ -103,14 +119,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/conditional-star-release-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/conditional-star-release-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/conditional-star-release-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/conditional-star-release-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/conditional-star-release-watcher/start-server.sh
|
||||
ports:
|
||||
- "3004"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3004"]
|
||||
interval: 20s
|
||||
@ -127,14 +149,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/delegated-sending-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/delegated-sending-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/delegated-sending-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/delegated-sending-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/delegated-sending-watcher/start-server.sh
|
||||
ports:
|
||||
- "3005"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3005"]
|
||||
interval: 20s
|
||||
@ -151,14 +179,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/ecliptic-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/ecliptic-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/ecliptic-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/ecliptic-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/ecliptic-watcher/start-server.sh
|
||||
ports:
|
||||
- "3006"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3006"]
|
||||
interval: 20s
|
||||
@ -175,14 +209,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/linear-star-release-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/linear-star-release-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/linear-star-release-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/linear-star-release-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/linear-star-release-watcher/start-server.sh
|
||||
ports:
|
||||
- "3007"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3007"]
|
||||
interval: 20s
|
||||
@ -199,14 +239,20 @@ services:
|
||||
depends_on:
|
||||
watcher-db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/watcher-azimuth/watcher-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_IPLD_ETH_RPC: ${CERC_IPLD_ETH_RPC}
|
||||
CERC_IPLD_ETH_GQL: ${CERC_IPLD_ETH_GQL}
|
||||
working_dir: /app/packages/polls-watcher
|
||||
command: "./start-server.sh"
|
||||
volumes:
|
||||
- ../config/watcher-azimuth/watcher-config.toml:/app/packages/polls-watcher/environments/watcher-config.toml
|
||||
- ../config/watcher-azimuth/watcher-config-template.toml:/app/packages/polls-watcher/environments/watcher-config-template.toml
|
||||
- ../config/watcher-azimuth/merge-toml.js:/app/packages/polls-watcher/merge-toml.js
|
||||
- ../config/watcher-azimuth/start-server.sh:/app/packages/polls-watcher/start-server.sh
|
||||
ports:
|
||||
- "3008"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "3008"]
|
||||
interval: 20s
|
||||
|
@ -5,24 +5,23 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
fi
|
||||
|
||||
CERC_IPLD_ETH_RPC="${CERC_IPLD_ETH_RPC:-${DEFAULT_CERC_IPLD_ETH_RPC}}"
|
||||
CERC_IPLD_GQL="${CERC_IPLD_GQL:-${DEFAULT_CERC_IPLD_GQL}}"
|
||||
CERC_IPLD_ETH_GQL="${CERC_IPLD_ETH_GQL:-${DEFAULT_CERC_IPLD_ETH_GQL}}"
|
||||
|
||||
echo "Using IPLD ETH RPC endpoint ${CERC_IPLD_ETH_RPC}"
|
||||
echo "Using IPLD GQL endpoint ${CERC_IPLD_GQL}"
|
||||
echo "Using IPLD GQL endpoint ${CERC_IPLD_ETH_GQL}"
|
||||
|
||||
# # TODO: Replace env variables in template TOML file
|
||||
# # Read in the config template TOML file and modify it
|
||||
# WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
|
||||
# WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
||||
# sed -E "s|REPLACE_WITH_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \
|
||||
# s|REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT|${CERC_L2_GETH_RPC}| ")
|
||||
# Replace env variables in template TOML file
|
||||
# Read in the config template TOML file and modify it
|
||||
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
|
||||
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
||||
sed -E "s|REPLACE_WITH_CERC_IPLD_ETH_RPC|${CERC_IPLD_ETH_RPC}|g; \
|
||||
s|REPLACE_WITH_CERC_IPLD_ETH_GQL|${CERC_IPLD_ETH_GQL}| ")
|
||||
|
||||
# # Write the modified content to a new file
|
||||
# echo "$WATCHER_CONFIG" > environments/watcher-config.toml
|
||||
# Write the modified content to a new file
|
||||
echo "$WATCHER_CONFIG" > environments/watcher-config.toml
|
||||
|
||||
# Merge SO watcher config with existing config file
|
||||
node merge-toml.js
|
||||
|
||||
|
||||
echo 'yarn server'
|
||||
yarn server
|
||||
|
@ -1,5 +1,6 @@
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
maxSimultaneousRequests = -1
|
||||
|
||||
[database]
|
||||
host = "watcher-db"
|
||||
@ -9,5 +10,5 @@
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://host.docker.internal:8083/graphql"
|
||||
rpcProviderEndpoint = "http://host.docker.internal:8082"
|
||||
gqlApiEndpoint = "REPLACE_WITH_CERC_IPLD_ETH_GQL"
|
||||
rpcProviderEndpoint = "REPLACE_WITH_CERC_IPLD_ETH_RPC"
|
5
app/data/config/watcher-azimuth/watcher-params.env
Normal file
5
app/data/config/watcher-azimuth/watcher-params.env
Normal file
@ -0,0 +1,5 @@
|
||||
# Defaults
|
||||
|
||||
# ipld-eth-server endpoints
|
||||
DEFAULT_CERC_IPLD_ETH_RPC=
|
||||
DEFAULT_CERC_IPLD_ETH_GQL=
|
@ -4,13 +4,15 @@ Instructions to setup and deploy Azimuth Watcher stack
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: ipld-eth-server RPC and GQL endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth setup-repositories
|
||||
```
|
||||
|
||||
NOTE: If the repository already exists and checked out to different versions, `setup-repositories` command will throw an error.
|
||||
NOTE: If the repository already exists and checked out to a different version, `setup-repositories` command will throw an error.
|
||||
For getting around this, the `azimuth-watcher-ts` repository can be removed and then run the command.
|
||||
|
||||
Checkout to the required versions and branches in repos
|
||||
@ -29,12 +31,24 @@ laconic-so --stack azimuth build-containers
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
Deploy the stack:
|
||||
### Configuration
|
||||
|
||||
* Create and update an env file to be used in the next step:
|
||||
|
||||
```bash
|
||||
# External ipld-eth-server endpoints
|
||||
CERC_IPLD_ETH_RPC=
|
||||
CERC_IPLD_ETH_GQL=
|
||||
```
|
||||
|
||||
* NOTE: If ipld-eth-server is running on the host machine, use `host.docker.internal` as the hostname to access host ports
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
* Deploy the containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth deploy-system up
|
||||
laconic-so --stack azimuth deploy-system --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
|
||||
@ -44,7 +58,7 @@ Deploy the stack:
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth deploy-system down 30
|
||||
laconic-so --stack azimuth deploy-system down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
Loading…
Reference in New Issue
Block a user