|
55 | 55 | - In contrast, Traefik requires the creation and gradual adjustment of various configuration files, which requires your App's docker binary running. |
56 | 56 |
|
57 | 57 |
|
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. |
60 | 60 | - 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)). |
61 | 61 | - 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`. |
63 | 63 |
|
64 | 64 | 3. **No unpredictable errors in reverse proxy and deployment : Implement safety measures to handle errors caused by your app or Nginx** |
65 | 65 | - 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; |
487 | 487 | E -->|Send Docker Image Binary| D[Server 3] |
488 | 488 | F[Git] -->|Github Action or Jenkins| E[Build Server] |
489 | 489 | ``` |
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``. |
505 | 503 | - 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 | | -
|
507 | 504 | - 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. |
508 | 505 |
|
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 | | -
|
523 | 506 | ### 2. ``GIT_IMAGE_LOAD_FROM=registry`` strategy (with Docker Registry) |
524 | 507 | #### Upload Image (CI/CD Server -> Git) |
525 | 508 | - 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