This script is designed to verify the network configuration and DNS resolution of services running in Docker containers specifically within an Islandora Isle-DC environment. It helps ensure that all microservices and components in the Isle-DC stack are correctly connected and communicating.
- Service Discovery: Automatically identifies services defined in your
docker-compose.yml
file for Isle-DC. - Network Validation: Checks if each Isle-DC service is connected to the correct Docker network.
- Ping Tests: Performs ping tests between all running Isle-DC services to verify inter-container communication.
- DNS Resolution: Ensures that DNS is properly configured and resolves between services in the Isle-DC environment.
- Summary Report: Provides a detailed summary of successful checks and any errors encountered.
-
Docker and Docker Compose installed.
-
yq
installed for parsing YAML files. You can installyq
using the following command:sudo apt-get install yq
Alternatively, you can install
yq
usingsnap
:sudo snap install yq
Installation on macOS:
brew install yq
Installation on Windows:
choco install yq
-
Download the Script:
You can download the script directly from this Gist by clicking on the "Download ZIP" button or by saving the check_service_discovery.sh file manually. Or you can clone this gist
git clone https://gist.github.com/DonRichards/cf3334218abdd23601564d600f55e94a.git docker_compose_network_check mv docker_compose_network_check/check_service_discovery.sh .
-
Place the Script in Your Isle-DC Project: Ensure that the script is located in the same directory as your Isle-DC
docker-compose.yml
file. -
Make the Script Executable:
chmod +x check_service_discovery.sh
-
Run the Script:
./check_service_discovery.sh
The script will perform the following checks:
- Service Discovery: Identifies services defined in the Isle-DC
docker-compose.yml
file and checks if their corresponding containers are running. - Network Check: Verifies that each Isle-DC service is connected to the expected Docker network.
- Ping Tests: Ensures that each container can communicate with the other containers in the Isle-DC stack.
- DNS Resolution: Verifies that DNS resolution is configured and working between containers.
At the end, the script provides a summary of the results:
- The number of successful checks.
- Any errors encountered during the checks (e.g., missing containers, network configuration issues).
Starting network and DNS configuration checks...
Extracting services from docker-compose.yml...
Raw extracted services:
activemq
alpaca
...
Filtered valid services:
activemq
alpaca
...
Detected Services: activemq alpaca blazegraph cantaloupe crayfits drupal fcrepo fits homarus houdini hypercube mariadb milliner solr traefik
Mapped Containers: isle-dc-activemq-1 isle-dc-alpaca-1 isle-dc-blazegraph-1 isle-dc-cantaloupe-1 isle-dc-crayfits-1 isle-dc-drupal-1 isle-dc-fcrepo-1 isle-dc-fits-1 isle-dc-homarus-1 isle-dc-houdini-1 isle-dc-hypercube-1 isle-dc-mariadb-1 isle-dc-milliner-1 isle-dc-solr-1 traefik
Checking network for container: isle-dc-activemq-1
isle-dc-activemq-1 is connected to network (isle_dc_default).
Checking network for container: traefik
traefik is connected to network (isle_dc_default).
===== SUMMARY =====
Successful checks: 435
No errors detected. All checks passed successfully.
===================
- Missing or Misconfigured Services: If the script detects that a service is missing or misconfigured, check your Isle-DC
docker-compose.yml
and ensure all services are properly defined and running. - Network Issues: If services are not connected to the correct network, ensure that Docker networks are properly configured and that containers are using the correct network bridge.
If you find something that should be added to this message me in Islandora's Slack Channel.