Skip to content

Commit c45577d

Browse files
committed
Added pm2 cluster support
- Added cluster mode toggle switch in process page - Processes with same name are grouped together in cluster view - Fixed process selection dropdown to show one entry per cluster - Enhanced selection logic to handle cluster operations - Cluster actions (restart, stop, delete) affect all process instances in the cluster
1 parent 83c39b7 commit c45577d

197 files changed

Lines changed: 16777 additions & 17460 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf

.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This configuration only applies to the package manager root.
2+
/** @type {import("eslint").Linter.Config} */
3+
module.exports = {
4+
ignorePatterns: ["apps/**", "packages/**"],
5+
extends: ["@pm2.web/eslint-config/base.js"],
6+
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "monthly"
12+
open-pull-requests-limit: 3
13+

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["master","develop"]
6+
pull_request:
7+
types: [opened, synchronize]
8+
9+
jobs:
10+
analyze:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 2
17+
- name: Setup Node.js environment
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: 'npm'
22+
- name: Install dependencies
23+
run: npm install
24+
- name: Run lint
25+
run: npm run lint
26+
- name: Run format
27+
run: npm run format:check
28+
test:
29+
runs-on: ubuntu-latest
30+
needs: analyze
31+
steps:
32+
- name: Check out code
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 2
36+
- name: Setup Node.js environment
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
40+
cache: 'npm'
41+
- name: Install dependencies
42+
run: npm install
43+
- name: Run tests
44+
run: npm test

.gitignore

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
1+
# Dependencies
2+
node_modules
3+
.pnp
4+
.pnp.js
25

6+
# Local env files
7+
.env
8+
.env.local
9+
.env.development.local
10+
.env.test.local
11+
.env.production.local
12+
13+
# Testing
14+
coverage
15+
16+
# Turbo
17+
.turbo
18+
19+
# Vercel
20+
.vercel
21+
22+
# Build Outputs
23+
.next/
24+
out/
25+
build
26+
dist
27+
28+
29+
# Debug
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
34+
# Misc
35+
.DS_Store
36+
*.pem

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cssvar.files": ["apps/dashboard/node_modules/@mantine/core/styles.css"],
3+
"cssvar.extensions": ["css", "scss", "tsx", "jsx"]
4+
}

CHANGELOG.MD

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# 1.4.0
2+
- refactor typings and mongoose models
3+
- use time series for statistics
4+
- migrate api endpoints to trpc
5+
- refactor react components
6+
- live charts (ram, used heap, cpu) for process page
7+
- update readme and setup guide
8+
9+
# 1.3.0
10+
11+
- setup test suite for dashboard
12+
- configure eslint/prettier for monorepo
13+
14+
# 1.2.0
15+
16+
- setup project as monorepo
17+
- integrate turborepo for better DX
18+
- share types and models between apps
19+
20+
## Breaking Changes
21+
22+
- If you use vercel to deploy the dashboard, you have to update the directory to apps/dashboard
23+
24+
# 1.1.0
25+
26+
- Upgrade Mantine 6 -> 7.5.2
27+
- Upgrade next.js 13.4.1 -> 14.1.0
28+
29+
# 1.0.0
30+
31+
- Initial release

README.md

Lines changed: 31 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -19,109 +19,10 @@ pm2.web is a web-based application designed to monitor and manage processes runn
1919

2020
To get started with pm2.web, follow these steps:
2121

22-
### Vercel & MongoDB Atlas
23-
24-
<details>
25-
<summary>Expand</summary>
26-
27-
#### MongoDB Atlas
28-
29-
1. Create a MongoDB Atlas account and create a new project.
30-
2. Create a new cluster and select the free tier.
31-
3. Create a new database user and save the username and password.
32-
4. Add your IP address to the IP Access List or through a CIDR block.
33-
34-
#### Vercel
35-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/oxdev03/pm2.web&env=MONGO_URI&description=Process+Monitoring+and+Management&rootDirectory=dashboard)
36-
37-
1. Click the deploy button above and follow the instructions.
38-
39-
#### Backend
40-
[Follow the instructions here , On-Premise->Backend](#backend1)
41-
42-
</details>
43-
44-
### On-Premise
45-
46-
<details>
47-
<summary>Expand</summary>
48-
49-
1. Clone the repository to your server.
50-
51-
```bash
52-
git clone https://github.com/oxdev03/pm2.web.git
53-
```
54-
55-
#### Backend
56-
<a name="backend1"></a>
57-
58-
The Backend is a simple nodejs application that uses the pm2 BUS API to communicate and monitor pm2 process.
59-
It doesn't require any open ports, since it only saves data to the database and events like restart, stop, delete are relayed through the change stream of mongodb.
60-
61-
##### Requirements
62-
63-
- Nodejs v16
64-
- MongoDB Cluster
65-
- PM2
66-
67-
##### Installation
68-
69-
1. Install the dependencies
70-
71-
```bash
72-
cd backend
73-
npm install
74-
```
75-
76-
2. Create a `.env` file in the backend directory and add the following variables
77-
78-
```bash
79-
MONGO_URI=<MongoDB URI>
80-
```
81-
82-
3. Start the backend
83-
84-
```bash
85-
npm start
86-
```
87-
88-
#### Frontend
89-
90-
##### Requirements
91-
92-
- Open Port 3000 or 80,443 (if you use a reverse proxy)
93-
- Nodejs v16
94-
- MongoDB
95-
96-
##### Installation
97-
98-
1. Install the dependencies
99-
100-
```bash
101-
cd dashboard
102-
npm install
103-
```
104-
105-
2. Create a `.env` file in the dashboard directory and add the following variables
106-
107-
```bash
108-
MONGO_URI=<MongoDB URI>
109-
NEXTAUTH_URL=<Index URL of the dashboard eg. http://ip:3000>
110-
```
111-
112-
3. Build the frontend
113-
114-
```bash
115-
npm run build
116-
```
117-
118-
4. Start the frontend
119-
120-
```bash
121-
npm start
122-
```
123-
124-
</details>
22+
1. [Setup Backend](./apps/backend/README.md)
23+
2. Setup Dashboard
24+
- **A:** [Setup Dashboard On Premise](./apps/dashboard/README.md#on-premise)
25+
- **B:** [Setup Dashboard Vercel](./apps/dashboard/README.md#vercel--mongodb-atlas)
12526

12627
## Usage
12728

@@ -135,10 +36,10 @@ Once pm2.web is installed and running, you can perform the following actions:
13536

13637
- Stop, restart, or delete processes from the process list page.
13738
- Access the logs generated by your processes.
138-
- View key metrics and graphs to assess the performance of your applications.
39+
- View key metrics, git versioning info and graphs to assess the performance of your applications.
13940
- Pm2 Settings & Git Feature
14041

141-
- **Server Management (Planned)**:
42+
- **Server Management (Planned/On Demand)**:
14243

14344
- Control server-level functions such as shutdown or restart using the dedicated server management page.
14445
- Execute these actions securely without the need for direct server access.
@@ -154,35 +55,48 @@ Once pm2.web is installed and running, you can perform the following actions:
15455

15556
- Configure settings such as the update interval, log rotation, and more.
15657

157-
- **Alert Setup (Planned)**:
58+
- **Alert Setup (Planned/On Demand)**:
59+
15860
- Configure alerts to receive notifications for specific actions.
15961
- Define alert rules based on events like shutdown, restart, or kill actions.
16062

161-
## Milestones (based on stars)
162-
163-
I have a lot of ideas for this project, but I don't have the time to implement them all due to my busy schedule. Nor the less the project will be maintained even if it doesn't reach the milestones.
164-
165-
- [x] 0 Stars - Active Maintenance/Bug Fixes
166-
- [] 20 Stars - Server Management
167-
- [] 50 Stars - Alert Setup
168-
- [] 100 Stars - Change Database to PostgreSQL for better performance
169-
- [] 150 Stars - Live Monitoring (Websocket)
63+
- **User Registration**:
64+
- User can register at the `/login` page
65+
- If a registration code is configured, the user needs to enter the code
66+
- The 1st user which registers is automatically assigned the owner permission
67+
- The owner can assign permissions to registered users through the access control page
68+
- registered user without any permissions can't access the dashboard nor login
69+
- accounts linked with oauth2 can't login with credentials (can be unlinked in the settings page)
70+
- **Setup Github OAuth**
71+
- https://github.com/settings/developers -> New OAuth App
72+
- Configure the callback url to `http://<domain|ip:port>/api/auth/callback/github`
73+
- Add `NEXT_PUBLIC_GITHUB_CLIENT_ID` and `NEXT_GITHUB_SECRET` to the `.env` file with the values from the OAuth App
74+
- **Usage**: Only registered users (per credentials) can login with auth2, which links the oauth2 with the existing user account in the database
75+
- **Setup Registration Code**
76+
- Go to the settings page and add/generate the registration code
77+
- **Setup Google OAuth (Planned/On Demand)**
78+
- TBD
79+
80+
## Up Next
81+
82+
- E2E Tests for current functionality
83+
- Performance Improvements for Charts & Logs
17084

17185
## Contributing
17286

17387
Contributions to pm2.web are welcome! If you would like to contribute to the project, please follow these guidelines:
17488

17589
1. Fork the repository on GitHub.
17690

177-
2. Create a new branch from the `develop` branch to work on your changes.
91+
2. Create a new branch from the `master` branch to work on your changes.
17892

17993
3. Make your modifications and ensure they adhere to the project's coding standards.
18094

18195
4. Commit your changes with clear and descriptive commit messages.
18296

18397
5. Push your branch to your forked repository.
18498

185-
6. Submit a pull request to the `develop` branch of the main pm2.web repository.
99+
6. Submit a pull request to the `master` branch of the main pm2.web repository.
186100

187101
## License
188102

apps/backend/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DB_URI=mongodb+srv://connecturi

0 commit comments

Comments
 (0)