Skip to content
Open
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
hard: 40000
command: [--ssl=0]
healthcheck:
test: ["CMD", "sh", "-c", "mysqladmin ping -uroot -proot && [ -f /var/lib/mysql/initialization-complete.flag ]"]
test: ["CMD", "mysql", "-h", "localhost", "-uroot", "-proot", "-D", "WSO2AM_SHARED_DB", "-e", "SELECT 1 FROM UM_ORG LIMIT 1;"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's explore the structure and find the initialization scripts
find . -type f -name "docker-compose*.yml" | head -20

Repository: wso2/docker-apim

Length of output: 229


🏁 Script executed:

# Find SQL and shell scripts in the conf directory
fd -e sql -e sh . ./conf --max-results 20

Repository: wso2/docker-apim

Length of output: 153


🏁 Script executed:

# Check if the conf/mysql/scripts directory exists and what's in it
ls -la docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts 2>/dev/null || echo "Path not found, searching..."
find . -path "*conf/mysql/scripts*" -type f

Repository: wso2/docker-apim

Length of output: 1039


🏁 Script executed:

# Examine the mysql_shared.sql file to see if WSO2AM_SHARED_DB and UM_ORG are created
cat "./docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_shared.sql" | head -100

Repository: wso2/docker-apim

Length of output: 4978


🏁 Script executed:

# Check the z_health_check.sh script
cat "./docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/z_health_check.sh"

Repository: wso2/docker-apim

Length of output: 924


🏁 Script executed:

# Search for initialization-complete.flag references
rg -n "initialization-complete.flag" 2>/dev/null || echo "No matches found"

Repository: wso2/docker-apim

Length of output: 781


🏁 Script executed:

# Check if the docker-compose.yml file has the healthcheck at line 32
sed -n '25,40p' "./docker-compose/apim-is-as-km-with-analytics/docker-compose.yml"

Repository: wso2/docker-apim

Length of output: 599


🏁 Script executed:

# Search for UM_ORG table in the SQL files
rg -n "UM_ORG" ./docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/

Repository: wso2/docker-apim

Length of output: 4160


🏁 Script executed:

# Check the full mysql_shared.sql file to see where UM_ORG is created (if at all)
wc -l ./docker-compose/apim-is-as-km-with-analytics/conf/mysql/scripts/mysql_shared.sql

Repository: wso2/docker-apim

Length of output: 145


🏁 Script executed:

# Search for UM_ORG in ALL SQL files across all docker-compose directories
rg -n "UM_ORG" --type sql

Repository: wso2/docker-apim

Length of output: 11556


🏁 Script executed:

# Check if z_health_check.sh is mounted in the reviewed docker-compose file
sed -n '15,35p' "./docker-compose/apim-is-as-km-with-analytics/docker-compose.yml"

Repository: wso2/docker-apim

Length of output: 620


🏁 Script executed:

# Check the mysql service volumes section in the reviewed file
rg -n "volumes:" -A 10 "./docker-compose/apim-is-as-km-with-analytics/docker-compose.yml" | grep -E "^[0-9]+:" | head -30

Repository: wso2/docker-apim

Length of output: 107


🏁 Script executed:

# Compare all three docker-compose files' mysql healthcheck sections
echo "=== apim-is-as-km-with-analytics ===" && \
sed -n '32p' "./docker-compose/apim-is-as-km-with-analytics/docker-compose.yml" && \
echo "=== apim-with-analytics ===" && \
sed -n '32p' "./docker-compose/apim-with-analytics/docker-compose.yml" && \
echo "=== apim-with-mi ===" && \
sed -n '32p' "./docker-compose/apim-with-mi/docker-compose.yml"

Repository: wso2/docker-apim

Length of output: 516


Inconsistent healthcheck implementation across docker-compose files.

The new SQL-based healthcheck in this file differs from the other docker-compose configurations, which still use mysqladmin ping && [ -f /var/lib/mysql/initialization-complete.flag ]. This creates maintenance burden and potential confusion.

Additionally, z_health_check.sh still exists and creates /var/lib/mysql/initialization-complete.flag as the final initialization step (the z_ prefix ensures it runs last), but this flag is no longer checked by the healthcheck. Either:

  1. Update all docker-compose files (apim-with-analytics, apim-with-mi) to use the SQL query approach, or
  2. Keep the flag-based approach consistently across all setups and remove the SQL query healthcheck

The z_health_check.sh script should not create an unused flag file.

interval: 30s
timeout: 60s
retries: 5
Expand Down