Nextcloud with Letsencrypt using OMV and docker-compose - Q&A

  • Which file should I edit to increase the pm.max_children parameter?


    3) I got "server reached pm.max_children" errors from the php log, which were solved by increasing the max_children in a similar fashion to what's being explained here.

  • Hello everyone,


    First I am not native, so sorry for typos writing.


    I am installing (at least trying) to install Nextcloud on OMV using Docker + Portainer + Swag with a DuckDNS URL.


    Error:

    From my local network:

    I can access my OMV (http://myip) but I cannot access Nextcloud (http://myip/nextcloud). Message is System Failure. Press left mouse button to continue. Page doesn't exist)


    Fom external network:

    When I choose mydomain.duckdns.org, the system shows a welcome page of SWAG (Welcome to your SWAG instance)

    When I choose mydomain.duckdns.org/nextcloud, the system shows nextcloud's starting page (OK). I should delete https because if not the Nextcloud says my access is not trustful


    What I did:

    Forward ports in Router:

    Ext:80, Int:81

    Ext:443, Int:444

    Checked docker user for taking PUID, PGID



    Followed the How-to guide of macom (thanks by the way): https://forum.openmediavault.o…omv-and-docker-compose%2F


    I copied the following, adapting to my case (DuckDNS)

    All logs were OK


    Created the copy of nextcloud.subfolder.conf.sample with name nextcloud.subfolder.conf and deleted the sample one

    Adapted the file /srv/dev-disk-by-label-disk1/appdata/nextcloud/config/www/nextcloud/config/config.php


    Restarted all containers


    I am not so expert with these topics, but I am pretty sure I followed all the steps correct. I think the problem is my ISP is not giving me the option of NAT Loopback and I don't know how to workaround it


    Thanks in advance for the help!

  • /srv/dev-disk-by-uuid/

    This is probably wrong: it should/must have also a series of numbers that identify the external drive.

    otherwise you're making a folder "Appdata" inside the folder ".../dev-disk-by-uuid" on the root drive.


    Will continue to help you in a few hours, if noone comes first.



    I think that you should access this URL: https://nextcloud.mydomain.duckdns.org

    This is only for subdomain, NOT subfolder

  • First I am not native

    I am pretty sure you are. Somewhere ;-)

    - URL=mydomain.duckdns.org #insert your domain name - yourdomain.url
    - DUCKDNSTOKEN=mytoken

    You need to add the token. Or did you remove it for privacy reasons? Than it is totally ok

    If you use this URL, then you need to use this URL and subdomain to reach your server. This sounds like you are not trying like this

    I cannot access Nextcloud (http://myip/nextcloud).

    Also check the log files of your containers.

  • I think that you should access this URL: https://nextcloud.mydomain.duckdns.org

    I use subfolders instead of subdomains, I think is also right




    I edited, don't know if this is sensible data. Total path:

    /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/nextcloud/config:/config


    I am pretty sure you are. Somewhere ;-)

    You need to add the token. Or did you remove it for privacy reasons? Than it is totally ok

    If you use this URL, then you need to use this URL and subdomain to reach your server. This sounds like you are not trying like this

    Also check the log files of your containers.

    I added the token (removed for privacy reasons)

    I am not sure I understood, should I use for example nextcloud.mydomain.duckdns.org ?


    Thanks for all comments!

  • Which file should I edit to increase the pm.max_children parameter?

    I have not done it, but I assume it is


    config_path/nextcloud/php/www2.conf

    It's that file, yes.


    After testing several configurations (and reading about it) I found that for my setup (me and the wife, and occasionally family access), the best option was with "pm = ondemand" instead of "dynamic"

    Some food for thoughts:

    PHP-FPM 'ondemand' Process Manager VS 'dynamic' | Webcore Community | Webcore Cloud

    How To Prevent PHP-FPM From Consuming Too Much RAM in Linux (tecmint.com)


    Editing the file, will make it something like:

    Code
    pi@XXXXXXX:~ $ cat /srv/dev-disk-by-label-sd_configs/@appdata/nextcloud/config/php/www2.conf
    ; Edit this file to override www.conf and php-fpm.conf directives and restart the container
    ; Pool name
    [www]
    pm = ondemand
    pm.max_children = 70
    pm.process_idle_timeout = 3s
    pm.max_requests = 200

    If you want to keep "dynamic", then you need to edit the file with something like this:


    This is all "academic" and depends on your Hardware (processor/memory) and how many active accesses you have at any given time.

    You will have to find/tune the best for your situation.

  • I edited, don't know if this is sensible data. Total path:

    /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/nextcloud/config:/config

    The UUID can be showned with no problem: noone will be able to hack you with the ID of the disk, ;)

    I added the token (removed for privacy reasons)

    I am not sure I understood, should I use for example nextcloud.mydomain.duckdns.org ?

    That is a good policy, hide the token.


    Now, some more pointers to your YML and config:


    Since you're using "wildcard" with "duckdns" validation, and you used "subfolder", the way to access via WAN will need to be:

    "https://<something>.mydomain.duckdns.org/nextcloud/" where <something> can be for eg. "www".


    To be sure that SWAG is running OK, just fire up "https://www.mydomain.duckdns.org/" and the page with SWAG will show up.


    As for your "config.php":

    You need to add your Local IP as in:

    Code
    ...
    'trusted_domains' =>
    array (
    0=> 'https://<YourLocalIP:450',
    1 => 'mydomain.duckdns.org',
    ...
    'dbtype' => 'sqlite3', # This means you set the Database wrong. Read the Guide to see where you set it for MariaDB/MySQL.
    ....
  • Changed but same errors, tried https://www.mydomain.duckdns.org/ with and without www. Should I change the dbtype? I am a bit frustrated I don't know what is wrong....

  • I also add info of swag log I didn't detect anything wrong:



    From nextcloud:

  • I am a bit frustrated I don't know what is wrong....

    Don't be, most of us have been where you are, but after having things running (and learning how it works) then it becomes easier.

    Most of the times, it's better to start again fresh to clear all issues that might be preventing it from starting.


    Start by deleting all folders that were created by the stack and then post your YML on a code box, hiding/masking only your PASSWORD; DUCKDNS TOKEN and the DOMAIN.


    Then it's possible to edit it step by step and see what is wrong.


    To delete the folders, according to the path you have, will be something like (make sure it's correct):

    sudo rm -rf /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/*

  • Should I remove the containers? Or just delete the folders, adapt the stack and execute?

  • I deleted folders, images, containers, networks, recreate the Appdata, restart stack with the following code

    Nextcloud log



    Mariadb log (nextclouddb)

    Swag log


    In the folder /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/swag/nginx/proxy-confs created the file nextcloud.subfolder.conf as copy of nextcloud.subfolder.conf.sample, then deleted the sample file.



    In the folder /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/nextcloud/config/www/nextcloud/config

    Original file

    PHP
    <?php
    $CONFIG = array (
    'memcache.local' => '\OC\Memcache\APCu',
    'datadirectory' => '/data',
    );

    New file:

    Swag log after restart:

    Nextcloud log after restart

    Now I test https://mydomain.duckdns.org/nextcloud


    Inside of my network: Error connection TimeOut

    Outside of my network: ER_CERT_COMMON_NAME_INVALID but using advanced settings I could allow the connection. If I connect to https://mydomain.duckdns.org I have the SWAG instance message, and through https://mydomain.duckdns.org/nextcloud I configured the connection.


    So again, my problem is again through my internal network

  • n the folder /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/swag/nginx/proxy-confs created the file nextcloud.subfolder.conf as copy of nextcloud.subfolder.conf.sample, then deleted the sample file.

    You don't need to delete the sample, every time SWAG is restarted, it will create the file again, ;)


    But, let's try differently, since you're using wildcard:


    1 - Delete the subfolder.conf: rm -f /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/swag/nginx/proxy-confs/nextcloud.subfolder.conf


    2 - rename the subdomain.conf: cp /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/swag/nginx/proxy-confs/nextcloud.subdomain.conf.sample  /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/swag/nginx/proxy-confs/nextcloud.subdomain.conf


    3 - Restart SWAG: docker restart swag


    4 - Check the logs for errors: docker logs -f swag (exit with Ctrl+C)


    Now, uncomment the "ports" on the "Nextcloud" service of the YML (lines #15 && #16):

    Code
    ports: # uncomment this and the next line if you want to bypass the proxy
    - 450:443

    Redploy the stack, and edit the "config.php" as per these instructions from Morlan, following the instructions after "nano config.php" :

    RE: Nextcloud with Letsencrypt using OMV and docker-compose - Q&A


    nano /srv/dev-disk-by-uuid-5e9600b0-9d65-44b6-8128-3435708c1d7d/Appdata/nextcloud/config/www/nextcloud/config.php


    Restart Nextcloud and access it with "https://nextcloud.yoursubdomain.duckdns.org"

  • You don't need to delete the sample, every time SWAG is restarted, it will create the file again, ;)

    ....

    Again, deleted folders.

    My new stack:

    Restarted the 3 containers:

    Log Nextclouddb


    Log Nextcloud


    Log SWAG


    I followed your instructions concerning the sample and created the file


    Swag log

    Code
    ...
    The cert does not expire within the next day. Letting the cron script handle the renewal attempts overnight (2:08am).
    [cont-init.d] 60-renew: exited 0.
    [cont-init.d] 70-templates: executing...
    ...
    [cont-init.d] 99-custom-files: exited 0.
    [cont-init.d] done.
    [services.d] starting services
    [services.d] done.

    config.php


    Restarted nextcloud, log

    Again, problems, from my local IP I cannot access


    I have a raspi with home assistant & adguard home, I don't know if somehow I can provide a rule for solve this problem....

  • 0 => 'myip:445',

    Change line #14 of the "config.php" to:

    Code
    0 => 'https://myip:450',


    When you write in the browser "https://YOURinternalIP:450", the name will change to the normal URL.

    That is OK and normal.

  • Change line #14 of the "config.php" to:

    Code
    0 => 'https://myip:450',


    When you write in the browser "https://YOURinternalIP:450", the name will change to the normal URL.

    That is OK and normal.

    Tried,


    After the warning ( MOZILLA_PKIX_error_self_signed_cert), I accepted but I got 504 Gateway time-out (nginx/1.18.0). Same with the duckdns address (ERR_CONNECTION_TIMED_OUT). It worked from external network. Any ideas?


    PS: Please share a patreon/ buy-me-a-coffee link afterwards, appretiate your tips! Thanks for support

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!