NextCloud - Funky Penguin's Geek Cookbook


#1

Nextcloud (a fork of OwnCloud, led by original developer Frank Karlitschek) is a suite of client-server software for creating and using file hosting services. It is functionally similar to Dropbox, although Nextcloud is free and open-source, allowing anyone to install and operate it on a private server. - https://en.wikipedia.org/wiki/Nextcloud


This is a companion discussion topic for the original entry at https://geek-cookbook.funkypenguin.co.nz/recipies/nextcloud/

#2

I had a pop at this today and I just get the following error:

 Error while trying to create admin user: Failed to connect to the database:
 An exception occured in driver: SQLSTATE[HY000] [1130] 
 Host '172.16.12.12' is not allowed to connect to this MariaDB server	

I followed the instructions to the letter, updated the Traefik hostname and deployed it. I get taken to a page to finalise setup where most of the fields are already filled in. I’m just asked to provide the admin password and the database password. Here is a pic: https://imgur.com/OPHCgoc

Any ideas?

EDIT: Yes, I made sure to use the same passwords as I set up in the env file :stuck_out_tongue:


#3

OK, I think what we’re seeing here might be an interaction between the env variables used for the database backup container, and the built-in env variables mysql/mariadb uses.

I just confirmed this simple example is working

services:
  nextcloud:
    image: nextcloud
    env_file: /var/data/config/nextcloud/nextcloud-dbtest.env
    networks:
      - internal
      - traefik_public
    deploy:
      labels:
        - traefik.frontend.rule=Host:nextcloud-dbtest.funkypenguin.co.nz
        - traefik.docker.network=traefik_public
        - traefik.port=80
    volumes:
      - /var/data/nextcloud-dbtest/:/var/www/html
      - /var/data/nextcloud-dbtest/apps:/var/www/html/custom_apps
      - /var/data/nextcloud-dbtest/config:/var/www/html/config
      - /var/data/nextcloud-dbtest/data:/var/www/html/data

  db:
    image: mariadb:10
    env_file: /var/data/config/nextcloud/nextcloud-dbtest.env
    networks:
      - internal
    volumes:
      - /var/data/runtime/nextcloud-dbtest/db:/var/lib/mysql

With env file:

[root@ds1 nextcloud]# cat nextcloud-dbtest.env
DB_TYPE=mysql
DB_NAME=nextcloud
DB_USER=nextcloud
DB_PASSWORD=nextcloud
DB_HOST=db

# For mysql
MYSQL_ROOT_PASSWORD=batman
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud
MYSQL_PASSWORD=nextcloud

Can you try stripping out the last 5 lines of the env file per the recipe (starting with # For database backup), and see whether this works? You may need to delete the contents of /var/data/runtime/nextcloud/db/ to force MariaDB to recreate them.

D


#4

Bingo! Thanks boss :smiley:

If anyone has an issue with Solr not starting properly, try:

sudo chmod 777 /var/data/runtime/nextcloud/solr

#5

Good to know :slight_smile: I’ve updated the recipe to indicate that we need a separate env file for the db-backup container : https://geek-cookbook.funkypenguin.co.nz/recipies/nextcloud/#prepare-environment


#6

@funkypenguin I have a question, might be a silly one at that. But how are you running this? I am using ESXI VMs and I am trying to decipher how much of this and what parts are applicable to me. What I want to ultimately do is run nextcloud stack and home assistant stack over SSL. Any help would be much appreciated, thanks.


#7

Hey,

Personally, my stack runs Atomic VMs under OpenStack, but that’s just my personal situation. You could do the same under ESXi. I’d suggest you start with just one VM (you can still have a swarm with a single “manager” host), setup NextCloud and HA stacks with traefik per the cookbook.

D


#8

@funkypenguin thanks for the reply, I have it running now. I used one VM with nextcloud and home assistant with traefik. I also didn’t deply a swarm. I would love to see your setup and try to immulate on my lab to see which runs better. I guess I would most likely have to have openstack integrate with my ESXi host then config 3 atomic vms in swarm.


#9

Great guide thanks! This went mostly flawlessly for me, with the additional correction to the solr file permissions mentioned by @nick. Thanks Nick!

FYI The Nextant plugin is depreciated and folks are being directed to using Full Text Search ready for Nextcloud 14’s release. I’ll look at integrating that soon.


#10

Thanks @seffyroff, I’ll be awaiting NextCloud 14 for a recipe refresh :wink:

D


#11

I think that the recipe needs to be updated to use the nextcloud-db-backup.env

db-backup:
image: mariadb:10
env_file: /var/data/config/nextcloud/nextcloud-db-backup.env


#12

@funkypenguin Thanks so much for this brother, it works like a charm in my swarm. minor db backup issues with permissions and nextant since it’s no longer supported and the nextcloud image was already updated to 14. Waiting patiently for the updated recipe (too lazy to update it myself for this as I’m not using it too much :smiley: )


#13

Glad to hear it!

If you join the discord in http://chat.funkypenguin.co.nz, you’ll find there’s some other geeks using later versions of NextCloud, and a recipe update in the works :wink:

D