Problem with installation and configuration of Nextcloud on Portainer (OpenMediaVault machine) with already configured nginx/duckdns

Hello, Nextcloud community :slight_smile:

I am writing directly to you because OMV community cannot help me with my problems anymore :frowning:

I am runing:

  • OpenMediaVault version 5.6.16-1 with kernel 5.10.0-0.bpo.8-amd64,
  • Portainer 2.6.3,

For a short time I have working Nextcloud instance on my server, I was deployed it in Portainer using below compose file:

version: ‘2’

volumes:
nextcloud:
db:

services:
db:
image: mariadb
container_name: nextcloud-database
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
volumes:
- /srv/dev-disk-by-uuid-1234/Config/nextcloud/database:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=PASSWORD
- MYSQL_PASSWORD=PASSWORD #the same as above
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=USER

app:
image: nextcloud
container_name: nextcloud
restart: always
ports:
- 4141:80
links:
- db
volumes:
- /srv/dev-disk-by-uuid-1234/NEXTCLOUD/data:/var/www/html/data #PATH WHERE USER’S DATA ARE STORED
- /srv/dev-disk-by-uuid-1234/Config/nextcloud/main:/var/www/html
- /srv/dev-disk-by-uuid-1234/Config/nextcloud/config:/var/www/html/config
- /srv/dev-disk-by-uuid-1234/Config/nextcloud/apps:/var/www/html/custom_apps
environment:
- MYSQL_PASSWORD=PASSWORD
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=USER
- MYSQL_HOST=db

I have a one hard drive in my OMV machine. The NEXTCLOUD folder is placed on the root of my OMV hd machine (/NEXTCLOUD), the Config/nextcloud/ folder is also placed on the root of my hard drive (/Config/nextcloud/) and it also contains (Config folder) some folders for other apps running on my server.

So I have managed do deploy below compose file correctly (of course all passwords and user entires are filled with my own data) and Nextcloud was running correctly when using it locally, but when trying to access via address set in my nginx configuration I am stuck on the login screen - I am able to enter login data but after pressing “Log in” button nothing happens (the loading image on the button keeps spinning and spinning). Bypassing this problem was available by refreshing the page - in this case I was taken directly to the nextcloud screen, but overall conenction was very slow, GUI have problems with load completely, etc. And I am also unable to login to it via Android app.

So I was looking for the solution to fix that problem in the internet and found some stuff to update in the config.php file. Unfortunately I was messed the config file completely and does not have a copy of it :frowning: I was decided to undeploy whole nextcloud installation in Portainer. I have removed everything from there and after completing it I have removed both folders created while deploying compose file from my hard drive manually (using SMB connection; I need to update the privileges to the root/user user because these folders have their own privileges).

From this point my problems with installation have begun…

Right now I am able deploy nextcloud container but it can’t configure itself completely and get redy to work.

In nextcloud container log below information appears again and again now:

Initializing nextcloud 22.1.1.2 …,

rsync: [generator] delete_file: rmdir(data#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#302#240#PATH WHERE USER’S DATA ARE STORED) failed: Device or resource busy (16),

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3],

The paths are 100% correct.
Restart of the machine didn’t help.
I’ve even changed the port to other - didn’t help.
I’ve changed the paths to /Config/nxtcld and /NXTCLD - did’t help.
And I hear constant work of my hard drive while this process is in progress.
Folders Config/nextcloud (with all data created while deploying container) and /NEXTCLOUD/data are created and are accessible, but permissions for these folders are changed - I need to restore permissions of my root folder to delete these folders.
Previously for correct installation these folders are also created with changed permissions but not accessible from SMB.

PLEASE HELP

So I have finally found what was wrong with my installation…

When first deploying I have copied code shared by the user of the OMV forum directly to the Portainer editor, changed some stuff and deployed it. Everything works as expected. After messing around with the config.php file, before decided to remove everything and start over I have copied compose text from Portainer editor directly to the newly opened tab in Notepad ++ without saving it as file. For the second and further installations I was using compose text copied directly from the Notepad++ to the Portainer editor.

Please see below path and error log:

/srv/dev-disk-by-uuid-1234/NEXTCLOUD/data:/var/www/html/data           #PATH WHERE USER’S DATA ARE STORED
delete_file: rmdir(data\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240\#302\#240#PATH WHERE USER'S DATA ARE STORED) failed: Device or resource busy (16),

rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3],

In log file there is an data\ path with these strange numbers like #302#240 etc., and at the ending there is a comment #PATH WHERE(…). So I’ve removed whole comment with whitespaces till the to have it directly like this:

/srv/dev-disk-by-uuid-1234/NEXTCLOUD/data:/var/www/html/data

And container was finally deployed without problems…

So it looks like copying from the Portainer editor to Notepad++, or from the Notepad++ to the Portainer editor messed up my text file in processing white spaces and replaced it with some non-white space chars which Portainer took as the part of the path to create.

Containers are running and nextcloud is accessible locally now. But I still have an problem with accessing it outside.

Here is my config.php file:

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oc13ydijqo6f',
  'passwordsalt' => 'cc9RIRbn6PPZ+BfWrpWqd1ajZrbcqF',
  'secret' => 'kRiY2hTQKx4t528vYxOD4KL7wcJ5wFrkFnSPa4nEfu29VJyH',
  'trusted_domains' =>
  array (
    0 => '1.2.3.4:1234',                            //without http/https
    1 => 'nextcloud.domainname.dnsprovider.org',    //also without http/https
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '22.1.1.2',
  'overwrite.cli.url' => 'http://1.2.3.4:1234', 
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'db_user',
  'dbpassword' => 'db_pass',
  'installed' => true,
);

It is an original config.php file. I’ve just added this entry in the ‘trusted_domains’ variable: 1 => ‘nextcloud.domainname.dnsprovider.org’,. Without this entry I am unable to acces my nextcloud from the outside - information that this site is must be added to the config.php file under trusted_domains variable is displayed.

Edit:

Found it!

I have found the solution here:

https://help.nextcloud.com/t/s…c-client-on-linux/47549/4

I have added these lines to my config.php file:

'overwrite.cli.url' => 'https://nextcloud.domainname.dnsprovider.org',
'overwriteprotocol' => 'https',
'overwritehost' => 'nextcloud.domainname.dnsprovider.org',
'trusted_proxies' =>
array (
 0 => '1.2.3.4',
),

And it is loading now.

It is working also in both configurations:

'trusted_domains' =>
array (
 0 => '1.2.3.4:1234',
 1 => 'nextcloud.domainname.dnsprovider.org',
),

and:

'trusted_domains' =>
array (
 0 => '1.2.3.4:1234',
),

and also without this variable:

'trusted_proxies' =>
array (
 0 => '1.2.3.4',
),

Not sure which configuration is 100% correct (or which entires are 100% required) but at least it is working, also on my Android phone :)