Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docker_notes:docker-nextcloud [2024-04-27 Sat wk17 11:58] – [CLI Use of Nextcloud] baumkpdocker_notes:docker-nextcloud [2024-04-28 Sun wk17 14:58] (current) – [Nextcloud with supervisord] baumkp
Line 1: Line 1:
 {{tag>linux docker nextcloud mysql mariadb}} {{tag>linux docker nextcloud mysql mariadb}}
 ======Nextcloud Container====== ======Nextcloud Container======
-<del>Nextcloud publishes their own Docker container of Nextcloud.</del> The Nextcloud image on Docker hub is maintained by the Nextcloud community, and is not officially supported by Nextcloud!   Linuxserver.io, as well as some others also have Nextcloud containers on Docker Hub.+<del>Nextcloud publishes their own Docker container of [[https://hub.docker.com/_/nextcloud|Nextcloud]].</del> The Nextcloud image on Docker hub is maintained by the Nextcloud community, and is not officially supported by Nextcloud!   Linuxserver.io, as well as some others also have Nextcloud containers on Docker Hub.
  
 Nextcloud needs a number of services to run; the main Nextcloud server, a database and Redis. In addition, there needs to be a proxy server or similar to forward on common domain requests to sub-domains as well as handling certificates, however this is required for all the various services and can be considered separately. Nextcloud needs a number of services to run; the main Nextcloud server, a database and Redis. In addition, there needs to be a proxy server or similar to forward on common domain requests to sub-domains as well as handling certificates, however this is required for all the various services and can be considered separately.
Line 10: Line 10:
   * ''%%docker exec -u www-data nextcloud-app-1 php occ maintenance:mode --off|on%%'' to turn maintenance mode off or on from the containers host shell   * ''%%docker exec -u www-data nextcloud-app-1 php occ maintenance:mode --off|on%%'' to turn maintenance mode off or on from the containers host shell
  
 +=====Nextcloud with supervisord=====
 +The base [[https://hub.docker.com/_/nextcloud|Nextcloud]] image does not directly support cron.  So it needs to be added, for the nextcloud-fpm.alpine version see [[https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron/fpm-alpine|github nextcloud docker fpm-apline cron dockerfile examples]]
 +
 +++tl;dr;|Today (2024-04-27) after upgrading to Nextcloud 29 I finally got rid of all my administration security and setup page warnings and errors. This included some issues with nginx configuration that magically went away with version 29 and adding imagemagick-svg to the image as just noted. As well as cleaning up [[https://wiki.kptree.net/doku.php?id=docker_notes:docker-nextcloud#file_integrity_check|file integrity error messages]].  This is the first time since moving to Nextcloud on Docker and quite some time before that.++
 +
 +As docker adminstartion warns about missing php imagemagick-svg support I also added the Apline package to the updated image to rectify this warning.  
 +
 +++++ Dockerfile|
 +<code yaml>#FROM nextcloud:stable-fpm-alpine
 +FROM nextcloud:fpm-alpine
 +# See https://hub.docker.com/_/nextcloud/ 
 +#   stable-fpm-alpine or production-fpm-alpine give the 
 +#   latest stable / production version versus fpm-alpine
 +#   that give the latest release
 +
 +RUN apk add --no-cache imagemagick-svg supervisor \
 +  && mkdir /var/log/supervisord /var/run/supervisord
 +
 +COPY supervisord.conf /
 +
 +ENV NEXTCLOUD_UPDATE=1
 +
 +CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]</code>
 +++++
 +
 +++++supervisord.conf|
 +<code yaml>[supervisord]
 +nodaemon=true
 +logfile=/var/log/supervisord/supervisord.log
 +pidfile=/var/run/supervisord/supervisord.pid
 +childlogdir=/var/log/supervisord/
 +logfile_maxbytes=50MB                           ; maximum size of logfile before rotation
 +logfile_backups=10                              ; number of backed up logfiles
 +loglevel=error
 +
 +[program:php-fpm]
 +stdout_logfile=/dev/stdout
 +stdout_logfile_maxbytes=0
 +stderr_logfile=/dev/stderr
 +stderr_logfile_maxbytes=0
 +command=php-fpm
 +
 +[program:cron]
 +stdout_logfile=/dev/stdout
 +stdout_logfile_maxbytes=0
 +stderr_logfile=/dev/stderr
 +stderr_logfile_maxbytes=0
 +command=/cron.sh</code>
 +++++
 +++++docker-compose.yml|
 +<code yaml>---
 +services:
 +  app:
 +    build: ./
 +    image: nextcloud-fpm-cron:latest
 +#    image: nextcloud:fpm-alpine
 +    restart: always
 +    depends_on:
 +      - db
 +      - redis
 +    volumes:
 +      - /mnt/docker_store/nextcloud/data/html/data:/var/www/html/data
 +      - /mnt/docker_store/nextcloud/data/html/custom_apps:/var/www/html/custom_apps
 +      - /mnt/docker_store/nextcloud/data/html/config:/var/www/html/config
 +      - /mnt/docker_store/nextcloud/data/html/themes:/var/www/html/themes
 +    networks:
 +      - proxy
 +    environment:
 +      - MYSQL_PASSWORD=kpb1670
 +      - MYSQL_DATABASE=nextcloud
 +      - MYSQL_USER=nextcloud
 +      - MYSQL_HOST=db
 +      - REDIS_HOST=redis
 +
 +  db:
 +    image: mariadb:11.3
 +    restart: always
 +    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
 +    volumes:
 +      - /mnt/docker_store/nextcloud/data/db:/var/lib/mysql
 +    environment:
 +      - MYSQL_ROOT_PASSWORD=kpb8487
 +      - MYSQL_PASSWORD=kpb1670
 +      - MYSQL_DATABASE=nextcloud
 +      - MYSQL_USER=nextcloud
 +      - MARIADB_AUTO_UPGRADE=1
 +    networks:
 +      - proxy
 +
 +  redis:
 +    image: redis:alpine
 +    restart: always
 +    networks: 
 +      - proxy
 +
 +  web:
 +    image: nginx
 +    restart: always
 +    ports:
 +      - 8180:80
 +    depends_on:
 +      - app
 +    volumes:
 +      - ./nginx.conf:/etc/nginx/nginx.conf:ro
 +    volumes_from:
 +      - app
 +    networks:
 +      - proxy
 + 
 +volumes:
 +  nextcloud:
 +  db:
 +
 +networks:
 +  proxy:
 +    external: true
 +</code>
 +++++
 ====RedirectRegex==== ====RedirectRegex====
 I get a redirect error in Nextcloud that I have not been able to track down to date.  Does not seem much info in this on the net, and the little there is also indicates a problem without and easy solution.  Nextcloud main support looks Apache web server based with little Nginx support and even less Traefik support. I get a redirect error in Nextcloud that I have not been able to track down to date.  Does not seem much info in this on the net, and the little there is also indicates a problem without and easy solution.  Nextcloud main support looks Apache web server based with little Nginx support and even less Traefik support.
Line 87: Line 205:
   *[[https://github.com/nextcloud/docker/tree/master/.examples|nextcloud github docker examples section]]   *[[https://github.com/nextcloud/docker/tree/master/.examples|nextcloud github docker examples section]]
  
-====CLI Use of Nextcloud====+=====CLI Use of Nextcloud=====
 Sometime it is necessary to get direct CLI (command line interface) access to Nextcloud for updating, turning of maintenance mode and similar. Sometime it is necessary to get direct CLI (command line interface) access to Nextcloud for updating, turning of maintenance mode and similar.
   * ''%%docker exec -it --user www-data nextcloud-app-1 ash%%''  gain terminal access to Nextcloud   * ''%%docker exec -it --user www-data nextcloud-app-1 ash%%''  gain terminal access to Nextcloud
Line 363: Line 481:
 ++++ ++++
  
-===File Integrity Check=== +====File Integrity Check==== 
-This error is a bit painful.  Basically check the files that are called up as failing integrity.  Judiciously delete files where they are not needed.  Then run command in the nextcloud instance: ''php occ integrity:check-core''.+This error is a bit painful.  In the nextcloud instance (container)" 
 +  - Basically check the files that are called up as failing integrity.   
 +  - Judiciously delete files where they are not needed.   
 +  - Then run command: ''php occ integrity:check-core''
 +Nextcloud runs ''integrety:check-core'' when starting.  So if manually cleaning-up Nextcloud to remove errors Nextcloud needs to have command manually run or restarted.
  
 =====Nextcloud Client and CLI client configuration===== =====Nextcloud Client and CLI client configuration=====