Skip to content
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

Fix healthcheck issue on Docker #72

Merged
merged 1 commit into from
Sep 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
ports:
- ${RELAYER_1_API_SERVER_HOST:-0.0.0.0}:${RELAYER_1_API_SERVER_PORT:-3000}:${RELAYER_1_API_SERVER_PORT:-3000}
healthcheck:
test: curl --fail http://relayer_1:${RELAYER_1_API_SERVER_PORT:-3000}/healthz
test: echo $$(wget --server-response http://relayer_1:${RELAYER_1_API_SERVER_PORT:-3000}/healthz 2>&1 | grep '200 OK') | grep '200' || exit 1
extra_hosts:
- "host.docker.internal:host-gateway"

Expand Down
3 changes: 1 addition & 2 deletions scripts/lisk/docker/dev/composeStart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ mkdir -p $PWD/.aws
cp $HOME/.aws/credentials $PWD/.aws/
git apply scripts/lisk/docker/dev/docker-compose-dev.patch

aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ECR_REGISTRY}
docker compose up --pull always --detach
docker compose up --pull always --build --detach
14 changes: 11 additions & 3 deletions scripts/lisk/docker/dev/docker-compose-dev.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
diff --git a/docker-compose.yml b/docker-compose.yml
index 5c229e7e..c4177aaf 100644
index 33792d2c..556ba0cf 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -21,17 +21,18 @@ services:
@@ -15,23 +15,24 @@ services:
retries: 3

relayer_1:
- image: ${AWS_ECR_REGISTRY}/${AWS_ECR_REPOSITORY}:${ACROSS_RELAYER_IMAGE_TAG}
+ build: .
platform: linux/amd64
depends_on:
redis:
condition: service_healthy
volumes:
- - ./scripts/lisk/docker/${NETWORK:-mainnet}/containerStartBot_1.sh:/home/lisk/across-relayer/scripts/start.sh
+ - ./.aws/credentials:/home/lisk/.aws/credentials
- ./scripts/lisk/docker/${NETWORK:-mainnet}/containerStartBot_1.sh:/home/lisk/across-relayer/scripts/start.sh
+ - ./scripts/lisk/docker/${NETWORK:-sepolia}/containerStartBot_1.sh:/home/lisk/across-relayer/scripts/start.sh
networks:
- across_relayer_network
restart: always
Expand Down
6 changes: 6 additions & 0 deletions scripts/lisk/docker/mainnet/containerStartBot_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ echo "RPC_PROVIDER_DRPC_1135=$RPC_PROVIDER_DRPC_1135" >> ${env_file}
RPC_PROVIDER_GELATO_1135=`echo $RELAYER_CONFIG | jq -r ."RPC_PROVIDER_GELATO_1135"`
echo "RPC_PROVIDER_GELATO_1135=$RPC_PROVIDER_GELATO_1135" >> ${env_file}

API_SERVER_HOST=`echo $RELAYER_CONFIG | jq -r ."RELAYER_1_API_SERVER_HOST"`
echo "API_SERVER_HOST=$API_SERVER_HOST" >> ${app_dir}/.env

API_SERVER_PORT=`echo $RELAYER_CONFIG | jq -r ."RELAYER_1_API_SERVER_PORT"`
echo "API_SERVER_PORT=$API_SERVER_PORT" >> ${app_dir}/.env

SLACK_CONFIG=`echo $RELAYER_CONFIG | jq -r ."SLACK_CONFIG"`
echo "SLACK_CONFIG=$SLACK_CONFIG" >> ${env_file}

Expand Down
6 changes: 6 additions & 0 deletions scripts/lisk/docker/sepolia/containerStartBot_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ echo "RPC_PROVIDER_GELATO_4202=$RPC_PROVIDER_GELATO_4202" >> ${env_file}
HUB_CHAIN_ID=`echo $RELAYER_CONFIG | jq -r ."HUB_CHAIN_ID"`
echo "HUB_CHAIN_ID=$HUB_CHAIN_ID" >> ${env_file}

API_SERVER_HOST=`echo $RELAYER_CONFIG | jq -r ."RELAYER_1_API_SERVER_HOST"`
echo "API_SERVER_HOST=$API_SERVER_HOST" >> ${app_dir}/.env

API_SERVER_PORT=`echo $RELAYER_CONFIG | jq -r ."RELAYER_1_API_SERVER_PORT"`
echo "API_SERVER_PORT=$API_SERVER_PORT" >> ${app_dir}/.env

echo "All env vars from secrets are set."

# Set the bot identifier
Expand Down
2 changes: 1 addition & 1 deletion src/api/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dotenv.config();

export function runAPIServer(logger: winston.Logger): void {
const app: Express = express();
const host = process.env.API_SERVER_HOST || "127.0.0.1";
const host = process.env.API_SERVER_HOST || "0.0.0.0";
const port = Number(process.env.API_SERVER_PORT) || 3000;

app.use("/healthz", healthz());
Expand Down
Loading