Skip to content

Commit 58bc9a5

Browse files
fix : .env conflict message
1 parent 0f544cb commit 58bc9a5

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

.docker/nginx/template/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "[INSIDE_NGINX_CONTAINER][NOTICE] Start Logrotate (every hour at minute 1)
1717
service cron restart || echo "[WARN] Restarting Cron failed."
1818

1919

20-
# From this point on, the configuration of the NGINX consul-template begins.
20+
# From this point on, the configuration of the NGINX template begins.
2121
if [[ ! -d /etc/templates ]]; then
2222
echo "[INSIDE_NGINX_CONTAINER][NOTICE] As the directory name '/etc/templates' does NOT exist, it has been created."
2323
mkdir /etc/templates

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,12 @@
6262
- Step 2: Perform a health check with customized settings defined in your .env file
6363
- Nginx Router Test Container
6464
- External Integrity Check
65-
- Nginx Prepared Plan
6665
- Rollback Procedures
6766
- Additional Know-hows on Docker: Tips and best practices for optimizing your Docker workflow and deployment processes
6867
- 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.
6968
- https://stackoverflow.com/questions/76660749/traefik-404-page-not-found-when-use-https
7069
- https://community.traefik.io/t/getting-bad-gateway-404-page-when-supposed-to-route-to-container-port-8443/20398
71-
- Manipulates NGINX configuration files directly to ensure container accessibility. It also tests configuration files by launching a test NGINX Docker instance, and if an NGINX config update via Consul-Template fails, Prepared Plan provided is activated to ensure connectivity to your containers.
70+
- Manipulates NGINX configuration files directly to ensure container accessibility.
7271

7372

7473
3. **Track Blue-Green status and the Git SHA of your running container for easy monitoring.**
@@ -159,7 +158,6 @@ graph TD;
159158
| docker | 24~27 | Manual | I think too old versions could cause problems, and the lastest version v27.x causes only a warning message. |
160159
| docker-compose | 2 | Manual | I think too old versions could cause problems, and the v2 is recommended. |
161160

162-
- Although issues with wrong versions of these libraries can cause errors, there are several safety mechanisms in place to prevent the server from being interrupted. For example, when you run run.sh, early on it checks: 1) the existence of the required libraries, 2) the NGINX Prepared Function section below, and 3) in case of restarting Nginx (NGINX_RESTART=true in .env), a preliminary check for integrity (check_nginx_templates_integrity in use-nginx.sh).
163161
- For ``docker-compose``, if you use a version above v2.25.0, you will see a warning message: ``[WARN] The attribute 'version' is obsolete and will be ignored. Please remove it to avoid potential confusion``. You can ignore it at this point.
164162
- For MAC users, ``GNU-based bash, sed, grep`` should be installed.
165163
- For MAC users, ``SHARED_VOLUME_GROUP_*`` on .env are skipped.
@@ -389,7 +387,7 @@ For all echo messages or properties .env, the following terms indicate...
389387
```shell
390388
bash check-current-states.sh
391389
# The output example
392-
[DEBUG] ! Checking which (Blue OR Green) is currently running... (Base Check) : consul_pointing(blue), nginx_pointing(blue}), blue_status(running), green_status(exited)
390+
[DEBUG] ! Checking which (Blue OR Green) is currently running... (Base Check) : nginx_pointing(blue}), blue_status(running), green_status(exited)
393391
[DEBUG] ! Checked which (Blue OR Green) is currently running... (Final Check) : blue_score : 130, green_score : 27, state : blue, new_state : green, state_for_emergency : blue, new_upstream : https://PROJECT_NAME:8300.
394392
```
395393
- The higher the score a state receives, the more likely it is to be the currently running state. So the updated App should be deployed as the non-occupied state(new_state).

emergency-all-down-and-up.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,4 @@ for container_id in "${container_ids[@]}"; do
3838
docker container rm "$container_id" || echo "[DEBUG] H"
3939
done
4040

41-
sleep 5
42-
43-
consul_down_and_up_with_network
41+
sleep 5

nginx-blue-green-activate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ new_upstream=$3
1515
echo "[NOTICE] new_state : ${new_state}, old_state : ${old_state}, new_upstream : ${new_upstream}"
1616

1717

18-
# The meaning of "${pid_was} != '-'" is that when Nginx has fully started, the BLUE-GREEN change operation is performed in CONSUL.
18+
# The meaning of "${pid_was} != '-'" is that when Nginx has fully started, the BLUE-GREEN change operation is performed.
1919
echo "[NOTICE] Check if Nginx is completely UP."
2020
for retry_count in {1..5}; do
2121
pid_was=$(docker exec ${project_name}-nginx pidof nginx 2>/dev/null || echo '-')

run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ _main() {
269269

270270
if [[ ${orchestration_type} != 'stack' ]]; then
271271
docker-compose -f docker-${orchestration_type}-${project_name}.yml stop ${project_name}-${initially_cached_old_state}
272-
echo "[NOTICE] The previous (${initially_cached_old_state}) container (initially_cached_old_state) has been stopped because the deployment was successful. (If NGINX_RESTART=true or CONSUL_RESTART=true, existing containers have already been terminated in the load_all_containers function.)"
272+
echo "[NOTICE] The previous (${initially_cached_old_state}) container (initially_cached_old_state) has been stopped because the deployment was successful. (If NGINX_RESTART=true, existing containers have already been terminated in the load_all_containers function.)"
273273
else
274274
docker stack rm ${project_name}-${initially_cached_old_state}
275-
echo "[NOTICE] The previous (${initially_cached_old_state}) service (initially_cached_old_state) has been stopped because the deployment was successful. (If NGINX_RESTART=true or CONSUL_RESTART=true, existing containers have already been terminated in the load_all_containers function.)"
275+
echo "[NOTICE] The previous (${initially_cached_old_state}) service (initially_cached_old_state) has been stopped because the deployment was successful. (If NGINX_RESTART=true, existing containers have already been terminated in the load_all_containers function.)"
276276
fi
277277

278278
display_checkpoint_message "CURRENT APP_URL: ${app_url}."

use-common.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ cache_non_dependent_global_vars() {
220220
skip_building_app_image=$(get_value_from_env "SKIP_BUILDING_APP_IMAGE")
221221

222222
if [[ ${docker_layer_corruption_recovery} == 'true' && ${skip_building_app_image} == 'true' ]]; then
223-
echo "[ERROR] On .env, docker_layer_corruption_recovery=true and skip_building_app_image=true as well. That does NOT make sense, as 'docker_layer_corruption_recovery=true' removes all images first." && exit 1
223+
echo "[ERROR] Configuration conflict in .env: 'docker_layer_corruption_recovery=true' and 'skip_building_app_image=true' cannot coexist. 'docker_layer_corruption_recovery=true' removes all images, so skipping the app image build is not logical." && exit 1
224+
fi
225+
226+
if [[ ${docker_layer_corruption_recovery} == 'true' && ${nginx_restart} == 'false' ]]; then
227+
echo "[ERROR] Configuration conflict in .env: 'docker_layer_corruption_recovery=true' and 'nginx_restart=false' cannot coexist. 'docker_layer_corruption_recovery=true' removes all images, which requires a restart of Nginx." && exit 1
224228
fi
225229

226230
orchestration_type=$(get_value_from_env "ORCHESTRATION_TYPE")

0 commit comments

Comments
 (0)