mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-20 12:03:11 -04:00
fix(tools): manage PM2 globally
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
5482650dd0
commit
7fd74c8f5c
@@ -458,7 +458,13 @@ Provisioning VMs with the Code
|
||||
npm install -g pnpm
|
||||
```
|
||||
|
||||
3. Clone freeCodeCamp, set up env, and keys.
|
||||
3. Install pm2 globally.
|
||||
|
||||
```console
|
||||
npm install -g pm2
|
||||
```
|
||||
|
||||
4. Clone freeCodeCamp, set up env, and keys.
|
||||
|
||||
```console
|
||||
git clone https://github.com/freeCodeCamp/freeCodeCamp.git
|
||||
@@ -466,28 +472,28 @@ cd freeCodeCamp
|
||||
git checkout prod-current # or any other branch to be deployed
|
||||
```
|
||||
|
||||
4. Create the `.env` from the secure credentials storage.
|
||||
5. Create the `.env` from the secure credentials storage.
|
||||
|
||||
5. Install dependencies
|
||||
6. Install dependencies
|
||||
|
||||
```console
|
||||
pnpm install
|
||||
```
|
||||
|
||||
6. Setup pm2 `logrotate` and startup on boot
|
||||
7. Setup pm2 `logrotate` and startup on boot
|
||||
|
||||
```console
|
||||
pnpm pm2 install pm2-logrotate
|
||||
pnpm pm2 startup
|
||||
pm2 install pm2-logrotate
|
||||
pm2 startup
|
||||
```
|
||||
|
||||
7. Build the server
|
||||
8. Build the server
|
||||
|
||||
```console
|
||||
pnpm prebuild && pnpm build:curriculum && pnpm build:server
|
||||
```
|
||||
|
||||
8. Start Instances
|
||||
9. Start Instances
|
||||
|
||||
```console
|
||||
pnpm start:server
|
||||
@@ -496,11 +502,11 @@ pnpm start:server
|
||||
### Logging and Monitoring
|
||||
|
||||
```console
|
||||
pnpm pm2 logs
|
||||
pm2 logs
|
||||
```
|
||||
|
||||
```console
|
||||
pnpm pm2 monit
|
||||
pm2 monit
|
||||
```
|
||||
|
||||
### Updating Instances (Maintenance)
|
||||
@@ -517,7 +523,7 @@ dependencies or adding environment variables.
|
||||
1. Stop all instances
|
||||
|
||||
```console
|
||||
pnpm pm2 stop all
|
||||
pm2 stop all
|
||||
```
|
||||
|
||||
2. Install dependencies
|
||||
@@ -535,13 +541,13 @@ pnpm prebuild && pnpm build:curriculum && pnpm build:server
|
||||
4. Start Instances
|
||||
|
||||
```console
|
||||
pnpm start:server && pnpm pm2 logs
|
||||
pnpm start:server && pm2 logs
|
||||
```
|
||||
|
||||
#### 2. Rolling updates - Used for logical changes to code.
|
||||
|
||||
```console
|
||||
pnpm reload:server && pnpm pm2 logs
|
||||
pnpm reload:server && pm2 logs
|
||||
```
|
||||
|
||||
> [!NOTE] We are handling rolling updates to code and logic via pipelines. You
|
||||
@@ -554,7 +560,7 @@ pnpm reload:server && pnpm pm2 logs
|
||||
2. Update pm2 to use the new version
|
||||
|
||||
```console
|
||||
pnpm pm2 update
|
||||
pm2 update
|
||||
```
|
||||
|
||||
## Work on Client Instances
|
||||
|
||||
Reference in New Issue
Block a user