Skip to content

RANGER-5227: Add healthchecks for all docker containers #600

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ jobs:
-f docker-compose.ranger-kafka.yml \
-f docker-compose.ranger-hive.yml \
-f docker-compose.ranger-knox.yml \
-f docker-compose.ranger-ozone.yml up -d
-f docker-compose.ranger-ozone.yml up -d --wait

- name: Check status of containers and remove them
run: |
sleep 60
containers=(ranger ranger-zk ranger-solr ranger-postgres ranger-usersync ranger-tagsync ranger-kms ranger-hadoop ranger-hbase ranger-kafka ranger-hive ranger-knox ozone-om ozone-scm ozone-datanode);
flag=true;
for container in "${containers[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion dev-support/ranger-docker/Dockerfile.ranger-base
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ENV OS_NAME=UBUNTU
# Install tzdata, Python, Java, python-requests
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata vim\
python3 python3-pip openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk bc iputils-ping ssh pdsh xmlstarlet && \
python3 python3-pip openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk bc iputils-ping ssh pdsh xmlstarlet curl && \
pip3 install apache-ranger && \
pip3 install requests

Expand Down
4 changes: 2 additions & 2 deletions dev-support/ranger-docker/docker-compose.ranger-hadoop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ services:
ranger:
condition: service_started
healthcheck:
test: "hdfs dfs -ls /hbase"
interval: 1m30s
test: [ "CMD-SHELL", "su hdfs -c \"/opt/hadoop/bin/hdfs dfsadmin -report | grep -q 'Live datanodes'\"" ]
interval: 30s
timeout: 10s
retries: 30
start_period: 40s
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-hbase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ services:
condition: service_healthy
ranger-zk:
condition: service_started
healthcheck:
test: [ "CMD", "wget", "-q", "--spider", "http://localhost:16030/rs-status" ]
interval: 30s
timeout: 10s
retries: 30
start_period: 40s
environment:
- HBASE_VERSION
- HBASE_PLUGIN_VERSION
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ services:
condition: service_started
ranger-hadoop:
condition: service_healthy
healthcheck:
test: [ "CMD-SHELL", "su hdfs -c \"/opt/hadoop/bin/hdfs dfsadmin -report | grep -q 'Live datanodes'\"" ]
interval: 30s
timeout: 10s
retries: 30
start_period: 40s
environment:
- HIVE_HADOOP_VERSION
- HIVE_VERSION
Expand Down
13 changes: 11 additions & 2 deletions dev-support/ranger-docker/docker-compose.ranger-kafka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ services:
condition: service_started
ranger-zk:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "echo 'ping' | kafka-console-producer.sh --broker-list localhost:9092 --topic health-check-topic && kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic health-check-topic --from-beginning --max-messages 1 | grep 'ping'" ]
interval: 60s
timeout: 10s
retries: 3
start_period: 20s
environment:
- KAFKA_VERSION
- KAFKA_PLUGIN_VERSION
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://ranger-kafka:9092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_VERSION: ${KAFKA_VERSION}
KAFKA_PLUGIN_VERSION: ${KAFKA_PLUGIN_VERSION}

networks:
ranger:
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-kms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ services:
depends_on:
ranger:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "grep 'Ranger KMS Started' /var/log/ranger/kms/ranger-kms*.log" ]
interval: 40s
timeout: 5s
retries: 10
start_period: 40s
environment:
- KMS_VERSION
- RANGER_DB_TYPE
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-knox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ services:
condition: service_started
ranger-zk:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "curl -k -i -u admin:admin-password 'https://localhost:8443/gateway/sandbox/webhdfs/v1/?op=LISTSTATUS'" ]
interval: 60s
timeout: 10s
retries: 10
start_period: 10s
environment:
- KNOX_VERSION
- KNOX_PLUGIN_VERSION
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-ozone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ services:
condition: service_started
ranger-solr:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "su om -c \"/opt/hadoop/bin/ozone fs -ls ofs://om/\"" ]
interval: 40s
timeout: 10s
retries: 5
start_period: 30s
environment:
ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
OZONE_OPTS: -Dcom.sun.net.ssl.checkRevocation=false
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-tagsync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ services:
depends_on:
ranger:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "grep 'Initializing TAG source and sink' /var/log/ranger/tagsync/tagsync*log*" ]
interval: 30s
timeout: 3s
retries: 10
start_period: 40s
environment:
- TAGSYNC_VERSION
- DEBUG_TAGSYNC=${DEBUG_TAGSYNC:-false}
Expand Down
6 changes: 6 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger-usersync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ services:
depends_on:
ranger:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "grep 'uploaded to ranger admin' /var/log/ranger/usersync/usersync*.log*" ]
interval: 30s
timeout: 3s
retries: 10
start_period: 40s
environment:
- USERSYNC_VERSION
- ENABLE_FILE_SYNC_SOURCE
Expand Down
20 changes: 20 additions & 0 deletions dev-support/ranger-docker/docker-compose.ranger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ services:
condition: service_healthy
ranger-solr:
condition: service_started
healthcheck:
test: [ "CMD-SHELL", "curl -i -u admin:rangerR0cks! 'http://localhost:6080'" ]
interval: 60s
timeout: 10s
retries: 3
start_period: 40s
environment:
- RANGER_VERSION
- RANGER_DB_TYPE
Expand All @@ -48,6 +54,14 @@ services:
- ranger
ports:
- "2181:2181"
healthcheck:
test: [ "CMD-SHELL", "echo ruok | nc localhost 2181 | grep imok" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
environment:
ZOO_4LW_COMMANDS_WHITELIST: "mntr,conf,ruok"

ranger-solr:
build:
Expand All @@ -66,6 +80,12 @@ services:
- solr-precreate
- ranger_audits
- /opt/solr/server/solr/configsets/ranger_audits/
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:8983/solr/ranger_audits/admin/ping" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s

networks:
ranger:
Expand Down
Loading