Skip to content

Commit

Permalink
feat(docker): replace wait-for-it by healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
nsteinmetz authored and tchiotludo committed Jun 17, 2022
1 parent 0bc9485 commit 0a85914
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 16 deletions.
23 changes: 19 additions & 4 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
version: "3.6"

services:
zookeeper:
image: confluentinc/cp-zookeeper:7.0.0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
healthcheck:
test: nc -z localhost 2181 || exit 1
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

kafka:
image: confluentinc/cp-kafka:7.0.0
Expand All @@ -15,8 +19,14 @@ services:
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE: 'false'
links:
- zookeeper
depends_on:
zookeeper:
condition: service_healthy
healthcheck:
test: echo "exit" | curl -s -f telnet://localhost:9092 || exit 1
interval: 30s
timeout: 10s
retries: 5
ports:
- 9092:9092

Expand All @@ -31,6 +41,11 @@ services:
hard: -1
ports:
- 9200:9200
healthcheck:
test: curl -s -f localhost:9200/_cat/health >/dev/null || exit 1
interval: 30s
timeout: 10s
retries: 5

mysql:
image: mysql
Expand Down
40 changes: 28 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.6"

volumes:
zookeeper-data:
driver: local
Expand All @@ -19,7 +17,13 @@ services:
ALLOW_ANONYMOUS_LOGIN: "yes"
ZOOKEEPER_CLIENT_PORT: 2181
ZOO_LOG_LEVEL: "WARN"

healthcheck:
test: nc -z localhost 2181 || exit 1
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

kafka:
image: 'bitnami/kafka:latest'
volumes:
Expand All @@ -32,8 +36,14 @@ services:
KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
depends_on:
- zookeeper

zookeeper:
condition: service_healthy
healthcheck:
test: echo "exit" | curl -s -f telnet://localhost:9092 || exit 1
interval: 30s
timeout: 10s
retries: 5

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
environment:
Expand All @@ -50,21 +60,24 @@ services:
hard: 65536
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data

healthcheck:
test: curl -s -f localhost:9200/_cat/health >/dev/null || exit 1
interval: 30s
timeout: 10s
retries: 5

kestra:
image: kestra/kestra:develop-full
# build:
# context: .
# args:
# KESTRA_PLUGINS: --repositories=https://s01.oss.sonatype.org/content/repositories/snapshots io.kestra.storage:storage-gcs:LATEST io.kestra.storage:storage-minio:LATEST io.kestra.plugin:plugin-aws:LATEST io.kestra.plugin:plugin-compress:LATEST io.kestra.plugin:plugin-crypto:LATEST io.kestra.plugin:plugin-elasticsearch:LATEST io.kestra.plugin:plugin-fs:LATEST io.kestra.plugin:plugin-gcp:LATEST io.kestra.plugin:plugin-googleworkspace:LATEST io.kestra.plugin:plugin-jdbc-clickhouse:LATEST io.kestra.plugin:plugin-jdbc-mysql:LATEST io.kestra.plugin:plugin-jdbc-oracle:LATEST io.kestra.plugin:plugin-jdbc-postgres:LATEST io.kestra.plugin:plugin-jdbc-redshift:LATEST io.kestra.plugin:plugin-jdbc-sqlserver:LATEST io.kestra.plugin:plugin-jdbc-vertica:LATEST io.kestra.plugin:plugin-jdbc-vectorwise:LATEST io.kestra.plugin:plugin-kafka:LATEST io.kestra.plugin:plugin-kubernetes:LATEST io.kestra.plugin:plugin-mongodb:LATEST io.kestra.plugin:plugin-notifications:LATEST io.kestra.plugin:plugin-script-groovy:LATEST io.kestra.plugin:plugin-script-jython:LATEST io.kestra.plugin:plugin-script-nashorn:LATEST io.kestra.plugin:plugin-serdes:LATEST io.kestra.plugin:plugin-singer:LATEST
# APT_PACKAGES: curl wait-for-it zip unzip
# APT_PACKAGES: curl zip unzip
entrypoint: /bin/bash
user: "root"
command:
- -c
- |
/usr/bin/wait-for-it -t 60 kafka:9092 && \
/usr/bin/wait-for-it -t 60 elasticsearch:9200 && \
curl -s -o /tmp/examples.zip https://kestra.io/examples.zip && \
unzip -o -d /tmp/examples /tmp/examples.zip > /dev/null && \
/app/kestra server standalone --flow-path=/tmp/examples --worker-thread=128
Expand Down Expand Up @@ -101,6 +114,9 @@ services:
ports:
- "8080:8080"
depends_on:
- kafka
- zookeeper
- elasticsearch
kafka:
condition: service_healthy
zookeeper:
condition: service_healthy
elasticsearch:
condition: service_healthy

0 comments on commit 0a85914

Please sign in to comment.