Last Updated: May 2020
Installing apps in a Tethys Portal configured for production can be challenging. Most of the difficulties arise, because Tethys is served by NGINX in production and all the files need to be owned by the NGINX user. The following instructions for installing apps in a production environment are provided to aid administrators of Tethys Portals.
conda activate tethys
Create the APP_SOURCES_ROOT directory that you decided on in the preparation section. We recommend creating this directory somewhere in the default web directory of the server (e.g.
sudo mkdir -p <APP_SOURCES_ROOT> sudo chown $USER <APP_SOURCES_ROOT>
You will need to copy the source code of the app to the server. There are many methods for accomplishing this, but one way is to create a repository for your code in GitHub, BitBucket, or another Git repository. To download the source from a Git repository, change into the app directory and then clone it as follows:
cd <APP_SOURCES_ROOT>sudo git clone <CLONE_URL>
<CLONE_URL>with the URL for your repository. These URLs generally look something like this:
Execute the install command in the app directory to make Python aware of the app and install any of its dependencies:
Installing your app in development mode on a production server (i.e.:
tethys install -dor
pip install -e .) is not recommended. Doing so has implications on file permissions that are not accounted for in these instructions. Do so at your own risk.
Application Installation for more information on the installation process.
You will need to collect the workspaces and static files from the new app to the
TETHYS_WORKSPACES_ROOT directories. This is easily done using the
collectall command. However, you will need to change ownership the
TETHYS_WORKSPACES_ROOT directories to your user before you can successfully run
collectall. Don't forget to change ownership of these files back to the
NGINX_USER after you are done.
Change the Ownership of Files to the Current User
sudo chown -R $USER <STATIC_ROOT> sudo chown -R $USER <TETHYS_WORKSPACES_ROOT>
TETHYS_WORKSPACES_ROOTwith the paths to the directories you set up in the Static and Workspaces Directories step.
tethys manage collectall
Change the Ownership of Files Back to the NGINX User
sudo chown -R <NGINX_USER>: <STATIC_ROOT> sudo chown -R <NGINX_USER>: <TETHYS_WORKSPACES_ROOT>
If you setup the shortcuts earlier, you can use them now to make installation of new apps a little easier (see: 2. Setup Shortcuts for Changing Permissions (Optional)):
Restart ASGI and NGINX services to effect the changes:
sudo supervisorctl restart all
Set any additional required settings on the app settings page in the Tethys Portal admin pages (see Admin Pages > Tethys Apps).
If your app requires a database via the persistent stores API, you will need to initialize it:
tethys syncstores all