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

Added healthcheck and conditions per container #15

Merged
merged 1 commit into from
Jan 30, 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
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ fi

## Build infrastructure ##
docker-compose up -d
sleep 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you still need the sleep, since it takes time to settle. Healthcheck + sleep?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, each container runs only if previous is "healthy", in this case it means that REST API is accessible. When we creating cluster we only care about master-node to be "healthy" cause we're making a REST API call to it


## Create cluster ##
docker-compose exec -T master-node "/opt/setup_cluster.sh"
Expand Down
21 changes: 19 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ services:
container_name: "master"
cap_add:
- SYS_RESOURCE
healthcheck:
test: ["CMD", "curl", "-k", "https://localhost:9443"]
interval: 5s
timeout: 2s
retries: 3
ports:
- "12000:12000"
- "9443:9443"
Expand All @@ -30,7 +35,13 @@ services:
cap_add:
- SYS_RESOURCE
depends_on:
- master-node
master-node:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-k", "https://localhost:9443"]
interval: 5s
timeout: 2s
retries: 3
ports:
- "12001:12000"
- "9444:9443"
Expand All @@ -54,7 +65,13 @@ services:
cap_add:
- SYS_RESOURCE
depends_on:
- node-1
node-1:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-k", "https://localhost:9443"]
interval: 5s
timeout: 2s
retries: 3
ports:
- "12002:12000"
- "9445:9443"
Expand Down
Loading