I’ve been working on Nextcloud server as a personal DevOps project. First, I started out setting up Nextcloud manually on a virtual machine, then I moved on to making the set up automatic with Bicep (eventually I will also use Terraform), Ansible and Azure DevOps Ci/CD. Recently, I have succeeded in separating out the database and file storage from the Nextcloud server. My next step now is to set up multiple servers connecting to the same database and file storage to create high availability.
However, as I have been working, I have realized that maintenance:install requires the username and password of an admin user so it can be created. This means it does not seem possible to run maintenance:install without --admin-user and --admin-pass, and if you try to use an already existing one, you get an error saying that the user already exists.
I have tried to look for a potential solution, including on this forum. I have seen a few threads (including this one which will be helpful when I want to tackle disaster recovery), but none that really address this topic in the manner I phrased the question. I did see a thread somewhere it was mentioned that this kind of multi-server set up is more for paying enterprise customers, although it should be possible for personal user(s) as well.
If it is not possible, or there are no workarounds, then I can come up with a solution that utilizes multiple admin users with different passwords, but ideally I would only have one, at least during the initial setup.
This forum has been helpful with my project, and I have learned a lot in particular about configuring a server, which has been great. Thanks in advance!
If I get it right, you already have database and files, so you don’t want to alter the existing database.
Which means: install with a new (temporary) admin user, this will create a fresh database and store the temp admin into it.
After installing, modify the config to point to the existing database and files; or even point to existing files with existing config to an existing database.
Your temporary created install-admin won’t exist anymore, as the user info is in the live-database. The only thing to do: get rid off the database created during install (which should be possible by some CI-hook)
Yes, you are correct, I would not want to alter the already existing database.
This is an interesting idea. It does add a few steps to the configuration on the server, but the pay off is I don’t create any extraneous admin users. This is the kind of work around I was looking for, so thank you!
That would be one way to handle it. The other way, which is probably how I would handle it, is just add a couple Ansible tasks to my Playbook that removes the DB on the server and then cleans up the default data folder.
Hey! I tried what you suggested last night, and it worked perfectly! It was pretty simple to set up MySQL db and use the default nextcloud data directory.
After the install, all I had to do was delete the config config.php file and replace it with one pointing to the Azure MySQL DB and the mount point (which the mount point is connected to Azure Blob Storage). From there, I updated .htaccess with maintenance:update:htaccess and verified that Nextcloud was working properly. Last, I removed the default nextcloud data directory and removed the temp user and database.
Just in case anyone else comes to this thread looking for this solution, I will note that there were a few files in the default data directory as a result of this method. However, I found when I updated .htaccess, those created files were moved the mount point, so moving those files manually is not required.