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:

Configuration of the main DB

HTML Pages

Notice the HTML pages checkbox. If this checkbox is omitted, the button for the web application will not appear in the lateral menu

3.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.

Dictionaries of the DB

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:

Connection group example

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:

Configuration of DB access in connection group

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.

Acces via the lateral button in Studio

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:

  1. Inside the user axional, create a folder for the project (in this example deister-pos).
    Copy
    mkdir deister-pos
    cd deister-pos
    cat > package.json < < 'END'
    {
        "name": "my-pos-production",
        "dependencies": {
            "@axional/axional-apps-pos-server": "latest"
        }
    }
    END
  2. Authenticate the current host/user into the Nexus3 NPM repository:
    Copy
    npm login --scope=@axional --registry=http://nexus3.deistercloud.com/repository/npm-private/
    For the credentials (user and pswd), please contact Deister.
  3. Finally, install the application:
    Copy
    npm install
  4. 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
  5. 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
    };
    Change the BACKENDURL and the DB_CODE to the URL and Databse of the installation. Change as well the API_VERSION that will be used. The file pos_config.ecom.js contains the followin lines:
    Copy
    vi pos_config.ecom.js
    module.exports = {
    	backendUrl		: 'BACKEND_URL',
    	database		: 'DB_CODE',
    	apiVersion		: API_VERSION,
    	ecomUser		: 'USER',
    	ecomPassword	: 'PASSWORD'
    };
    In this file, change the BACKEND_URL, the DB_CODE, the API_VERSION as done with the previous file. The parameters USER and PASSWORD are the credentials that all the customers of the ECOM application will use to connect to the DB.
  6. 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).

  1. Log in with the user axional
  2. Go to the folder thta was created during installation
    Copy
    cd /home/axional/node-pos
  3. 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:

Copy
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:

Copy
pm2 log <id>
pm2 status [all, <id>]
pm2 stop [all, <id>]
pm2 start [all, <id>]
pm2 restart [all, <id>]

External URL

To access the application with an external URL (i.e. 'https://www.myweb.com') please contact your Tech support team.