This documentation provides you with step by step instructions on how to build and deploy this application in an OpenShift 3.3+ and Ruby 2.x+ environment. Jenkins is not required and you could just use the built-in OpenShift triggers.
The benefits are:
Enhancements to base Ruby image are:
This build strategy uses OpenShift's feature called Extended Builds.
In a nutshell, it allows you to build with one s2i image, i.e., NodeJS 6+, then use another image, i.e., nginx, for runtime.
OpenShift is responsible for:
This is your builder image that compiles the angular source code.
This image is based on the OpenShift's community NodeJS 6 image, i.e., FROM centos/nodejs-6-centos7
.
We use this because the stock NodeJS 4 can't compile angular-cli
(an ES6 issue). Once the stock NodeJS 4 image
is upgraded this won't be required.
To add this image to your OpenShift Project,
angular-builder.json
into form -> Createangular-builder
-> Start BuildWhat happens in OpenShift:
Dockerfile
from <your repo>/angular-builder/Dockerfile
angular-builder
image into your project's Image StreamsThis is your runtime image that is deployed with output of the angular-builder
.
This images is based on docker hub's official nginx image, i.e., FROM nginx:mainline
. It will auto
update to latest mainline for every build. If you need to pin it to a version alter the nginx-runtime/Dockerfile
.
To add this image to your OpenShift Project,
nginx-runtime.json
into form -> Createnginx-runtime
-> Start BuildWhat happens in OpenShift:
Dockerfile
from <your repo>/angular-builder/Dockerfile
nginx-runtime
image into your project's Image StreamsThis is the s2i builder image to glue the angular-builder
output with the nginx-runtime
image. The result is a
new image based on nginx-runtime
but with the output of angular-builder
.
To add this image to your OpenShift Project,
angular-on-nginx-build.json
into form -> CreateName
to the name of your applicationGit Source Repo URL
to yours -> CreateWhat happens in OpenShift:
angular-builder
to build with your source code/opt/app-root/src/dist/
to nginx-runtime
directory tmp/app
<your app name>-build
to Image StreamOnce we've got an image out of the angular-on-nginx
builder, e.g., <your app name>
, we
need to setup the deployment. We've provide a deployment template that is based on real load testing:
The deployment template will create in OpenShift:
To add this image to your OpenShift Project,
angular-on-nginx-deploy
into form -> CreateName
to the name of your applicationImage Namespace
to the project of where it's builtEnv TAG name
to the name of your applicationAPPLICATION_DOMAIN
to the domain name you would likeRepeat these steps for each environment you have changing the Env TAG name
.
You can choose not to use Jenkins at this point. Instead, use vanilla OpenShift build triggers and image changes deployments. However, Jenkins provides some nice features you'll probably need.
So, you've chosen to use Jenkins! Congrats!
This repo also comes with a Jenkinsfile
to take advantage of the Pipelines feature in OpenShift and Jenkins.
Follow BCDevOps Jenkins Configuration to get started
Note: we've already provided the default Jenkinsfile
tailored for this app.
Jenkins out-of-the-box needs some additional setup.
jenkins-pipeline-svc
-> Environment -> JENKINS_PASSWORD
GitHub
plugin