I found a workaround for the 504 Error while setting up Nextcloud with MariaDB.
Maybee this will help you guys, as I saw you had the same problems as I did:
Install Nextcloud without external DB (on SQLite)
Migrate DB from SQLite to MariaDB
Install Nextcloud and MariaDB as described in the tutorials
(Like: https://blog.linuxserver.io/2017/05/10/installing-nextcloud-on-unraid-with-letsencrypt-reverse-proxy/ or in the Spaceinvader One Video)
Setup MariaDB Docker
Create DB User, Database and grant rights
Setup Nextcloud Docker
Choose the SQLite selected as standard instead of the MariaDB you just initiated
Nextcloud should now work (even if the error comes up)
Now we have a functional Nextcloud on SQLite, thanks to the buildin occ tool we can now migrate to MariaDB.
Migrate DB to MariaDB
(See also Nextcloud Documentation: https://docs.nextcloud.com/server/18/admin_manual/configuration_database/db_conversion.html)
Open Unraid Terminal
Open Nextcloud Docker Terminal signing in as user "abc" (technical nextcloud user):
docker exec -it -u abc nextcloud sh
Navigate to Nextcloud directory:
Run OCC DB:Convert-Type Tool filling in the MariaDB (type mysql is correct in this case) credentials: (Schema: db:convert-type [--port PORT] <type> <username> <hostname> <database>)
php occ db:convert-type --port="3306" mysql your_mariadb_user <Docker/Unraid IP> your_database_name
You will be prompted for the MariaDB User password, and the tool will migrate the DB.
Create missing indexes executing:
php occ db:add-missing-indices
Migrate some column types to bigint:
php occ db:convert-filecache-bigint
Check everything worked in the WebGui under Settings - > Administration -> Overview
This should do the trick.
I hope this also works for you!