Hello,
I did a lot of research on Google/SO/GitHub to see how to handle the situation this issue is aiming to fix and I didn't find anything else than "it's currently not possible/supported". When deploying a new Umbraco site (on-premise), the "web.config" needs to be carefully managed. Indeed, at the first installation, the "umbracoDbDSN" connection string and the "umbracoConfigurationStatus" app settings must be cleared to tell Umbraco that we want to do a new installation. This means that in the web site project, this "web.config" must be configured that way. Either that, or a "web.config" transformation must be created that clears these two settings, but the issue remains the same.
Indeed, once the installation is done, the value of these parameters are set by Umbraco. Meaning that a developer must edit the "web.config" of the project (or its transformation) to apply the new value.
But there are two issues with this:
To complete the second point, I can take the company I'm currently working at as an exemple. All deployments are done using "XL Deploy". Basically, it simply copies files from a location to another. The way of handling the "web.config" is to provide it a template with placeholders, for example:
<add name="umbracoDbDSN" connectionString="{{ connectionString }}" providerName="{{ providerName }}" />
Somewhere in "XL Deploy", there is a dictionary containing all the configuration settings for each environment. This way, when a deployment occurs, the "web.config" template is read, tokens are replaced by the correct values depending on the target environment and everything goes well. However, the initial issue remains, indeed, that means that when a deployment is done for the first time, the dictionary settings for the connection string must be empty, then updated once the initial deployment is done. This is pretty error-prone and not very automation-friendly. If this setting is not updated for whatever reason, an upgrade of the site would clear again the connection string...
The proposed solution would be to add an additional check in the Umbraco source code to detect whether or not the tables of the Umbraco database have been created and add this check in the method that determines whether or not it's a fresh install or not.
Basically, this would allow to preserve the current behavior but add a new supported scenario. Indeed, in the case where the version/connection string is not defined, the Umbraco installation would be done as usual. However, if the connection string is defined and point to an existing database, Umbraco will check whether the database is empty or not. If it's not empty, it will simply load Umbraco as it does today, however, if the database exists but is empty, Umbraco would ignore it and consider it as a fresh installation (what else could it be ? ^^).
The main advantage of this solution would be that it would allow the pre-definition of the connection string even before the first installation. Indeed, if I take the "XL Deploy" example again, the dictionary could be defined during the configuration of the deployment job and never be touched again. At the first deployment, the connection string would be defined in the "web.config" but as it would refer to an empty database, Umbraco would consider this as a fresh installation and display the wizard. Now the guy who configures Umbraco would be able to define the same connection string or another one. In our case, it goes even further. Indeed, I created a powershell script mimicking the behaviour of the AngularJs installation wizard to be able to bypass the wizard, which means that I'll be able to tell "XL Deploy" to deploy the site, generate the "web.config" based on the template and the dictionary, then run the powershell script by passing the same connection string as the one defined in the "web.config" and Umbraco would get configured automatically without needing any manual intervention nor the dictionary to be altered afterwards.
I know that it's not a front end feature that thousands of user would enjoy but automation becomes more and more important these days (and I know Umbraco HQ get that, being why UaaS exist). This minor change could improve it dramatically by allowing the user to have a "web.config" correctly configured even for the first installation without creating any regression in the Umbraco current process. Moreover, it increases the compatibility of Umbraco with deployment tools.
I've been working on it all day long and I could modify the code of Umbraco to allow such a behavior without causing any regression (I passed all my day installing Umbraco under different configurations ^^). If this is accepted, I can provide a PR with the required changes.
That was a veeeeeeerry long description to say:
If a connection string is set in the web.config, check if the Umbraco tables are installed, if they aren't installed then show the installer screen.
Did I get that correctly? :-)
That's a veeeeeeeeeery nice way to summarize it.
I wrote this very long description because I suspect that changing the way the Umbraco installation performs might be a bit touchy but I think that the proposal is valid and wanted to precisely explain why I think it is necessary :-D
The only touchy thing here is that you added curly braces for if statements with just one line of code under them.. 馃槈
Yes, changes to how the installer detects things are difficult since the way it works currently has been carefully... curated (_cough set up after numerous bad experiences and facepalms cough_). But this seems okay, even if I don't know the whole story then it seems fine to say: well, you tried to start Umbraco but we can't find the database tables, so the only remaining thing I can do now is to install Umbraco from scratch.
That said, I will need to check with the Cloud team if this will work, I don't think it's a problem.
Ha ha ha, for your first comment, take a look in here : https://github.com/umbraco/Umbraco-CMS/issues/3752 :-) I also noticed this coding style change but it is because the way my Visual Studio is configured, which is why I proposed to improve the .editorconfig file to avoid this ;-)
Let me know the feedback from Umbraco Cloud :-)
Thanks
Hi,
did you have time to ask Umbraco Cloud team ?
Thanks
@ssougnez Sorry, not yet, forgot to put it on the list. 馃檲 It's on the list now!
Update, works with Cloud as well so can be tested and merged at some point.
Woohoo \o/
Cool, thanks a lot
Just starting on Umbraco. This would be a huge plus for us, as we CI/CD everything towards Azure.
Hi @nul800sebastiaan
has this ticket been addressed in v8?
Indeed it would be great if the installation could see a connection string but with an empty db, and still show the install screen and skip the DB selection step.
If you think this is useful, I can have a look at porting the PR #3754 to v8
@simonech Looks like it never made it to v7, but I'll be happy to have it for v8! 馃憤
Ok, I'll work on it in the next weeks
Most helpful comment
@simonech Looks like it never made it to v7, but I'll be happy to have it for v8! 馃憤