nextcloud / app_api

Nextcloud AppAPI
https://apps.nextcloud.com/apps/app_api
GNU Affero General Public License v3.0
82 stars 7 forks source link

Feature: Expanding Deploy Options #406

Open bigcat88 opened 1 month ago

bigcat88 commented 1 month ago

Issue: Enhancements Needed for AppAPI Deployment in Nextcloud

As you know, we are already developing more complex programs in the form of ExApps, with examples like Flow and Visionatrix.

During the development of such large and multifunctional programs, we have identified some deployment shortcomings:

  1. There is no possibility to specify environment variables specifically for the ExApp (currently, this feature is available only for the Deploy Daemon- no, it is not available).
  2. An ExApp can only list its configurable environment variables in its documentation, which is quite inconvenient.
  3. There is no option to map a folder from the host to the container.
  4. There is also a request from the Office team to allow binding/opening ports during ExApp install

Why is it so important to be able to specify variables?

For example, the Flow application has a variable that controls the number of workers for processing flows, and this cannot be changed at runtime.

For example, PyTorch has a bunch of environment variables that affect its behavior during initialization, and they need to be able to be set before the application starts.

Also, environment variables usually always affect the initialization of applications, and they cannot be simply taken and passed so that they can be changed while the application is already running.

In practice, these three points are crucial in a production environment.

Examples

Example 1:

Both applications use PostgreSQL. As an administrator, I don't want PostgreSQL running inside a container because I want to monitor it, adjust its settings for speed optimization, and perform maintenance. I would prefer to install the database on the Docker server and allow the ExApps within their containers to connect to it, while still having access to all the familiar tools as an admin.

For this, we need the ability to specify environment variables during deployment (point 1).

Example 2:

We have applications that work with AI models. As an administrator, I don't want everything stored in unoptimized Docker volumes, nor do I want to modify settings to increase volume limits (AI models can be around 300 GB, which exceeds Docker's default volume size limits). I simply want to map a network drive to the Docker host and pass it through as a folder.

For this, we need both the ability to specify environment variables during deployment (point 1) and folder mapping (point 3).

Example 3:

It's not always convenient to dig through the application documentation to find out which environment variables they support. I would prefer if the most important environment variables were automatically displayed in the Nextcloud UI during deployment, with default values that I can modify if needed.

Examples of how it is done in UnRaid software:

image

Adding path mappings in UnRaid during App install:

image

My suggestion would be to make an "Advanced Deploy" "sub-button" - where you can set additional environment changes during deployment or specify folder mapping.

Also add the ability to specify in info.xml the Environment Variables for display for this.

bigcat88 commented 1 month ago

The AppStore was deployed with the changes from linked PR, the app (visionatrix version 1.0.1) was also uploaded to speed up development(two test env vars were declared, one with default parameter and second without).

appapi_apps.json now has the following part:


"environmentVariables":[{"envName":"EXTERNAL_DATABASE","displayName":"External database","description":"External database URI in SqlAlchemy format: postgresql+psycopg://vix_user:vix_password@localhost:5432/vix_db","default":""},{"envName":"DISABLE_WORKER","displayName":"Disable tasks execution (Server mode only)","description":"If you have external workers, you can disable the bundled one to make Visionatrix work only in Server mode for task management.","default":"0"}]

here is the link to it's info.xml from which it was generated.