Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Dependencies #967

Merged
merged 13 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/tethys-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,45 @@ jobs:
conda activate tethys;
echo "Publishing to dev channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/tethys-platform*.tar.bz2 --force;

# BUILD micro-tethys-platform

# Generate Conda Recipe With Constrained Dependencies
- name: Generate Conda Recipe - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
tethys gen metayaml -p minor --micro --overwrite;
# Show Tethys Meta
- name: Show Tethys Meta - micro
run: |
cd ..
cat ./tethys/conda.recipe/meta.yaml
# Build Conda
- name: Build Conda - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda create -y -c conda-forge -n conda-build conda-build anaconda-client
conda activate conda-build
conda config --set anaconda_upload no
mkdir -p ~/conda-bld
conda-build -c tethysplatform -c conda-forge ./tethys/conda.recipe
# Upload to Anaconda Cloud
- name: Upload to Conda Release Channel - micro
if: ${{ steps.version.outputs.prerelease == '' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
echo "Publishing to release channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} $CONDA_BLD_PATH/noarch/micro-tethys-platform*.tar.bz2 --force;
- name: Upload to Conda Dev Channel - micro
if: ${{ steps.version.outputs.prerelease != '' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
echo "Publishing to dev channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/micro-tethys-platform*.tar.bz2 --force;
41 changes: 40 additions & 1 deletion .github/workflows/tethys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ jobs:
conda activate conda-build
conda config --set anaconda_upload no
mkdir -p ~/conda-bld
conda-build -c tethysplatform -c conda-forge ./tethys/conda.recipe
conda-build -c conda-forge ./tethys/conda.recipe
# Upload Conda No Pull Request No Tag
- name: Upload Conda No Tag
if: ${{ github.event_name != 'pull_request' }}
Expand All @@ -232,3 +232,42 @@ jobs:
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "Uploading is skipped for pull requests."

# BUILD micro-tethys-platform

# Generate Conda Recipe Without Constrained Dependencies
- name: Generate Conda Recipe - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
tethys gen metayaml --micro --overwrite;
# Show Tethys Meta
- name: Show Tethys Meta - micro
run: |
cd ..
cat ./tethys/conda.recipe/meta.yaml
# Build Conda
- name: Build Conda - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda create -y -c conda-forge -n conda-build conda-build anaconda-client
conda activate conda-build
conda config --set anaconda_upload no
mkdir -p ~/conda-bld
conda-build -c conda-forge ./tethys/conda.recipe
# Upload Conda No Pull Request No Tag
- name: Upload Conda No Tag - micro
if: ${{ github.event_name != 'pull_request' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
ls ~/conda-bld/noarch
conda activate conda-build
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/micro-tethys-platform*.tar.bz2 --force;
# No Upload if Pull Request
- name: No Upload - micro
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "Uploading is skipped for pull requests."
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ build/
dist/
tethys_portal/_version.py
# Required for docs build
git-lfs-*/*
git-lfs-*/*
conda.recipe/meta.yaml
107 changes: 0 additions & 107 deletions conda.recipe/meta.yaml

This file was deleted.

38 changes: 28 additions & 10 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,37 @@ Also, be sure that the system you are using meets the minimum :ref:`system_reqs`
1. Install the ``tethys-platform`` Conda Package
------------------------------------------------

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

.. code-block:: bash

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

.. tip::

**Installation Speedup**

If conda is taking too long to solve the Tethys environment, try using the ``libmamba`` solver: :ref:`libmamba_solver`.

**Install Micro-Tethys**

The ``micro-tethys-platform`` conda package is a minimal version of ``tethys-platform``. It has the exact same code base, but doesn't include any of the optional dependencies. As a result the environment is much smaller, but none of the optional features will be enabled. Any of the optional features can be enabled simply by installing the dependencies required by those features (see :ref:`optional_features`).

.. code-block:: bash

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

**Install Development Build**

To install the latest development build of ``tethys-platform`` add the ``tethysplatform/label/dev`` channel to the list of conda channels::
To install the latest development build of ``tethys-platform`` add the ``tethysplatform/label/dev`` channel to the list of conda channels:

.. code-block:: bash

conda create -n tethys -c tethysplatform/label/dev -c tethysplatform -c conda-forge tethys-platform
conda create -n tethys -c tethysplatform/label/dev -c conda-forge tethys-platform
sdc50 marked this conversation as resolved.
Show resolved Hide resolved

Alternatively, to install from source refer to the :ref:`developer_installation` docs.


2. Activate the Tethys Conda Environment
----------------------------------------

Expand All @@ -51,7 +62,9 @@ Anytime you want to work with Tethys Platform, you'll need to activate the ``tet
3. Create a :file:`portal_config.yml` File
------------------------------------------

To add custom configurations such as the database and other local settings you will need to generate a :file:`portal_config.yml` file. To generate a new template :file:`portal_config.yml` run::
To add custom configurations such as the database and other local settings you will need to generate a :file:`portal_config.yml` file. To generate a new template :file:`portal_config.yml` run:

.. code-block:: bash

tethys gen portal_config

Expand All @@ -61,20 +74,24 @@ You can customize your settings in the :file:`portal_config.yml` file after you
4. Configure the Tethys Database
--------------------------------

Tethys Platform requires a PostgreSQL database server. There are several options for setting up a DB server: local, docker, or dedicated. For development environments you can use Tethys to create a local server::
There are several options for setting up a DB server: local, docker, or remote. Tethys Platform uses a local SQLite database by default. For development environments you can use Tethys to create a local server:

.. code-block:: bash

tethys db configure

.. note::

The tethys db command (:ref:`tethys_db_cmd`) will create a local database server in the directory specified by the ``DIR`` setting in the ``DATABASES`` section of the :file:`portal_config.yml` file. If the value of ``DIR`` is a relative path then the database server will be created relative to directory specified by the ``TETHYS_HOME`` environment variable. By default ``TETHYS_HOME`` is at `~/.tethys`.
The tethys db command (:ref:`tethys_db_cmd`) will create a local database file in the location specified by the ``NAME`` setting in the ``DATABASES`` section of the :file:`portal_config.yml` file (by default ``tethys_platform.sqlite``). If the value of ``NAME`` is a relative path then the database file will be created relative to directory specified by the ``TETHYS_HOME`` environment variable. By default ``TETHYS_HOME`` is at `~/.tethys`.

As an alternative to creating a local database server you can also configure a Docker DB server (see :ref:`using_docker`). A local database server is only recommended for development environments. For production environments please refer to :ref:`production_installation`.
For additional options for configuring a database see :ref:`database_configuration`

5. Start the Development Server
-------------------------------

Once you have a database successfully configured you can run the Tethys development server::
Once you have a database successfully configured you can run the Tethys development server:

.. code-block:: bash

tethys manage start

Expand All @@ -84,7 +101,7 @@ This will start up a locally running web server. You can access the Tethys Porta

You can customize the port that the server is running on by adding the ``-p`` option.

::
.. code-block:: bash

tethys manage start -p 8001

Expand All @@ -110,6 +127,7 @@ Related Docs

installation/system_requirements
tethys_portal/configuration
installation/database_configuration
installation/conda
installation/application
installation/showcase_apps
Expand Down
12 changes: 12 additions & 0 deletions docs/installation/application.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ install.yml

This file is generated with your application scaffold. Dependencies that are listed in the ``install.yml`` will be installed with conda and will honor the specified channel priority. If there are any dependencies listed in the ``setup.py`` that are not specified in the ``install.yml`` then these packages will be installed with pip as part of the setup process. This file should be committed with your application code in order to aid installation on a Tethys Portal.

.. important::

The ``conda`` sections of the ``install.yml`` file require the ``conda`` library and optionally the ``conda-libmamba-solver`` library to be installed. Starting with Tethys 5.0 or if you are using ``micro-tethys-platform``, you will need to install these libraries using conda or pip as follows:

.. code-block:: bash

# conda: conda-forge channel strongly recommended
conda install -c conda-forge conda conda-libmamba-solver

# pip
pip install conda

.. literalinclude:: resources/example-install.yml
:language: yaml

Expand Down
8 changes: 4 additions & 4 deletions docs/installation/production/docker/docker_compose.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ c. Add the following contents to each ``.env`` file:

**db.env**

.. code-block:: env
.. code-block:: docker

# Password of the db admin account
POSTGRES_PASSWORD=please_dont_use_default_passwords
Expand All @@ -323,7 +323,7 @@ c. Add the following contents to each ``.env`` file:

**thredds.env**

.. code-block:: env
.. code-block:: docker

# Password of the TDM admin user
TDM_PW=please_dont_use_default_passwords
Expand Down Expand Up @@ -355,7 +355,7 @@ c. Add the following contents to each ``.env`` file:

**web.env**

.. code-block:: env
.. code-block:: docker

# Domain name of server should be first in the list if multiple entries added
ALLOWED_HOSTS="\"[localhost]\""
Expand Down Expand Up @@ -471,7 +471,7 @@ a. Create a :file:`.gitignore` file:

b. Add the following contents to the :file:`.gitignore` file to omit the contents of these directories from being tracked:

.. code-block:: gitignore
.. code-block:: text

data/
keys/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ Lockout (Optional)

**Last Updated:** May 2020

.. important::

This feature requires the ``django-axes`` library to be installed. Starting with Tethys 5.0 or if you are using ``micro-tethys-platform``, you will need to install ``django-axes`` using conda or pip as follows:

.. code-block:: bash

# conda: conda-forge channel strongly recommended
conda install -c conda-forge django-axes

# pip
pip install django-axes

Tethys Portal includes lockout capabilities to prevent brute-force login attempts. This capability is provided by the `Django Axes <https://django-axes.readthedocs.io/en/latest/>`_ add-on for Django. This document describes the different configuration options that are available for lockout capabilities in Tethys Portal.

.. image:: ./images/locked_out.png
Expand Down
Loading
Loading