Skip to content

Commit f67252c

Browse files
fix : README.md
1 parent e313df7 commit f67252c

File tree

3 files changed

+202
-33
lines changed

3 files changed

+202
-33
lines changed

.env.example.php.production.build

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# IMPORTANT - mac : docker.for.mac.localhost OR check IP. / win : host.docker.internal OR you can just type your host IP.
2+
HOST_IP=host.docker.internal
3+
4+
APP_URL=https://localhost:8085
5+
6+
USE_COMMERCIAL_SSL=true
7+
COMMERCIAL_SSL_NAME=laravel-crud-boilerplate
8+
9+
DOCKER_LAYER_CORRUPTION_RECOVERY=false
10+
11+
NGINX_RESTART=false
12+
13+
# The method of acquiring Docker images:
14+
# build (Used in developer's local environment or during Jenkins builds when a new image needs to be built, so this module is typically used)
15+
# registry (Used on deployment servers where images are fetched from a repository, so this module is used)
16+
# If you choose the "build" method, you don't need to input the values below since Dockerfile is used (no image is fetched from the Docker registry).
17+
GIT_IMAGE_LOAD_FROM=build
18+
GIT_IMAGE_LOAD_FROM_HOST=xxx
19+
GIT_IMAGE_LOAD_FROM_PATHNAME=xxx
20+
GIT_TOKEN_IMAGE_LOAD_FROM_USERNAME=xxx
21+
GIT_TOKEN_IMAGE_LOAD_FROM_PASSWORD=xxx
22+
GIT_IMAGE_VERSION=1.0.0
23+
24+
PROJECT_NAME=laravel_crud_boilerplate
25+
PROJECT_LOCATION=/var/www/app
26+
PROJECT_PORT=[8085,8081]
27+
# Example (8093,8094,11000...)
28+
ADDITIONAL_PORTS=
29+
30+
# If you locate your project on ../ (upper folder)
31+
HOST_ROOT_LOCATION=./samples/laravel-crud-boilerplate
32+
# If you locate your project's Dockerfile ../ (upper folder)
33+
DOCKER_FILE_LOCATION=./samples/laravel-crud-boilerplate
34+
35+
# This is for integrating health checkers such as "https://www.baeldung.com/spring-boot-actuators"
36+
APP_HEALTH_CHECK_PATH=api/v1/health
37+
BAD_APP_HEALTH_CHECK_PATTERN=DOWN
38+
GOOD_APP_HEALTH_CHECK_PATTERN=UP
39+
40+
41+
# This is for environment variables for docker-compose-app.
42+
DOCKER_COMPOSE_ENVIRONMENT={"XDEBUG_CONFIG":"idekey=IDE_DEBUG","PHP_IDE_CONFIG":"serverName=laravel-crud-boilerplate"}
43+
# This goes with "docker build ... in the 'run.sh' script file", and the command always contain "HOST_IP" and "APP_ENV" above.
44+
# docker exec -it CONTAINER_NAME cat /var/log/env_build_args.log
45+
DOCKER_BUILD_ARGS={"SAMPLE":"YAHOO","SAMPLE2":"YAHOO2","shared_volume_group_id":"1351","shared_volume_group_name":"laravel-shared-volume-group"}
46+
DOCKER_BUILD_LABELS=["foo=happy","bar=sad"]
47+
# EX. For Mac, add --platform linux/amd64 here
48+
DOCKER_BUILD_ADDITIONAL_RAW_PARAMS=
49+
# Your Git's commit SHA will be added as a label to DOCKER_BUILD_LABELS when your container is built.
50+
DOCKER_BUILD_SHA_INSERT_GIT_ROOT=
51+
52+
# [NOTICE] Set this to be "/your-project-path:/var/www/app" for local development
53+
DOCKER_COMPOSE_SELECTIVE_VOLUMES=["./shared/app-error-logs:/var/www/app/storage/logs"]
54+
DOCKER_COMPOSE_NGINX_SELECTIVE_VOLUMES=["./shared/nginx-error-logs:/var/log/nginx"]
55+
DOCKER_COMPOSE_HOST_VOLUME_CHECK=false
56+
57+
DOCKER_COMPOSE_STOP_GRACEFUL_SHUTDOWN_PERIOD=40s
58+
59+
NGINX_CLIENT_MAX_BODY_SIZE=50M
60+
61+
USE_MY_OWN_APP_YML=false
62+
63+
SKIP_BUILDING_APP_IMAGE=true
64+
65+
ORCHESTRATION_TYPE=compose
66+
67+
ONLY_BUILDING_APP_IMAGE=false
68+
69+
DOCKER_BUILD_MEMORY_USAGE=1G
70+
71+
USE_NGINX_RESTRICTED_LOCATION=false
72+
# ex. /docs/api-app.html
73+
NGINX_RESTRICTED_LOCATION=xxx
74+
75+
REDIRECT_HTTPS_TO_HTTP=true
76+
77+
NGINX_LOGROTATE_FILE_NUMBER=7
78+
NGINX_LOGROTATE_FILE_SIZE=100K
79+
80+
SHARED_VOLUME_GROUP_ID=1351
81+
SHARED_VOLUME_GROUP_NAME=laravel-shared-volume-group
82+
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=1000
83+
84+
ONLY_BUILDING_APP_IMAGE_FOR_PRODUCTION=true
85+
86+
REMOTE_DEPLOYMENT_RUNNER_PATH=/home/my-account/docker-blue-green-runner
87+
REMOTE_DEPLOYMENT_IP_ADDRESS_LIST=["111.111.111.111"]
88+
REMOTE_DEPLOYMENT_PORT_NUMBER_LIST=["11222"]
89+
REMOTE_DEPLOYMENT_SSH_PRIVATE_KEY_LOCAL_PATH_WITH_FILE=~/.ssh/id_rsa_ssh_deployer
90+
REMOTE_DEPLOYMENT_SSH_USER=my-account
91+
REMOTE_DEPLOYMENT_FAILURE_STRATEGY=stop
92+
93+
WITH_SUDO=false

.env.example.php.production.remote

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# IMPORTANT - mac : docker.for.mac.localhost OR check IP. / win : host.docker.internal OR you can just type your host IP.
2+
HOST_IP=host.docker.internal
3+
4+
APP_URL=https://localhost:8085
5+
6+
USE_COMMERCIAL_SSL=true
7+
COMMERCIAL_SSL_NAME=laravel-crud-boilerplate
8+
9+
DOCKER_LAYER_CORRUPTION_RECOVERY=false
10+
11+
NGINX_RESTART=false
12+
13+
# The method of acquiring Docker images:
14+
# build (Used in developer's local environment or during Jenkins builds when a new image needs to be built, so this module is typically used)
15+
# registry (Used on deployment servers where images are fetched from a repository, so this module is used)
16+
# If you choose the "build" method, you don't need to input the values below since Dockerfile is used (no image is fetched from the Docker registry).
17+
GIT_IMAGE_LOAD_FROM=file
18+
GIT_IMAGE_LOAD_FROM_HOST=xxx
19+
GIT_IMAGE_LOAD_FROM_PATHNAME=xxx
20+
GIT_TOKEN_IMAGE_LOAD_FROM_USERNAME=xxx
21+
GIT_TOKEN_IMAGE_LOAD_FROM_PASSWORD=xxx
22+
GIT_IMAGE_VERSION=1.0.0
23+
24+
PROJECT_NAME=laravel_crud_boilerplate
25+
PROJECT_LOCATION=/var/www/app
26+
PROJECT_PORT=[8085,8081]
27+
# Example (8093,8094,11000...)
28+
ADDITIONAL_PORTS=
29+
30+
# If you locate your project on ../ (upper folder)
31+
HOST_ROOT_LOCATION=./samples/laravel-crud-boilerplate
32+
# If you locate your project's Dockerfile ../ (upper folder)
33+
DOCKER_FILE_LOCATION=./samples/laravel-crud-boilerplate
34+
35+
# This is for integrating health checkers such as "https://www.baeldung.com/spring-boot-actuators"
36+
APP_HEALTH_CHECK_PATH=api/v1/health
37+
BAD_APP_HEALTH_CHECK_PATTERN=DOWN
38+
GOOD_APP_HEALTH_CHECK_PATTERN=UP
39+
40+
41+
# This is for environment variables for docker-compose-app.
42+
DOCKER_COMPOSE_ENVIRONMENT={"XDEBUG_CONFIG":"idekey=IDE_DEBUG","PHP_IDE_CONFIG":"serverName=laravel-crud-boilerplate"}
43+
# This goes with "docker build ... in the 'run.sh' script file", and the command always contain "HOST_IP" and "APP_ENV" above.
44+
# docker exec -it CONTAINER_NAME cat /var/log/env_build_args.log
45+
DOCKER_BUILD_ARGS={"SAMPLE":"YAHOO","SAMPLE2":"YAHOO2","shared_volume_group_id":"1351","shared_volume_group_name":"laravel-shared-volume-group"}
46+
DOCKER_BUILD_LABELS=["foo=happy","bar=sad"]
47+
# EX. --platform linux/amd64
48+
DOCKER_BUILD_ADDITIONAL_RAW_PARAMS=
49+
# Your Git's commit SHA will be added as a label to DOCKER_BUILD_LABELS when your container is built.
50+
DOCKER_BUILD_SHA_INSERT_GIT_ROOT=
51+
52+
# [NOTICE] Set this to be "/your-project-path:/var/www/app" for local development
53+
DOCKER_COMPOSE_SELECTIVE_VOLUMES=["./shared/app-error-logs:/var/www/app/storage/logs"]
54+
DOCKER_COMPOSE_NGINX_SELECTIVE_VOLUMES=["./shared/nginx-error-logs:/var/log/nginx"]
55+
DOCKER_COMPOSE_HOST_VOLUME_CHECK=false
56+
57+
DOCKER_COMPOSE_STOP_GRACEFUL_SHUTDOWN_PERIOD=40s
58+
59+
NGINX_CLIENT_MAX_BODY_SIZE=50M
60+
61+
USE_MY_OWN_APP_YML=false
62+
63+
SKIP_BUILDING_APP_IMAGE=false
64+
65+
ORCHESTRATION_TYPE=compose
66+
67+
ONLY_BUILDING_APP_IMAGE=false
68+
69+
DOCKER_BUILD_MEMORY_USAGE=1G
70+
71+
USE_NGINX_RESTRICTED_LOCATION=false
72+
# ex. /docs/api-app.html
73+
NGINX_RESTRICTED_LOCATION=xxx
74+
75+
REDIRECT_HTTPS_TO_HTTP=true
76+
77+
NGINX_LOGROTATE_FILE_NUMBER=7
78+
NGINX_LOGROTATE_FILE_SIZE=100K
79+
80+
SHARED_VOLUME_GROUP_ID=1351
81+
SHARED_VOLUME_GROUP_NAME=laravel-shared-volume-group
82+
UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID=1002
83+
84+
ONLY_BUILDING_APP_IMAGE_FOR_PRODUCTION=false
85+
86+
REMOTE_DEPLOYMENT_RUNNER_PATH=
87+
REMOTE_DEPLOYMENT_IP_ADDRESS_LIST=
88+
REMOTE_DEPLOYMENT_PORT_NUMBER_LIST=
89+
REMOTE_DEPLOYMENT_SSH_PRIVATE_KEY_LOCAL_PATH_WITH_FILE=
90+
REMOTE_DEPLOYMENT_SSH_USER=
91+
REMOTE_DEPLOYMENT_FAILURE_STRATEGY=
92+
93+
WITH_SUDO=false

README.md

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
- In contrast, Traefik requires the creation and gradual adjustment of various configuration files, which requires your App's docker binary running.
5656

5757

58-
2. **Isomorphic local-and-remote runner**
59-
- The same `run.sh` and `.env` drive deployments locally and on remote servers over SSH.
58+
2. **Isomorphic standalone-and-remote runner**
59+
- The same `run.sh` and `.env` drive deployments on standalone hosts and on remote servers over SSH.
6060
- Remote servers receive the image binary and execute the same pipeline with `GIT_IMAGE_LOAD_FROM=file` (see [Production > GIT_IMAGE_LOAD_FROM=file](#1-git_image_load_fromfile-strategy-without-docker-registry)).
6161
- Behavior stays consistent across environments; only the image source differs (build/registry/file).
62-
- Example: Run the same pipeline across local and remote (SSH) environments using a single `run.sh` and `.env`. Includes a file-based image delivery and remote execution flow via `GIT_IMAGE_LOAD_FROM=file`.
62+
- Example: Run the same pipeline across standalone and remote (SSH) environments using a single `run.sh` and `.env`. Includes a file-based image delivery and remote execution flow via `GIT_IMAGE_LOAD_FROM=file`.
6363

6464
3. **No unpredictable errors in reverse proxy and deployment : Implement safety measures to handle errors caused by your app or Nginx**
6565
- If any error occurs in the app or router, ``deployment is halted`` to prevent any impact on the existing deployment
@@ -487,39 +487,22 @@ graph TD;
487487
E -->|Send Docker Image Binary| D[Server 3]
488488
F[Git] -->|Github Action or Jenkins| E[Build Server]
489489
```
490-
- Set the Load Balancer to use "Round-Robin"
491-
- What is "Round-Robin"?
492-
- Round-robin is a load-balancing method that distributes incoming requests evenly across all available servers in a sequential order. For example, the first request goes to Server 1, the second request to Server 2, the third request to Server 3, and then it cycles back to Server 1. This ensures a balanced distribution of traffic across the servers.
493-
- Your Github Action or Jenkins scripts just send the source codes to the Build Server or run ``git pull`` on the server.
494-
- Set the 'Docker-Blue-Green-Runner' on the Build Server, and run ``run.sh`` with ``ONLY_BUILDING_APP_IMAGE_FOR_PRODUCTION`` set to ``true``.
495-
- The ``ONLY_BUILDING_APP_IMAGE_FOR_PRODUCTION=true`` creates the Docker binary file to ``./.docker/binary``
496-
- If ``REMOTE_DEPLOYMENT_RUNNER_PATH``, ``REMOTE_DEPLOYMENT_IP_ADDRESS_LIST``, ``REMOTE_DEPLOYMENT_PORT_NUMBER_LIST``, and ``REMOTE_DEPLOYMENT_SSH_PRIVATE_KEY_LOCAL_PATH_WITH_FILE`` are set:
497-
- The Runner automatically copies the binary to each server at ``${REMOTE_DEPLOYMENT_RUNNER_PATH}/.docker/binary``.
498-
- If ``REMOTE_DEPLOYMENT_FAILURE_STRATEGY`` is set (``stop`` | ``rollback`` | ``go``), the Runner connects via SSH and executes ``sudo bash run.sh`` on each server after pre-checks (``GIT_IMAGE_LOAD_FROM=file`` and sudo). Failures follow the configured strategy.
499-
- If ``REMOTE_DEPLOYMENT_FAILURE_STRATEGY`` is NOT set, you can perform the steps manually:
500-
- Set ``GIT_IMAGE_LOAD_FROM=file`` on each server.
501-
- Copy the binary to each server's ``${REMOTE_DEPLOYMENT_RUNNER_PATH}/.docker/binary``.
502-
- Run ``run.sh`` on ``Server 1``; if any issues are found, run ``rollback.sh``.
503-
- If no problems are detected, run ``run.sh`` on both ``Server 2`` and ``Server 3``.
504-
490+
- From the sample envs (``.env.example.php.production.build``for the Build Server, ``.env.example.php.production.remote``for the Server 1,2,3),
491+
- Your Github Action or Jenkins scripts just send the source codes to the Build Server or run ``git pull`` on the server.
492+
- Set the 'Docker-Blue-Green-Runner' on the Build Server, and run ``run.sh`` with ``ONLY_BUILDING_APP_IMAGE_FOR_PRODUCTION`` set to ``true``.
493+
- If you want to deploy without building and only use the files already present on Server 1, 2, and 3, set ``SKIP_BUILDING_APP_IMAGE=true``.
494+
- The ``ONLY_BUILDING_APP_IMAGE_FOR_PRODUCTION=true`` creates the Docker binary file to ``./.docker/binary``
495+
- If ``REMOTE_DEPLOYMENT_RUNNER_PATH``, ``REMOTE_DEPLOYMENT_IP_ADDRESS_LIST``, ``REMOTE_DEPLOYMENT_PORT_NUMBER_LIST``, and ``REMOTE_DEPLOYMENT_SSH_PRIVATE_KEY_LOCAL_PATH_WITH_FILE`` are set:
496+
- The Runner automatically copies the binary to each server at ``${REMOTE_DEPLOYMENT_RUNNER_PATH}/.docker/binary``.
497+
- If ``REMOTE_DEPLOYMENT_FAILURE_STRATEGY`` is set (``stop`` | ``rollback`` | ``go``), the Runner connects via SSH and executes ``sudo bash run.sh`` on each server after pre-checks (``GIT_IMAGE_LOAD_FROM=file`` and sudo). Failures follow the configured strategy.
498+
- If ``REMOTE_DEPLOYMENT_FAILURE_STRATEGY`` is NOT set, you can perform the steps manually:
499+
- Set ``GIT_IMAGE_LOAD_FROM=file`` on each server.
500+
- Copy the binary to each server's ``${REMOTE_DEPLOYMENT_RUNNER_PATH}/.docker/binary``.
501+
- Run ``run.sh`` on ``Server 1``; if any issues are found, run ``rollback.sh``.
502+
- If no problems are detected, run ``run.sh`` on both ``Server 2`` and ``Server 3``.
505503
- Tip: For smooth permission and volume access, include the UID of the ``REMOTE_DEPLOYMENT_SSH_USER`` in ``UIDS_BELONGING_TO_SHARED_VOLUME_GROUP_ID`` (in your `.env`).
506-
507504
- CI tip: If you set ``REMOTE_DEPLOYMENT_SSH_PRIVATE_KEY_LOCAL_PATH_WITH_FILE`` and ``REMOTE_DEPLOYMENT_SSH_USER`` to match your GitHub Actions credentials, and your workflow triggers ``sudo bash run.sh`` on the build server, then with ``REMOTE_DEPLOYMENT_FAILURE_STRATEGY`` configured, the Runner can perform end-to-end distribution and remote execution in a single run.
508505
509-
510-
APP_URL=https://localhost:8085
511-
512-
USE_COMMERCIAL_SSL=true
513-
COMMERCIAL_SSL_NAME=laravel-crud-boilerplate
514-
# COMMERCIAL_SSL_NAME 이름은 pk, chained crt
515-
516-
REMOTE_DEPLOYMENT_RUNNER_PATH=/home/teamlead/test-projects/docker-blue-green-runner
517-
REMOTE_DEPLOYMENT_IP_ADDRESS_LIST=["223.130.154.176"]
518-
REMOTE_DEPLOYMENT_PORT_NUMBER_LIST=["10222"]
519-
REMOTE_DEPLOYMENT_SSH_PRIVATE_KEY_LOCAL_PATH_WITH_FILE=~/.ssh/id_rsa_ssh_dev
520-
REMOTE_DEPLOYMENT_SSH_USER=teamlead
521-
REMOTE_DEPLOYMENT_FAILURE_STRATEGY=stop
522-
523506
### 2. ``GIT_IMAGE_LOAD_FROM=registry`` strategy (with Docker Registry)
524507
#### Upload Image (CI/CD Server -> Git)
525508
- If you run the ``push-to-git.sh`` command, it pushes the container image currently running on the test server to the ``Git Container Registry`` at the specified address.

0 commit comments

Comments
 (0)