setup:
- git repo – code base created
- docker repo – project repo created
- jenkins platform – with the pipeline,openshift addon
- openshift platform – project with oc login, imaging pulling access
in codebase:
- create a Dockerfile for the base image installing only the needed libraries and tools.
- create a Dockerfile for the actual code base from git repo.
- calling from the base image
- script to install dependencies
- expose the right ports 8080 for server
in Jenkins:
- create a custom project for the base image. define the image path and give it a tag as base.
- get the git report with the base dockerfile.
- Call docker build the image with dockerfile and tag location.
- Then call docker push into the docker repo.
- create a pipeline for building the codebase. define the image path and give it a tag as the dev or production. Create node for the process, and then create stages for the different parts.
- stage clean the existing files locally.
- stage run unit tests and additional stages for integration acceptance tests
- stage for call docker build the image with dockerfile and output location.
- stage for call docker push to the docker repo.
- emailing or other post build clean ups
- create a project for deployment using the jenkins node docker-oc
- define the docker image path and tags from codebase docker repo
- login oc , and oc project
- import the docker image path into the OSE3 project with a tag name
- if its first time, create-new app with the image path and the app name.
- logout oc when done
- link all these parts together into a bigger pipeline or emailtxt if preferred.
In Openshift3:
- if creating the app from the Jenkins pipeline CLI, then go to step2.
- For sample project, create a project from the templates. change deployment from git to use image stream tag.
- go into the deployment and edit the yaml file.
- for the parts(2 of them) that is listening “on change” for image, make sure it is pointing the imported docker image from the jenkins step
- we dont need a build process since thats done with docker
- make sure the services and routes are active. expose port same as the pod’s port
- Verify that the Jenkins step pushed a new image stream into the project
- new apps should trigger to build with the oc rc replication controller
- create new routes to expose the app, make sure the code base/docker image is exposing the same port number. default for OSE is 8080
DB storage within OSE3:
- for example if you want to create an instance of mysql into OSE. you can only access the db directly through the Pod’s IP when running the app on the server.
- If you need to work on it locally. You should OC login to the project, then do port forwarding to your machine. While the port-forwarding is still active, you can then access the db through localhost.