-
Notifications
You must be signed in to change notification settings - Fork 182
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
[full-ci] enhancement: allow ocis to provide custom web applications #8523
Conversation
@butonic, @micbar, @kulmann, the current logic expects a file named in my opinion we should use something more agnostic like The reason why I'm torn is that when we mention web in the name, everyone assumes that these are only web apps (static files)... But I think it would be great if we also allowed injecting proxy routes in the long term. I know it's always difficult to look into the crystal ball, but I'm trying to prevent future migration efforts what do you all mean? |
118d0b2
to
dbdef9a
Compare
we discussed the following adjustments:
cc.: @kulmann |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found some typos...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it! ❤️
@dragonchaser can you please re-review and approve too, GH does not allow me to merge without your approval |
I’m not happy with the fallbackfs, I need to apply one more change before we merge it. |
was unable to load app with the latest changes and I was wondering why. Then found out that the env was changed |
Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com>
Co-authored-by: Martin <github@diemattels.at>
…ck members for better understanding
@fschade IMPORTANT --> before merging, see my comment: #8523 (comment) |
Quality Gate passedIssues Measures |
…8523) * enhancement: allow ocis to provide custom web applications * enhancement: add an option to disable web apps * test: add default logger tests * test: add app loading tests * test: add asset server tests * enhancement: make use of dedicated app conf file and app asset paths * enhancement: adjust asset locations and deprecate WEB_ASSET_PATH * enhancement: get rid of default logger and use the service level logger instead * Apply suggestions from code review Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> * enhancement: use basename as app id * Apply suggestions from code review Co-authored-by: Martin <github@diemattels.at> * enhancement: use afero as fs abstraction * enhancement: simplify logo upload * enhancement: make use of introductionVersion field annotations --------- Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> Co-authored-by: Martin <github@diemattels.at>
Overview
The administrator of the environment is capable of providing custom web applications to the users.
This feature is useful for organizations that have specific web applications that they want to provide to their users.
It's important to note that the feature at the moment is only capable of providing static (js, mjs, e.g.) web applications
and does not support injection of dynamic web applications (custom dynamic backends).
Loading Applications
Loading applications is provided in three ways:
WEB_APPS_PATH
environment variable.$OCIS_BASE_DATA_PATH/web/apps
.e.g.
ocis_src_path/services/web/apps
followed by a build.The list of available applications is composed of the build in extensions and the custom applications
provided by the administrator, e.g.
WEB_APPS_PATH
or$OCIS_BASE_DATA_PATH/web/apps
.for example, if ocis contains a build in extension
image-viewer-dfx
and the administrator provides a customapplication
image-viewer-obj
in theWEB_APPS_PATH
directory,the user will be able to access both applicationsfrom the web ui.
Application Structure
Applications always have to follow a strict structure, which is as follows:
manifest.json
fileeverything else is skipped and not considered as an application.
The
manifest.json
file contain the following fields:id
- required - the name of the application must be unique across all applicationsentrypoint
- required - the entrypoint of the application, e.g.index.js
, the path is relative to the parent directoryconfig
- optional - a list of key-value pairs that are passed to the global web application configurationApplication Configuration
it's important to note that an application manifest should never be changed manually;
if a custom configuration is needed, the administrator should provide the required configuration inside the
$OCIS_BASE_DATA_PATH/config/apps.yaml
file.The
apps.yaml
file must contain a list of key-value pairs which gets merged with theconfig
field.For example, if the
image-viewer-obj
application contains the following configuration:and the
apps.yaml
file contains the following configuration:the final configuration for web will be:
besides the configuration from the
manifest.json
file, theapps.yaml
file can also contain the following fields:disabled
- optional - defaults tofalse
- if set totrue
, the application will not be loadedThe local provided configuration yaml will always override the shipped application manifest configuration.
Fallback Mechanism
Besides the configuration and application registration, there is one further important aspect to now;
in the process of loading the application assets, the system uses a fallback mechanism to load the assets.
This is incredibly useful for cases where just a single asset should be overwritten, e.g., a logo or similar.
Consider the following, ocis is shipped with a default extension called
image-viewer-dfx
which contains a logo,but the administrator wants to provide a custom logo for the
image-viewer-dfx
application.This can be achieved by providing a custom logo in the
WEB_APPS_PATH
directory, e.g.WEB_APPS_PATH/image-viewer-dfx/logo.png
.Every other asset is loaded from the build in extension, but the logo is loaded from the custom directory.
The same applies for the
manifest.json
file, if the administrator wants to provide a custommanifest.json
file.Miscellaneous
Please note that ocis needs a restart to load new applications or changes to the
apps.yaml
file.PR related information
Related Issue
How Has This Been Tested?
Types of changes
Checklist: