Skip to content

Commit

Permalink
Adding final openshift-applier inventory for sprint-boot pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
etsauer committed Feb 5, 2018
1 parent 938b6cc commit 5eb182c
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 14 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ Typically the things required to build a pipeline sample include:
- etc.

See our [basic spring boot](./basic-spring-boot) example for a very simple reference architecture.

## Automated Deployments

These pipeline quickstarts include an Ansible inventory through which they can be automatically deployed and managed using the [OpenShift Applier](https://github.com/redhat-cop/casl-ansible/tree/master/roles/openshift-applier) role.
26 changes: 14 additions & 12 deletions basic-spring-boot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,38 @@ This example demonstrates how to implement a full end-to-end Jenkins Pipeline fo
* "One Click" instantiation of a Jenkins Pipeline using OpenShift's Jenkins Pipeline Strategy feature
* Promotion of an application's container image within an OpenShift Cluster (using `oc tag`)
* Promotion of an application's container image to a separate OpenShift Cluster (using `skopeo`) - Coming Soon!
* Automated rollout using the [openshift-appler](https://github.com/redhat-cop/casl-ansible/tree/master/roles/openshift-applier) Ansible role.

## Quickstart
## Automated Quickstart

Run the following commands to instantiate this example.
This quickstart can be deployed quickly using Ansible. Here are the steps.

1. Clone [this repo](https://github.com/redhat-cop/container-pipelines.git) and the [casl-ansible](https://github.com/redhat-cop/casl-ansible.git) repo.
2. Log into an OpenShift cluster, then run the following command.
```
cd ./basic-spring-boot
oc create -f projects/projects.yml
oc process openshift//jenkins-ephemeral | oc apply -f- -n basic-spring-boot-dev
oc process -f deploy/template.yml --param-file=deploy/dev/params | oc apply -f-
oc process -f deploy/template.yml --param-file=deploy/stage/params | oc apply -f-
oc process -f deploy/template.yml --param-file=deploy/prod/params | oc apply -f-
oc process -f build/template.yml --param-file build/dev/params | oc apply -f-
$ oc login
$ ansible-playbook -i container-pipelines/basic-spring-boot/inventory/ casl-ansible/playbooks/openshift-cluster-seed.yml --connection=local
```

At this point you should have 3 projects deployed (`basic-spring-boot-dev`, `basic-spring-boot-stage`, and `basic-spring-boot-prod`) with our [Spring Rest](https://github.com/redhat-cop/spring-rest.git) demo application deployed to all 3.

## Architecture

The following breaks down the architecture of the pipeline deployed, as well as walks through the manual deployment steps

### OpenShift Templates

The components of this pipeline are divided into two templates.

The first template, `build/template.yml` is what we are calling the "Build" template. It contains:
The first template, `files/builds/template.yml` is what we are calling the "Build" template. It contains:

* A `jenkinsPipelineStrategy` BuildConfig
* An `s2i` BuildConfig
* An ImageStream for the s2i build config to push to

The build template contains a default source code repo for a java application compatible with this pipelines architecture (https://github.com/redhat-cop/spring-rest).

The second template, `deploy/template.yml` is the "Deploy" template. It contains:
The second template, `files/deployments/template.yml` is the "Deploy" template. It contains:

* A tomcat8 DeploymentConfig
* A Service definition
Expand All @@ -62,7 +64,7 @@ https://github.com/redhat-cop/spring-rest
* OpenShift 3.5+ is required.
* Access to GitHub

## Implementation Instructions
## Manual Deployment Instructions

### 1. Create Lifecycle Stages

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions basic-spring-boot/inventory/group_vars/seed-hosts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
openshift_cluster_content:
- object: projects
content:
- name: "create environments"
file: "{{ inventory_dir }}/../files/projects/projects.yml"
file_action: create
- object: deployments
content:
- name: "deploy dev environment"
template: "{{ inventory_dir }}/../files/deployments/template.yml"
params: "{{ inventory_dir }}/../files/deployments/params.dev"
- name: "deply stage environment"
template: "{{ inventory_dir }}/../files/deployments/template.yml"
params: "{{ inventory_dir }}/../files/deployments/params.stage"
- name: "deply prod environment"
template: "{{ inventory_dir }}/../files/deployments/template.yml"
params: "{{ inventory_dir }}/../files/deployments/params.prod"
- object: builds
content:
- name: "deploy build pipeline to dev"
template: "{{ inventory_dir }}/../files/builds/template.yml"
params: "{{ inventory_dir }}/../files/builds/params.dev"
2 changes: 2 additions & 0 deletions basic-spring-boot/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[seed-hosts]
localhost
1 change: 1 addition & 0 deletions basic-tomcat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This example demonstrates how to implement a full end-to-end Jenkins Pipeline fo
* "One Click" instantiation of a Jenkins Pipeline using OpenShift's Jenkins Pipeline Strategy feature
* Promotion of an application's container image within an OpenShift Cluster (using `oc tag`)
* Promotion of an application's container image to a separate OpenShift Cluster (using `skopeo`)
* Automated rollout using the [openshift-appler](https://github.com/redhat-cop/casl-ansible/tree/master/roles/openshift-applier) Ansible role.

## Quickstart

Expand Down
5 changes: 3 additions & 2 deletions blue-green-spring/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# A Sample OpenShift Pipeline for Blue Green deployments

This example demonstrates how to implement a full end-to-end Jenkins Pipeline for a Java application in a Blue/Green deployment in the OpenShift Container Platform. The pipleine will create two instances of the applicaiton in the Production namespace. There will be three routes in the namespace; a blue, green and blue-green route. The blue-green route will switch to the latest deployment when the pipeline completes. This allows for tesing of the new deployment prior to switching live traffic. Also, the previous deployment can be used to compmare the previous deployment.
This example demonstrates how to implement a full end-to-end Jenkins Pipeline for a Java application in a Blue/Green deployment in the OpenShift Container Platform. The pipleine will create two instances of the applicaiton in the Production namespace. There will be three routes in the namespace; a blue, green and blue-green route. The blue-green route will switch to the latest deployment when the pipeline completes. This allows for tesing of the new deployment prior to switching live traffic. Also, the previous deployment can be used to compmare the previous deployment.

This sample demonstrates the following capabilities:

Expand All @@ -11,6 +11,7 @@ This sample demonstrates the following capabilities:
* Tagging images with the current version of the artifact defined in the pom.xml file
* Promotion of an application's container image to a blue/green production configuration
* Switching production routes between blue and green deployments after confirmation
* Automated rollout using the [openshift-appler](https://github.com/redhat-cop/casl-ansible/tree/master/roles/openshift-applier) Ansible role.

## Quickstart

Expand Down Expand Up @@ -105,7 +106,7 @@ This template should be instantiated once in each of the lower level namespaces

A production blue/green_deploy template_ is provided at `deploy/simple-spring-boot-template-prod.yml` that defines all of the resources required to run the openjdk8 application. It includes:

* Two `Service's`
* Two `Service's`
* Three `Route's` a blue route, green route and main route that switches between the two deployments/services.
* Two `ImageStream's`
* Two `DeploymentConfig's`
Expand Down

0 comments on commit 5eb182c

Please sign in to comment.