Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team6-Digital Insight for Health
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chen Liang
Team6-Digital Insight for Health
Commits
d2782d1c
Commit
d2782d1c
authored
3 months ago
by
Burhan Akbar
Browse files
Options
Downloads
Patches
Plain Diff
Add healthcheck for MariaDB and wait condition for app
parent
62088847
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker-compose.yml
+14
-3
14 additions, 3 deletions
docker-compose.yml
with
14 additions
and
3 deletions
docker-compose.yml
+
14
−
3
View file @
d2782d1c
...
...
@@ -6,15 +6,23 @@ services:
container_name
:
mariadb
network_mode
:
"
host"
# Consider changing this to bridge networking later for better isolation
environment
:
MYSQL_ROOT_PASSWORD
:
comsc
MYSQL_ROOT_PASSWORD
:
comsc
# Ensure this is set
MYSQL_DATABASE
:
healthcare
volumes
:
# Mount the directory containing 01_schema.sql and 02_data.sql
-
./src/main/resources:/docker-entrypoint-initdb.d
# --- BEGIN HEALTHCHECK ---
healthcheck
:
test
:
[
"
CMD"
,
"
mariadb-admin"
,
"
ping"
,
"
-h"
,
"
localhost"
,
"
-u"
,
"
root"
,
"
-p${MYSQL_ROOT_PASSWORD}"
]
interval
:
10s
timeout
:
5s
retries
:
5
start_period
:
30s
# Give it 30s to initialize before starting checks
# --- END HEALTHCHECK ---
healthcare_01
:
build
:
context
:
.
context
:
.
# Added context back
dockerfile
:
Dockerfile
container_name
:
healthcare_01
network_mode
:
"
host"
...
...
@@ -25,4 +33,7 @@ services:
-
SPRING_DATASOURCE_USERNAME=root
# You need to specify the username
-
SPRING_DATASOURCE_PASSWORD=comsc
depends_on
:
-
mariadb
# Make sure the app waits for the db
# --- MODIFIED depends_on ---
mariadb
:
condition
:
service_healthy
# Wait for the healthcheck to pass
# --- END MODIFIED depends_on ---
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment