Skip to content

Commit d4494de

Browse files
authored
Eliminating the use of PM2 on the server.
1 parent f7c2bb3 commit d4494de

File tree

6 files changed

+12
-70
lines changed

6 files changed

+12
-70
lines changed

.clocignore

-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ Server/Tools/GPT/g4f
99
Server/node_modules
1010
Server/package-lock.json
1111
Server/package.json
12-
Server/PM2.config.js
1312

1413
Documentation/

Documentation/docs/Introduction.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Table of Contents:
1616
- Installing necessary dependencies before proceeding with the installation. [[View]](/#before-you-start-the-installation)
1717
- Cloning the Github repository that contains the Lovelace source code. [[View]](/installation)
1818
- Knowing the functionality of the files and directories found within the cloned repository. [[View]](/installation#knowing-a-little-more-about-the-contents-of-the-cloned-repository)
19-
- Running the backend server on the network and in production mode with the help of the process manager for NodeJS PM2. [[View]](/mounting-server-in-the-network/)
19+
- Running the backend server on the network. [[View]](/mounting-server-in-the-network/)
2020
- Knowing the environment variables that the Lovelace Backend has. [[View]](/mounting-server-in-the-network/#what-about-environment-variables)
2121
- Mounting the Lovelace Frotend built with Vite + React on the network. [[View]](/mounting-webapp-in-the-network/)
2222
- Knowing and modifying the environment variables that the Vite + React application has (Frontend). [[View]](/mounting-webapp-in-the-network/#modifying-environment-variables)
@@ -36,7 +36,7 @@ Table of Contents:
3636
- Video-based example of the use of the web application on mobile devices. [[View]](/Web-App-Usage#using-the-web-application-on-mobile)
3737

3838
## Before you start the installation
39-
Installing Lovelace on your computer or server is relatively simple, you shouldn't have any major complications in the process; however, before you start cloning the repository, make sure you have at least `NodeJS v18.0.0`, `Python v3.10` and `PM2 with SocketIO Deps [npm install -g @socket.io/pm2 pm2]`.
39+
Installing Lovelace on your computer or server is relatively simple, you shouldn't have any major complications in the process; however, before you start cloning the repository, make sure you have at least `NodeJS v18.0.0` and `Python v3.10`.
4040

4141
Consider that, in case you do not have the required NodeJS version installed on your system, you can use the version manager [`NVM (Node Version Manager)`](https://github.com/nvm-sh/nvm#installing-and-updating).
4242

@@ -69,10 +69,4 @@ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
6969
python3 get-pip.py
7070
```
7171

72-
Next, we will install the necessary dependencies to be able to use PM2 on SocketIO and in the same way we will install the PM2 process manager, consider that this installation has the `-g` parameter, that is, it will be done globally. The mentioned packages that you will install are necessary, you will not be able to run the server in production if you do not have them.
73-
74-
```bash
75-
npm install -g @socket.io/pm2 pm2
76-
```
77-
7872
Now, assuming you have the aforementioned dependencies installed on your system, we can proceed to the next step...

Documentation/docs/Mounting-Server.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@ If you have done everything correctly, the server should already be running on y
2121

2222
## Other ways to raise the server...
2323

24-
Consider that, when setting up the server in production, `PM2` is used, which is nothing more than a `Process Manager for NodeJS`. It is used in Lovelace due to its built-in load balancer, as well as allowing you to always keep applications active and load them without any downtime, among other advantages in terms of performance. Next, you will have a table with all the scripts you can run using `npm run <script_name>`.
25-
2624
| Script (`npm run <script_name>`) | Description |
2725
| ------ | ------ |
28-
| start | Start the server running normally, you may prefer to use this mode in case you want to make development level changes within the source code regarding the server. |
29-
| production | As previously seen, this mode allows you to mount the server on the network in production mode. |
30-
| stop | It allows turning off the server that was started in production, since, unlike `npm run start`, when executing `npm run production` the process goes to the background, that is, you cannot give a `CTRL + C` to be able to end the execution, otherwise you should use `npm run stop`. |
31-
| restart | Following the same line of the previous script of the "`stop`" table, with `npm run restart` you allow to restart the server that is being executed in production mode. |
26+
| start |The normal execution of the server begins, you can consider this option in case you want to mount it in production. |
27+
| dev | Start the execution of the server in development mode with the help of the "nodemon" package.|
3228

3329
## What about environment variables?
3430
You should know that environment variables are dynamic character values, which allow you to store information related to credentials, configurations, etc..., then you will be presented with the ".env" file located within the server's source code, where in turn you will have a description about the operation of the available variables.

README.md

+6-16
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Table of Contents:
1818
- Installing necessary dependencies before proceeding with the installation. [[View]](/#before-you-start-the-installation)
1919
- Cloning the Github repository that contains the Lovelace source code. [[View]](/#cloning-the-repository-and-starting-the-installation)
2020
- Knowing the functionality of the files and directories found within the cloned repository. [[View]](/#knowing-a-little-more-about-the-contents-of-the-cloned-repository)
21-
- Running the backend server on the network and in production mode with the help of the process manager for NodeJS PM2. [[View]](/#riding-the-lovelace-backend-and-going-geeper-into-it)
21+
- Running the backend server on the network. [[View]](/#riding-the-lovelace-backend-and-going-geeper-into-it)
2222
- Knowing the environment variables that the Lovelace Backend has. [[View]](/#what-about-environment-variables)
2323
- Mounting the Lovelace Frotend built with Vite + React on the network. [[View]](/#setting-up-the-vite--react-application-delving-into-the-client)
2424
- Knowing and modifying the environment variables that the Vite + React application has (Frontend). [[View]](/#modifying-environment-variables)
@@ -38,7 +38,7 @@ Table of Contents:
3838
- Video-based example of the use of the web application on mobile devices. [[View]](https://lovelace-docs.codewithrodi.com/Web-App-Usage#using-the-web-application-on-mobile)
3939

4040
## Before you start the installation
41-
Installing Lovelace on your computer or server is relatively simple, you shouldn't have any major complications in the process; however, before you start cloning the repository, make sure you have at least `NodeJS v18.0.0`, `Python v3.10` and `PM2 with SocketIO Deps [npm install -g @socket.io/pm2 pm2]`.
41+
Installing Lovelace on your computer or server is relatively simple, you shouldn't have any major complications in the process; however, before you start cloning the repository, make sure you have at least `NodeJS v18.0.0` and `Python v3.10`.
4242

4343
Consider that, in case you do not have the required NodeJS version installed on your system, you can use the version manager [`NVM (Node Version Manager)`](https://github.com/nvm-sh/nvm#installing-and-updating).
4444

@@ -71,12 +71,6 @@ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
7171
python3 get-pip.py
7272
```
7373

74-
Next, we will install the necessary dependencies to be able to use PM2 on SocketIO and in the same way we will install the PM2 process manager, consider that this installation has the `-g` parameter, that is, it will be done globally. The mentioned packages that you will install are necessary, you will not be able to run the server in production if you do not have them.
75-
76-
```bash
77-
npm install -g @socket.io/pm2 pm2
78-
```
79-
8074
Now, assuming you have the aforementioned dependencies installed on your system, we can proceed to the next step...
8175

8276
# Cloning the repository and starting the installation
@@ -131,22 +125,18 @@ Let's start with the server, this is where the magic will happen, you can commun
131125
# Accessing the <Server> folder that houses the repository you cloned earlier
132126
cd Server/
133127

134-
# Running the server in Production mode
135-
npm run production
128+
# Running the server...
129+
npm run start
136130
```
137131

138132
If you have done everything correctly, the server should already be running on your system. You can check it if you access `http://0.0.0.0:8000/api/v1/`!
139133

140134
## Other ways to raise the server...
141135

142-
Consider that, when setting up the server in production, `PM2` is used, which is nothing more than a `Process Manager for NodeJS`. It is used in Lovelace due to its built-in load balancer, as well as allowing you to always keep applications active and load them without any downtime, among other advantages in terms of performance. Next, you will have a table with all the scripts you can run using `npm run <script_name>`.
143-
144136
| Script (`npm run <script_name>`) | Description |
145137
| ------ | ------ |
146-
| start | Start the server running normally, you may prefer to use this mode in case you want to make development level changes within the source code regarding the server. |
147-
| production | As previously seen, this mode allows you to mount the server on the network in production mode. |
148-
| stop | It allows turning off the server that was started in production, since, unlike `npm run start`, when executing `npm run production` the process goes to the background, that is, you cannot give a `CTRL + C` to be able to end the execution, otherwise you should use `npm run stop`. |
149-
| restart | Following the same line of the previous script of the "`stop`" table, with `npm run restart` you allow to restart the server that is being executed in production mode. |
138+
| start |The normal execution of the server begins, you can consider this option in case you want to mount it in production. |
139+
| dev | Start the execution of the server in development mode with the help of the "nodemon" package.|
150140

151141
## What about environment variables?
152142
You should know that environment variables are dynamic character values, which allow you to store information related to credentials, configurations, etc..., then you will be presented with the ".env" file located within the server's source code, where in turn you will have a description about the operation of the available variables.

Server/PM2.config.js

-36
This file was deleted.

Server/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
},
1313
"scripts": {
1414
"start": "node Server",
15-
"production": "pm2 start PM2.config.js",
16-
"stop": "pm2 stop PM2.config.js",
17-
"restart": "pm2 restart PM2.config.js"
15+
"dev": "nodemon Server"
1816
},
1917
"dependencies": {
18+
"nodemon": "^3.0.1",
2019
"compression": "^1.7.4",
2120
"cors": "^2.8.5",
2221
"dotenv": "^16.3.1",

0 commit comments

Comments
 (0)