bPortal is a SuiteCRM portal written using django project.
This document describes how to install bPortal on a virtualmin server. This guide is based on Ubuntu 16.04 environment.
The folliwing dependences are needed to run bPortal. You can install all dependences with:
sudo apt-get install libapache2-mod-wsgi-py3 gettext git
It’s recommended to use virtualenv and pip packages to manage Python dependences. You can install both dependences with:
sudo apt-get install virtualenv python-pip
Once you have virtualenv and pip tools ready it’s time to prepare the virtual environment to run the application.
Following we create a virtual environment and install all Python dependencies:
cd bPortal
virtualenv env
source env/bin/activate
pip install -r requirements.txt
pip install -r suitepy/requirements.txt
deactivate
Go to home directory of the virtualserver in which the portal will be installed and clone the repository of bPortal with:
git clone --recursive https://github.com/sanchezfauste/bPortal.git
If bPortal/custom_settings.py config file does not exist then create it with:
cp bPortal/custom_settings.py.sample bPortal/custom_settings.py
After, edit bPortal/custom_settings.py file and set the following parameters conveniently:
ALLOWED_HOSTS list of IPs and servernames on which the portal must listen.SECRET_KEY a random generated key (do not share this key). By example: ceigohhaihohm0eam7ielei1Vie4ea9u.EMAIL_HOST SMTP server used to send automatic emails.EMAIL_PORT SMTP port.EMAIL_HOST_USER SMTP user.EMAIL_HOST_PASSWORD SMTP password.EMAIL_USE_TLS left it to True if TLS is gone to be used. Otherwise set it as False.DEFAULT_FROM_EMAIL specify FROM used when sending emails.Configuration of SuiteCRM instance that will be connected to the portal.
It is recommended to create a new user used exclussively to interact with the portal.
Create suitepy/suitepy.ini file using the following template. Replace the API credentials given as example by the ones that you are going to use:
[SuiteCRM API Credentials]
url = https://example.org/service/v4_1/rest.php
username = api
password = 123456
application_name = SuitePY
verify_ssl = True
The following dependences are needed by the portal app to connect to the MySQL database. You can install the dependences with:
sudo apt-get install libmysqlclient-dev python-dev
source env/bin/activate
pip install mysqlclient
deactivate
If mysql_config.cnf config file does not exist then create it with:
cp mysql_config.cnf.sample mysql_config.cnf
After, edit mysql_config.cnf with your MySQL connection settings.
Finally create the DB structure with:
source env/bin/activate
python manage.py migrate
deactivate
Create a supperuser account to manage the portal configuration:
source env/bin/activate
python manage.py createsuperuser
deactivate
You have to compile static files and translations. You can do it running the following commands inside bPortal directory:
source env/bin/activate
python manage.py collectstatic
./compile_messages.sh
deactivate
Modify /etc/apache2/sites-available/{virtualserver}.conf file and add the following parameters:
WSGIDaemonProcess {virtualserver_user} user={virtualserver_user} python-path=/home/{virtualserver_home}/public_html/bPortal python-home=/home/{virtualserver_home}/public_html/bPortal/env
WSGIProcessGroup {virtualserver_group}
WSGIScriptAlias / /home/{virtualserver_home}/public_html/bPortal/bPortal/wsgi.py
Alias /static /home/{virtualserver_home}/public_html/bPortal/static
Comment/remove DocumentRoot directive.
If you have SSL enabled you can redirect HTTP requests to HTTPS setting the following directive to the configuration of port 80:
Redirect permanent / https://{virtualserver_domain}/
Finally reload apache2 configuration with:
service apache2 reload
If you are planning to use the portal with a Let’s Encrypt certificate you need to add the following rule in the virtualserver configuration, so Let’s Encrypt can validate the certificate correctly.
Alias /.well-known/acme-challenge/ /home/{virtualserver_home}/public_html/.well-known/acme-challenge/