How to deploy different artifacts to multiple environments from single deploy

alexander's Avatar

alexander

31 Aug, 2018 08:14 PM

We use Appveyor to build and deploy our single project (which contains a website and a windows service) to a single environment using Appveyor Deployment Agent installed on our server.

Now we have the requirement to split the windows service and the website to two separate servers (possibly more servers in the future). How do I achieve this in the most simple way? We use the UI to trigger a deployment and would like to keep it that way. We do not want to create two separate environments in Appveyor because then we would have to trigger two deploys. In other terms: we would like to still be able to deploy from Appveyor UI and not having to do multiple manually deploys.

  1. Support Staff 1 Posted by Owen McDonnell on 01 Sep, 2018 04:30 AM

    Owen McDonnell's Avatar

    There are 2 options available:

    We could help you come up with a script solution. You would provide build number and which artifact to deploy and the script would call deployments via the api.

    Or, if you are ok with using last successful build as default then you could have a use a deployment project approach as detailed here. Don't let the blog post scare you, its not too complicated an idea. No need for new repository, you can simply have a separate config file in the same repository named deploy.yml for instance and then set a custom yaml name for that project in the AppVeyor UI.

    Feel free to ask any questions regarding details of either approach.

  2. 2 Posted by alexander on 01 Sep, 2018 11:39 AM

    alexander's Avatar

    Thank your for your reply. I had a feeling that this would require a custom script solution. Based on the two options I would go for the first one and sacrifice the "deploy-from-ui" solution that we use today.

    Do you have any sample scripts (powershell preferably) using your api that does something like this?

    1. Deploy first artifact X from build Y to environment Z
    2. Wait for success for step 1 (I guess this would require some polling of the deployment status using your api?)
    3. When step 1 has succeeded then deploy second artifact X from build Y to environment Z
    4. Wait for success for step 3.
    5. Done!

  3. Support Staff 3 Posted by Owen McDonnell on 07 Sep, 2018 01:07 AM

    Owen McDonnell's Avatar

    Sorry for the delay. I have a script and approach that should work for you, or at least get you started.

    You will need to create 2 different environments, one for each of the artifacts you want to deploy.
    Then you can call this script, passing in each environment name (in order of dependent artifacts to deploy) and the build version as parameters. Other parameters (account name and project slug) can be hard coded or you can parameterize them if you prefer.

    If you have any more questions or need any clarification don't hesitate to ask.

  4. 4 Posted by alexander on 08 Sep, 2018 05:31 AM

    alexander's Avatar

    Thank you for this script, excellent support. However, I have already implemented something similar using the very same API) just a few days ago. I can verify this works very well for our needs. This script will be great for others to review and modify for their needs.

  5. Support Staff 5 Posted by Owen McDonnell on 09 Sep, 2018 02:41 AM

    Owen McDonnell's Avatar

    Great. As long as you have something that works for you!

  6. Owen McDonnell closed this discussion on 09 Sep, 2018 02:41 AM.

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