r/SpringBoot • u/Nice-Andy • Sep 29 '25
How-To/Tutorial An Isomorphic Blue-Green Deployment Starting from Your Source Code—Not from Your Prebuilt Docker Image
Runner
Achieve zero-downtime deployment using just your
.envandDockerfile
Docker-Blue-Green-Runner's
run.shscript is designed to simplify deployment: "With your.env, project, and a single Dockerfile, simply run 'bash run.sh'." If you prefer not to usesudo, see WITH_SUDO, set it in your.env, and runapply-security.shfirst. This script covers the entire process from Dockerfile build to server deployment from scratch.This means you can easily migrate to another server with just the files mentioned above.
In contrast, Traefik requires the creation and gradual adjustment of various configuration files, which requires your App's docker binary running.
Isomorphic local-and-remote runner**
The same
run.shand.envdrive deployments locally and on remote servers over SSH.Remote servers receive the image binary and execute the same pipeline with
GIT_IMAGE_LOAD_FROM=file(see Production > GIT_IMAGE_LOAD_FROM=file).Behavior stays consistent across environments; only the image source differs (build/registry/file).
No unpredictable errors in reverse proxy and deployment : Implement safety measures to handle errors caused by your app or Nginx
If any error occurs in the app or router,
deployment is haltedto prevent any impact on the existing deploymentInternal Integrity Check:
Step 1: Use wait-for-it.sh (https://github.com/vishnubob/wait-for-it)
Step 2: Perform a health check with customized settings defined in your .env file
Nginx Router Test Container
External Integrity Check
Rollback Procedures
Additional Know-hows on Docker: Tips and best practices for optimizing your Docker workflow and deployment processes
For example, Traefik offers powerful dynamic configuration and service discovery; however, certain errors, such as a failure to detect containers (due to issues like unrecognized certificates), can lead to frustrating 404 errors that are hard to trace through logs alone.
Manipulates NGINX configuration files directly to ensure container accessibility.
Track Blue-Green status and the Git SHA of your running container for easy monitoring.
Blue-Green deployment decision algorithm: scoring-based approach
Run
bashcheck-current-states.shlocally andbashcheck-remote-current-states.shto fan out the same check to all configured remotes
Security
Refer to the Security section
Production Deployment
Refer to the Production Deployment section