How to move the Fleio installation to a new URL

You have already installed Fleio and you want to change the URL, maybe for adding an SSL certificate. Here’s how to do it.

The following steps have been tested on an Ubuntu 18.04 install, assume you have filled in the 12.34.56.78 address when running bootstrap:

* Install Fleio at URL [http://12.34.56.78]:

and you are logged in as root.

So URL http://12.34.56.78 was filled in all the settings and you want to change the URL to http://mydomain.

1. Change the nginx config file name

cd /etc/nginx/sites-enabled/
mv 12.34.56.78.conf mydomain.conf

2. Change server name in nginx config

Edit the nginx conf file:

nano mydomain.conf
# change the server_name 12.34.56.67; directive to:
server_name mydomain;

Save, exit the editor, then restart the nginx service:

systemctl restart nginx

3. Change allowed hosts and frontend URL in Fleio backend settings

# edit backend settings
nano /var/webapps/fleio/project/fleio/settings.py
# change ALLOWED_HOSTS. You can also have a list of domains if needed: '
ALLOWED_HOSTS = ['mydomain']
# change FRONTEND_URL to
FRONTEND_URL = 'mydomain'

Optionally, if you have the Fleio frontend on another domain or if you have multiple frontends, each with another domain, you must also uncomment these lines in settings.py and add all the domains to CORS_ORIGIN_WHITELIST:

# NEW_MIDDLEWARE = list(MIDDLEWARE)
# NEW_MIDDLEWARE.insert(1, 'corsheaders.middleware.CorsMiddleware')
# MIDDLEWARE = tuple(NEW_MIDDLEWARE)
# CORS_ORIGIN_WHITELIST = (
#    'http://host1',
#    'http://host2',
# )
# CORS_ALLOW_CREDENTIALS = True

Note that since django-cors-headers version 3.0.0 you need to specify an URI scheme for each origin.q

If you have multiple frontends on a single Fleio backend, also edit this section from settings.py:

FRONTEND_URL = 'mydomain'

# The mapping consists of key-value pairs where the key stands for the client_group and the value will be its
# corresponding frontend URL; each client account will be associated with a group or multiple groups through ClientGroup
# For two frontend urls using the same backend the setting will look like:
# FRONTEND_URL_MAPPING = {'client_group1' : 'http://urlexample1.com/', 'client_group2': 'http://urlexample2.com/'}

Save, exit the editor, then restart fleio services:

systemctl restart uwsgi
systemctl restart fleio
systemctl restart celery

4. Change backend API URL in frontend settings

Edit end-user panel settings:

nano /var/webapps/fleio/frontend/site/constants.js

and change api_url: 'http://12.34.56.78/backend/api' to

api_url: 'http://mydomain/backend/api'

and the same thing for the staff panel:

nano /var/webapps/fleio/frontend/site/staff/constants.js

change api_url: 'http://12.34.56.78/backend/staffapi' to

api_url: 'http://fleio.internal/backend/staffapi',

Your Fleio installation should now work on the new domain.