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

  • Then maybe I'd better postpone the migration of the mariadb docker provider, but at the latest by the time nextcloud 21 is available for my HW platform.

    OMV 5.6.21 Usul | omvextrasorg 5.6.5 | Kernel Linux 5.10.60-mvebu | Armbian Buster 21.08.6 | Hardware Helios 4

  • I don't think so, since the duckdns key and subdomain information is listed in the swag portion of the docker-compose file. I haven't tried it myself without it though.

    Easy data backup: In a Scheduled Job: rsync -av --delete /srv/dev-disk-by-label-SOURCE/ /srv/dev-disk-by-label-DESTINATION/ (HT: Getting Started with OMV5)
    OMV 5 (current) - Thinkserver TS140, Nextcloud, Plex, Airsonic, Navidrome, Ubooquity, Digikam, Wetty, & Heimdall - NanoPi M4 (v.1): backups using Rsync and Rsnapshot - Odroid XU4 (Using DietPi): PiHole - hc2, xu4, Pi 3B+, Odroid H2, and VirtualBox: Testing and playing - Mac user converting to Linux, Debian 10 KDE.

  • Just make sure you have a working backup. It tried to migrate a test instance this morning and wasn’t able to get Nextcloud to connect to the migrated database.


    Then maybe I'd better postpone the migration of the mariadb docker provider, but at the latest by the time nextcloud 21 is available for my HW platform.


    With a little more time I was able to successfully migrate the database now. It was a problem of database permissions.

    I try to write a small guide tomorrow.

  • Hello, i have trouble with my docker GUIDE installation.


    - i don't get updates for my duckdns service.

    - fetch problem RE: apt update - W: Failed to fetch http:/.......................... - solved by @dleiderthttps://forum.openmediavault.org/index.php?thread/37562-apt-update-w-failed-to-fetch-http/&postID=265866#post265866


    Why we use "dev-disk-by-label-disk" and not the "uuid"?


    @all

    When did have check, install the GUIDE [How-To] Nextcloud with Letsencrypt using OMV and docker-compose?

    The GUIDE is very old.

    Which OMV 5 Debian 10 Base installation should i'm prefer?

  • I won't to have a OMV 5 Installation with Docker_Nextcloud_SWAG.

    I know what you want, the HOWTO which this Q&A relates to will do that, I haven't read all this thread but SWAG replaces Letsencrypt I believe.


    The change from dev-disk-by-label to to dev-disk-by-uuid was brought about by the changes in OMV, so all one does is substitute/change those references.

    Raid is not a backup! Would you go skydiving without a parachute?

  • I try to write a small guide tomorrow.

    We would be grateful ;-)

    Thank you for all the work done in this "how-to" ;)

    French nooby User. Sorry for my English language mistakes, I'm not used to post on english forum

    • MB: Asrock QC5000m microATX with AMD 5050 APU / RAM : 16 gb HyperX, Case: Fractal Design Node 804
    • Storage : Kingston SSD 128go (for OMV) / 1x4Tb Seagate IronWolf, 1x4Tb WD Red, 1x200 Go Maxtor and 1x230Go Maxtor (old devices)
    • Docker CE (not the OMV plugin) : managed by Portainer , run JDownloader2, TeamSpeak3, NextCloud 20 etc
    • Locate / MySQL (db kodi, nextcloud) / SMB_CIFS
  • FredK Here's the guide. I hope I didn't forget a step...


    I assume you are doing this with root privileges

    • Get database password from nextcloud config.php: cat /srv/dev-disk-by-label-disk1/appdata/nextcloud/config/www/nextcloud/config/config.php
    • Save the password under 'dbpassword' somewhere
    • Enable maintenance mode of nextcloud docker: docker exec nextcloud sudo -u abc php /config/www/nextcloud/occ maintenance:mode --on
    • Create database backup: docker exec -it nextclouddb bash
    • mysqldump --single-transaction -u root -p nextcloud > /config/nc_backup.bkp
    • Enter mariadb_root_password
    • exit
    • Stop containers: cd /home/docker1/nextcloud && docker-compose down
    • Open docker-compose.yml: nano docker-compose.yml
    • Comment out old mariadb-container:


    Below insert new MariaDB-block:

    Code
    mariadb:
    image: webhippie/mariadb:latest
    container_name: nextclouddb
    environment:
    - MARIADB_ROOT_PASSWORD=mariadbpassword
    volumes:
    - /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/mysql:/var/lib/mysql #/srv/dev-disk-by-label-disk1 needs to be adjusted
    - /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/conf.d:/etc/mysql/conf.d #/srv/dev-disk-by-label-disk1 needs to be adjusted
    - /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/backup:/var/lib/backup #/srv/dev-disk-by-label-disk1 needs to be adjusted
    restart: unless-stopped
    • Start containers: docker-compose up -d
    • Copy backup to new container: cp /srv/dev-disk-by-label-disk1/appdata/nextclouddb/nc_backup.bkp /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/mysql/
    • Import database: docker exec -it nextclouddb bash
    • mysql -u root -p
    • Enter new_mariadb_root_password
    • CREATE DATABASE nextcloud;
    • GRANT USAGE ON *.* TO 'oc_admin'@'%' IDENTIFIED BY 'enter_dbpassword_from_config.php';
    • GRANT ALL PRIVILEGES ON nextcloud.* TO 'oc_admin'@'%' ;
    • FLUSH PRIVILEGES;
    • EXIT
    • mysql -u root -p nextcloud < /var/lib/mysql/nc_backup.bkp
    • Enter new_mariadb_root_password
    • exit
    • Restart nextcloud docker: docker restart nextcloud
    • Disable maintenance mode of nextcloud docker: docker exec nextcloud sudo -u abc php /config/www/nextcloud/occ maintenance:mode --off
    • Cross your fingers...
  • RE: Nextcloud with Letsencrypt using OMV and docker-compose - Q&A


    Quote

    Then maybe I'd better postpone the migration of the mariadb docker provider, but at the latest by the time nextcloud 21 is available for my HW platform.


    Quote

    Quote from Morlan



    I try to write a small guide tomorrow.



    Hello Morian, did you mean this guide #533 ?


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

  • Morlan
    I'm stuck at last step (Disable maintenance mode)

    See my comments inline.

    EDIT:

    After repeating the database command using oc_he instead of oc_admin disabling maintenance mode was successful.

    Nextcloud started, login successful!

    OMV 5.6.21 Usul | omvextrasorg 5.6.5 | Kernel Linux 5.10.60-mvebu | Armbian Buster 21.08.6 | Hardware Helios 4

    Edited once, last by FredK: I got it! ().

  • Quote

    Could it be that I created nextcloud in the past as my unprivileged user "he"?

    maybe it’s the user you specified as admin when setting up Nextcloud. Mine was called admin in the Test instance.

    I’m glad it worked!

  • FredK Here's the guide. I hope I didn't forget a step...


    I assume you are doing this with root privileges

    • Get database password from nextcloud config.php: cat /srv/dev-disk-by-label-disk1/appdata/nextcloud/config/www/nextcloud/config/config.php
    • Save the password under 'dbpassword' somewhere
    • Enable maintenance mode of nextcloud docker: docker exec nextcloud sudo -u abc php /config/www/nextcloud/occ maintenance:mode --on
    • Create database backup: docker exec -it nextclouddb bash
    • mysqldump --single-transaction -u root -p nextcloud > /config/nc_backup.bkp
    • Enter mariadb_root_password
    • exit
    • Stop containers: cd /home/docker1/nextcloud && docker-compose down
    • Open docker-compose.yml: nano docker-compose.yml
    • Comment out old mariadb-container:


    Below insert new MariaDB-block:

    Code
    mariadb:
    image: webhippie/mariadb:latest
    container_name: nextclouddb
    environment:
    - MARIADB_ROOT_PASSWORD=mariadbpassword
    volumes:
    - /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/mysql:/var/lib/mysql #/srv/dev-disk-by-label-disk1 needs to be adjusted
    - /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/conf.d:/etc/mysql/conf.d #/srv/dev-disk-by-label-disk1 needs to be adjusted
    - /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/backup:/var/lib/backup #/srv/dev-disk-by-label-disk1 needs to be adjusted
    restart: unless-stopped
    • Start containers: docker-compose up -d
    • Copy backup to new container: cp /srv/dev-disk-by-label-disk1/appdata/nextclouddb/nc_backup.bkp /srv/dev-disk-by-label-disk1/appdata/nextclouddb_new/mysql/
    • Import database: docker exec -it nextclouddb bash
    • mysql -u root -p
    • Enter new_mariadb_root_password
    • CREATE DATABASE nextcloud;
    • GRANT USAGE ON *.* TO 'oc_admin'@'%' IDENTIFIED BY 'enter_dbpassword_from_config.php';
    • GRANT ALL PRIVILEGES ON nextcloud.* TO oc_admin@%;
    • FLUSH PRIVILEGES;
    • EXIT
    • mysql -u root -p nextcloud < /var/lib/mysql/nc_backup.bkp
    • Enter new_mariadb_root_password
    • exit
    • Restart nextcloud docker: docker restart nextcloud
    • Disable maintenance mode of nextcloud docker: docker exec nextcloud sudo -u abc php /config/www/nextcloud/occ maintenance:mode --off
    • Cross your fingers...

    Been a long time reader with no input, soz.


    1st, Thank you ALL for every input on this thread.

    I managed to have all running on a RPi4, flawless.


    Just a small remark about this:

    I already enabled the 4 Byte UTF support on the DB, as mentioned here: Enabling MySQL 4-byte support — Nextcloud latest Administration Manual latest documentation


    With this, shouldn't the commands for backup and restore be sligthly different?!?


    BACKUP:

    Quote


    Note

    Also make sure your backup strategy still work. If you use mysqldump make sure to add the --default-character-set=utf8mb4 option. Otherwise your backups are broken and restoring them will result in ? instead of the emojis, making files inaccessible.

    [/BACKUP]


    [RESTORE]

    Quote

    If you use UTF8 with multibyte support (e.g. for emojis in filenames), use:

    Code
    mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud"
    mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"

    [/RESTORE]


    Sorry for asking but I'm not a very knowlegble person on Linux/SQL/etc.


    And, since I had to re-do all installation, several times till I got it right, I don't want to mess things up, :)


    Thank you all

Participate now!

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