Container nextcloud-aio-nextcloud starts extremely slow

The main issue: The container nextcloud-aio-nextloud takes more than 25 minutes to start. I expect it to start in no more than 2 minutes. There is barely any load on the system while it is starting.

Eventually Nextcloud is starting normally, and it seems to work reanonably well. But I also have a cloud VPS at Hetzner with 4 cores, 8GB and that starts normally - and it has a lot of apps installed and a few hundred GB of data.

I’m running Nextcloud AIO v7.2.1

What is my setup?
At home, behind my router, on a mini-pc with a Ryzen 7 7840HS. I’m running Proxmox 8 with two VMs.
vm1 is running only nextcloud.
vm2 is running SWAG and several services. SWAG is reverse proxy to vm1 as well.

vm1 has 8 virtual cores and 16GB RAM.

I enabled all services for nextcloud, including ClamAV, Talk recording. But without those two it was equally slow. Also, only Apache, Notify push and Nextcloud are still ‘starting’. The first two are just waiting for Nextcloud to start.

My docker compose on vm1:

services:
  nextcloud-aio-mastercontainer:
    image: nextcloud/all-in-one:latest
    init: true
    restart: always
    container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
      - /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
    ports:
       - 8080:8080
      - 443:443
      - 8443:8443 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
    environment: # Is needed when using any of the options below
      - APACHE_PORT=11000 # Is needed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      - APACHE_IP_BINDING=192.168.2.154 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
       - NEXTCLOUD_DATADIR=/home/myuser/nextcloud/data # Allows to set the host directory for Nextcloud's datadir. ⚠️⚠️⚠️ Warning: do not set or adjust this value after the initial Nextcloud installation is done! See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
     - NEXTCLOUD_MEMORY_LIMIT=1024M # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-memory-limit-for-nextcloud
      - NEXTCLOUD_ADDITIONAL_APKS=imagemagick # This allows to add additional packages to the Nextcloud container permanently. Default is imagemagick but can be overwritten by modifying this value. See https://github.com/nextcloud/all-in-one#how-to-add-os-packages-permanently-to-the-nextcloud-container
      - NEXTCLOUD_ENABLE_DRI_DEVICE=false # This allows to enable the /dev/dri device in the Nextcloud container. ⚠️⚠️⚠️ Warning: this only works if the '/dev/dri' device is present on the host! If it should not exist on your host, don't set this to true as otherwise the Nextcloud container will fail to start! See https://github.com/nextcloud/all-in-one#how-to-enable-hardware-transcoding-for-nextcloud
      - SKIP_DOMAIN_VALIDATION=true

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer # This line is not allowed to be changed as otherwise the built-in backup solution will not work

I explicitly set NEXTCLOUD_ENABLE_DRI_DEVICE to false because the log from nextcloud-aio-nextloud starts with something about /dev/dri:

 2023-09-22 17:49:36.668909+00
(1 row)

+ '[' -f /dev-dri-group-was-added ']'
++ find /dev -maxdepth 1 -mindepth 1 -name dri
+ '[' -n '' ']'
+ set +x
Installing imagemagick via apk...
Enabling Imagick...
Configuring Redis as session handler...
Setting php max children...

I set SKIP_DOMAIN_VALIDATION=true because without that I couldn’t get the proxy server to work. My SWAG/Nginx nextcloud.subdomain.conf on vm2 looks like this:

server {
      listen 443 ssl;  
      #listen [::]:443 ssl;  
      server_name nc.mydomain.com;  
       
      #include /config/nginx/ssl.conf;  
      client_max_body_size 0;  
   
      location / {
          include /config/nginx/proxy.conf;  
          # resolver 127.0.0.11 valid=30s;
          proxy_pass http://192.168.2.154:11000;  
          }  
    } 

Here is the log from nextcloud-aio-nextcloud after it started.

-------------------------------
 2023-09-22 17:49:36.668909+00
(1 row)

+ '[' -f /dev-dri-group-was-added ']'
++ find /dev -maxdepth 1 -mindepth 1 -name dri
+ '[' -n '' ']'
+ set +x
Installing imagemagick via apk...
Enabling Imagick...
Configuring Redis as session handler...
Setting php max children...
Applying one-click-instance settings...
System config value one-click-instance set to boolean true
System config value one-click-instance.user-limit set to integer 100
System config value one-click-instance.link set to string https://nextcloud.com/all-in-one/
support already enabled
Adjusting log files...
System config value upgrade.cli-upgrade-link set to string https://github.com/nextcloud/all-in-one/discussions/2726
System config value logfile set to string /var/www/html/data/nextcloud.log
Config value logfile for app admin_audit set to /var/www/html/data/audit.log
System config value updatedirectory set to string /nc-updater
Applying network settings...
System config value davstorage.request_timeout set to integer 3600
System config value trusted_domains => 1 set to string nc.mydomain.com
System config value overwrite.cli.url set to string https://nc.mydomain.com/
System config value htaccess.RewriteBase set to string /
.htaccess has been updated
System config value dbpersistent set to boolean true
System config value files_external_allow_create_new_local set to boolean false
System config value trusted_proxies => 0 set to string 127.0.0.1
System config value trusted_proxies => 1 set to string ::1
Config value base_endpoint for app notify_push set to https://nc.mydomain.com/push
Config value wopi_url for app richdocuments set to https://nc.mydomain.com/
System config value allow_local_remote_servers set to boolean true
No ipv6-address found for nc.mydomain.com.
Config value wopi_allowlist for app richdocuments set to [my ip4]],127.0.0.1/8,192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,fd00::/8,::1
Config value recording_servers for app spreed set to {"servers":[{"server":"http://nextcloud-aio-talk-recording:1234/","verify":true}],"secret":"somesecret"}
Config value av_mode for app files_antivirus set to daemon
Config value av_port for app files_antivirus set to 3310
Config value av_host for app files_antivirus set to nextcloud-aio-clamav
Config value av_stream_max_length for app files_antivirus set to 104857600
Config value av_max_file_size for app files_antivirus set to 104857600
Config value av_infected_action for app files_antivirus set to only_log
System config value enabledPreviewProviders => 0 set to string OC\Preview\Imaginary
System config value preview_imaginary_url set to string http://nextcloud-aio-imaginary:9000
{
    "search_platform": "OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform",
    "app_navigation": "0",
    "provider_indexed": "{\"test_provider\":\"0\",\"deck\":\"1\",\"files\":\"1\"}",
    "cron_err_reset": "1695150093",
    "tick_ttl": "1800",
    "collection_indexing_list": "50",
    "migration_24": "1"
}
{
    "elastic_host": "http:\/\/elastic:6a4fba509d1a4bb425cbc620bd33266a86871686fce14b9a@nextcloud-aio-fulltextsearch:9200",
    "elastic_index": "nextcloud-aio",
    "fields_limit": "10000",
    "es_ver_below66": "0",
    "analyzer_tokenizer": "standard"
}
{
    "files_local": "1",
    "files_external": "0",
    "files_group_folders": "0",
    "files_encrypted": "0",
    "files_federated": "0",
    "files_size": "20",
    "files_pdf": "1",
    "files_office": "1",
    "files_image": "0",
    "files_audio": "0",
    "files_chunk_size": "2"
}
[22-Sep-2023 18:16:56] NOTICE: fpm is running, pid 951
[22-Sep-2023 18:16:56] NOTICE: ready to handle connections
Activating Collabora config...
Activated any config changes

The time in this docker is 2 hours behind the time on the vm by the way.

My router is forwarding ports 80 and 443 to vm2 (the reverse proxy). I forwarded port 3478 (Talk) to vm1, although I’m not sure that is correct and it did not solve this problem anyway.

I’m out of my league here. Is it something to do with the reverse proxy settings? Something with the firewall from my router? Is Nextcloud trying to verify something or waiting for something at every step?

Trying asking Hetzner. Your provider should be able to help you.

It’s not a Hetzner problem, that one works fine. It’s a self hosting living room problem. That one is slow to start its container.

Okay, in that case you could fill out our support template. Do also keep in mind we have no idea on other services running on the machine and also using up resources. Use top and similar tools to see what is actually running. For example, my Nextcloud docker boots off of an old microsd card in a few seconds. I’ve never encountered the performance issues you are talking about, but hopefully we can offer assistance based off logs and more info.

You are missing the required support template. Please fill this form out and edit into your post.

This will give us the technical info and logs needed to help you! Thanks.

1 Like

Thanks for helping out. I will fill out the form below. The issue is gone when I use Caddy for reverse proxy. However, this is not a good option for me, since I don’t know how to get other services to work then - I have no experience with it and I ran into problems with the first service other than nextcloud I tried to proxy with it. So I rather solve this problem.

Nextcloud version (eg, 20.0.5): Nextcloud AIO v7.2.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): the one in latest AIO version
PHP version (eg, 7.4): the one in latest AIO version

The issue you are facing:
I’m reverse proxying from VM2 to VM1. The reverse proxy is the latest SWAG image (so Nginx). It seems to work, but the nextcloud-aio-nextcloud container takes 30 minutes to start. After that it operates normally.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Install proxmox. Install 2 VMs with Ubuntu 22.04 with Docker
  2. Run SWAG in VM2 and Nextcloud AIO in VM1
  3. Start VM2, start VM1. Go through install. Notice Nextcloud starts slowly.

The output of your Nextcloud log in Admin > Logging:

not there yet, since it is now stuck in one of its 30 minute boot processes. 

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  '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,
    ),
  ),
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => '85172523055somethingsomethinge5fe8aa5611efbd10',
    'port' => 6379,
  ),
  'overwritehost' => 'nc.mydomain',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'Lqx3Twsomethingsomething7kcY',
  'secret' => 'hu8UdzPiuM/ysFsomethingsomething8bSr2kvn',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'nc.mydomain',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '27.1.0.7',
  'overwrite.cli.url' => 'https://nc.mydomain/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => '969b5ff6csomethingsomethingfb86',
  'installed' => true,
  'instanceid' => 'oco8ue8j6xv9',
  'maintenance' => false,
  'loglevel' => '2',
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => '10485760',
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'enabledPreviewProviders' => 
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
  ),
  'enable_previews' => true,
  'upgrade.disable-web' => true,
  'mail_smtpmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 30',
  'activity_expire_days' => '30',
  'simpleSignUpLink.shown' => false,
  'share_folder' => '/Shared',
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'upgrade.cli-upgrade-link' => 'https://github.com/nextcloud/all-in-one/discussions/2726',
  'updatedirectory' => '/nc-updater',
  'davstorage.request_timeout' => 3600,
  'htaccess.RewriteBase' => '/',
  'dbpersistent' => true,
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
    1 => '::1',
  ),
  'allow_local_remote_servers' => true,
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'mail_from_address' => 'mail',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'mydomain',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'mail.mydomain',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'mail@mymail',
  'mail_smtppassword' => '1HsomethingsomethingaE',
  'default_phone_region' => 'NL',
);

The output of your Apache/nginx/system log in /var/log/____:
this is from 192.168.2.154:8080/api/docker/logs?id=nextcloud-aio-apache

Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...
Waiting for Nextcloud to start...

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

PASTE HERE

It just started, there are no output errors