pndash v0.1.4
MudahProniagaDashboard
New Proniaga Dashboard build using React-Redux and Using Proapi as API backend
Key Features
Dashboard for PRO Niaga users for them to:
- manage their ads
- purchase premium services
- check for transaction history
- reload credit
- update account profile
- check for pending cheque clearance
- download credit purchase invoices
- create subuser account
Getting Started
There are 3 choices of environment for running the project
OPTION 1: via regress environment (Recommended)
in regress
Setup private npm registry
- npm set registry http://52.76.20.170:4873
- npm adduser --registry http://52.76.20.170:4873
- npm login
- Username: admin
- Password: m1u2d3a4h5
in regress environment mudahmy repository
- Run
make rinfoto getphp apps port,proapi port,pn dashboard varnish portandpn dashboard browsersync port
$ make rinfo
[php_apps_port] - portnumber for the prefork server (php apps)
:
:
:
[proapi_port] - portnumber for proapi
[pn_dashboard_varnish_port] - portnumber for varnish in Proniaga Dashboard
[pn_dashboard_browsersync_port] - portnumber for Browsersync of Proniaga DashboardRun
make paito start up the proapi endpoint serviceRun
printf "cmd:bconf\ncommit:1\nend\n" | nc localhost [trans_port] | grep "newpn\.client\.host"in regress and make sure the proniaga dashboard URL ishttp://regress.mudah.my:[pn_dashboard_varnish_port]
in regress environment MudahProniagaDashboard repository
Clone the MudahProniagaDashboard repository into regress root directory. Once cloned, change directory into the cloned project
Create copy of dev_config_example.js, rename to dev_config.js
Place the ports obtained from mudahmy into the dev_config.js file
module.exports = {
PROAPI_URL: 'http://regress.mudah.my:[proapi_port]/pndash/v1',
SITE_URL: 'http://regress.mudah.my:[php_apps_port]',
SITE_2_URL: 'http://regress.mudah.my:[php_apps_port]',
CHAT_URL: 'https://chatweb-pergi.mudah.my',
ERROR_URL: 'https://proniaga.regress.mudah.my:3000/error/log',
PNDASH_VARNISH: [pn_dashboard_varnish_port],
PNDASH_BROWSERSYNC: [pn_dashboard_browsersync_port]
};Run
npm installRun
npm run devstartto start the dashboard serviceDelete
conf/bconf/bconf.txt.site.in, if you are moving from local macOS to regress server.
OPTION 2: via local macOS machine
in regress environment mudahmy repository
- Run
make rinfoto getphp apps port,proapi port,pn dashboard varnish portandpn dashboard browsersync port
$ make rinfo
[php_apps_port] - portnumber for the prefork server (php apps)
:
:
:
[proapi_port] - portnumber for proapi
[pn_dashboard_varnish_port] - portnumber for varnish in Proniaga Dashboard
[pn_dashboard_browsersync_port] - portnumber for Browsersync of Proniaga DashboardRun
make paito start up the proapi endpoint serviceRun
cp conf/bconf/bconf.txt.regress.local.in.example conf/bconf/bconf.txt.regress.local.into set local regress bconfCommented below line on
conf/bconf/bconf.txt.site.in, to prevent slowest on controlpanel edit store profile checking the chat info*.*.common.chat_server.chat.host=https://chat.mudah.my
Modify the content in
bconf.txt.regress.local.inso that the conf*.*.common.newpn.client.host=http://proniaga.regress.mudah.my:%REGRESS_PNDASH_VARNISH_PORT%/is set in the fileRun
make rbfor the conf to take effectRun
printf "cmd:bconf\ncommit:1\nend\n" | nc localhost [trans_port] | grep "newpn\.client\.host"in regress and make sure the proniaga dashboard URL ishttp://proniaga.regress.mudah.my:[pn_dashboard_varnish_port]
in mac machine
You will need to have node.js installed. On macOS, node.js can be installed via Homebrew. In the terminal type
$ brew install nodecommand to install NodeOR
via downloading node installation package from https://nodejs.org/en/download/
To check the Node and NPM version.
$ node -v$ npm -vAdd host entry in
/etc/hosts127.0.0.1 proniaga.regress.mudah.mysetup private npm registry
- npm set registry http://52.76.20.170:4873
- npm adduser --registry http://52.76.20.170:4873
- npm login
- Username: admin
- Password: m1u2d3a4h5
in mac machine MudahProniagaDashboard repository
Clone the MudahProniagaDashboard repository in
~/Desktopdirectory. Once cloned, change directory into the cloned projectCreate copy of dev_config_example.js, rename to dev_config.js
Place the ports obtained from mudahmy into the dev_config.js file
module.exports = {
PROAPI_URL: 'http://regress.mudah.my:[proapi_port]/pndash/v1',
SITE_URL: 'http://regress.mudah.my:[php_apps_port]',
SITE_2_URL: 'http://regress.mudah.my:[php_apps_port]',
CHAT_URL: 'https://chatweb-pergi.mudah.my',
ERROR_URL: 'https://proniaga.regress.mudah.my:3000/error/log',
PNDASH_VARNISH: [pn_dashboard_varnish_port],
PNDASH_BROWSERSYNC: [pn_dashboard_browsersync_port]
};Run
npm installRun
npm run devstartto start the dashboard service
OPTION 3: via docker container
Can build development env using ./Dockerfile
./docker directory contains docker-compose file with EFK log server stack
There is a separate docker image DevDockerfile for developer
Build docker image once.
docker build -t pndashimg -f ./DevDockerfile .Run container using
pndashimgdocker imagedocker run -v ~/Desktop/MudahProniagaDashboard:/usr/src/app/pndash -p 3000:3000 -it --name pndashcon -d -t pndashimgAdd host entry in /etc/hosts
127.0.0.1 proniaga.regress.mudah.mySSH into container
docker exec -it pndashcon bashcd pndashnpm run devstart
Staging Build
Run
npm installRun
npm run clean-distto clean any previous build filesConfigure
webpack.config.staging.jsif neededRun
npm run build-stagingto build production ready files in./distdirectory
Production Build
Run
npm installConfigure
webpack.config.prod.jsif neededRun
npm run clean-distto clean any previous build filesRun
npm run buildto build production ready files in./distdirectoryJavaScript list and other error may show. In that case build without list test
Deployment
Log server:
In directory ./docker configure .env file like example.env
docker-compose -f ./docker-compose-efk-only.yml up --build -d
App server:
In directory ./docker configure .env file like example.env
docker-compose up --build -d
5 years ago