OpenShift Create an Application from a Git Repository: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * oc new-app * Application Operations =Overview=")
 
 
Line 5: Line 5:


=Overview=
=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, [[OpenShift_Application_Operations#What_Build_Strategy.3F|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 [[OpenShift_Concepts#Build_Configuration|build configuration]] and a [[OpenShift_Concepts#Deployment_Configuration|deployment configuration]]. A service will be connected to the first public port of the app. [[oc_status|oc status]] can be used to check on progress.
[[oc new-app]] https://github.com/test/testapp.git
Successful creation output:
<pre>
--> 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.
</pre>
Forcing a [[OpenShift_Concepts#Source-to-Image_.28S2I.29_Build|source-to-image]] build based on repository sources:
oc new-app nodejs:latest~https&#58;//github.com/wkulhanek/ocp-appdev-helloworld-nodejs.git \
  --strategy=source --name=hello-nodejs

Latest revision as of 00:52, 20 January 2018

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