{"action":"created","issue":{"url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/3753","repository_url":"https://api.github.com/repos/umbraco/Umbraco-CMS","labels_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/3753/labels{/name}","comments_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/3753/comments","events_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/3753/events","html_url":"https://github.com/umbraco/Umbraco-CMS/issues/3753","id":383826893,"node_id":"MDU6SXNzdWUzODM4MjY4OTM=","number":3753,"title":"Reduce the dependencies on web.config for installation/upgrade","user":{"login":"ssougnez","id":10199821,"node_id":"MDQ6VXNlcjEwMTk5ODIx","avatar_url":"https://avatars1.githubusercontent.com/u/10199821?v=4","gravatar_id":"","url":"https://api.github.com/users/ssougnez","html_url":"https://github.com/ssougnez","followers_url":"https://api.github.com/users/ssougnez/followers","following_url":"https://api.github.com/users/ssougnez/following{/other_user}","gists_url":"https://api.github.com/users/ssougnez/gists{/gist_id}","starred_url":"https://api.github.com/users/ssougnez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssougnez/subscriptions","organizations_url":"https://api.github.com/users/ssougnez/orgs","repos_url":"https://api.github.com/users/ssougnez/repos","events_url":"https://api.github.com/users/ssougnez/events{/privacy}","received_events_url":"https://api.github.com/users/ssougnez/received_events","type":"User","site_admin":false},"labels":[{"id":1040131970,"node_id":"MDU6TGFiZWwxMDQwMTMxOTcw","url":"https://api.github.com/repos/umbraco/Umbraco-CMS/labels/community/pr","name":"community/pr","color":"b8d9ff","default":false},{"id":1040135395,"node_id":"MDU6TGFiZWwxMDQwMTM1Mzk1","url":"https://api.github.com/repos/umbraco/Umbraco-CMS/labels/type/feature","name":"type/feature","color":"9644bf","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-11-23T13:35:13Z","updated_at":"2018-11-26T11:12:13Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hello,\r\n\r\nI 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.\r\n\r\nIndeed, 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.\r\n\r\nBut there are two issues with this:\r\n\r\n- Not all connection strings use \"integrated authentication\", so it means that username/password could end up in the \"web.config\" file of a project. I know no average/big company that would allow \"simple\" developers to know the username/password of a production database and to push it in GIT.\r\n- This works when using \"Visual Studio web publish\" but not all companies use it.\r\n\r\nTo 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:\r\n\r\n`<add name=\"umbracoDbDSN\" connectionString=\"{{ connectionString }}\" providerName=\"{{ providerName }}\" />`\r\n\r\nSomewhere 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...\r\n\r\nThe 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.\r\n\r\nBasically, 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 ? ^^).\r\n\r\nThe 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.\r\n\r\nI 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.\r\n\r\n\r\nHow can you help?\r\n-------------------------------\r\n\r\nI'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."},"comment":{"url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/comments/441603231","html_url":"https://github.com/umbraco/Umbraco-CMS/issues/3753#issuecomment-441603231","issue_url":"https://api.github.com/repos/umbraco/Umbraco-CMS/issues/3753","id":441603231,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTYwMzIzMQ==","user":{"login":"ssougnez","id":10199821,"node_id":"MDQ6VXNlcjEwMTk5ODIx","avatar_url":"https://avatars1.githubusercontent.com/u/10199821?v=4","gravatar_id":"","url":"https://api.github.com/users/ssougnez","html_url":"https://github.com/ssougnez","followers_url":"https://api.github.com/users/ssougnez/followers","following_url":"https://api.github.com/users/ssougnez/following{/other_user}","gists_url":"https://api.github.com/users/ssougnez/gists{/gist_id}","starred_url":"https://api.github.com/users/ssougnez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssougnez/subscriptions","organizations_url":"https://api.github.com/users/ssougnez/orgs","repos_url":"https://api.github.com/users/ssougnez/repos","events_url":"https://api.github.com/users/ssougnez/events{/privacy}","received_events_url":"https://api.github.com/users/ssougnez/received_events","type":"User","site_admin":false},"created_at":"2018-11-26T11:12:13Z","updated_at":"2018-11-26T11:12:13Z","author_association":"CONTRIBUTOR","body":"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 ;-)\r\n\r\nLet me know the feedback from Umbraco Cloud :-)\r\n\r\nThanks"}}
{"actor":{"display_login":"ssougnez"}}