For Bahaa and Khaleed.
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-server
Set the default node version to the one installed.
nvm alias default v10.x.x
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-8
yum install git
Clone the repository
git clone https://github.com/daud99/ExamByPass.git
(The repo might be somewhere else as well)
Code will be downloaded to:
/var/ExamByPass
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
Pull and update dependencies
cd server
npm install
cd ..
cd client
npm install
Compile webpack/GUI front end for production
npm install
npm run build
This will store the minified front end in the server/public folder and you will not be needing the client folder anymore.
Navigate to /config
directory.
cd config
Change site URL
nano site.js
or vi site.js
Change the URL to the public URL, and save the file.
NOTE: The config may get replaced when
git pull
is applied. It happens when the updated code is related to configuration.
There are a lot of other configuration files such as stripe, parser, and smtp. Depending on the situation, they may need updates.
Place your production keys respectively by generating them from the facebook and google developer console respectively in the keys.js file.
Change the parser URL in the parser.js file respectively
DB configuration will be placed in db.js file
Install PM2
npm install pm2@latest -g
Start the process in background
pm2 start app.js (make sure youre in the code directory)
Register process on startup
pm2 startup systemd
Navigate to http://<your-url>/
and test out the following basic features:
- Login and session maintainance
- Database store/retreive (Try users section)
- Parser connection (Try agents, groups section)
- Email sending (Try forgot password feature)
The code can be updated to the git repository master branch. Whenever the update needs to be reflected to the production server.
- Perform a
git pull
on the code directory - In case there's a conflict or update in
git pull
, try: https://stackoverflow.com/a/2798934/673606 2a. In case of a hard reset, make sure you reconfigure the SocDash - Perform
npm install
incase a new package was added - Perform
npm run build
if the UI was changed - Restart the process:
pm2 restart app.js
cd server
npm install
npm start
cd client
npm install
npm start
By above way we will be able to test both node and vue running on single port 3000
cd client
npm install
npm run build