The last thing that we need to do before we can create the deployment scripts is to create a dummy service in Rancher that we can then replace with our deployed application. We need to do this because our deployment scripts need to reference a service id and will fail if the id doesn’t exist yet.
In the Rancher interface create a new ‘Stack’ for your applications. Stacks are a way to organize different applications together.
Give your stack a name and click on the create button. You will end up with empty stack with no services running. In Rancher a service is one or more containers running a single docker image. Click on the Add Service button.
Give your service a name ( single word lowercase is the best practice ) and then for the Select Image section enter in ‘busybox’. This is just a very small linux distribution that does an excellent job as a temporary standin for our deployment scripts
I am also adding a single environment variable called spring.profiles.active and setting the value to dev. In your other environments I would set the value to ‘test’ and ‘prod’ as needed. This is used to select to correct spring profile at a later stage in the process.
Click on create button and then when the service has been created click on the service name and take a look at the URL in your browser.
In the URL there are three IDs. The first is the environment ID, the next is the Stack ID and the last one is the Service ID. You will need to take a note of the last one for the deployment scripts.
We are now ready to create the deployment definition in VSTS.