Do not remove ExApp docker volume by default, deprecate old option
`keep-data`, add new `rm-data` to remove ExApp data.
---------
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
This PR introduces new (mandatory if you use the ExApp proxy) registration of the routes that are allowed to call on ExApp via AppAPI ExApp proxy.
---------
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Co-authored-by: Alexander Piskun <13381981+bigcat88@users.noreply.github.com>
The system flag and extra table for that `ex_app_users` is removed to
optimize database usage and simplify the system logic.
---------
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
This PR introduces our internal occ command for sending a request to
ExApp with notification about an event happened. The occ command is
needed to perform the HTTP request in a truly async maner not blocking
the original PHP process during request, that have to improve the user
experience.
The request is limited to 2s timeout, so that this occ command process
shouldn't live too long to not exceed the limits.
---------
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Co-authored-by: Alexander Piskun <13381981+bigcat88@users.noreply.github.com>
Before this, we didn’t have a `healthcheck` at all, but instead there
was simply a check to see if the container was running.
Checking whether the container is running has been moved to Deploy stage
and now occurs at the end of the deployment process.
And between deployment and “init” there is now a correct health check.
Applications are not required to support healthcheck at all, so it is
only checked if `['State']['Health']['Status']` is present.
Without a timeout, the timeout must be set by the application itself, as
it is usually done for Docker containers healthcheck.
During a healthcheck, an application, for example, can now install some
of its own packages or do something other with its docker container.
It should not communicate with the Nextcloud itself at this
stage(healthcheck), because application is not considered enabled.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Co-authored-by: Andrey Borysenko <andrey18106x@gmail.com>
We hold pre-defined API Scopes in memory only.
Anyway we currently do not supporting defining API Scopes at runtime and
not sure that we will in future, so better to make it simpler and faster
for now.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
They do almost the same like the original flags from Server repo with
one difference:
`--showonly` flag can be specified only with `--all` flag.
We can not easy make `--showonly` work for specified appid, cause we
support updating ExApps with specifyng `json` or `xml` and not only by
`appid`.
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
This will fix situations when ExApp after update or enabling work
without errors, but state of previous error is still in DB and UI
displays an error when all is already ok.
Also now we set 'error'(empty) always be present in "status" to allow us
in future not check for it presence.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
PR should not break anything, for old parts added a workarounds, that we
will remove in a month when all ExApps will publish their updates.
**Changes**:
* UI now use the same algorithm/code for ExApp `register` & `update` as
the CLI commands.
* Deprecated "deploy" command, now `register` commands performs deploy.
**Refactoring**:
* Removed internal `DispatchInit` command, as from CLI we already can do
it without spawning additional process.
* Removed hack(`status['active']`) when we have some half-enabled state
of ExApp when it is not enabled, but already can call APIs, now ExApp
enables before calling `/init`
* Made code more consistent in many place.
OTHER CHANGES FOR DEVS:
* For `--json-info` parameter in occ `register` command keys renamed:
"appid" -> "id", "system_app" -> "system"
_Old naming is still supported but will be removed in future, in such
way we make consistent parameters between `info.xml` and `--json-info`._
----
Related: #219
_AppAPI will perform deploy & registration in a background and issue
should be fixed_
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Co-authored-by: Andrey Borysenko <andrey18106x@gmail.com>
ExApp.php:
```php
$this->addType('status', 'string');
```
->
```php
$this->addType('status', 'json');
```
In DB we already have this field marked as json.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Changed loglevel to debug(we should stick in all Services to loglevel
`info` or `debug`).
It is used in 3 places, one place is already covered with log level, two
more are in UI and it will visible in UI if returned array is empty.
Looks like it was a typo during initial fast development, I did not find
today any reason to perform a call
```php
$this->daemonConfigService->unregisterDaemonConfig($daemonConfig)
```
two times in a row.
If the `php occ app_api:app:register ... --info-xml` parameter is
specified, then we should return an error if the file is not available
for the specified parameter, rather than silently ignoring it.
Fixes: #122
1. Made sending the "init" request in a separate process
2. If "init" request fails with STATUS_NOT_IMPLEMENTED or
STATUS_NOT_FOUND sets the progress to 100
3. Added `wait-finish` optional parameter to `app_api:app:register` occ
command.
What is missing:
- [x] Global option: how long the "/init" request can be proceed.
- [x] Docs update for this
- [x] Update nc_py_api CI for this
- [x] Added test for registering ExApp that does not have "/init"
endpoint.
This allows to implement ExApp without "/init" endpoint and made it
optional.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Co-authored-by: Andrey Borysenko <andrey18106x@gmail.com>
Fixes#121
- small actions clean up
- added basic but very useful tests for "occ app_api:app:unregister"
Changes in behaviour:
- container of app is always removed
- volume with data is removed by default, but optionally can be kept
- app_api does not try to disable ExApp if it is already disabled
- "--silent" options now means "max silence as possible"
- added "--force" option to ignore errors if any.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Fixes IDE warnings:
* Qualifier can be replaced with an import
* Argument matches the parameter's default value
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
* removed property declaration/assigment
* added "void" return type to subclasses of Command class.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
- [ ] Update ExApps used in tests to provide textual scopes (ApiScope
names)
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Co-authored-by: Alexander Piskun <bigcat88@icloud.com>
Resolves: #21
Changes:
- [x] do not update sensitive flag each time config value updated
- [x] remove deprecated and unused `IControllerMethodReflector` in
`AppEcosystemAuthMiddleware`