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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chen Liang
Team6-Digital Insight for Health
Commits
08b410d4
Commit
08b410d4
authored
4 months ago
by
Burhan Akbar
Browse files
Options
Downloads
Patches
Plain Diff
Deployment checks App Works
parent
88d5a500
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Jenkinsfile
+14
-5
14 additions, 5 deletions
Jenkinsfile
with
14 additions
and
5 deletions
Jenkinsfile
+
14
−
5
View file @
08b410d4
...
...
@@ -92,17 +92,26 @@ pipeline {
scp src/main/resources/01_schema.sql ${APP_VM}:~/healthcare/src/main/resources/
scp src/main/resources/02_data.sql ${APP_VM}:~/healthcare/src/main/resources/
"""
// Run Docker Compose commands on App VM
// Run Docker Compose commands on App VM
with error checking and health probe
sh
"""
ssh ${APP_VM} '
set -e; # Exit immediately if a command exits with a non-zero status.
cd ~/healthcare &&
/usr/local/bin/docker-compose down -v --remove-orphans || echo "Compose down failed or had nothing to do."
docker system prune -f || echo "Prune failed."
echo "Bringing down existing services and volumes..."
/usr/local/bin/docker-compose down -v --remove-orphans
echo "Pruning unused Docker objects..."
docker system prune -af # Use -a to remove all unused images, not just dangling ones
echo "Building and starting services..."
# Keep password hardcoded in docker-compose.yml for now
/usr/local/bin/docker-compose -f docker-compose.yml up -d --build || echo "Compose up command failed."
/usr/local/bin/docker-compose -f docker-compose.yml build --pull # Add --pull to ensure base images are updated
/usr/local/bin/docker-compose -f docker-compose.yml up -d
echo "Waiting briefly for application to start..."
sleep 5 # Optional: Give the app a few seconds to initialize before probing
echo "Checking application health..."
curl -f http://localhost:8081/actuator/health # Fail the step if health check fails
echo "Application is healthy!"
'
"""
}
}
}
...
...
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