OpenShift Create an Application from a Git Repository

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Internal

Overview

If a source code URL is specified, OpenShift will pull the source code and convert it into an image to run inside a pod, attempting to guess what build strategy to use. Local source must be in a Git repository that has a remote repository that the server can see. new-app will create a build configuration and a deployment configuration. A service will be connected to the first public port of the app. oc status can be used to check on progress.

oc new-app https://github.com/test/testapp.git

Successful creation output:

--> Found image eaf9dfd (5 weeks old) in image stream "openshift/nodejs" under tag "6" for "nodejs"

    Node.js 6
    ---------
    Node.js 6 available as docker container is a base platform for building and running various Node.js 6 applications and frameworks. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

    Tags: builder, nodejs, nodejs6

    * The source repository appears to match: nodejs
    * A source build using source code from https://github.com/test/testapp will be created
      * The resulting image will be pushed to image stream "testapp:latest"
      * Use 'start-build' to trigger a new build
    * This image will be deployed in deployment config "testapp"
    * Port 8080/tcp will be load balanced by service "testapp"
      * Other containers can access this service through the hostname "testapp"

--> Creating resources ...
    imagestream "testapp" created
    buildconfig "testapp" created
    deploymentconfig "testapp" created
    service "testapp" created
--> Success
    Build scheduled, use 'oc logs -f bc/testapp' to track its progress.
    Run 'oc status' to view your app.

Forcing a source-to-image build based on repository sources:

oc new-app nodejs:latest~https://github.com/wkulhanek/ocp-appdev-helloworld-nodejs.git \
 --strategy=source --name=hello-nodejs