mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
103 lines
7.7 KiB
Plaintext
103 lines
7.7 KiB
Plaintext
[id="odc-importing-codebase-from-git-to-create-application_{context}"]
|
|
= Importing a codebase from Git to create an application
|
|
|
|
You can use the *Developer* perspective to create, build, and deploy an application on {product-title} using an existing codebase in GitHub.
|
|
|
|
The following procedure walks you through the *From Git* option in the *Developer* perspective to create an application.
|
|
|
|
.Procedure
|
|
|
|
. In the *+Add* view, click *From Git* in the *Git Repository* tile to see the *Import from git* form.
|
|
. In the *Git* section, enter the Git repository URL for the codebase you want to use to create an application. For example, enter the URL of this sample Node.js application `\https://github.com/sclorg/nodejs-ex`. The URL is then validated.
|
|
. Optional: You can click *Show Advanced Git Options* to add details such as:
|
|
|
|
* *Git Reference* to point to code in a specific branch, tag, or commit to be used to build the application.
|
|
* *Context Dir* to specify the subdirectory for the application source code you want to use to build the application.
|
|
* *Source Secret* to create a *Secret Name* with credentials for pulling your source code from a private repository.
|
|
|
|
. Optional: You can import a devfile, a Dockerfile, or a builder image through your Git repository to further customize your deployment.
|
|
* If your Git repository contains a devfile, a Dockerfile, or a builder image, it is automatically detected and populated on the respective path fields. If a devfile, a Dockerfile, and a builder image are detected in the same repository, the devfile is selected by default.
|
|
* To edit the file import type and select a different strategy, click *Edit import strategy* option.
|
|
* If multiple devfiles, Dockerfiles, or builder images are detected, to import a specific devfile, Dockerfile, or a builder image, specify the respective paths relative to the context directory.
|
|
|
|
. After the Git URL is validated, the recommended builder image is selected and marked with a star. If the builder image is not auto-detected, select a builder image. For the `https://github.com/sclorg/nodejs-ex` Git URL, by default the Node.js builder image is selected.
|
|
.. Optional: Use the *Builder Image Version* drop-down to specify a version.
|
|
.. Optional: Use the *Edit import strategy* to select a different strategy.
|
|
|
|
. In the *General* section:
|
|
.. In the *Application* field, enter a unique name for the application grouping, for example, `myapp`. Ensure that the application name is unique in a namespace.
|
|
.. The *Name* field to identify the resources created for this application is automatically populated based on the Git repository URL if there are no existing applications. If there are existing applications, you can choose to deploy the component within an existing application, create a new application, or keep the component unassigned.
|
|
+
|
|
[NOTE]
|
|
====
|
|
The resource name must be unique in a namespace. Modify the resource name if you get an error.
|
|
====
|
|
|
|
. In the *Resources* section, select:
|
|
|
|
* *Deployment*, to create an application in plain Kubernetes style.
|
|
* *Deployment Config*, to create an {product-title} style application.
|
|
* *Serverless Deployment*, to create a Knative service.
|
|
|
|
+
|
|
[NOTE]
|
|
====
|
|
The *Serverless Deployment* option is displayed in the *Import from git* form only if the {ServerlessOperatorName} is installed in your cluster. For further details, refer to the {ServerlessProductName} documentation.
|
|
====
|
|
|
|
. In the *Pipelines* section, select *Add Pipeline*, and then click *Show Pipeline Visualization* to see the pipeline for the application.
|
|
|
|
. In the *Advanced Options* section, the *Create a route to the application* is selected by default so that you can access your application using a publicly available URL. You can clear the check box if you do not want to expose your application on a public route.
|
|
|
|
. Optional: You can use the following advanced options to further customize your application:
|
|
|
|
Routing::
|
|
Click the *Routing* link to:
|
|
* Customize the hostname for the route.
|
|
* Specify the path the router watches.
|
|
* Select the target port for the traffic from the drop-down list.
|
|
* Secure your route by selecting the *Secure Route* check box. Select the required TLS termination type and set a policy for insecure traffic from the respective drop-down lists.
|
|
+
|
|
For serverless applications, the Knative service manages all the routing options above. However, you can customize the target port for traffic, if required. If the target port is not specified, the default port of `8080` is used.
|
|
|
|
Domain mapping::
|
|
If you are creating a *Serverless Deployment*, you can add a custom domain mapping to the Knative service during creation.
|
|
+
|
|
* In the *Advanced options* section, click *Show advanced Routing options*.
|
|
** If the domain mapping CR that you want to map to the service already exists, you can select it from the *Domain mapping* drop-down menu.
|
|
** If you want to create a new domain mapping CR, type the domain name into the box, and select the *Create* option. For example, if you type in `example.com`, the *Create* option is *Create "example.com"*.
|
|
|
|
Health Checks::
|
|
Click the *Health Checks* link to add Readiness, Liveness, and Startup probes to your application. All the probes have prepopulated default data; you can add the probes with the default data or customize it as required.
|
|
+
|
|
To customize the health probes:
|
|
+
|
|
* Click *Add Readiness Probe*, if required, modify the parameters to check if the container is ready to handle requests, and select the check mark to add the probe.
|
|
* Click *Add Liveness Probe*, if required, modify the parameters to check if a container is still running, and select the check mark to add the probe.
|
|
* Click *Add Startup Probe*, if required, modify the parameters to check if the application within the container has started, and select the check mark to add the probe.
|
|
+
|
|
For each of the probes, you can specify the request type - *HTTP GET*, *Container Command*, or *TCP Socket*, from the drop-down list. The form changes as per the selected request type. You can then modify the default values for the other parameters, such as the success and failure thresholds for the probe, number of seconds before performing the first probe after the container starts, frequency of the probe, and the timeout value.
|
|
|
|
|
|
Build Configuration and Deployment::
|
|
Click the *Build Configuration* and *Deployment* links to see the respective configuration options. Some options are selected by default; you can customize them further by adding the necessary triggers and environment variables.
|
|
+
|
|
For serverless applications, the *Deployment* option is not displayed as the Knative configuration resource maintains the desired state for your deployment instead of a `DeploymentConfig` resource.
|
|
|
|
Scaling::
|
|
Click the *Scaling* link to define the number of pods or instances of the application you want to deploy initially.
|
|
+
|
|
For serverless applications, you can:
|
|
|
|
* Set the upper and lower limit for the number of pods that can be set by the autoscaler. If the lower limit is not specified, it defaults to zero.
|
|
* Define the soft limit for the required number of concurrent requests per instance of the application at a given time. It is the recommended configuration for autoscaling. If not specified, it takes the value specified in the cluster configuration.
|
|
* Define the hard limit for the number of concurrent requests allowed per instance of the application at a given time. This is configured in the revision template. If not specified, it defaults to the value specified in the cluster configuration.
|
|
|
|
Resource Limit::
|
|
Click the *Resource Limit* link to set the amount of *CPU* and *Memory* resources a container is guaranteed or allowed to use when running.
|
|
|
|
Labels::
|
|
Click the *Labels* link to add custom labels to your application.
|
|
|
|
. Click *Create* to create the application and see its build status in the *Topology* view.
|