docker icon indicating copy to clipboard operation
docker copied to clipboard

Brainstorm how (if) to do anything specific to AppAPI in our examples/docs/etc

Open joshtrichards opened this issue 11 months ago • 7 comments

https://github.com/nextcloud/app_api https://nextcloud.github.io/app_api/DeployConfigurations.html https://github.com/nextcloud/docker-socket-proxy

Off-hand:

  • Examples
  • Docs
  • Links (e.g. to the above resources)

joshtrichards avatar Jan 03 '25 15:01 joshtrichards

I have mixed feelings on this. It works, but the check container never goes past healthcheck, and at some random time it just stops working unless I down&up the whole compose stack. Followed AppApi docs to the dot, tried random stuff from their issue section - I never got it "cleanly" working without any workarounds. If we copy-paste their docs without some way of "simplifying" the process, we gonna have a lot of people opening tickets here, not there ;)

tzerber avatar Jan 21 '25 16:01 tzerber

Doubleposting, because i just updated primary instance to .5 and here we go again ..

Image Using the below appapi dsp

nextcloud-appapi-dsp:
    platform: linux/amd64
    container_name: appapi
    image: ghcr.io/nextcloud/nextcloud-appapi-dsp:release

I will probably start documenting the whole process in order to (maybe?) put an example file.

tzerber avatar Jan 25 '25 06:01 tzerber

My setup differs a bit from the "examples" because I use a completely separated proxy / proxy network, but it goes along this:

You need Redis, you need cron container, main app container and appapi container at minimum for it to work. AppApi has to have additional network because that network is needed for the daemon setup. Don't ask me why, but this way it works fine.

  appapi:
    name: appapi_network

You need to fill the following, as show in the image :

Image

Where :

  1. Display Name is clear what it is
  2. Deployment metod must be Docker or Custom install, it works with Docker
  3. Nexcloud URL must be the external root of the nextcloud instance, as seen from the internet. The checkbox "Enable HTTPS" must not be checked.
  4. Advanced config : Network name must be the network you created in the compose file (will provide example below).
  5. HaProxy password must match the password in compose file / env file.
  6. Compute device : CPU. Working on running it with GPU as well and getting the docs needed.

Here's a slightly modified compose from my prod environment. It's been running for quite a while now, and it works fine.

services:
  db:
    image: postgres:16-alpine
    restart: unless-stopped
    volumes:
      - db:/var/lib/postgresql/data:Z
    environment:
      - POSTGRES_PASSWORD=CHANGEME
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud

  app:
    image: nextcloud:stable-fpm
    restart: unless-stopped
    volumes:
      - nextcloud:/var/www/html
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - default
      - appapi
    environment:
      - REDIS_HOST=redis
      - POSTGRES_HOST=db
      - POSTGRES_PASSWORD=CHANGEME
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
    depends_on:
      - db
      - redis

  redis:
    image: redis:alpine
    restart: unless-stopped

  web:
    image: nginx:alpine
    restart: unless-stopped
    hostname: web
    volumes:
      - nextcloud:/var/www/html:ro
      - ./nginx.conf:/etc/nginx/nginx.conf:ro # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
    expose:
      - 80
    depends_on:
      - app
    networks:
      - default
      - proxy
      - appapi

  cron:
    image: nextcloud:stable-fpm
    restart: unless-stopped
    networks:
      - default
      - appapi
    volumes:
      - nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis
  
  nextcloud-appapi-dsp:
    platform: linux/amd64
    image: ghcr.io/nextcloud/nextcloud-appapi-dsp:release
    networks:
      - default
      - proxy
      - appapi
    restart: unless-stopped
    environment:
      - NC_HAPROXY_PASSWORD=CHANGEME
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    privileged: true

volumes:
  db:
  nextcloud:

networks:
  proxy:
    name: proxy-manager_proxy_network
    external: true
  appapi:
    name: appapi_network
graph TD
    subgraph Proxy Stack
        Proxy[Proxy Container]
        ProxyNet
    end

    subgraph Nextcloud Stack
        NC-Cron
        NC-Main
        DB
        Web
        Redis
        AppApiDSP[AppApi Container]
        NCNet
        AppApiNet[App Api Network]
    end

    %% Networks
    ProxyNet[Proxy Network]
    NCNet[Nextcloud Internal Network]
    Internet[Internet]

    %% Connections
    Internet --- |HTTPS| ProxyNet
    ProxyNet ---|HTTPS| Internet
    ProxyNet --- Proxy
    Proxy --- ProxyNet
    NCNet --- ProxyNet
    NCNet --- Redis
    Redis --- NCNet
    ProxyNet --- NCNet
    NC-Cron --- NCNet
    NC-Main --- NCNet
    DB --- NCNet
    NCNet --- NC-Cron
    NCNet --- NC-Main
    NCNet --- DB
    NCNet --- AppApiDSP
    AppApiDSP --- NCNet
    AppApiNet --- AppApiDSP
    AppApiDSP --- AppApiNet
    AppApiNet --- ProxyNet
    ProxyNet --- AppApiNet
    Web --- NCNet
    NCNet --- Web

@joshtrichards when you have some free time, can you please test it ?

I'm in a proccess of figuring out a working solution for the GPU variant, because there's some weird randomness as well :)

EDIT:

Image

tzerber avatar Mar 04 '25 13:03 tzerber

Another thing

To run LLM2 and the AI stuff, you need to have poetry in the container. The easiest way is to have a custom Dockerfile that has the following (Note: unsure of the ffmpeg part, because the Dockerfile below is a strip from a prod one that has a bunch of other things in it. Even unused it's not that big of a burden to have it) :

FROM nextcloud:stable-fpm
RUN apt-get update && apt-get install -y ffmpeg python3.11-venv pipx 
USER www-data
RUN pipx ensurepath
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
USER root

tzerber avatar Mar 05 '25 07:03 tzerber

Update: It works like charm in 31.0.9 and as I can see AppApi is part of Server now. I will make an example for the DSP container and call it a day.

tzerber avatar Sep 29 '25 14:09 tzerber

After upgrading to NC 32, I get the following error, using my docker-compose.yml.

Image

Is this issue here also related to the need of including this new nextcloud-appapi-dsp on .examples?

e.g.

  appapi_dsp:
    image: ghcr.io/nextcloud/nextcloud-appapi-dsp:release
    container_name: nextcloud-appapi-dsp
    restart: unless-stopped
    volumes:
      - html:/var/www/html
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DSP_VERBOSE=1
      - DSP_NEXTCLOUD_CONTAINER_NAME=nextcloud-app
      - DSP_DOCKER_NETWORK=nextcloud_default

24mu13 avatar Oct 10 '25 13:10 24mu13

EDIT: nvm, it's actually required and it's called HaRP or something. Will add it to examples.

tzerber avatar Oct 10 '25 16:10 tzerber