AppApi: Unable to update status

Nextcloud version (eg, 29.0.5): 29.0.1
Operating system and version (eg, Ubuntu 29.04): Docker

The issue you are facing:

I am unable to get AppApi working. I installed NextCloud using Docker, and want to use the same Docker Daemon to run the external apps. The Deploy Deamon is reachable and when installing the Test-Deployment, I see that a new container is spun up. However, the progress meter stays at 0/6. Rebooting Nextcloud makes it move to 3/6 and stay there.
It seems that the container can’t make any callbacks to the nextcloud instance, it receives a 401:

Started
INFO:     Started server process [1]
INFO:     Waiting for application startup.
TRACE:    ASGI [1] Started scope={'type': 'lifespan', 'asgi': {'version': '3.0', 'spec_version': '2.0'}, 'state': {}}
TRACE:    ASGI [1] Receive {'type': 'lifespan.startup'}
TRACE:    ASGI [1] Send {'type': 'lifespan.startup.complete'}
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:23000 (Press CTRL+C to quit)
TRACE:    172.18.0.11:42722 - HTTP connection made
TRACE:    172.18.0.11:42722 - ASGI [2] Started scope={'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.18.0.12', 23000), 'client': ('172.18.0.11', 42722), 'scheme': 'http', 'root_path': '', 'headers': '<...>', 'state': {}, 'method': 'GET', 'path': '/heartbeat', 'raw_path': b'/heartbeat', 'query_string': b''}
TRACE:    172.18.0.11:42722 - ASGI [2] Send {'type': 'http.response.start', 'status': 200, 'headers': '<...>'}
Heartbeat was called
INFO:     172.18.0.11:42722 - "GET /heartbeat HTTP/1.1" 200 OK
TRACE:    172.18.0.11:42722 - ASGI [2] Send {'type': 'http.response.body', 'body': '<15 bytes>'}
TRACE:    172.18.0.11:42722 - ASGI [2] Completed
TRACE:    172.18.0.11:42722 - ASGI [3] Started scope={'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.18.0.12', 23000), 'client': ('172.18.0.11', 42722), 'scheme': 'http', 'root_path': '', 'headers': '<...>', 'state': {}, 'method': 'POST', 'path': '/init', 'raw_path': b'/init', 'query_string': b''}
Init was called
TRACE:    172.18.0.11:42722 - ASGI [3] Send {'type': 'http.response.start', 'status': 200, 'headers': '<...>'}
INFO:     172.18.0.11:42722 - "POST /init HTTP/1.1" 200 OK
TRACE:    172.18.0.11:42722 - ASGI [3] Send {'type': 'http.response.body', 'body': '<2 bytes>'}
TRACE:    172.18.0.11:42722 - HTTP connection lost
Try default url to report the init status: http://nextcloud-app
[401] Unauthorized <request: PUT /ocs/v1.php/apps/app_api/apps/status/test-deploy>

ERROR occurred! Can't report the ExApp status to the Nextcloud instance.
TRACE:    172.18.0.11:42722 - ASGI [3] Completed

I use a custom docker network named “proxy” for nextcloud, postgres, traefik (as reverse proxy for SSL), and the docker-proxy. I configured the deploy daemon accordingly:

**Name:** docker_socket_proxy
**Protocol:** http
**Host:** nextcloud-appapi-dsp:2375
### Deploy config
**Docker network:** proxy
**Nextcloud URL:** http://nextcloud-app
**HaProxy password:** redacted
**GPUs support:** false
**Compute device:** CPU

For reference, this is my docker-compose configuration (slightly redacted):

  nextcloud-db:
    image: postgres:14
    container_name: nextcloud-db
    restart: unless-stopped
    volumes:
      <redacted>
    networks:
      - proxy
  nextcloud-app:
    image: nextcloud:apache
    container_name: nextcloud-app
    restart: unless-stopped
    depends_on:
      - nextcloud-db
      - traefik
      - nextcloud-appapi-dsp
    environment:
      - PHP_MEMORY_LIMIT=4G
      - PHP_UPLOAD_LIMIT=24G
    volumes:
      - <redacted>
    labels:
      - <redacted>
    networks:
      - proxy
  nextcloud-appapi-dsp:
    image: ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release
    container_name: nextcloud-appapi-dsp
    restart: unless-stopped
    environment:
      NC_HAPROXY_PASSWORD: <redacted>
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    privileged: true
    networks:
      - proxy

my config.php (redacted):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'redacted',
  'passwordsalt' => 'redacted',
  'trusted_proxies' => 
  array (
    0 => '172.0.0.0/24',
  ),
  'trusted_domains' => 
  array (
    0 => 'redacted',
    1 => 'nextcloud-app',
  ),
  'datadirectory' => '/var/www/data',
  'dbtype' => 'pgsql',
  'version' => '29.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-db',
  'dbtableprefix' => 'nc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'redacted',
  'maintenance' => false,
  'maintenance_window_start' => 1,
  'installed' => true,
  'secret' => 'redacted',
  'mail_from_address' => 'redacted',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'redacted',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtphost' => 'redacted',
  'mail_smtpauth' => 1,
  'mail_smtpsecure' => 'tls',
  'loglevel' => 0,
  'trashbin_retention_obligation' => 'auto',
  'updatechecker' => false,
  'overwrite.cli.url' => 'redacted',
  'dbport' => '5432',
  'mail_smtpname' => 'redacted',
  'mail_smtppassword' => 'redacted',
  'overwriteprotocol' => 'https',
  'default_phone_region' => 'redacted',
  'share_folder' => '/Shared with me',
  'theme' => '',
  'app_install_overwrite' => 
  array (
    0 => 'video_converter',
    1 => 'workflow_media_converter',
    2 => 'richdocuments',
    3 => 'files_fulltextsearch_tesseract',
    4 => 'fulltextsearch_elasticsearch',
    5 => 'files_fulltextsearch',
    6 => 'fulltextsearch',
    7 => 'twofactor_email',
    8 => 'upscaler_example',
  ),
);

Possibly related nextcloud logs:

Jun 08 12:23:05 sumu docker-compose[6539]: nextcloud-app            | 172.18.0.12 - - [08/Jun/2024:10:23:00 +0000] "PUT /ocs/v1.php/apps/app_api/apps/status/test-deploy?format=json HTTP/1.1" 401 1715 "-" "python-httpx/0.27.0"
Jun 08 12:23:30 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:30 haproxy[13]: 172.18.0.11:34330 [08/Jun/2024:10:23:29.569] docker_engine bk_docker_engine/dockersocket 0/0/0/876/948 200 456 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/images/create?fromImage=ghcr.io%2Fcloud-py-api%2Ftest-deploy-cpu%3Arelease HTTP/1.1"
Jun 08 12:23:30 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:30 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:30.527] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 6116 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:31 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:31 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:30.528] docker_engine bk_docker_engine/dockersocket 0/0/0/550/550 204 155 - - ---- 1/1/0/0/0 0/0 "DELETE /v1.41/containers/nc_app_test-deploy?force=true HTTP/1.1"
Jun 08 12:23:31 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:31 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:31.089] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 201 403 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/volumes/create HTTP/1.1"
Jun 08 12:23:32 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:32 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:31.090] docker_engine bk_docker_engine/dockersocket 0/0/0/1572/1572 201 284 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/containers/create?name=nc_app_test-deploy HTTP/1.1"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:32.669] docker_engine bk_docker_engine/dockersocket 0/0/0/436/436 204 155 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/containers/nc_app_test-deploy/start HTTP/1.1"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:33.116] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:33.124] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:33.124] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-app            | 172.18.0.1 - - [08/Jun/2024:10:23:28 +0000] "POST /apps/app_api/daemons/docker_socket_proxy/test_deploy HTTP/1.1" 500 3319 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-app            | 172.18.0.1 - - [08/Jun/2024:10:23:33 +0000] "DELETE /apps/app_api/daemons/docker_socket_proxy/test_deploy HTTP/1.1" 200 807 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
Jun 08 12:23:33 sumu docker-compose[6539]: nextcloud-app            | 172.18.0.1 - - [08/Jun/2024:10:23:33 +0000] "GET /apps/app_api/daemons HTTP/1.1" 200 1037 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
Jun 08 12:23:34 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:34 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:34.125] docker_engine bk_docker_engine/dockersocket 0/0/0/1/1 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:35 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:35 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:35.126] docker_engine bk_docker_engine/dockersocket 0/0/0/1/1 200 5597 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:36 sumu docker-compose[6539]: nextcloud-appapi-dsp     | <134>Jun  8 10:23:36 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:36.128] docker_engine bk_docker_engine/dockersocket 0/0/0/1/1 200 5648 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
Jun 08 12:23:55 sumu docker-compose[6539]: nextcloud-app            | 172.18.0.12 - - [08/Jun/2024:10:23:36 +0000] "PUT /ocs/v1.php/apps/app_api/apps/status/test-deploy?format=json HTTP/1.1" 401 1719 "-" "python-httpx/0.27.0"

Finally, the logs from the docker proxy:

<134>Jun  8 10:23:30 haproxy[13]: 172.18.0.11:34330 [08/Jun/2024:10:23:29.569] docker_engine bk_docker_engine/dockersocket 0/0/0/876/948 200 456 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/images/create?fromImage=ghcr.io%2Fcloud-py-api%2Ftest-deploy-cpu%3Arelease HTTP/1.1"
<134>Jun  8 10:23:30 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:30.527] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 6116 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
<134>Jun  8 10:23:31 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:30.528] docker_engine bk_docker_engine/dockersocket 0/0/0/550/550 204 155 - - ---- 1/1/0/0/0 0/0 "DELETE /v1.41/containers/nc_app_test-deploy?force=true HTTP/1.1"
<134>Jun  8 10:23:31 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:31.089] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 201 403 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/volumes/create HTTP/1.1"
<134>Jun  8 10:23:32 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:31.090] docker_engine bk_docker_engine/dockersocket 0/0/0/1572/1572 201 284 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/containers/create?name=nc_app_test-deploy HTTP/1.1"
<134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:32.669] docker_engine bk_docker_engine/dockersocket 0/0/0/436/436 204 155 - - ---- 1/1/0/0/0 0/0 "POST /v1.41/containers/nc_app_test-deploy/start HTTP/1.1"
<134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:33.116] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
<134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:33.124] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
<134>Jun  8 10:23:33 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:33.124] docker_engine bk_docker_engine/dockersocket 0/0/0/0/0 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
<134>Jun  8 10:23:34 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:34.125] docker_engine bk_docker_engine/dockersocket 0/0/0/1/1 200 5533 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
<134>Jun  8 10:23:35 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:35.126] docker_engine bk_docker_engine/dockersocket 0/0/0/1/1 200 5597 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"
<134>Jun  8 10:23:36 haproxy[13]: 172.18.0.11:57834 [08/Jun/2024:10:23:36.128] docker_engine bk_docker_engine/dockersocket 0/0/0/1/1 200 5648 - - ---- 1/1/0/0/0 0/0 "GET /v1.41/containers/nc_app_test-deploy/json HTTP/1.1"

Hi, I have the same issue, did you fixed it?

After update Appapi v3.0.0, it can be solved.