diff --git a/Makefile b/Makefile index 4cca9d47..62f77567 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,6 @@ help: @echo " dock-port create docker daemons for Nextcloud 28, 27 (host.docker.internal:8443)" @echo " dock-port28 create docker daemon for Nextcloud 28 (host.docker.internal:8443)" @echo " dock-port27 create docker daemon for Nextcloud 27 (host.docker.internal:8443)" - @echo " " - @echo " " - @echo " example-deploy deploy Example App to docker" - @echo " example28 register & enable Example App in Nextcloud 28" - @echo " example27 register & enable Example App in Nextcloud 27" .PHONY: dock-sock dock-sock: @@ -45,7 +40,7 @@ dock-sock28: .PHONY: dock-sock27 dock-sock27: @echo "creating daemon for nextcloud 'stable27' container" - docker exec master-nextcloud-1 sudo -u www-data php occ app_api:daemon:unregister docker_dev || true + docker exec master-stable27-1 sudo -u www-data php occ app_api:daemon:unregister docker_dev || true docker exec master-stable27-1 sudo -u www-data php occ app_api:daemon:register \ docker_dev Docker docker-install unix-socket /var/run/docker.sock http://stable27/index.php --net=master_default @@ -86,20 +81,3 @@ dock-port27: docker exec master-stable27-1 sudo -u www-data php occ app_api:daemon:register \ docker_dev Docker docker-install https host.docker.internal:6443 http://stable27/index.php \ --net=master_default --ssl_cert /client/cert.pem --ssl_key /client/key.pem - -.PHONY: example-deploy -example-deploy: - docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:deploy skeleton docker_dev \ - --info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml - -.PHONY: example28 -example28: - docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent || true - docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev - docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:enable skeleton - -.PHONY: example27 -example27: - docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent || true - docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton docker_dev - docker exec master-stable27-1 sudo -u www-data php occ app_api:app:enable skeleton diff --git a/docs/ManagingExternalApplications.rst b/docs/ManagingExternalApplications.rst index 10a07ae6..23b9ee2a 100644 --- a/docs/ManagingExternalApplications.rst +++ b/docs/ManagingExternalApplications.rst @@ -44,7 +44,7 @@ Options Register -------- -Command: ``app_api:app:register [-e|--enabled] [--force-scopes] [--info-xml INFO-XML] [--json-info JSON-INFO] [--] `` +Command: ``app_api:app:register [--force-scopes] [--info-xml INFO-XML] [--json-info JSON-INFO] [--] `` The register command is the second ExApp installation step. @@ -57,7 +57,6 @@ Arguments Options ******* - * ``-e|--enabled`` *[optional]* - enable ExApp after registration * ``--force-scopes`` *[optional]* - force scopes approval * ``--json-info JSON-INFO`` **[optional]** - ExApp deploy JSON info (json string) * ``--info-xml INFO-XML`` **[required]** - path to info.xml file (url or local absolute path) diff --git a/docs/conf.py b/docs/conf.py index b904879d..b223c0a5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,6 +48,11 @@ # switch. nitpicky = True +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["resources"] + def setup(app): app.add_js_file("js/script.js") diff --git a/docs/resources/css/styles.css b/docs/resources/css/styles.css index 111f8408..cbb596cc 100644 --- a/docs/resources/css/styles.css +++ b/docs/resources/css/styles.css @@ -6,3 +6,7 @@ th p { font-size: 1rem; margin-bottom: 0; } + +.wy-nav-content { + max-width: 80% !important; +} diff --git a/docs/tech_details/Deployment.rst b/docs/tech_details/Deployment.rst index 8bf4d6d6..4f2154b3 100644 --- a/docs/tech_details/Deployment.rst +++ b/docs/tech_details/Deployment.rst @@ -107,8 +107,7 @@ This can be done by ``occ`` CLI command **app_api:app:deploy**: For development this step is skipped, as ExApp is deployed and started manually by developer. .. warning:: - After successful deployment (pull, create and start container), there is a heartbeat check with 1 hour timeout (will be configurable). - If command seems to be stuck, check if ExApp is running and accessible by Nextcloud instance. + After successful deployment (pull, create and start container), there is a heartbeat check with 90 seconds timeout (will be configurable). Arguments ********* @@ -193,7 +192,7 @@ This can be done by ``occ`` CLI command **app_api:app:register**: .. code-block:: bash - app_api:app:register [-e|--enabled] [--force-scopes] [--] + app_api:app:register [--force-scopes] [--] Arguments ********* @@ -204,13 +203,21 @@ Arguments Options ******* - * ``-e|--enabled`` *[optional]* - enable ExApp after registration * ``--force-scopes`` *[optional]* - force scopes approval * ``--json-info JSON-INFO`` **[required]** - path to JSON file with deploy result (url or local absolute path) With provided ``appid`` and ``daemon-config-name``, Nextcloud will retrieve ExApp info from deployed container and register it. In case of ``manual-install`` DeployConfig type, ExApp info must be provided by ``--json-info`` option `as described before <#deploy-result-json-output>`_. +Application installation scheme +------------------------------- + +1. AppAPI deploys the application and launches it. +2. AppAPI for `N` seconds (default ``90``) checks the ``/heartbeat`` endpoint with ``GET`` request. +3. AppAPI sends a ``POST`` to the ``/init`` endpoint. +4. ExApp sends an integer from ``0`` to ``100` to the OCS endpoint ``apps/app_api/apps/status`` indicating the initialization progress. After sending ``100``, the application is considered initialized. +5. AppAPI sends a PUT to the ``/enabled`` endpoint. + ExApp info.xml schema --------------------- diff --git a/lib/DeployActions/DockerActions.php b/lib/DeployActions/DockerActions.php index e673d944..e4ab5629 100644 --- a/lib/DeployActions/DockerActions.php +++ b/lib/DeployActions/DockerActions.php @@ -489,7 +489,7 @@ public function containerStateHealthy(array $containerInfo): bool { public function healthcheckContainer(string $containerId, DaemonConfig $daemonConfig): bool { $attempts = 0; - $totalAttempts = 60; // ~60 seconds for container to initialize + $totalAttempts = 90; // ~90 seconds for container to initialize while ($attempts < $totalAttempts) { $containerInfo = $this->inspectContainer($this->buildDockerUrl($daemonConfig), $containerId); if ($this->containerStateHealthy($containerInfo)) {