Optimize Nextcloud Performance


noja

Recommended Posts

3 hours ago, CorneliousJD said:

 

yes, very easy to get it working w/ FileRun!

 

I installed the onlyoffice/documentserver container, set JWT enabled and created a JWT secret (this protects my onlyoffice from random public use) and threw it behind my reverse proxy, and pointed FileRun to it and gave it the JWT secret so it can authenticate. 

NOTE: I could not get it to work unless I put it behind my reverse proxy, but the JWT token makes that not a concern.

 

That's it. easy peasy :)

 

If needed, here's the bottom  two variables referencing JWT, you'll need to add those yourself - as the template doesn't have them included by default. 

 

image.thumb.png.389ba118d8642f86b34ba52d7ffdbccb.png

Awesome thanks for the info.  I will give that a try and let you know how it goes.  Appreciate all the info and help.

Link to comment
33 minutes ago, InfInIty said:

@CorneliousJD

 

with Nginx, did you just set it up as an HTTP source, and not assign a cert?  With only an office are you supposed to be able to see the web view of the container?  With the community server it just sits and says preparing, I do not get a WebUI at all with the document server.

 

There should be a web UI demo/trial environment on onlyoffice/documentserver

Make sure you're using that container specifically if you're trying to replicate my setup, as that's the official container.

 

As far as reverse proxy goes, I'm using NGINX Proxy Manager (NPM) and I just had to plug in the reverse proxy info, HTTP source w/ the proper port and that was it.

Link to comment
7 minutes ago, CorneliousJD said:

 

There should be a web UI demo/trial environment on onlyoffice/documentserver

Make sure you're using that container specifically if you're trying to replicate my setup, as that's the official container.

 

As far as reverse proxy goes, I'm using NGINX Proxy Manager (NPM) and I just had to plug in the reverse proxy info, HTTP source w/ the proper port and that was it.

Hmm, I am using the same container from your screen shot.  I will keep poking around and see what I can figure out.

Link to comment
  • 5 months later...

Hey I know this thread is pretty old, but I was having the same issues and I just solved in. If you click on the docker for Nextcloud in unRAID, click show more settings, and change the appdata location from /mnt/user/system/appdata/nextcloud to /mnt/cache/system/appdata/nextcloud it fixed my issue. Worth a try.

  • Thanks 1
Link to comment
5 minutes ago, WantACookie said:

Hey I know this thread is pretty old, but I was having the same issues and I just solved in. If you click on the docker for Nextcloud in unRAID, click show more settings, and change the appdata location from /mnt/user/system/appdata/nextcloud to /mnt/cache/system/appdata/nextcloud it fixed my issue. Worth a try.

 

Thanks for the info! My appdata was already on my cache, but I ended up fixing nextcloud performance finally (actually just last week!)

 

The long version here is I abandoned the LSIO container and went with the official apache-based container, spun it up on MariaDB w/ Redis caching, no memory limits (defaults to only 512MB), actually running system cron as recommended, etc, and it's night and day difference in speed, it's amazing, plus the container itself updates the nextcloud instance, no more web-based updater.

  • Thanks 1
  • Upvote 1
Link to comment
44 minutes ago, JonathanM said:

What exactly did you do? Were you able to continue to use your appdata and existing database, or did you start over?

 

I had started completely over, however I'm sure you could get it to work with your existing data but I had given up on nextcloud for months and started using Filerun instead, but Filerun had it's own problems sadly. 

 

This got me motivated to figure out what the heck was going on with Nextcloud again and I started with the official image. My docker config for it is attached, and here's relevant config.php info as well.

 

I even setup Collabra server as a seprate docker and have all that working as well.

Passing with A+ security rating and no issues/warnings found in the instance at all, so far so good!

It's been a long process to tweak to this point but hopefully this gives you a good starting point!

 

Note that I also setup system cron via unraid userscripts running at */5 * * * *

 

 

#!/bin/bash
docker exec -u www-data Nextcloud php cron.php

 

image.thumb.png.ca1332b1c0f09553a91722db29f83046.png

 

Sanitized config.php


 

<?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,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '10.0.0.10',
    'password' => '',
    'port' => 6379,
  ),
  'trusted_proxies' => 
  array (
    0 => '10.0.0.10',
  ),
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => '10.0.0.10:8118',
    2 => 'cloud.domain.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '24.0.3.2',
  'overwrite.cli.url' => 'https://cloud.domain.com',
  'overwriteprotocol' => 'https',
  'trashbin_retention_obligation' => '30, 30',
  'default_phone_region' => 'US',
  'dbname' => 'nextcloud',
  'dbhost' => '10.0.0.10',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx,
  'installed' => true,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
    0 => 'admin',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
***EMAIL CONFIG REDACTED***
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\TIFF',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\Font',
    11 => 'OC\\Preview\\MP3',
    12 => 'OC\\Preview\\Movie',
    13 => 'OC\\Preview\\MKV',
    14 => 'OC\\Preview\\MP4',
    15 => 'OC\\Preview\\AVI',
  ),
  'loglevel' => 2,
  'maintenance' => false,
);

 

  • Like 1
  • Thanks 2
Link to comment

I've just successfully migrated keeping everything. Browser navigation is still slow by today's responsive standards, but very significantly better and I guess there's just not going to be a miracle happening on such an old codebase compared to stuff built from the start using the latest tech.

Note the first loads of each app page is slow but it seems that then gets cached and much better. That's probably what makes the difference TBH.

 

Basically:

- Installed the official container, setting network to bridge and adding a port mapping from 80 to 82 that I was using before

- Ran it once as default so it created all the default folders

- Replaced the /appdata/nextcloud/nextcloud/apps directory with my www/nextcloud/apps from the old install

- Merged my existing config.php with the created default, but probably could have just replaced it

- Edited the docker to now point data to my existing /mnt/user/nextcloud share

 

DB unchanged, just connected straight

Had to fight a bit with file pernissions, having to change owner of the data share to 33 (shows up as sshd on unraid...) and permissions to 0770

 

And had to add the cron job as per @CorneliousJD, thankfully refreshed the page and saw that literally at the same time I was opening the setup warnings page and was going to have to deal with it, probably would have been lost so thanks :D

Comes out A+ as well.

 

I can not get collabora running either with built-in server or external. Get the green checkmark both ways but documents never load. This isn't new though, didn't work either on LSIO or on the other server it was on before moving to unraid (was originally an ubuntu snap installed maybe 2 years ago). Something must be preventing it from working but I have no idea what. A clean install "just works" with the built in server...

Edited by Kilrah
Link to comment
3 minutes ago, Kilrah said:

I can not get collabora running either with built-in server or external. Get the green checkmark both ways but documents never load. This isn't new though, didn't work either on LSIO or on the other server it was on before moving to unraid (was originally an ubuntu snap installed maybe 2 years ago). Something must be preventing it from working but I have no idea what. A clean install "just works" with the built in server...

 

Yes the nextcloud performance isn't great by today's standards, but that's nextcloud as a whole to my understanding, but my setup is VASTLY faster than my old LSIO container setup. 

 

 

I had to add my own variable to the Collabora environment.

 

Variable of aliasgroup1

Value of https://cloud.mydomain:443

 

This is what gives it an allow list of what URL to allow it to load from, working fine for me w/out any issues in nextcloud after that. 

I also had to reverse proxy my collabora to collabora.mydomain.com and put that in my settings, otherwise it wasn't working.

But it's working now and so does co-authoring/guest authoring, etc.

 

image.thumb.png.92cdc495dcbd69ecbe697df5ea9e6f58.png

Link to comment

Trying... I guess it must be a reverse proxy issue? 

 

wsd-00001-00042 2022-07-22 20:38:13.149417 +0000 [ websrv_poll ] ERR  #27 Exception while processing incoming request: [GET /cool/https%3A%2F%2Fcloud.mydomain.xyz%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F115187_ocr90ojbtpom%3Faccess_token%3DsomethingmiFcOs%26access_token_ttlblah/ws?WOPISrc=https%3A%2F%2Fcloud.mydomain.xyz%2Findex.php%2Fapps%2Frichdocuments%2...]: Invalid or unknown request.| wsd/COOLWSD.cpp:3570

 

Link to comment
  • 6 months later...

I know I'm reviving an old thread, but I'm following the example of @CorneliousJD and have a few questions. Hopefully he sees this...

 

  1. When I try to set the `APACHE_DISABLE_REWRITE_IP` container variable it fails to start and I get an error in the logs `Could not remove /etc/apache2/conf-enabled/remoteip.conf: Permission denied`. If I remove that variable it starts and seems to work fine. I have `trusted_proxies` setup in config.php and everything seems to work. Do I need to fix this? What exactly does this variable do?
  2. I see in your config.php that you are using a preview provider. I see mention of using Imaginary in the docs for tuning, but you don't give a url for the imaginary instance. Is Imaginary built into this container? Or how does that work?

The good news is that so far it's running MUCH faster and seems like everything is working. Thanks in advance!

Link to comment
8 hours ago, shooga said:

I know I'm reviving an old thread, but I'm following the example of @CorneliousJD and have a few questions. Hopefully he sees this...

 

  1. When I try to set the `APACHE_DISABLE_REWRITE_IP` container variable it fails to start and I get an error in the logs `Could not remove /etc/apache2/conf-enabled/remoteip.conf: Permission denied`. If I remove that variable it starts and seems to work fine. I have `trusted_proxies` setup in config.php and everything seems to work. Do I need to fix this? What exactly does this variable do?
  2. I see in your config.php that you are using a preview provider. I see mention of using Imaginary in the docs for tuning, but you don't give a url for the imaginary instance. Is Imaginary built into this container? Or how does that work?

The good news is that so far it's running MUCH faster and seems like everything is working. Thanks in advance!

So glad you're seeing the same speed improvements, I have been running and using Nextcloud this way for months now and it is so much better!

 

1. Looks like others on github have had your same issue w/ the disable rewrite IP issue: https://github.com/nextcloud/docker/issues/1494

For what it's wroth I am NOT running into that issue though. I'm not sure if you need it though, iirc it's for logging? Going off memory here tho.

Here's my whole setup (Below)

2. the image providers are built-in -- you do need to install ffmpeg for video previews, but i have that on a 7AM recurring cron job to install it into the container (so it survives container rebuilds) but all the others should be baked in by default already.

 

 

image.thumb.png.85c8e07862de29c68575bcd620bcd119.png

Link to comment

Thanks again, @CorneliousJD! This has renewed my faith/interest in using Nextcloud.

 

I added the preview providers via config.php. I just copied your block and tried it with the video previews still in to see what would happen. Turns out .mp4 and .mov previews work without installing ffmpeg. I was surprised, but I'm not complaining...

 

Edit: I take back what I said. I think I misunderstood what they meant by previews. The videos will play inside Nextcloud when I click them, but there's no thumbnail. Maybe that's what the preview is? Would you mind sharing your script to install ffmpeg so I can give it a try?

 

In this documentation they recommend using their Imaginary container to speed up previews, but the performance is quite fast for me right now so I don't see the point. 

Edited by shooga
Link to comment
  • 7 months later...

I know I'm digging up an old thread here, but I thought I'd chime in with something I found out yesterday:

For some reason, my LSIO NextCloud instance had the log level defined in config.php set at 0 (debug), rather than the default 2 (warn). I'd never set this myself, so I'm assuming it's a silly default set by LSIO.

Since I changed it, my instance seems snappier and my photo thumbnails in this third party Android app (https://play.google.com/store/apps/details?id=com.nkming.nc_photos.paid) load heaps quicker as I jump through the timeline.

So, if anyone on the LSIO NextCloud container is experiencing problems, double check the log level set in your config.php

HTH

  • Like 1
Link to comment
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.