Tethys Platform
Table Of Contents
Table Of Contents

Production Installation

Last Updated: June 2017

This article will provide an overview of how to install Tethys Portal in a production setup ready to host apps. Currently production installation of Tethys is only supported on Linux. Some parts of these instructions are optimized for Ubuntu 16.04, though installation on other Linux distributions will be similar.

1. Install Tethys Portal

Follow these steps to install Tethys Portal with the following considerations

  • Make sure to install the correct version.

  • Assign strong passwords to the database users.

  • You must edit the portal_config.yml file to ensure production settings (i.e. DEBUG: False, etc.)

  • Optionally, Follow the Distributed Configuration instructions to install Docker and the components of the software suite on separate servers.

a) Install with Conda

To install tethys-platform into a new conda environment then run the following commands:

conda create -n tethys -c tethysplatform -c conda-forge tethys-platform
conda activate tethys

Some of the following steps are dependent on the specific distribution where tethys-platform is installed.

  • Install Supervisor (See http://supervisord.org/installing.html)

  • Install NGINX (See https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)

  • Optionally, install Docker (See https://docs.docker.com/v17.09/engine/installation/)

  • Create portal_config.yml:

    $ tethys gen portal_config
    
  • Set allowed hosts:

    $ tethys settings --set ALLOWED_HOSTS "<ALLOWED_HOST>"
    
  • Set database parameters:

    $ tethys settings --set DATABASES.default.USER <TETHYS_DB_USERNAME> --set DATABASES.default.PASSWORD <TETHYS_DB_PASSWORD> --set DATABASES.default.PORT <TETHYS_DB_PORT> --set DATABASES.default.DIR <TETHYS_DB_DIR>
    
  • Disable Debug:

    $ tethys settings --set DEBUG False
    
  • Install PostgresSQL

    1. Manual installation: See https://www.postgresql.org/download/

    2. Docker Alternative (requires previous Docker installation): Get Postgres Docker image with the PostGIS extension from https://hub.docker.com/r/mdillon/postgis/

    Tip

    the tethys Docker command can be used to get the Postgress Docker image

    $ tethys docker init -c postgis
    
  • Setup Tethys database:

    $ tethys db configure --username <TETHYS_DB_USERNAME> --password <TETHYS_DB_PASSWORD> --superuser-name <TETHYS_DB_SUPER_USERNAME> --superuser-password <TETHYS_DB_SUPER_PASSWORD> --portal-superuser-name <TETHYS_SUPER_USER> --portal-superuser-email '<TETHYS_SUPER_USER_EMAIL>' --portal-superuser-pass <TETHYS_SUPER_USER_PASS>
    

    Tip

    The postgres password from the Docker container is needed to configure the database with a Docker or a local install.

    $ PGPASSWORD="<POSTGRES_PASSWORD>" tethys db configure --username <USERNAME> --password <TETHYS_DB_PASSWORD> --superuser-name <TETHYS_DB_SUPER_USERNAME> --superuser-password <TETHYS_DB_SUPER_PASSWORD> --portal-superuser-name <TETHYS_SUPER_USER> --portal-superuser-email '<TETHYS_SUPER_USER_EMAIL>' --portal-superuser-pass <TETHYS_SUPER_USER_PASS>
    
  • Generate NGINX AND ASGI templates

    $ tethys gen nginx --overwrite
    $ tethys gen nginx_service --overwrite
    $ tethys gen asgi_service --overwrite
    

Note

If the distribution is Secure Linux, the security policy will also need to be configured.

b) Install with Script

A script to automatically install tethys-platform is provided mainly for development installations. However, this script can also be used for production installations at the developer's discretion.

The script can be downloaded and run from the terminal using the following command:

For systems with wget (most Linux distributions):

wget https://raw.githubusercontent.com/tethysplatform/tethys/master/scripts/install_tethys.sh
bash install_tethys.sh -b master --production

For Systems with curl (e.g. Mac OSX and CentOS):

curl https://raw.githubusercontent.com/tethysplatform/tethys/master/scripts/install_tethys.sh -o ./install_tethys.sh
bash install_tethys.sh -b master --production

Note

See Developer Installation for more detailed instructions about the script and its options.

2. Customize Production Settings

The internet is a hostile environment and you need to take every precaution to make sure your Tethys Platform installation is secure. There are several settings in the portal_config.yml file that should be added for a production environment. Django provides a Deployment Checklist that points out critical settings. You should review this checklist carefully before launching your site. Follow the process described below to review and edit settings. Only a few examples are included here, but be sure to review and update any settings that are needed to provide a secure production server environment.

Open the portal_config.yml module for editing using vim or another text editor:

sudo vim $TETHYS_HOME/portal_config.yml

Press i to start editing and change settings as necessary for your production environment. Some settings you may want to customize include:

  1. Social authentication settings

If you wish to enable social authentication capabilities in your Tethys Portal, follow the Social Authentication instructions.

  1. Email settings

    If you would like to enable resetting passwords then an email server needs to be configured. See the next section for details.

Press ESC to exit INSERT mode and then press :x and ENTER to save changes and exit.

Important

Review the Django Deployment Checklist carefully.

3. Setup Email Capabilities (optional)

Tethys Platform provides a mechanism for resetting forgotten passwords that requires email capabilities, for which we recommend using Postfix. Install Postfix as follows:

sudo apt-get install postfix

When prompted select "Internet Site". You will then be prompted to enter you Fully Qualified Domain Name (FQDN) for your server. This is the domain name of the server you are installing Tethys Platform on. For example:

foo.example.org

Next, configure Postfix by opening its configuration file:

sudo vim /etc/postfix/main.cf

Press i to start editing, find the myhostname parameter, and change it to point at your FQDN:

myhostname = foo.example.org

Find the mynetworks parameter and verify that it is set as follows:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

Press ESC to exit INSERT mode and then press :x and ENTER to save changes and exit. Finally, restart the Postfix service to apply the changes:

sudo service postfix restart

Several email settings need to be configured for the forget password functionality to work properly. The following exampled illustrates how to setup email in the portal_config.yml file.

EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST: localhost
EMAIL_PORT: 25
EMAIL_HOST_USER: ''
EMAIL_HOST_PASSWORD: ''
EMAIL_USE_TLS: False
DEFAULT_FROM_EMAIL: Example <noreply@exmaple.com>

For more information about setting up email capabilities for Tethys Platform, refer to the Sending email documentation.

For an excellent guide on setting up Postfix on Ubuntu, refer to How To Install and Setup Postfix on Ubuntu 14.04.

5. Install Apps

Download and install any apps that you want to host using this installation of Tethys Platform. For more information see: Installing Apps in Production.

Tip

Troubleshooting: If you are experiencing problems please search for a solution or post a question on the Tethys Platform Forum.