Wazone Panel and Node.js server INSTALL (VPS + CloudPanel)

REQUIREMENTS:
– Ubuntu server 22.04 or Debian 11 (Others WILL NOT WORK!)
– CloudPanel v2.x
https://www.cloudpanel.io/docs/v2/introduction/
choose “others” if your hosting is not on the list

WAZONE ADMIN PANEL:
– Add sites
Admin panel -> choose PHP Site
Application: Generic (DO NOT choose others!)
Domain Name: admin.mydomain.com
PHP Version: PHP 8.1 (DO NOT choose others!)

– Click “Manage”
Vhost tab edit:
(look for this): try_files $uri $uri/ /index.php?$args;
(replace with this): try_files $uri $uri/ /index.php?$args /public/index.php?$args;

Databases tab: Add Database (please copy the database credentials)

SSL/TLS tab: Actions-> New Let’s Encrypt Certificate

File Manager tab: htdocs -> admin.mydomain.com -> upload wazone-admin-panel.zip -> extract to . (yes, extract to dot “.” is extract to current folder)

start installation by going to admin.mydomain.com (no “/public”) on your browser
Please pay attention to the highlighted text!

CRON JOB:
From Admin panel, open menu “Rest API”, activate license if you have not done so (you might need to de-activate license first from https://visimisi.net/my-account/).

Now we go back to CloudPanel to “Cron Jobs” tab, choose every minute and paste the command below:
php8.1 ~/htdocs/admin.visimisi.net/artisan schedule:run >> /dev/null 2>&1
(Please change admin.visimisi.net to your own admin panel folder)
then click “Add Cron Job” button to save it.

WAZONE NODE.JS SERVER:
– Add sites
Node.js server -> choose Node.js Site


Domain Name: api.mydomain.com
Node.js Version: Node 14 LTS (DO NOT choose others!)
App Port: 8000
Site User: mydomain-api
Site User Password: xxxxxxxxxxxx
We will need this user and password for later, so copy it to somewhere safe.

– Click “Manage”
SSL/TLS tab: Actions-> New Let’s Encrypt Certificate

File Manager tab: htdocs -> delete api.mydomain.com folder -> upload wazone-nodejs-server.zip -> extract to api.mydomain.com


Open/create .env:
APP_URL=https://admin.mydomain.com
NODE_URL=https://api.mydomain.com
APP_PORT=8000
REFRESH_DEVICES=true

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your-database-name
DB_USERNAME=your-database-username
DB_PASSWORD=your-database-password

*correction: NODE_URL=https://api.visimisi.net

– Log in via SSH with your Site User:
ssh mydomain-api@your_public_ip_address
Use the username/password that we saved earlier above (visimisi-api/easy_to_remember_password)

– Go to the root directory of your project:
cd htdocs/api.mydomain.com/

– Install the latest pm2 via npm.
npm install pm2@latest -g

– Use the following command to start your application via pm2:
pm2 start server.js

– To save the pm2 configuration, execute the save command:
pm2 save

– If your setup was correct, you will see a response if you go to: https://api.mydomain.com/info

– To save the pm2 configuration, execute the save command:
pm2 save

– If your setup was correct, you will see a response if you go to: https://api.mydomain.com/info

– To restart the pm2:
pm2 restart all

– For a complete pm2 commands:
https://www.cloudpanel.io/docs/v2/nodejs/deployment/pm2/

Powered by BetterDocs