Compare commits

...
8 Commits
Author SHA1 Message Date
dboreham c358dd554f Merge pull request #253 from cerc-io/dboreham/wait-for-export-cluster-config
Detect transient errors exporting variables and re-try

Former-commit-id: a4a9607ea8
2023-03-28 11:44:54 -06:00
dboreham 75ca0d4138 Detect transient errors exporting variables and re-try
Former-commit-id: 15c0a92f30
2023-03-28 11:44:02 -06:00
dboreham 29f0302fb0 Merge pull request #252 from cerc-io/dboreham/fix-go-ethereum-foundry-startup
Fix health checks in erc20 containers

Former-commit-id: bb63035fcc
2023-03-28 10:47:07 -06:00
dboreham b3ae2159ee Fix health checks in erc20 containers
Former-commit-id: 35ca979068
2023-03-28 10:46:26 -06:00
dboreham bd61d823d7 Merge pull request #251 from cerc-io/dboreham/fix-ethereum-foundry
Update go-ethereum-foundry container for Debian base image

Former-commit-id: b1f4f2e4e3
2023-03-28 09:53:22 -06:00
dboreham ce04ca2be5 Update go-ethereum-foundry container for Debian base image
Former-commit-id: 82acc99e2d
2023-03-28 09:52:34 -06:00
dboreham 126d671bb0 Update version
Former-commit-id: 3caf0da956
2023-03-28 07:17:06 -06:00
dboreham 616f85ce6b Update version
Former-commit-id: 7e1137f811
2023-03-27 08:00:19 -06:00
5 changed files with 45 additions and 23 deletions
@@ -8,7 +8,7 @@ services:
condition: service_healthy condition: service_healthy
image: cerc/go-ethereum-foundry:local image: cerc/go-ethereum-foundry:local
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "localhost", "8545"] test: ["CMD", "nc", "-vz", "localhost", "8545"]
interval: 30s interval: 30s
timeout: 3s timeout: 3s
retries: 10 retries: 10
@@ -39,7 +39,7 @@ services:
- "0.0.0.0:3002:3001" - "0.0.0.0:3002:3001"
- "0.0.0.0:9002:9001" - "0.0.0.0:9002:9001"
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "localhost", "3002"] test: ["CMD", "nc", "-vz", "localhost", "3001"]
interval: 20s interval: 20s
timeout: 5s timeout: 5s
retries: 15 retries: 15
@@ -1,7 +1,9 @@
# Note: cerc/foundry is Debian based
FROM cerc/foundry:local FROM cerc/foundry:local
RUN apk update ; apk add --no-cache --allow-untrusted ca-certificates curl bash git jq RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
RUN apk add --no-cache --upgrade grep && apt-get -y install --no-install-recommends jq curl netcat
WORKDIR /root WORKDIR /root
ARG GENESIS_FILE_PATH=genesis.json ARG GENESIS_FILE_PATH=genesis.json
+1 -1
View File
@@ -1,2 +1,2 @@
# This file should be re-generated running: scripts/update-version-file.sh script # This file should be re-generated running: scripts/update-version-file.sh script
v1.0.31-e70dca7 v1.0.33-7e1137f
+38 -18
View File
@@ -292,21 +292,41 @@ def _orchestrate_cluster_config(ctx, cluster_config, docker, container_exec_env)
directive directive
) )
if ctx.verbose: if ctx.verbose:
print(f"Setting {pd.destination_container}.{pd.destination_variable} = {pd.source_container}.{pd.source_variable}") print(f"Setting {pd.destination_container}.{pd.destination_variable}"
# TODO: fix the script paths so they're consistent between containers f" = {pd.source_container}.{pd.source_variable}")
source_value = docker.compose.execute(pd.source_container, # TODO: add a timeout
["sh", "-c", waiting_for_data = True
f"sh /docker-entrypoint-scripts.d/export-{pd.source_variable}.sh"], while waiting_for_data:
tty=False, # TODO: fix the script paths so they're consistent between containers
envs=container_exec_env) source_value = None
# TODO: handle the case that the value is not yet available try:
if ctx.debug: source_value = docker.compose.execute(pd.source_container,
print(f"fetched source value: {source_value}") ["sh", "-c",
destination_output = docker.compose.execute(pd.destination_container, "sh /docker-entrypoint-scripts.d/export-"
["sh", "-c", f"{pd.source_variable}.sh"],
f"sh /scripts/import-{pd.destination_variable}.sh {source_value}"], tty=False,
tty=False, envs=container_exec_env)
envs=container_exec_env) except DockerException as error:
if ctx.debug: if ctx.debug:
print(f"destination output: {destination_output}") print(f"Docker exception reading config source: {error}")
# TODO: detect errors here # If the script executed failed for some reason, we get:
# "It returned with code 1"
if "It returned with code 1" in str(error):
if ctx.verbose:
print("Config export script returned an error, re-trying")
# If the script failed to execute (e.g. the file is not there) then we get:
# "It returned with code 2"
if "It returned with code 2" in str(error):
print(f"Fatal error reading config source: {error}")
if source_value:
if ctx.debug:
print(f"fetched source value: {source_value}")
destination_output = docker.compose.execute(pd.destination_container,
["sh", "-c",
f"sh /scripts/import-{pd.destination_variable}.sh"
f" {source_value}"],
tty=False,
envs=container_exec_env)
waiting_for_data = False
if ctx.debug:
print(f"destination output: {destination_output}")