==============================
How to enable Reseller feature
==============================
.. contents:: :local:
.. _enable-reseller-feature:
How to enable reseller feature in docker deployment
===================================================
In order to enable the reseller feature when you have installed Fleio using the Docker deployment method you will have to:
1. Change the ``FLEIO_ENABLE_RESELLER=0`` to ``FLEIO_ENABLE_RESELLER=1`` environment variable in the ``/home/fleio/compose/.env`` file.
.. warning::
If you don't have variable in the ``/home/fleio/compose/.env`` file, you need to add it at the end of the file.
2. Enable the ``billing.reseller`` feature in the settings.py file:
.. code-block:: bash
fleio edit settings.py
Add ``STAFF_FEATURES['billing.reseller'] = True`` at the end of the file.
3. Save, exit and restart Fleio by pressing ``Y``.
4. Run ``fleio recreate``.
This will recreate all the Fleio containers, and it will include the nginx configuration that is needed for the reseller frontend.
If you're upgrading from 2021.02 or lower (docker deployment), you also need to create and configure the reseller.config.json file.
First we will copy the reseller configuration file from a templated file located
at `/var/webapps/fleio/frontend/reseller/assets/config-templates/reseller-template.config.json`
.. code-block:: bash
sudo su fleio && cd /home/fleio/compose
docker-compose exec -T frontend cp /var/webapps/fleio/frontend/reseller/assets/config-templates/reseller-template.config.json /var/webapps/fleio/frontend/reseller/assets/config/reseller.config.json
Then we will configure the Fleio backend URL:
.. code-block:: bash
fleio edit reseller.config.json
Replace `localhost:8000` with `your-fleio-frontend-url.tld/backend/`.
The reseller frontend panel should now be available at `your-fleio-frontend-url.tld/reseller`.
How to enable the reseller feature (package installation)
=========================================================
Enable reseller feature
-----------------------
In order to enable the reseller feature you must set the ``billing.reseller`` feature to ``True`` in settings.py file.
You can do that by adding the following line at the end of the settings.py file
.. code-block:: bash
STAFF_FEATURES['billing.reseller'] = True
For more information see :doc:`advanced settings file `.
Edit nginx configuration
------------------------
Next step would be edit the nginx configuration. Depending on your operating system, you might need to edit
``/etc/nginx/sites-enabled/your-site.conf`` if you're using Ubuntu or ``/etc/nginx/conf.d/your-site.conf``
if you're using CentOS.
If you initially installed Fleio before version 2020.05 the ``/reseller`` nginx configuration section might look differently
or might be totally missing in nginx config. Add the code below.
.. code-block:: none
location /reseller {
alias /var/webapps/fleio/frontend/reseller/;
expires -1;
try_files $uri $uri/ /../reseller/index.html;
}
Restart services
----------------
The last step is to restart Fleio services (see :ref:`restart-fleio`) and to reload the nginx service:
.. code-block:: bash
service nginx reload
Upgrading Fleio from 2019.10.0 or lower
=======================================
If you're upgrading from 2019.10.0 or lower you will also need to run the following commands:
.. code-block:: bash
cp /var/webapps/fleio/frontend/reseller/assets/config-templates/reseller-template.config.json /var/webapps/fleio/frontend/reseller/assets/config/reseller.config.json
sed 's|"backendApiUrl": "//localhost:8000/resellerapi|"backendApiUrl": "//REPLACE-ME/backend/resellerapi|' -i /var/webapps/fleio/frontend/reseller/assets/config/reseller.config.json
sed 's|||' -i /var/webapps/fleio/frontend/site/reseller/index.html
Please replace "REPLACE-ME" with your domain configured at bootstrapping.
The last step is to restart Fleio services (see :ref:`restart-fleio`) and to reload the nginx service:
.. code-block:: bash
service nginx reload