Skip to content

Commit

Permalink
doc : additional README
Browse files Browse the repository at this point in the history
  • Loading branch information
patternhelloworld committed Oct 30, 2024
1 parent a851204 commit 5268625
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Deploying web projects should be [simple, with high availability and security](h
- On Linux, you only need to have ``docker, docker-compose`` and some helping libraries such as ``git, curl, bash, yq(v4.35.1)`` installed.
- So, this is available for both non-cloud and cloud environments. You only need one machine.
- With your ``.env, project, and its sole Dockerfile``, Docker-Blue-Green-Runner manages the remainder of the Continuous Deployment (CD) process with [wait-for-it](https://github.com/vishnubob/wait-for-it), [consul-template](https://github.com/hashicorp/consul-template) and [Nginx](https://github.com/nginx/nginx). Just run ``bash run.sh``.

- 'wait-for-it' can be a reliable tool to ensure your container is fully up and ready before proceeding with dependencies or further operations.
- Using 'consul-template' allows your application to dynamically switch to blue or green deployments. Implementing an Nginx Contingency Plan can provide an added layer of stability to handle potential issues gracefully.

![consists-of.png](/documents/images/consists-of.png )

Expand Down Expand Up @@ -145,7 +146,7 @@ Deploying web projects should be [simple, with high availability and security](h
| React | X | O |

### How to Start with a React Guide (Real)
[Link : Deploy your static React project](Deploy-React-Project-with-DBGR.md)
[Link : Deploy your static React project](documents/Deploy-React-Project-with-DBGR.md)

### How to Start with a Node Sample (Local)
- Check the port number 13000 available before getting this started.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

## The Goal
- External -> Docker-Blue-Green-Runner (443 port) -> Your App (8360 port)
- For a perfectly static React app, your application should include NGINX, which requires more setup compared to something like Spring Boot, which can be run directly from the command line, or use Next.js.
- For a perfectly static React app, your application should include NGINX, which requires more setup compared to something like Spring Boot, which can be run directly from the command line, or you wouldn't love that, use Next.js.

## Locate projects
- Clone the project https://github.com/patternhelloworld/docker-blue-green-runner at to ``/var/projects/docker-blue-green-runner`` (the path is not important; adjust as per your setup).
- Clone your application to ``/var/projects/your-app`` (the path is not important; adjust as per your setup).

## Runner-side work
### Create a .env file in the Runner's Root Directory
#### Points
- ``443`` indicated below
- ``DOCKER_BUILD_ARGS`` for your Dockerfile
- ``DOCKER_COMPOSE_REAL_SELECTIVE_VOLUMES`` for your Volumes.
- ``REDIRECT_HTTPS_TO_HTTP``
- .env file
- ```dotenv
HOST_IP=host.docker.internal
APP_ENV=real
Expand Down Expand Up @@ -110,13 +116,14 @@
### Dockerfile
- At ``/var/projects/your-app``, write the following.
- The ARG below PROJECT_ROOT_IN_CONTAINER is passed from the above during the building process.

```Dockerfile
FROM node:18.20.4-slim AS build

ARG PROJECT_ROOT_IN_CONTAINER

RUN mkdir -p $PROJECT_ROOT_IN_CONTAINER
COPY . $PROJECT_ROOT_IN_CONTAINER
COPY .. $PROJECT_ROOT_IN_CONTAINER
WORKDIR $PROJECT_ROOT_IN_CONTAINER
RUN export NODE_OPTIONS="--max-old-space-size=2048"
RUN whereis npm && alias npm='node --max_old_space_size=2048 /usr/local/bin/npm'
Expand All @@ -137,7 +144,7 @@ COPY --chown=nginx --from=build $PROJECT_ROOT_IN_CONTAINER/dist/ $PROJECT_ROOT_I
USER root
WORKDIR $PROJECT_ROOT_IN_CONTAINER

COPY ./.docker/ssl /etc/nginx/ssl
COPY ../.docker/ssl /etc/nginx/ssl

COPY ./.docker/entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh
Expand Down

0 comments on commit 5268625

Please sign in to comment.