README
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 rinfo
to getphp apps port
,proapi port
,pn dashboard varnish port
andpn 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 Dashboard
Run
make pai
to 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 install
Run
npm run devstart
to 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 rinfo
to getphp apps port
,proapi port
,pn dashboard varnish port
andpn 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 Dashboard
Run
make pai
to start up the proapi endpoint serviceRun
cp conf/bconf/bconf.txt.regress.local.in.example conf/bconf/bconf.txt.regress.local.in
to 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.in
so that the conf*.*.common.newpn.client.host=http://proniaga.regress.mudah.my:%REGRESS_PNDASH_VARNISH_PORT%/
is set in the fileRun
make rb
for 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 node
command to install NodeOR
via downloading node installation package from https://nodejs.org/en/download/
To check the Node and NPM version.
$ node -v
$ npm -v
Add host entry in
/etc/hosts
127.0.0.1 proniaga.regress.mudah.my
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 mac machine MudahProniagaDashboard repository
Clone the MudahProniagaDashboard repository in
~/Desktop
directory. 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 install
Run
npm run devstart
to 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
pndashimg
docker imagedocker run -v ~/Desktop/MudahProniagaDashboard:/usr/src/app/pndash -p 3000:3000 -it --name pndashcon -d -t pndashimg
Add host entry in /etc/hosts
127.0.0.1 proniaga.regress.mudah.my
SSH into container
docker exec -it pndashcon bash
cd pndash
npm run devstart
Staging Build
Run
npm install
Run
npm run clean-dist
to clean any previous build filesConfigure
webpack.config.staging.js
if neededRun
npm run build-staging
to build production ready files in./dist
directory
Production Build
Run
npm install
Configure
webpack.config.prod.js
if neededRun
npm run clean-dist
to clean any previous build filesRun
npm run build
to build production ready files in./dist
directoryJavaScript 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