[Support] kilrah/nextcloud-ffmpeg


Recommended Posts

Project: https://nextcloud.com/
Original image: https://hub.docker.com/_/nextcloud
Custom image used for this template: https://hub.docker.com/repository/docker/kilrah/nextcloud-ffmpeg

 

What is Nextcloud?
A safe home for all your data. Access & share your files, calendars, contacts, mail & more from any device, on your terms.

 

Why yet another?

  1. There are several Nextcloud templates on unraid already, but none integrate ffmpeg to allow for video thumbnail generation and usage of the video conversion apps available in Nextcloud's App Store.
  2. The existing template for the official Nextcloud image is confusing and does not include some basic entries e.g. for the web port.
  3. The official image seems to be quite a bit faster than some 3rd-party builds.
  4. I'm hoping to be able to provide some extra tips and tricks in this support thread.
  5. It now also supports Intel Quicksync video transcoding in the memories app.

 

This template defaults to pulling my image that is built from the official "latest" image and additionally installs ffmpeg, no other change. Should you not care for that (ffmpeg adds about 450MB to the image) and just want an easy template it can also be used with the official image, just change "Repository" from "kilrah/nextcloud-ffmpeg" to "nextcloud". 

 

Basic installation:

  • Change the Repository if needed
  • Choose the port you wish to use for the web interface 
  • Choose your appdata directory should you wish something other than the default, this is where Nextcloud's code and configuration will live
  • Choose your user data directory if desired. If you expect to store lots of data in your instance you will probably want to create a dedicated unraid share and select it there. 
  • Click Apply. The container will be created and started. Note that on the first run it may take a couple of minutes before the web UI is available.

 

First steps:
On the first access Nextcloud will have you create an admin account and select a database type. By default it will choose a SQLite database which requires no further configuration but as mentioned on the page is not recommended especially if you are going to use desktop clients. 


I use MariaDB-Offical:

When going to install it choose a database name, user and password, create the container, and in Nextcloud's interface enter the same details, choosing your server's IP for "Database Host" instead of "localhost". If you already have a compatible database container that you wish to reuse you can use your favorite tool like phpmyadmin or adminer to connect to it and add a new database.

 

Configuration tips:

To use the video thumbnail capabilities nextcloud needs to be told to do so by enabling the relevant preview providers in its config file (in appdata/config/config.php), if you have Unraid 6.10+ and Dynamix File Manager you can edit it directly from the Unraid GUI. The relevant documentation is here:

https://docs.nextcloud.com/server/22/admin_manual/configuration_server/config_sample_php_parameters.html#previews

The config.sample.php that is present in the same folder is well documented and also a good reference.

 

You might want to define a larger than default preview_max_memory if needed, along with increasing the PHP memory limit with -e PHP_MEMORY_LIMIT=XX in the template's Extra parameters. I use 1G for both to be sure previews can be generated for huge images.

 

My relevant config:

  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\Image',
    4 => 'OC\\Preview\\Photoshop',
    5 => 'OC\\Preview\\TIFF',
    6 => 'OC\\Preview\\SVG',
    7 => 'OC\\Preview\\Font',
    8 => 'OC\\Preview\\MP3',
    9 => 'OC\\Preview\\Movie',
    10 => 'OC\\Preview\\MKV',
    11 => 'OC\\Preview\\MP4',
    12 => 'OC\\Preview\\AVI',
  ),
  'preview_max_memory' => 1024,
  'preview_max_x' => NULL,
  'preview_max_y' => NULL,
  'preview_max_filesize_image' => 400,

 

Companion container:

Project: https://github.com/rcdailey/nextcloud-cronjob

Image: https://hub.docker.com/r/rcdailey/nextcloud-cronjob

 

The official Nextcloud image needs an external trigger for its scheduled task processing. The Nextcloud-cronjob container is provided for this purpose. Install it making sure to specify your Nextcloud container's name correctly if you changed it from the default, let it run and you should be good to go. Make sure "Cron (Recommended)" is selected for the Background Jobs option in your nextcloud instance's Basic Settings.

It can be used for other Nextcloud containers provided the settings are set appropriately in the Advanced section. For example with the LSIO container:

  • Set NEXTCLOUD_EXEC_SHELL to sh
  • Set NEXTCLOUD_EXEC_USER to abc
  • Create a folder mapped to Scripts path and place a script e.g. lsio.sh in it, containing php -f /config/www/nextcloud/cron.php

 

Updates:

One confusing thing with the official Docker image is that Nextcloud will notify you when a new version is available and tell you to go to settings and use the "Open Updater" button, but this does nothing. For some reason they have not hidden it in the Docker environment, but disabled its functionality with new versions actually being provided through container updates. It usually takes a couple of days for a new container to be published after the availability of the Nextcloud update so we just have to live with the notification in the meantime.

 

Running occ commands in the container:

Use Unraid's terminal and run the command like

docker exec -u 33 Nextcloud-ffmpeg sh -c "php occ maintenance:mode --on"

 

Of course replacing the container name if you used something else.

 

Quicksync hardware transcoding support:

 

Add an extra Device to the template, "/dev/dri" then run Memories' occ video configuration command. Of course you need the "Intel GPU TOP" plugin installed. Support may be limited to 10th gen and older, don't have anything to validate.

Edited by Kilrah
  • Like 1
Link to comment

Performance tweaks

 

Using cache as appdata mountpoint

If you have an SSD cache and it is big enough to hold the appdata (up to about 2GB if you have the user data separate, depends on installed apps), it helps to set the Application data path to /mnt/cache/xxx instead of /mnt/user/xxx.

The template defaults to user for compatibility.

 

Using Redis

Using Redis for caching can improve browsing responsiveness pretty significantly.

 

I'm using the official container using the jj9987 template:

 

Install it, then add the following to your nextcloud config.php:

 

  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'server_ip',
    'port' => 6379,
    'password' => 'redis_password',
  ),

 

substituting IP / password as necessary.

Edited by Kilrah
Link to comment
  • 1 month later...
On 10/8/2022 at 2:40 PM, Masterwishx said:

 

Nextcloud-cronjob working with nextcloud from linuxserver ?

 

I just tried it on a fresh LSIO install, and it does work albeit with some tweaking. I added the necessary option to the template and instructions to the first post.

That said the built-in cron in the LSIO container should work just fine on its own... don't know what makes it break so often on updates.

 

Was also a reminder of how ungodly slow it is :D

 

  • Thanks 1
Link to comment
On 10/12/2022 at 7:52 PM, Kilrah said:

I just tried it on a fresh LSIO install, and it does work albeit with some tweaking. I added the necessary option to the template and instructions to the first post.

That said the built-in cron in the LSIO container should work just fine on its own... don't know what makes it break so often on updates.

 

Thanks for your work, i will check it when will have more time ...

for now, i just using the simple script in user scripts for update apps only :)

'docker exec -i nextcloud occ app:update --all'
but for more cron stuff need more scripts or your container ...   

Link to comment
  • 2 weeks later...

Nextcloud 25 is now out, but given that as usual with major releases s bunch of apps are not compatible yet I'll keep the latest tag on 24. If you want to upgrade you can change repository in the template to kilrah/nextcloud-ffmpeg:25.

For more version info see the 2nd post in the thread.

Link to comment
On 10/25/2022 at 10:55 AM, Kilrah said:

Nextcloud 25 is now out, but given that as usual with major releases s bunch of apps are not compatible yet I'll keep the latest tag on 24. If you want to upgrade you can change repository in the template to kilrah/nextcloud-ffmpeg:25.

For more version info see the 2nd post in the thread.

Wouldn't it be best to keep it on the same version as the official Docker image? IIRC Nextcloud doesn't support downgrading, so a user wouldn't be able to switch from the official image to this version unless they specify the 25 tag.

Link to comment

I think there's no perfect solution like on most of the major upgrades... a conscious user should already not be on latest on the official one for that precise reason, it may be updated to a new version with breaking changes at anytime with no warning. 

I'd think favoring existing users of this container is more important, and I used not to have the specific version tags until last post so latest was all they had to choose from. 

I've added the version note to dockerhub.

 

A few of the apps I use have been upgraded in the past couple of days so the transition period shouldn't be too long. One of my most important ones doesn't though...

Edited by Kilrah
  • Like 1
Link to comment
  • 4 weeks later...

<initial issue fixed, new issue however.>

 

EDIT 2: Second issue also fixed, it was my HTTPS everywhere add-on for firefox messing with nextcloud, all is running and working.

 

Now I just need to get the reverse proxy working and should be good!

Edited by kftX
both issues fixed.
Link to comment
  • 2 weeks later...

Not sure what to post in here. I am trying to get cron jobs setup for Nextcloud in Unraid.  I thought I had the settings in but Nextcloud keeps saying jobs are not running and looking at the logs it doesn't appear things are working as well.  I know you are going to want to see something, tell me what and how to get it to you and I can do that. 

 

One error that keeps popping up in the app logs is this

Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database file in /var/www/html/lib/private/DB/Connection.php:139

 

So - I got past that error and now I am getting the following, I am guessing there is a path variable that I am missing

-------------------------------------------------------------
 Executing Cron Tasks: Thu Dec  8 01:24:00 UTC 2022
-------------------------------------------------------------
> Nextcloud Container ID: 2057ca735f0d
> Running Script: ./run-cron-php.sh
Could not open input file: /var/www/html/cron.php
> Done

Edited by bluepoet
Link to comment

I have tried all three versions of the next cloud - my container name is Nextcloud, for the database I finally installed is mariadb.  The version of nexcloud I have currently is the official version by knext666's repository.  This is also through unraid.  I am no opposed as well to remove everything and start from scratch again.  I think permissions are all off on things now as well.  

Edited by bluepoet
Link to comment

So i have another issue that came up, well two and not sure how to resolve them.  I tried to follow the documents but with it in a docker - the commands just dont work.  

 

Issue 1:  Have a ton of image files on my server and some movie files as well from like phone video recordings.  Some pictures will show an thumbnail image, others do not and the video files never show any images.  I upped my memory cache to 1G which at least allows me to open the files, before it wouldn't even do that.  Any way to get the thumbnails to come up for the other files? 

 

Issue 2:  Picture files are very slow to load up, any way to speed that up?

 

Issue 3: It said there was an update, I updated and now I am getting a database is missing indexes and it says to run a command to fix it.  Tried to run the command but it doesn't work, any suggestions on how to fix this.  

 

Any help would be appreciated.  Running unraid 6.11.5, Ryzen 5, 5600 with Radeon Graphics, 8 GB ram which I am thinking of bumping that up.  Also for the cron job, should it be run more then every 15 minutes, is there any negative to doing it every minute or 5 minutes per say?

Edited by bluepoet
Link to comment

For video thumbnails you need to be using this container (kilrah/nextcloud-ffmpeg), you can put that in your template as repository instead of what you already have. That is the whole point of this container/thread. Then you need to enable video previews in nextcloud config, see first post.

 

6 hours ago, bluepoet said:

Issue 2:  Picture files are very slow to load up, any way to speed that up?

 

If you're talking of generating the previews not really, if they're large images that's a lot of processing. There's a "preview generator" app in nextcloud apps that you can use to pre-generate them, might help.

 

6 hours ago, bluepoet said:

Issue 3: It said there was an update, I updated and now I am getting a database is missing indexes and it says to run a command to fix it.  Tried to run the command but it doesn't work, any suggestions on how to fix this.

 

How to run commands in the container is mentioned at the end of the first post.

 

6 hours ago, bluepoet said:

Also for the cron job, should it be run more then every 15 minutes, is there any negative to doing it every minute or 5 minutes per say?

I have it at 5 minutes myself, should be fine. 

Edited by Kilrah
Link to comment
On 12/11/2022 at 11:16 PM, Kilrah said:

The app comes with its own bundled nodejs and as far as I can see already works fine that way.

 

That's strange. It can not be found on me?

 

root@ae995bd20a60:/# node -v
bash: node: command not found

 

In the Nextcloud settings you can also set a path to the Node.JS. I just don't know where that should be?

Link to comment

I don't understand. The file seems to exist, but cannot be executed: O.o

root@ae995bd20a60:/# /var/www/html/custom_apps/recognize/bin/node -v
bash: /var/www/html/custom_apps/recognize/bin/node: No such file or directory
root@ae995bd20a60:/# cd /var/www/html/custom_apps/recognize/bin/
root@ae995bd20a60:/var/www/html/custom_apps/recognize/bin# dir
node  x64.tar.gz
root@ae995bd20a60:/var/www/html/custom_apps/recognize/bin# ./node -v
bash: ./node: No such file or directory
root@ae995bd20a60:/var/www/html/custom_apps/recognize/bin# /node -v
bash: /node: No such file or directory
root@ae995bd20a60:/var/www/html/custom_apps/recognize/bin# node -v
bash: node: command not found

 

image.thumb.png.1c6e04a32d37fb1e8d0f2a2617540a55.png

Link to comment

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.