Hello,
We’re trying to create dynamic test environments, so our process:
1.Create the machine (EC2) in AWS with Terraform,
2.Deploy the packages to the newly created instance.
How can I do that with Octopus?
Hello,
We’re trying to create dynamic test environments, so our process:
1.Create the machine (EC2) in AWS with Terraform,
2.Deploy the packages to the newly created instance.
How can I do that with Octopus?
Hi @cpieren!
Thanks for reaching out, and for the great question. The most common way that this is done is through the use of a deployment target trigger on your project, configured to automatically deploy one or more projects to the machine when it is registered as a deployment target in Octopus.
We also have a great set of resources on deploying to elastic and transient environments here:
I hope this helps, and please don’t hesitate to reach out if you have any further questions!
Hey, thanks for the quick reply!
Our idea is to have multiple versions deployed to N number of AWS EC2 instances. So, our QA team can deploy a version to an instance and run tests, after some inactive time that machine would be terminated.
If I understood the “Elastic and transient environments - Octopus Deploy”, this would deploy the last version to every registered machine. Am I right?
Hey there, Justin asked me to take this over. I work for our customer solutions team and I hope I can help get you up and running.
You mention wanting to have multiple versions deployed to N number of EC2 instances. Essentially the QA team can quickly spin up a new testing lab with a specific version and run some tests. Then eventually have it all get torn down.
I have a few clarification questions if you don’t mind.
Deploying 2021.1.1.3 would spin up different testing infrastructure specific for that version.
Etc.
Hello, thanks for the help!
Answers:
Hi Chris,
Awesome, thank you for providing that extra context. The tricky part here is when you register a server you register it to specific environments for specific roles.
For example, if I had the following targets in the test environment:
If I were to spin up a new EC2 instance, t-target-04, and give it the role hello-world-api, then by default when I deploy a release to the test environment all 4 servers would be chosen.
It is possible to limit which machines are used in a deployment via both the API and the UI.
But this is confusing, as anyone who looked at the Octopus Deploy project overview wouldn’t know what machines have what versions. And anyone could overwrite the versions on any machines at anytime.
My suggestion is to leverage the multi-tenancy tenants in Octopus Deploy. Tenants add an extra layer in which you can pick a version
And then deploy that version to a specific tenant
Once you add tenants you get the ability to restrict deployment targets to specific tenants.
TL;DR; tenants solve both problems of restricting targets to specific “testing environments” and provide a nice visualization as to what “testing environment” has what version.
To do this:
What this will also do is allow you to have your normal deployment process except for “test” which has your various testing tenants.
The run a runbook step accepts tenant name as a parameter
You can pass in #{Octopus.Deployment.Tenant.Name}.
The runbooks themselves will do as you described, except when it comes time to register the target you’d specify the tenant name.
I hope that helps!
Hey, thanks for the help!
A project has multiple clients ( tenants ), and the way they want this to work is like this:
yesterday I had 10 test env, today 5 and tomorrow 20. That is why I cannot create a tenant for each one.
So, is my understanding that we cannot do this with Octopus, that is fine. My proposed solution is using octopus to handle the ec2 deploy and do the package deploys with PowerShell. This raises some new questions:
Again, thank you. I really appreciate the help
Another option is to have a runbook that creates a tenant on the fly, spins up the machines in EC2, and triggers a deployment to that tenant. You could have another runbook query the API and see the last time a tenant was deployed to. If it is more than a certain timeframe you could remove it.
It’d be a bit more API work but completely possible.
To answer your specific questions:
Thank you! I’ll discuss these ideas with the team.
You are welcome. If anything new comes up please let me know.
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.