11 software delivery problems solved by intelligence software delivery platform  Download
Select Page

Continuous Deployments in VMWare/Pivotal (PCF) Environments with Spinnaker

Srinivas K April 6, 2020
Share

Introduction

Cloud Foundry is used by enterprises across the world to host applications and supports the full application development lifecycle. With out-of-the-box support for Cloud Foundry from drivers contributed by Pivotal, Spinnaker is a perfect complement to Cloud Foundry, enabling the safe deployment of workloads using blue/green (a.k.a red/black) strategies and, if required, rollback.

Here we show step-by-step instructions for configuring Spinnaker and deploying to Cloudfoundry.

What you need:

a) A Cloudfoundry account. You can get it here for free

b) A Github account that will be used as a source of artifacts to be deployed

c) An instance of Spinnaker along with access to the halyard for configuring provider and artifact accounts

d) General knowledge of configuring Spinnaker using the hal command, configuring and running pipelines in Spinnaker

Adding provider and artifact accounts

Add the cloud foundry account as follows:

# hal config provider cloudfoundry account add pivotal --api-host api.run.pivotal.io \

--user cloudfoundry@email.com --password 'cloudfoundry-password'

# hal config provider cloudfoundry enable

Add the Github artifact source as follows:

# hal config artifact github account add ksrini-spin-artifacts --token-file /home/spinnaker/.hal/github-ksrini-token

# hal config artifact github enable

We also need an HTTP artifact provider:

# hal config artifact http account add cloudfoundry-samples --password 'http-source-password'

# http password: <ENTER http-source-password>

# hal config artifact http enable

We are using Github as the Http source. In this case, the password is the Github password.

Once all the accounts are added, don’t forget to run :

# hal deploy apply

Deploying a Java Application

For deploying a JAR file resulting from a Java build:

a) Use Http artifact provider

b) Go to Github and get the “raw” URL for a binary file.

c) Test the raw-URL. An easy way to test it is to copy-paste the URL in a browser: the file should

get downloaded. An example URL looks like this:

https://github.com/ksrinimba/spin-artifacts/blob/master/spring-music-1.0.jar?raw=true

ksrinimba = Username

spin-artifacts = Repository name

master = Branch

spring-music-1.0.jar = The file we want Spinnaker to download and deploy

d) Configure a pipeline as shown in the images below. Here we use the UI for specifying the manifest details. For specifying manifest as a file, please see the next section

Pipeline Definition view:

Click the EDIT button:

Enter the required details, select the deployment strategy.

Provide the application location and manifest inputs

Deploying a Golang and other applications

For deploying a Golang application:

a) Use Github artifact provider b) ZIP the application directory and push to GitHub c) Enter the API-Url for the ZIP file to Spinnaker. d) Test the API-URL.  An easy way to test it is to copy-paste the URL in a browser. You should get a JSON response. An example URL for ZIP and a manifest looks like this:

https://api.github.com/repos/ksrinimba/spin-artifacts/contents/test-app.zip 

https://api.github.com/repos/ksrinimba/spin-artifacts/contents/manifest.yml

            ksrinimba      = Username

            spin-artifacts = Repository name

            test-app.zip   = Application directory zipped up with the command:

                             zip -r /tmp/test-app.zip .  # The “.” at the end is the current directory

            manifest.yml   = Manifest file, provided as an artifact instead of entering the details in

                             Spinnaker UI.

e) Configure the deployment as shown below. Here we use the manifest.yml from GitHub for specifying the manifest details.

Enter the required details, select the deployment strategy.

Provide the application and manifest artifact locations.

Execute the pipeline to deploy.

 

You May Like

Continuous Verification of Deployments

November 12, 2020
Share