1

Ubuntu 18.04 Docker version 20.10.2 docker-compose version 1.27.4

The main problem here is that i have pretty little experience with dockers.

From this page I think I need to download and place the apps in /var/www/nextcloud/apps, the thing is... that route as I understand is the one inside the docker.

I may be able to copy the files like this solution, but I want a cleaner version where I can keep editing and updating the apps.

In my .yml file I have one entry like this:

volumes:
  - /data/ncweb:/var/www/html

I think I should add another entry to link that virtual path with a real one outside the docker.

2 issues here:

  1. I don't know which entry should be
  2. Not sure if I have to tell Nextcloud to look there and how, in my opinion there will be no need.

Maybe this?

volumes:
  - /data/ncweb:/var/www/html
  - /data/ncapps:/var/www/nextcloud/apps

I don't know either how to look for the path of apps inside the docker, so that route may be totally wrong. I tried with a tool named dive but I'm using it in the wrong way.

Thanks in advance

..... EDIT .....

Here there is the full .yml file

version: "3.3"

networks:
  web:
    external: true
  internal:
    external: false

services:
  nextcloud:
    image: nextcloud:20
    container_name: nextcloud-web
    environment:
      MYSQL_HOST: nextcloud-db:3306
      MYSQL_DATABASE: nextdb
      MYSQL_USER: nextuser
      MYSQL_PASSWORD: abcdefghijklm
    volumes:
      - ./ncweb:/var/www/html
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=web"
      - "traefik.http.routers.nc.rule=Host(`example.com`)"
      - "traefik.http.routers.nc.entrypoints=websecure"
      - "traefik.http.routers.nc.tls=true"
      - "traefik.http.routers.nc.tls.certresolver=le"
      - "traefik.http.routers.nc.middlewares=nc-header"
      - "traefik.http.routers.nc.service=nextcloud"
      - "traefik.http.services.nextcloud.loadbalancer.server.port=80"
      - "traefik.http.middlewares.nc-header.headers.referrerPolicy=no-referrer"
      - "traefik.http.middlewares.nc-header.headers.stsSeconds=31536000"
      - "traefik.http.middlewares.nc-header.headers.forceSTSHeader=true"
      - "traefik.http.middlewares.nc-header.headers.stsPreload=true"
      - "traefik.http.middlewares.nc-header.headers.stsIncludeSubdomains=true"
      - "traefik.http.middlewares.nc-header.headers.browserXssFilter=true"
      - "traefik.http.middlewares.nc-header.headers.customRequestHeaders.X-Forwarded-Proto=https"
    networks:
      - internal
      - web
    depends_on:
      - nextcloud-db
      - ooserver
    logging:
      options:
        max-size: '1m'
        max-file: '10'
      driver: json-file

  ooserver:
    image: alehoho/oo-ce-docker-license
    container_name: ooserver
    environment:
      # Uncomment strings below to enable the JSON Web Token validation.
      - JWT_ENABLED=true
      - JWT_SECRET=abcdefghijklm
      - JWT_HEADER=Authorization
      - JWT_IN_BODY=true
    networks:
      - web
    stdin_open: true
    tty: true
    restart: unless-stopped
    volumes:
      - ./oodata:/var/www/onlyoffice/Data
      - ./oolib:/var/lib/onlyoffice
      - ./oodb:/var/lib/postgresql
      - ./oologs:/var/log/onlyoffice
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=web"
      - "traefik.http.routers.oo.service=oo"
      - "traefik.http.routers.oo.entrypoints=websecure"
      - 'traefik.http.routers.oo.rule=Host("ooserver.example.com")'
      - "traefik.http.routers.oo.tls=true"
      - "traefik.http.routers.oo.tls.certresolver=le"
      - "traefik.http.routers.oo.middlewares=oo-header"
      - "traefik.http.services.oo.loadbalancer.server.port=80"
      - "traefik.http.middlewares.oo-header.headers.referrerPolicy=no-referrer"
      - "traefik.http.middlewares.oo-header.headers.stsSeconds=31536000"
      - "traefik.http.middlewares.oo-header.headers.forceSTSHeader=true"
      - "traefik.http.middlewares.oo-header.headers.stsPreload=true"
      - "traefik.http.middlewares.oo-header.headers.stsIncludeSubdomains=true"
      - "traefik.http.middlewares.oo-header.headers.browserXssFilter=true"
      - "traefik.http.middlewares.oo-header.headers.customRequestHeaders.X-Forwarded-Proto=https"
    logging:
      options:
        max-size: '1m'
        max-file: '10'
      driver: json-file

  nextcloud-db:
    image: mariadb:10
    container_name: nextcloud-db
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    environment:
      MYSQL_ROOT_PASSWORD: abcdefghijklm
      MYSQL_DATABASE: nextdb
      MYSQL_USER: nextuser
      MYSQL_PASSWORD: abcdefghijklm
    volumes:
      - nextdb-data:/var/lib/mysql
    restart: unless-stopped
    networks:
      - internal
    labels:
      - "traefik.enable=false"
    logging:
      options:
        max-size: '1m'
        max-file: '10'
      driver: json-file

  adminer:
    image: adminer
    container_name: nextcloud-dbadmin
    environment:
      ADMINER_DEFAULT_SERVER: nextcloud-db
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=web"
      - "traefik.http.routers.dbncadmin.rule=Host(`dbadmin.example.com`)"
      - "traefik.http.routers.dbncadmin.entrypoints=websecure"
      - "traefik.http.routers.dbncadmin.tls=true"
      - "traefik.http.routers.dbncadmin.tls.certresolver=le"
      - "traefik.http.routers.dbncadmin.service=dbncadmin"
      - "traefik.http.routers.dbncadmin.middlewares=securelogin"
      - "traefik.http.services.dbncadmin.loadbalancer.server.port=8080"
      - "traefik.http.middlewares.securelogin.basicauth.users=xxxxxx:$$apr1$$abcdefghijklm$$abcdefghijklm"
    networks:
      - internal
      - web
    depends_on:
      - nextcloud-db

volumes:
  nextdb-data:
dadiaar
  • 418
  • 5
  • 13
  • Apps can be easily managed within nextcloud webapp pages, there is no need to manage any text file, neither for installing it nor for installing apps. A simple explanation of how to do this could be the correct answer for you? – mrq Feb 06 '21 at 18:16
  • Hi Mrs. Sure, the final goal is to have the Apps. At the moment I can't see most of the Apps in the settings, which would be the normal and easy way. The server is in China, I say it just in case the calls to the store are being blocked. – dadiaar Feb 06 '21 at 22:22
  • Please state the image used or paste the full `docker-compose.yaml`. It makes answering your question way easier (and shorter ;) ). – boppy Feb 07 '21 at 00:40
  • You are broadly on the right track. You do want to map the downloaded files to a folder (volume) outside the container so that you can restart the container and not have to download the apps again. You will have to find the default location that is used to hold the apps, but that should be in the docs somewhere. – Software Engineer Feb 07 '21 at 08:10
  • Hi Software Engineer, thanks. The path is /var/www/nextcloud/apps, and I would be able to do it if docker wasn't involved, but it is. How do I link the previous path, that is virtualized inside Docker, to the real filesystem? – dadiaar Feb 07 '21 at 08:27

2 Answers2

0

Perfect! As you are using the Container Image provided by Nextcloud themselves, you have a good time!

Just add another volume to you compose file that links to /var/www/html/custom_apps and you should be good to go. See Persistent data in their docs.

You should NOT link the default app path with docker, since that means that an empty (or only with your apps populated) directory is linked into the container. But since NC is kind of a framework, even the file listing is an app - that will be missing, if you don't provide your on version!

boppy
  • 1,753
  • 12
  • 10
0

As of March 2022 the Nextcloud container image has some apps pre-installed in custom_apps. In my case mounting a custom_apps directory overwrote the apps that were already installed there. I ended up adding individual apps as volumes rather than the whole directory. Here's an example docker-compose.yml snippet using the backup app with your file structure in the main app Docker container:

volumes:
  - /data/ncweb:/var/www/html
  - /data/ncapps/backup:/var/www/nextcloud/custom_apps/backup

I had an issue where www-data did not own this file in the Docker container so I modified the entry point for the container that manages the Nextcloud cron job to fix that:

#!/bin/bash

# we need to chown the custom_apps folder in order to install custom apps
chown -R www-data /var/www/html/custom_apps

# run cron script, which is the default entrypoint for the cron usage of this image
/bin/bash /cron.sh

Be sure to mount the volume and the bash script to the cron container and change the default entry point in docker-compose.yml:

volumes:
  - /data/ncweb:/var/www/html
  - /data/ncapps/backup:/var/www/html/custom_apps/backup
  - /cron-entry.sh:/cron-entry.sh
entrypoint: /cron-entry.sh

Just to be clear, there are two Docker containers shown, one for the app and one for the cron job. This snippet of docker-compose.yml is for the cron container, the earlier snippet is for the app container. I noticed in your docker-compose.yml you don't have any mention of the cron container which might be something you want to look into. Nextcloud requires a cron process to run every 5 minutes to handle background tasks and Docker recommends having one process per container which is why I have a separate container just for the cron job. I'm using the cron container to run my own entry script because it was easier to find and call that entry point.

Anyway, once that's done go to /settings/apps/disabled in your Nextcloud app. You should be able to enable the app there.

intcreator
  • 4,206
  • 4
  • 21
  • 39