OpenShift supports application deployment by using a source from GitHub and specifying an image. A build configuration file is generated for the S2I deployment in a new pod called Build Pod. In the build configuration file, you can configure the triggers needed to automate the new build process every time a condition meets the specifications you defined. After the deployment is complete, a new image with injected source code is created automatically.
Perform the following steps to deploy an application. The sample deployment uses httpd-ex as the GitHub source.
- Log in to the OpenShift cluster:
oc login -u <user name>
- Create a new project by running:
oc new-project <project name>
- Use the GitHub source and specify the image of which the application will be a part to create the application:
oc new-app centos/httpd-24-centos7~https://github.com/sclorg/httpd-ex.git
Note: The image is centos/httpd-24-centos7 and the GitHub source is https://github.com/sclorg/httpd-ex.git. You can obtain build logs by running oc logs -f bc/httpd-ex for this example.
- After the image is deployed, identify all the objects that were created as part of the deployment by running the oc get all command.
The following output is displayed:
Figure 12. Sample S2I deployment status
- Obtain triggers for this deployment by checking the YAML template of the build config:
oc get buildconfig httpd-ex -o yaml