IOTstack icon indicating copy to clipboard operation
IOTstack copied to clipboard

nextcloud_db is missing

Open AMDFreak2006 opened this issue 1 year ago • 1 comments

When activating the Checkbox for NextCloud installation in the menu.sh script, the generated docker-compose.yml includes a part for nextcloud but not for the nextcloud_db, resutling in a missing dependency.

AMDFreak2006 avatar Mar 15 '25 09:03 AMDFreak2006

I just did the following:

$ cd ~/IOTstack
$ docker-compose down
$ cd ..
$ mv IOTstack IOTstack.off
$ git clone https://github.com/SensorsIot/IOTstack.git
$ cd IOTstack
$ ./menu.sh 
$ cat docker-compose.yml 

The result of the cat:

networks:
  default:
    driver: bridge
    ipam:
      driver: default
  nextcloud:
    driver: bridge
    internal: true
    ipam:
      driver: default

services:
  nextcloud:
    container_name: nextcloud
    image: nextcloud
    restart: unless-stopped
    environment:
    - TZ=${TZ:-Etc/UTC}
    - MYSQL_HOST=nextcloud_db
    - MYSQL_PASSWORD=IOtSt4ckmySqlDbPw
    - MYSQL_DATABASE=nextcloud
    - MYSQL_USER=nextcloud
    ports:
    - "9321:80"
    - "9343:443"
    volumes:
    - ./volumes/nextcloud/html:/var/www/html
    depends_on:
    - nextcloud_db
    networks:
    - default
    - nextcloud

  nextcloud_db:
    container_name: nextcloud_db
    build: ./.templates/mariadb/.
    restart: unless-stopped
    environment:
    - TZ=${TZ:-Etc/UTC}
    - PUID=1000
    - PGID=1000
    - MYSQL_ROOT_PASSWORD=IOtSt4ckToorMySqlDb
    - MYSQL_PASSWORD=IOtSt4ckmySqlDbPw
    - MYSQL_DATABASE=nextcloud
    - MYSQL_USER=nextcloud
    volumes:
    - ./volumes/nextcloud/db:/config
    - ./volumes/nextcloud/db_backup:/backup
    networks:
    - nextcloud

Then:

$ docker-compose up -d
$ docker ps
CONTAINER ID   IMAGE                   COMMAND                  CREATED         STATUS                     PORTS                                         NAMES
1fa7d01b4eb8   nextcloud               "/entrypoint.sh apac…"   3 minutes ago   Up 3 minutes               0.0.0.0:9321->80/tcp, 0.0.0.0:9343->443/tcp   nextcloud
1fdb7ce8db54   iotstack-nextcloud_db   "/init"                  3 minutes ago   Up 3 minutes (unhealthy)                                                 nextcloud_db

However, when I attempted to use the menu to add NextCloud to an existing stack, I got the same error as you are seeing.

The menu system is a great way of getting your first stack up and running but I've long been of the view that it's somewhere between suboptimal and problematic as a maintenance tool. What I generally advise is (a) recognising that, at its core, the menu is just a concatenation tool, and (b) studying how everything inside the IOTstack folder is set up and then rolling your own.

The quickest path to a solution is to open your docker-compose.yml in a text editor, find the nextcloud service definition that was just added by the menu and remove all those lines. Then, instead of using the menu, do this:

$ cd ~/IOTstack
$ sed -e "s/^/  /" ./.templates/nextcloud/service.yml >>docker-compose.yml

The sed sticks two leading spaces on the start of each line, which is needed to convert a "template" into something useful.

It would also be a good idea to check that the start of your compose file looks like the contents of:

~/IOTstack/.templates/docker-compose-base.yml

Among other things, that file defines the private network shared between NextCloud and its database.

Once all that is in place, "up" the stack.

Paraphraser avatar Mar 15 '25 13:03 Paraphraser