How to install reseller frontend

After you configure the Fleio backend as described in How to configure Fleio in order to sell reseller packages you will need to also configure the reseller’s frontend. For this, you need to install nginx and fleio-frontend.

Depending on the OS distribution, you need to run the following commands:

Centos

Install nginx

yum install nginx
systemctl enable nginx

Install fleio-frontend

yum install https://repos.fleio.com/rhel/7/fleio-release-1-2.el7.noarch.rpm
yum install fleio-frontend

Ubuntu 16

Install nginx

apt-get install nginx

Install fleio-frontend

apt-get install curl software-properties-common apt-transport-https
curl  https://repos.fleio.com/public.key | apt-key add -
add-apt-repository "deb [arch=amd64] https://repos.fleio.com/ubuntu xenial main"
apt-get install fleio-frontend

Ubuntu 18

Install nginx

ubuntu: apt-get install nginx

Install fleio-frontend

apt-get install curl software-properties-common apt-transport-https
curl  https://repos.fleio.com/public.key | apt-key add -
add-apt-repository "deb [arch=amd64] https://repos.fleio.com/ubuntu bionic main"
apt-get install fleio-frontend

After installing the webserver (nginx) and the frontend you need to configure them.

Nginx configuration

Create a new configuration file using the reseller’s domain. In our example we will use reseller-domain.tld, but keep in mind that this is not fixed and needs to be adjusted for each reseller.

ubuntu 16 and ubuntu 18: touch /etc/nginx/sites-enabled/reseller-domain.tld.conf
centos: touch /etc/nginx/conf.d/reseller-domain.tld.conf

Open the /etc/nginx/sites-enabled/reseller-domain.tld with your preferred text editor and insert the following configuration

server {
    listen      80;
    client_max_body_size 5000m;
    #EDIT HERE
    server_name reseller-domain.tld;

    location /images {
        alias /var/webapps/fleio/frontend/site/images/;
        break;
    }

    location /js {
        alias /var/webapps/fleio/frontend/site/js/;
        expires max;
        break;
    }

    location /vendor {
        alias /var/webapps/fleio/frontend/site/vendor/;
        expires max;
        break;
    }

    location /styles {
        alias /var/webapps/fleio/frontend/site/styles/;
        expires max;
        break;
    }

     location /reseller {
         root /var/webapps/fleio/frontend/site/;
         expires -1;
         try_files $uri $uri/ /reseller/index.html;
     }

    location /staff {
        alias /var/webapps/fleio/frontend/site/staff/;
    return 301;
        expires -1;
        try_files $uri $uri/ /staff/index.html;
    }


    location / {
        alias /var/webapps/fleio/frontend/site/;
        expires -1;
        try_files $uri $uri/ /index.html;
    }
}

Fleio frontend configuration

Since we installed just fleio-frontend you need to manually set in place the configuration files. First of all you need to run the following commands:

cp /var/webapps/fleio/frontend/site/template_constants.js /var/webapps/fleio/frontend/site/constants.js

Change the api_url to the backend url that we configured at Add nginx configuration

/var/webapps/fleio/frontend/site/constants.js
var user_config = {
  api_url: 'http://{{ backend url }}/backend/api',
  ...

/var/webapps/fleio/frontend/site/reseller/assets/config/reseller.config.json
...
"backendApiUrl": "//{{ backend url }}/backend/resellerapi/"
...

The last step would be configure the reseller ID in the constants.js file. Please see Force newly registered users to be created under a reseller