Docker Install, Reset Password, and Allow Database to be Writen too

Ok, so here we go. I have successfully install Nextcloud on my synology using docker. The site pulls up and asks me to create an administrator. I create the administrator. It sits for a while doing it’s thing. I can confirm the creation of database items inside phpmyadmin. Everything seems to be working. Then It comes up asking me to sign into next cloud. I sign in using the new admin account I created and nothing happens. It spins and goes too a redirect. “http://10.10.10.80:8080/login?redirect_url=/apps/dashboard/” asking me to log back in. I try to log back in and the same thing happens.

In the past when I saw this I solved it by adding the code below. Then resetting the master password using the OCC command.

 'overwrite.cli.url' => 
  array (
    0 => '10.10.10.80:8080',
	1 => 'cloud.example.com',
	2 => 'www.cloud.example.com'
  ),
  'overwriteprotocol' => 
  array (
    0 => 'https',
	1 => 'http',
  ),

This was the command I use to use:

$ sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin

However, I’m on a synology where you must run code through a scheduled task and there is no additional input allowed except for the command that you give. I have tried verious of things I found on the internet with no success. This was the last command I tried.

sudo docker exec -u www-data cloud_rndadhdman_com_nextcloud_1 php occ user:resetpassword david

This was the response I got back for the command:

Task: ResetNextCloudPassword
Start time: Tue, 22 Feb 2022 15:50:39 GMT
Stop time: Tue, 22 Feb 2022 15:50:39 GMT
Current status: 1 (Interrupted)
Standard output/error:
Console has to be executed with the user that owns the file config/config.php
Current user id: 33
Owner id of config.php: 1026
Try adding 'sudo -u #1026' to the beginning of the command (without the single quotes)
If running with 'docker exec' try adding the option '-u 1026' to the docker command (without the single quotes)

When I added the sudo -u #1026 this is the error message I got

Task: ResetNextCloudPassword
Start time: Tue, 22 Feb 2022 15:49:35 GMT
Stop time: Tue, 22 Feb 2022 15:49:35 GMT
Current status: 1 (Interrupted)
Standard output/error:
sudo: unknown user: 1026
sudo: error initializing audit plugin sudoers_audit

Here is the docker compose I scrapped together to make this happen.

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=PasswordsRockMySocksToMarsAndBackYall
      - MYSQL_PASSWORD=PasswordsRockMySocksToMarsAndBackYall
      - MYSQL_DATABASE=nextclouddb
      - MYSQL_USER=nextcloud
	ports:
      - 3305:3306

  nextcloud:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /volume1/docker/cloud_rndadhdman_com/html:/var/www/html
      - /volume1/docker/cloud_rndadhdman_com/custom_apps:/var/www/html/custom_apps
      - /volume1/docker/cloud_rndadhdman_com/config:/var/www/html/config
      - /volume1/docker/cloud_rndadhdman_com/data:/var/www/html/data
      - /volume1/docker/cloud_rndadhdman_com/themes:/var/www/html/themes/
    environment:
      - MYSQL_PASSWORD=PasswordsRockMySocksToMarsAndBackYall
      - MYSQL_DATABASE=nextclouddb
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: pma
    links:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
    restart: always
    ports:
      - 8081:80
networks:
  default:
    external: true
    name: nextcloud

Other things I have tried:

  • I have tried to add the above statements to the config file before doing the first sign in, this caused a 500 error. I tried to match permissions of the config file, but nothing worked. Unsure if that was a good way to go or not.
  • tried using the termial on docker to reset the password. This caused docker to erase key files and brick the next cloud. I had to rebuild.

So here are the questions:

  1. How can I reset a users password using synology scheduled tasks?
  2. Can I add these config changes to the config file during the container’s creation?
  3. Is there a perfect compose out there that allows for phpmyadmin, nextcloud, and mariadb?

Update:
The Environment for nextcloud, I added -TRUSTED_PROXIES. This now allows me to login without any issues while connected to the 10.10.10.80:8080. I have not setup a domain and passed to it yet. That is the next step. Will update if this is a problem with a domain. Then we will push it to ssl.