Skip to content

Commit 8da414d

Browse files
committed
docs: update README for Node 20, workflow names, tokens/permissions, health-check, deployment access and Nginx example
1 parent 9cac537 commit 8da414d

1 file changed

Lines changed: 41 additions & 6 deletions

File tree

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ This project is a demonstration of how to set up a full CI/CD pipeline for a Nod
1616

1717
## CI/CD Pipeline
1818

19-
The CI/CD pipeline is split into two workflows: `ci-cd.yml` for Continuous Integration and `release.yml` for Continuous Deployment.
19+
The CI/CD pipeline is split into two workflows: `ci.yml` for Continuous Integration and `release.yml` for Continuous Deployment.
2020

21-
### `ci-cd.yml` - Continuous Integration
21+
### `ci.yml` - Continuous Integration
2222

2323
This workflow runs on every push to the `main`, `development`, and `feature/*` branches. It consists of two jobs:
2424

2525
1. **`build-and-test`:** This job builds the application and runs the test suite.
26-
2. **`bump-version`:** This job runs only on the `main` branch after the `build-and-test` job succeeds. It automatically bumps the patch version of the application and creates a new Git tag (e.g., `v1.0.1`).
26+
2. **`bump-version`:** This job runs only on the `main` branch after the `build-and-test` job succeeds. It automatically bumps the patch version of the application and creates a new Git tag (e.g., `v1.0.1`). The tagging step uses a Personal Access Token stored as `REPO_ACCESS_TOKEN`.
2727

2828
### `release.yml` - Continuous Deployment
2929

@@ -40,7 +40,7 @@ This workflow is triggered whenever a new tag is pushed to the repository (tags
4040

4141
2. **`create-release`:**
4242
- Runs after successful deployment
43-
- Creates a GitHub Release with the tag name
43+
- Creates a GitHub Release with the tag name using `GITHUB_TOKEN` and `permissions: contents: write`
4444

4545
To trigger this workflow:
4646

@@ -63,7 +63,7 @@ graph TD
6363

6464
## Technologies Used
6565

66-
- **Node.js**
66+
- **Node.js 20.x (LTS)**
6767
- **Express**
6868
- **Jest** for testing
6969
- **GitHub Actions** for CI/CD
@@ -103,4 +103,39 @@ The CI/CD pipeline requires the following secrets to be set in the GitHub reposi
103103
- `DEV_EC2_HOST`: The hostname or IP address of the development EC2 instance.
104104
- `DEV_EC2_USER`: The username for the development EC2 instance.
105105
- `DEV_EC2_KEY`: The private SSH key for the development EC2 instance.
106-
- `REPO_ACCESS_TOKEN`: A Personal Access Token (PAT) with `repo` scope. This is required for the `bump-version` job to create tags that trigger other workflows. To create a PAT, go to your GitHub settings -> Developer settings -> Personal access tokens -> Tokens (classic) -> Generate new token. Give it a descriptive name and select the `repo` scope. Copy the token and add it as a secret in your repository settings.
106+
- `REPO_ACCESS_TOKEN`: A Personal Access Token (classic) with `repo` scope. This is required for the `bump-version` job to create tags that trigger `release.yml`.
107+
108+
Optional:
109+
- `HEALTHCHECK_ISSUE_TOKEN`: A Personal Access Token (classic) with `repo` scope if you prefer creating issues from the scheduled health-check with a PAT instead of the built-in token.
110+
111+
Repository Settings → Actions → General:
112+
- Set Workflow permissions to “Read and write permissions” to allow the built-in token to create releases and issues.
113+
114+
## Health Check and Monitoring
115+
116+
- Health endpoint: `/api/health`.
117+
- Workflow: `.github/workflows/health-check.yml` runs every 5 minutes and can be run manually via “Run workflow”.
118+
- On failure, it creates an issue in the repository (requires write permissions as noted above).
119+
120+
## Deployment and Access
121+
122+
- Zero-downtime releases with PM2: the deploy script runs the app via the stable symlink `current/src/server.js` and swaps releases atomically.
123+
- The app listens on `0.0.0.0:3000`. You can access it at:
124+
- `http://YOUR_EC2_PUBLIC_IP:3000/`
125+
- `http://YOUR_EC2_PUBLIC_IP:3000/api/health`
126+
- If you prefer port 80/443, add an Nginx reverse proxy in front of the app. Example server block (HTTP only):
127+
128+
```nginx
129+
server {
130+
listen 80;
131+
server_name _;
132+
133+
location / {
134+
proxy_pass http://127.0.0.1:3000;
135+
proxy_set_header Host $host;
136+
proxy_set_header X-Real-IP $remote_addr;
137+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
138+
proxy_set_header X-Forwarded-Proto $scheme;
139+
}
140+
}
141+
```

0 commit comments

Comments
 (0)