1 Installation considerations

When the module is going to be installed together with existing modules (IGES,ICON...), it is necessary to consider the possibility of carrying out a separate installation. Even though it is a lightweight application, this makes it possible not to put the ERP operating database (management, accounting) at risk.
When performing a separate installation, the data on one side and the other must be synchronized.
- The ERP will provide the catalog of products, prices and rates, as well as the clients and their respective rates.
- The POS module will provide the tickets made, cash audits and new customers.
2 Requirements
- Studio
- Database
- Redis
- Terminals
- Printers
- Cashdrawers
3 Database configuration (wic_conf)
After the installation of the Studio and the wic_conf, the databases must be configured correctly. In this example, the dictionary databases are wic_epos
, wic_ecom
and wic_eproducts
(for the POS and ECOM module respectively).
These databases will be dictionaries of our database (in this example demo_epos
).
3.1 Database parameters
The database demo_epos
must have a certain configuration (Redis, HTML, dictionaries, etc.) for it to work as expected. For the Redis configuration, please go to Redis Configuration section.
The configuration of the main DB must remain as seen in the image below:
HTML Pages
Notice the HTML pages checkbox. If this checkbox is omitted, the button for the web application will not appear in the lateral menu3.1.1 Database dictionaries
In the database object, one must go into the tab Dictionaries. There, the dictionary wic_epos
, wic_ecom
and wic_eproducts
must be inserted into the object.
3.2 Users parameters
The users must belong to a connection group, and this connection group must be granted access to the Database in order to be able to transact with it.
3.2.1 Connection group
First, a connection group must be created from the wic_conf
, as in the example below:
Once the connection gorup is created, one can create a new user and link it to the recently created connection group.
3.2.2 Connection group and DB access
Now, the connection group is created, as well as the user. To see the database demo_epos
when accessing the Studio
, and being able to operate with it, access to it must be granted from the wic_conf
.
To give access to the newly created connection group, one must go to the object of the connection group, and into the tab Databases. In this tab, one must configure the new Database demo_epos
as below:
API
The API resource checkbox is the one that will allow us to operate with the web application. If this checkbox is not selected, then the user will see the applicaiton, but will not be able to open it.4 Access via studio
By selecting the option HTML pages in the configuration of the main DB, the web application will be available from the right menu in the Studio main page. Make sure the user has API premissions. If not, then activate them as seen above in the Connection group configuration.
5 Access via Node.js server
Using a Node.js server one can as well access the application if wanted. To do this, the process is slightly different than just granting permissions in the Database.
The server is composed of a .jar application, pulled from a Nexus repository, served by a Node.js server (in the machine that will be used as the server).
All the parameters for the applicaiton to run in a Node.js server are stored in the application itself.
5.1 Node server installation
Prerequisites
Node and npm must be installed in the system. If they are not, please install them before proceeding.
To install the server in the machine, one has to follow the following steps:
-
Inside the user axional, create a folder for the project (in this example
deister-pos
).
Copymkdir deister-pos cd deister-pos cat > package.json < < 'END' { "name": "my-pos-production", "dependencies": { "@axional/axional-apps-pos-server": "latest" } } END
-
Authenticate the current host/user into the Nexus3 NPM repository:
Copynpm login --scope=@axional --registry=http://nexus3.deistercloud.com/repository/npm-private/
-
Finally, install the application:
Copy
npm install
-
Then configure the application with default value:
Copy
cp node_modules/@axional/axional-apps-pos-server/*.config.*.js . mv pos.config.ecom.sample.js pos.config.ecom.js mv pos.config.shop.sample.js pos.config.shop.js mv ecosystem.config.sample.js ecosystem.config.js
-
Then modify the files pos_config.ecom.js and pos_config.shop.js, as follows.
The file pos_config.shop.js contains the following lines:
Copy
vi pos_config.shop.js module.exports = { backendUrl : 'BACKEND_URL', database : 'DB_CODE', apiVersion : API_VERSION };
Copyvi pos_config.ecom.js module.exports = { backendUrl : 'BACKEND_URL', database : 'DB_CODE', apiVersion : API_VERSION, ecomUser : 'USER', ecomPassword : 'PASSWORD' };
-
Globally install pm2 (https://pm2.keymetrics.io/) to run the applications (may require root access):
Copy
npm install pm2@latest -g
Once this process is followed, the application is already installed in the system and the only thing left to do is to run it (Section Run the application)
5.1.1 Update the application
In order to update the application, one must sstablish an SSH connection with the machine where the server is (the same where it was installed).
- Log in with the user axional
-
Go to the folder thta was created during installation
Copy
cd /home/axional/node-pos
-
Update the existing repositroy using the following command:
Copy
npm install -s --save @axional/axional-apps-pos-server@latest
5.2 Run the application
In order to run the application we'll use the package pm2, which will monitor the application.
To start the application run:
pm2 start ecosystem.config.js
-------------
__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
_\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
_\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
_\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
_\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
_\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
_\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
_\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
_\///______________\///______________\///__\///////////////__
Runtime Edition
PM2 is a Production Process Manager for Node.js applications
with a built-in Load Balancer.
Start and Daemonize any application:
$ pm2 start app.js
Load Balance 4 instances of api.js:
$ pm2 start api.js -i 4
Monitor in production:
$ pm2 monitor
Make pm2 auto-boot at server restart:
$ pm2 startup
To go further checkout:
http://pm2.io/
-------------
[PM2] Spawning PM2 daemon with pm2_home=/home/axs/.pm2
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications axional-apps-pos-ecom, axional-apps-pos-shop not running, starting...
[PM2] App [axional-apps-pos-ecom] launched (1 instances)
[PM2] App [axional-apps-pos-shop] launched (1 instances)
┌─────┬──────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼──────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ axional-apps-pos-ecom │ default │ 0.0.39 │ fork │ 20414 │ 0s │ 0 │ online │ 0% │ 12.8mb │ axs │ disabled │
│ 1 │ axional-apps-pos-shop │ default │ 0.0.39 │ fork │ 20420 │ 0s │ 0 │ online │ 0% │ 11.0mb │ axs │ disabled │
└─────┴──────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Now the application is running in the port specified in the ecosystem.config.js file. Each application (ECOM
and POS
) have their specific port specified in the aforementioned file.
There are several other commands that pm2 supports, like:
pm2 log <id> pm2 status [all, <id>] pm2 stop [all, <id>] pm2 start [all, <id>] pm2 restart [all, <id>]