Automatic deployment to a load balanced environment
Hi all,
I've got to configure an automatic deployment process for a load balanced web application and I'd like to validate my solution before actually implementing it. I have 3 servers and this is what I have to do for each one:
* Disconnect the server from the load balancer (before-deploy script)
* Make the deployment
* Check the deployment with a Selenium test (after-deploy script)
* Connect the server to the load balancer again
* Trigger a deployment to the next server
My questions with this workflow are:
* How can I make a decision based on the results of a Selenium test?
* How can I trigger the next deployment if everything was ok? I was thinking about using AppVeyor's API.
* How can I make a rollback if any of the deployments fail?
Cheers!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ilya Finkelshte... on 14 Mar, 2017 03:33 AM
Hello,
However I think that scenario with Selenium tests on every server is a little fragile. Maybe better do Selenium test only on AppVeyor VM, after the build. Here is some notes. And as part of deployment script do only lightweight testing with
invoke-webrequest
command.Thanks!
Ilya.
2 Posted by cam on 14 Mar, 2017 12:06 PM
Hi Ilya,
Thank you for your response, I'll have everything clearer now.
Cheers.
3 Posted by Ilya Finkelshte... on 14 Mar, 2017 05:51 PM
Sure, please feel free to ping with any questions when implementing it.
4 Posted by andrew on 16 Mar, 2017 12:18 PM
Hi,
We have been doing very similar with AppVeyor for a number of months. I am having an issue whereby machines that go through the deployment process command though are being re-deployed, so for example:
- Machine 1 starts up, initialises and runs the deployment script which sends the deployment message to AppVeyor, the machine gets deployed.
2. Second machine comes up, runs through the same process and runs the deployment. As machine 1 is in the same group, it deploys to both machines.
Is there a way to deploy to just the one machine?
Andrew.
5 Posted by Ilya Finkelshte... on 16 Mar, 2017 11:53 PM
@Andrew could you please provide more details about your environment? Are all servers use the same Environment access key? Is your application have multiple tiers (main reason to have a groups)? Also please check this post if you did not do it already, to get good example of groups usage.
Thanks!
Ilya.
6 Posted by andrew on 17 Mar, 2017 09:05 AM
Hi,
We have a single environment called production and in that environment I have several servers in different groups. There are multiple servers per groups (i.e, multiple front-end machines, multiple back-end machines etc. From the URL you posted, I don't think there is any way to target a specific server for deployment, and I would say this would be a really good feature to have for auto-scaling environments, as with the current solution if a tier autoscales, it causes a re-deployment to all servers in that environment.
Thanks.
Andrew.
7 Posted by cam on 17 Mar, 2017 01:42 PM
Hi All,
I've been able to configure my deployment flow.
I'm using web deploy so I created 3 different environments in AppVeyor, one for each server, let's call them E1, E2 and E3. This is how the deploy works:
* I push to a git branch that triggers a deployment to E1
* E1 disconnects itself from the load balancer through a before deployment command.
* E1 gets deployed
* E1 connects itself to the load balancer again and trigger the deployment to E2 through an after deployment command.
* E2 disconnects itself from the load balancer through a before deployment command.
* E2 gets deployed
* E2 connects itself to the load balancer again and trigger the deployment to E3 through an after deployment command.
* E3 gets deployed
So far so good, this flow works perfectly.
The missing part is the selenium test which I don't know how to configure.
I already have the test but I don't know how to make it work in AppVeyor, these are my questions:
* Which URL should I use for the test?
* in which step of the pipeline does it get executed?
I'd like to execute it after E1 gets deployed and before it connects itself to the load balancer.
Cheers,
Cristhian.
8 Posted by Ilya Finkelshte... on 17 Mar, 2017 04:47 PM
@cam
Please see my answers below:
Which URL should I use for the test?
127.0.0.1 www.yoursite.com
inhosts
file. Samples are here. It is good idea to restore hosts file after your test finished.in which step of the pipeline does it get executed?
9 Posted by Ilya Finkelshte... on 17 Mar, 2017 04:53 PM
@Andrew I agree, we plan major improvements for deployment this year, will take this into account. For now I believe to avoid deployment duplication, you have to create separate environment for each server as @cam did.
10 Posted by Ilya Finkelshte... on 17 Mar, 2017 06:11 PM
https://github.com/appveyor/ci/issues/1406
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:15 AM.