How to setup VSTS continuous deployment for GoDaddy
Setting up deployment/Release tasks from VSTS to Azure system/resource is a piece of cake (Microsoft has made sure that it is so).
But think about the low priced hosting providers like GoDaddy. Setting up a continuous deployment from VSTS to these hosting servers are a real challenge. I have tried many predefined deployment tasks but ended up in dead end. GoDaddy server current setup & rules, outdated deployment options have blocked easy deployment possibilities.
Here is the list of tasks / templates, I have tried from the release definition
1) FTP Deploy :
This task appears by default in the release task catalog and it allows you to easily setup deployment to FTP / FTPS server. It requires you to create a service endpoint for connecting with the FTP server.
This is the most straight forward method that won't simply work with the GoDaddy shared hosting. Maybe due to
- The TLS certificate error while connecting to FTP server or
- The service endpoint requires a valid secure connection (FTPs)
2) FTP Uploader:
This task uses the PowerShell based FTP Client module. You can specify server details and credentials in the task - more simple that the out of box FTP task. You can include the task in release definition by installing FTP Uploader extension from the marketplace to your VSTS project.
As expected, this won't work well with GoDaddy's setup. Seems to throw strange error connecting to the FTP server.
Phew!! I went through numerous articles online for finding a way to connect GoDaddy FTP server from VSTS. But GoDaddy seems to hate this method and also there were numerous discussion on how FTP is not a reliable way to transfer data. SSH is recommended everywhere but GoDaddy doesn't seem to offer this for basic/entry level plan.
This made me look for an alternate way to deploy. MS Deploy appeared to be a perfect solution and also an intelligent one - it compares the file size before initiating the data transfer. So it avoids transfer of files, if there is no change.
3) MSDeployAllTheThings :
This is a perfect deploy task available in Visual Studio Team Service marketplace. It allows you to select the package published by the Visual Studio build (MS build) tool and deploy it to a destination machine with a username and password.
It appeared so promising BUT - It required user account to have access to IIS website to set few security rules, & also access services to stop and re-start the website in IIS. These permissions were not assigned for the user account in GoDaddy. So the hope of using this extension ended up in error log.
4) MS Deploy - using publish profile from Visual studio :
I found an article on GoDaddy forum confirming that GoDaddy has all permissions configured for MS Web deploy. So, to validate the claim - I tried to setup the Web deploy from my local Visual Studio. Following Publish profile setup wizard creates .pubxml under properties folder in your project.
At first, it ended up in timeout error - This was due to the CDN (Cloudflare) setup for my website. So I added an alternate subdomain through which I could finally connect & perform web deploy from my local to GoDaddy. This confirmed that Visual Studio can indeed connect to web deploy services at GoDaddy.
Since, Visual Studio Team Service allows us to compile our application using Visual Studio on a virtual machine. Same theory should workout - i.e., the webdeploy from VS should be feasible from VSTS virtual machine to GoDaddy.
Following are the steps for setting up
1) Select Visual Studio template
2) In the Build Solution step,
specify the publish profile (.pubxml) that you've created on your local system and provide the credentials for web deploy as below
/p:DeployOnBuild=true /p:PublishProfile="sitename.com - Web Deploy.pubxml" /p:AllowUntrustedCertificate=true /p:UserName="uname" /p:Password="password" /p:VisualStudioVersion=14.0
Now your continuous deployment should be all set. Perform code merge to main branch(which is set as a trigger event), VSTS will automatically start deploying the code to GoDaddy server.
The only pitfalls that I see in this method is that, your code release / deploy to target machine happens on Building rather than a Release definition. This wasn't a deal breaker in my case. So I have finally succeeded in configuring continuous deployment from VSTS to GoDaddy for this website.
Hope this helps you! If you want an automated deploy setup on GoDaddy.