Skip to content

Commit

Permalink
Updated Docs for Recent Updates (#23)
Browse files Browse the repository at this point in the history
* updated docs

* added python dependencies to setup.py

* fixed update modal issue where app_type was not being passed
  • Loading branch information
ckrew authored Feb 22, 2024
1 parent 44d1671 commit 26bcd13
Show file tree
Hide file tree
Showing 25 changed files with 305 additions and 76 deletions.
Binary file modified docs/_static/images/add_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/add_proxyapp_modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_static/images/add_step_1.png
Binary file not shown.
Binary file added docs/_static/images/app_store_app_install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/proxyapp_submit_modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/proxyapp_update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/proxyapp_update_modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_static/images/refresh_button.png
Binary file not shown.
Binary file added docs/_static/images/tethysapp_submit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/tethysapp_update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/tethysapp_update_modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 0 additions & 56 deletions docs/app-submit.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx_rtd_theme"
]
extensions = ["sphinx_rtd_theme"]
pygments_style = 'sphinx'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
62 changes: 58 additions & 4 deletions docs/install.rst → docs/get-started.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
============
Installation
============
===============
Getting Started
===============

This application can be installed on your local Tethys portal in the following ways:

Expand Down Expand Up @@ -57,8 +57,62 @@ In case you installed the app store from GitHub, just pull the latest changes:
git pull
Configuring App Store Settings
******************************

After the app store has been installed in tethys, you will need to configure the following settings.

**sudo_server_pass (optional)**: This is the sudo password for the server running the tethys portal. This is used to help
restart the tethys portal after new applications are installed. Other methods are used first to restart the server so
this may not be needed.

**encryption_key (required)**: This is the encryption key used to created the encrypted tokens in the store settings. In order
to create encrypted keys and tokens, do the following:

.. code-block:: python
>>> from cryptography.fernet import Fernet
>>> encryption_key = Fernet.generate_key()
>>> f = Fernet(encryption_key)
>>> encrypted_github_token = f.encrypt(b"my_github_token")
**stores_settings (required)**: The app store requires a github organization and a conda channel in order to submit and
install applications. This json has to following pattern:

.. code-block:: json
{
"stores": [
{
"default": "<true|false>",
"github_organization": "FIRO-Tethys",
"github_token": "<encrypted github token for repo access, creating repos, updating repos, etc>",
"conda_channel": "<conda channel to use for retrieving and downloading apps>",
"conda_labels": "<comma delimited string for conda labels to be used>"
}
]
}
An example of the stores_settings would be:

.. code-block:: json
{
"stores": [
{
"default": true,
"conda_labels": "main",
"github_token": "abcdefg12345678",
"conda_channel": "tethysapp",
"github_organization": "tethysapp"
}
]
}
Migrating from Warehouse to App Store
****************************
*************************************

In September, 2021 this package went through a name change and all future updates are published as `app-store` and not `warehouse`. If you have an existing version of the `Tethys App Warehouse` installed on your system, please follow the following steps to update it to the `Tethys App Store`. These steps assume you had installed the warehouse using Miniconda.

Expand Down
5 changes: 3 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ The Tethys App Store is similar in concept to the iOS App Store for Apple mobile
:caption: Table of Contents
:maxdepth: 2

install
app-submit
get-started
manage-tethysapp
manage-proxyapp
production
compatibility
github-install
Expand Down
72 changes: 72 additions & 0 deletions docs/manage-proxyapp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
===================
Managing Proxy Apps
===================

Creating
========

Proxy apps can be installed via a conda channel the same way as a tethys application. If you want to create a new
proxy application, you can click on the Add App button as highlighted in the image below and clicking on the
"Add Proxy App to Portal" option:

.. image:: _static/images/add_button.png
:width: 600

Upon clicking that button, you will be presented with a modal that asks for all the metadata for the proxy app. Once
the inputs are filled out, click on "Create Proxy App".

.. image:: _static/images/add_proxyapp_modal.png
:width: 300



Installing
==========

Applications that can be installed into the tethys portal are all hosted in an anaconda channel such as the
`tethysapp <https://anaconda.org/tethysapp/repo>`_ channel. Users can install applications to the app store by
clicking on the Install button in the application table and selecting the desired conda channel, conda label, and app
version as highlighted in the image below:

.. image:: _static/images/app_store_app_install.png
:width: 600


Upon clicking the desired app version, you will be presented with a modal to confirm the selection and start the
application install process.

.. image:: _static/images/app_store_app_install_modal.png
:width: 600



Updating
========

After an application is installed, users are given the options to uninstall or update the installed application.

.. image:: _static/images/proxyapp_update.png
:width: 800

Click on the update button for the proxy app to change any of the proxy app metadata. The update form will be
prepopulated with the current information. You can edit any information except the name. Once the form is updated,
click on the "Update Proxy App" button to save the changes.

.. image:: _static/images/proxyapp_update_modal.png
:width: 400



Submitting to App Store
=======================

Once a proxy app is configured correctly, you can click on the "Submit to App Store" button in the application table.

You can submit their tethys applications to the app store by click on the Add App button as highlighted in the
image below and clicking on the "Submit Tethys App to Store" option. You will be presented with a modal that asks for
an email address which is notified once the build is completed successfully and the application is available on the
app store. You will also need to select the store/conda channel where you want the application submitted and the label
to be used.

.. image:: _static/images/proxyapp_submit_modal.png
:width: 400
106 changes: 106 additions & 0 deletions docs/manage-tethysapp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
====================
Managing Tethys Apps
====================

Installing
==========

Applications that can be installed into the tethys portal are all hosted in an anaconda channel such as the
`tethysapp <https://anaconda.org/tethysapp/repo>`_ channel. Users can install applications to the app store by
clicking on the Install button in the application table and selecting the desired conda channel, conda label, and app
version as highlighted in the image below:

.. image:: _static/images/app_store_app_install.png
:width: 600


Upon clicking the desired app version, you will be presented with a modal to confirm the selection and start the
application install process.

.. image:: _static/images/app_store_app_install_modal.png
:width: 600


After the application is successfully installed, the app store will attempt to configure the application as well. If
the application has any custom settings, you will be prompted to supply the desired configuration and continue
the process. You can also skip the settings configuration or submit the desired settings.

.. image:: _static/images/app_store_app_install_settings.png
:width: 600



Updating
========

After an application is installed, users are given the options to uninstall or update the installed application.

.. image:: _static/images/tethysapp_update.png
:width: 800

If you want to change the installed version of the application, you can click on the update button and you will be
presented with a modal to select the version you want to install and start the process.

.. image:: _static/images/tethysapp_update_modal.png
:width: 600



Submitting to App Store
=======================

Before attempting to submit your tethys application to the app store, ensure that your application fulfills the
requirements for Tethys App Store:

- Application is compatible with Tethys 3+
- Application should run on Python 3.7+
- Cleanup old init files if the application was upgraded from an older Tethys 2 compatible version.:
https://gist.github.com/rfun/ca38bb487ca1649be8491227adb7ca37


Application Metadata + setup.py
*******************************

The build process uses the setup.py file to pull the metadata for your application. The following fields are pulled
from the setup.py and are displayed in the app store:

- Application name (Same as release package)
- Version
- Description
- Keywords
- Author Name
- Author Email
- URL
- License

It is recommended to fill in the values in your setup.py so that your application has those details visible in the app
store for easier discovery and filtering.

Each time you have a new version for your application, it is recommended to update the version number in your setup.py
file so that a new package is built and published.

Steps to Submit
***************

You can submit their tethys applications to the app store by click on the Add App button as highlighted in the
image below and clicking on the "Submit Tethys App to Store" option:

.. image:: _static/images/add_button.png
:width: 600

Upon clicking that button, you will be presented with a modal that asks for the link to the GitHub Repository of your
Tethys Application. It also instructs to put in an email address which is notified once the build is completed
successfully and the application is available on the app store. You will also need to select the store/conda channel
where you want the application submitted and the label to be used.

.. image:: _static/images/tethysapp_submit.png
:width: 300

- Enter Notification email address (Mostly this will be your own or the developer's email address)
- Enter the link to your GitHub Repository
- Select the conda channels and labels that you would like to use for the submission
- If there are multiple branches on your GitHub repository, you will be presented with a list of branches on your
GitHub repository, Select the branch that you would like to submit to the application app store. The app store uses
the Master/Main branch in case only one branch exists.
- After selecting the branch the app store begins the processing. Once the build is done, an email will be sent to the
address provided.
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ def find_resource_files(directory, relative_to=None):


# -- Python Dependencies -- #
dependencies = []
dependencies = [
"gitpython",
"toml",
"semver",
"pygithub",
"pytest",
"pytest-cov",
"pytest-django",
"pytest-lazy-fixtures",
"pytest-mock",
"pytest-asyncio"
]

setup(
name=release_package,
Expand Down
8 changes: 7 additions & 1 deletion tethysapp/app_store/mamba_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ def mamba_install(app_metadata, app_channel, app_label, app_version, channel_lay
"conda environment to attempt a manual installation : "
f"mamba install -c {label_channel} {app_name}",
channel_layer)
if (check_all_present(str_output, ['Mamba Install Complete'])):
if (check_all_present(str_output, ['Mamba failed. Trying conda now.'])):
success = False
send_notification("Install failed using mamba. Trying now with conda.", channel_layer)
if (check_all_present(str_output, ['Conda Install Success'])):
success = True
send_notification("Install succeeded with conda.", channel_layer)
if (check_all_present(str_output, ['Install Complete'])):
break

send_notification("Mamba install completed in %.2f seconds." % (time.time() - start_time), channel_layer)
Expand Down
2 changes: 1 addition & 1 deletion tethysapp/app_store/public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const getVersionsHTML_dropdown = (app,checkIfNeeded,isUpdate) => {
for (sinlge_version in versions_obj[channel][label]){
// string_dropdown += `<li><a class="dropdown-item" href="#">${versions_obj[channel][label][sinlge_version]}</a></li>`
string_dropdown +=`<li><a class="${class_html} button-spaced dropdown-item" href="javascript:void(0)" title="Install">
<button type="button" id="${channel}__${label}__${versions_obj[channel][label][sinlge_version]}__${app['name']}__install" class="label_dropdown custom-label label-color-${color_icon} label-outline-xs">${versions_obj[channel][label][sinlge_version]}</button>
<button type="button" id="${channel}__${label}__${versions_obj[channel][label][sinlge_version]}__${app['app_type']}__${app['name']}__install" class="label_dropdown custom-label label-color-${color_icon} label-outline-xs">${versions_obj[channel][label][sinlge_version]}</button>
</a></li>`
}
string_dropdown += `</ul></li>`;
Expand Down
Loading

0 comments on commit 26bcd13

Please sign in to comment.