NextCloud - Funky Penguin's Geek Cookbook


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. -

This is a companion discussion topic for the original entry at


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 '' 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:

Any ideas?

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


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

    image: nextcloud
    env_file: /var/data/config/nextcloud/nextcloud-dbtest.env
      - internal
      - traefik_public
        - traefik.port=80
      - /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

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

With env file:

[root@ds1 nextcloud]# cat nextcloud-dbtest.env

# For mysql

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.



Bingo! Thanks boss :smiley:

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

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


Good to know :slight_smile: I’ve updated the recipe to indicate that we need a separate env file for the db-backup container :


@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.



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.



@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.


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.


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



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

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


@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: )


Glad to hear it!

If you join the discord in, you’ll find there’s some other geeks using later versions of NextCloud, and a recipe update in the works :wink: