|
|
|
|
|
|
|
|
|
|
|
|
| |
| <!-- jQuery Eclipse IP approval https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10801 --> |
| <script type="text/javascript" charset="utf8" src="../../../docs/assets/scripts/jquery-1.8.1.min.js"></script> |
| |
| <script type="text/javascript" charset="utf8"> |
| $(document).ready(function(){ |
| var images = document.getElementsByTagName('img'); |
| for (var i = 0; i < images.length; i++) { |
| var image = images[i]; |
| var parentElement = image.parentElement; |
| var a = document.createElement('a'); |
| if (! image.getAttribute('src').includes("logo-codenvy.svg") && ! image.getAttribute('src').includes("codenvy-contribute.svg") ){ |
| a.href = image.getAttribute('src'); |
| a.target = "_blank"; |
| a.appendChild(image); |
| parentElement.appendChild(a); |
| } |
| } |
| }); |
| </script> |
| <!DOCTYPE HTML> |
| <html lang="en-US"> |
| <head> |
| <title>OpenShift Use - |
| |
| Docs |
| - Eclipse Che</title> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <meta name="generator" content="Jekyll v3.5.1"> |
| <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900"> |
| <link rel="stylesheet" href="../../../docs/assets/css/screen.css"> |
| <link rel="icon" type="image/x-icon" href="../../../docs/assets/imgs/favicon.ico"> |
| <!--[if lt IE 9]> |
| <script src="/js/html5shiv.min.js"></script> |
| <script src="/js/respond.min.js"></script> |
| <![endif]--> |
| </head> |
| |
| |
| <body class="wrap"> |
|
|
|
|
|
|
|
|
|
|
|
|
| |
| |
| <header> |
| <nav class="mobile-nav show-on-mobiles"> |
| <ul> |
| |
| <li class=""> |
| <a href="../../../docs/index.html">Docs</a> |
| </li> |
| <li class=""> |
| <a href="../../../docs/tutorials/multi-machine/index.html">Tutorials</a> |
| </li> |
| <li class="current"> |
| <a href="../../../docs/openshift/config/index.html">OpenShift</a> |
| </li> |
| <li> |
| <a href="https://github.com/eclipse/che-docs/tree/master/src/main">GitHub</a> |
| </li> |
| </ul> |
| |
| </nav> |
| <div class="grid"> |
| <div class="unit one-third center-on-mobiles"> |
| <a href="https://eclipse.org/che/"> |
| <span class="sr-only">Eclipse Che</span> |
| <img src="../../../docs/assets/imgs/logo-eclipseche.svg" alt="Eclipse Che Logo" width="249" height="115"> |
| </a> |
| </div> |
| <nav class="main-nav unit two-thirds hide-on-mobiles"> |
| <ul> |
| |
| <li class=""> |
| <a href="../../../docs/index.html">Docs</a> |
| </li> |
| <li class=""> |
| <a href="../../../docs/tutorials/multi-machine/index.html">Tutorials</a> |
| </li> |
| <li class="current"> |
| <a href="../../../docs/openshift/config/index.html">OpenShift</a> |
| </li> |
| <li> |
| <a href="https://github.com/eclipse/che-docs/tree/master/src/main">GitHub</a> |
| </li> |
| </ul> |
| |
| </nav> |
| </div> |
| </header> |
| |
| |
| <section class="docs"> |
| <div class="grid"> |
| |
| <div class="docs-nav-mobile unit whole show-on-mobiles"> |
| <select onchange="if (this.value) window.location.href=this.value"> |
| <option value="">Navigate the docs…</option> |
| |
| |
| <optgroup label="OPENSHIFT PLUG-IN FOR ECLIPSE CHE"> |
|
|
|
|
|
|
|
|
|
|
|
|
| |
| <ul> |
| |
| </ul> |
| |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class=""><a href="../../../docs/openshift/config/index.html">OpenShift Install</a></li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="current"><a href="../../../docs/openshift/user-guide/index.html">OpenShift Use</a></li> |
| |
| |
| |
| </ul> |
| |
| |
| </optgroup> |
| |
| |
| |
| |
| |
| |
| </select> |
| </div> |
| |
| |
| <div class="unit four-fifths"> |
| <article> |
| <div class="improve right hide-on-mobiles"> |
| <a href="https://github.com/codenvy/che-docs/blob/master/src/main/_docs/openshift/openshift-user-guide.md"><i class="fa fa-pencil"></i> Improve this page</a> |
| <!--<a href="https://github.com/eclipse/che/blob/master/docs/_docs/openshift/openshift-user-guide.md"><i class="fa fa-pencil"></i> Improve this page</a>--> |
| </div> |
| <div class="doc-title"> |
| <h1>OpenShift Use</h1> |
| <div class="doc-title-border"> |
| </div> |
| </div> |
| |
| <h1 id="run-che">Run Che</h1> |
| |
| <div class="language-shell highlighter-rouge"><pre class="highlight"><code><span class="c"># if you downloaded binaries</span> |
| /bin/che.sh run |
| |
| <span class="c"># if you built Che from source</span> |
| assembly/openshift-plugin-assembly-main/target/eclipse-che-<span class="k">${</span><span class="nv">version</span><span class="k">}</span>/eclipse-che-<span class="k">${</span><span class="nv">version</span><span class="k">}</span>/bin/che.sh run |
| </code></pre> |
| </div> |
| <p>Che will be available at <code class="highlighter-rouge">http://localhost:8080</code></p> |
| |
| <h1 id="connect-account">Connect Account</h1> |
| <p>Login to your account <strong>OpenShift > Connect Account</strong>. You will retrieve a token using authentication method set up for your OpenShift installation (login/password, Google oAuth etc).</p> |
| |
| <h1 id="create-application-from-template">Create Application From Template</h1> |
| <p>Create a new app from a template at <strong>OpenShift > Create Application From Template</strong>. This will both create a new OpenShift project (namespace) and a set of configs, as well as import an app into Che.</p> |
| |
| <p>Once an app is imported, OpenShift metadata is added to project attributes, thus a connection between Che and OpenShift resources is established.</p> |
| |
| <h4 id="import-a-module">Import a Module</h4> |
| <p>If template buildConfig features <strong>GIT_CONTEXT_DIR</strong> parameter, a particular project module will be checked out into a project tree.</p> |
| |
| <p>This module will be a sub-folder of a root project which you should then turn into a Maven module (right click to call a context menu > Create Module)</p> |
| |
| <p><img src="../../../docs/assets/imgs/module.png" alt="module.png" /></p> |
| |
| <h4 id="development-cycle">Development cycle</h4> |
| <p>Since projects created from OpenShift templates use GitHub repositories that you cannot push to, use templates just for demo purposes. Alternatively, you may replace Git URL in <em>buildConfig</em> with the one you have push permissions at <code class="highlighter-rouge">OpenShift > Manage Configs</code>.</p> |
| |
| <h1 id="import-existing-openshift-app">Import Existing OpenShift App</h1> |
| <p>When importing an existing OpenShift application, the plugin checks for all <em>buildConfigs</em> in all user namespaces, extracts Git URLs and shows them in the application list, grouped by a namespace.</p> |
| |
| <h1 id="deploy-existing-app-to-openshift">Deploy Existing App to OpenShift</h1> |
| <p>Deployment to OpenShift triggers two actions: marking Che project as OpenShift project type and creating a set of objects on the OpenShift side.</p> |
| |
| <p>A user can choose/edit:</p> |
| <ul> |
| <li>namespace where all the objects will be created (new vs existing one)</li> |
| <li>builder image, i.e. where the code will be compiled (if applicable) and deployed with an app server</li> |
| <li>environment variables/labels and their values</li> |
| </ul> |
| |
| <p>You’ll need to enter both project and application names.</p> |
| |
| <h1 id="link-che-app-with-existing-openshift-app--unlink-app">Link Che App With Existing OpenShift App / Unlink App</h1> |
| <p>Che projects can be linked with existing OpenShift applications at <strong>OpenShift > Deploy > Link With Existing App</strong>. When a Che project is linked to OpenShift application, OpenShift metadata is saved to Che project attributes (namespace and label).</p> |
| |
| <p>It is possible to <code class="highlighter-rouge">'unlink'</code> Che project from OpenShift, which means clearing Che project attributes. Unlinking project does not delete OpenShift namespace and its associated resources.</p> |
| |
| <h1 id="delete-openshift-project">Delete OpenShift Project</h1> |
| <p>It is possible to delete an OpenShift project only when a related Che project is selected in a project tree. Deleting OpenShift project resets Che project (OpenShift attributes are removed) and deletes OpenShift namespace.</p> |
| |
| <p>If an OpenShift namespace has multiple <code class="highlighter-rouge">buildConfigs</code> (apps), a user will be prompted to confirm namespace deletion. Warning message will contain the list of resources that will be deleted.</p> |
| |
| <h1 id="get-webhooks">Get Webhooks</h1> |
| <p>GitHub and generic Git webhooks make it possible to notify OpenShift that a Git repo has been updated. Git push will trigger a new build in OpenShift, and a <code class="highlighter-rouge">buildConfig</code> will clone updated source code. Webhooks are retrieved at <code class="highlighter-rouge">OpenShift > Manage Configs > Build</code>.</p> |
| |
| <h1 id="show-appication-url">Show Appication URL</h1> |
| <p>If a project has been deployed to OpenShift, linked with existing app or imported an as existing OpenShift application, it is possible to get preview URL of a running app (get route) at <code class="highlighter-rouge">OpenShift > Manage Configs > Route</code>.</p> |
| |
| <h1 id="trigger-build">Trigger Build</h1> |
| <p><code class="highlighter-rouge">OpenShift > Start Build</code> will initiate a new build, subscribe to Websocket channels to track build status and stream build logs.</p> |
| |
| <p>Che will also listen to other build channels, and if a build has been triggered (not necessarily from Che), build logs will be streamed to a dedicated panel.</p> |
| |
| <h1 id="add-a-database">Add A Database</h1> |
| <p>Databases can be added at <code class="highlighter-rouge">OpenShift > Services > Add Service</code>.</p> |
| |
| <p>OpenShift Plugin will look for database templates in <code class="highlighter-rouge">openshift</code> namespace and all user namespaces, let a user edit/add environment variables (username, password, databasename) create objects listed in a template, and add database pod environment variables to application <code class="highlighter-rouge">deploymentConfig</code>.</p> |
| |
| <h4 id="database-templates">Database Templates</h4> |
| <p>The plugin filters templates by <code class="highlighter-rouge">database</code> tag. If you database templates do not have this tag, they will not be listed in the popup.</p> |
| |
| <h1 id="how-to-connect-to-a-database-pod">How to Connect to a Database Pod</h1> |
| <p>Pods use environment variables for communication. Some env variables are shared across all pods running in the same namespace, while others are added to application <code class="highlighter-rouge">deploymentConfig</code> when a database pod is created.</p> |
| |
| <p>Having added a database, connect to it, using environment variables.</p> |
| |
| <p>A few examples: |
| <em>Java</em></p> |
| <div class="language-java highlighter-rouge"><pre class="highlight"><code><span class="n">System</span><span class="o">.</span><span class="na">getenv</span><span class="o">(</span><span class="s">"MYSQL_USER"</span><span class="o">)</span> |
| </code></pre> |
| </div> |
| |
| <p><em>PHP</em></p> |
| <div class="language-php highlighter-rouge"><pre class="highlight"><code>$servername = getenv("MYSQL_PORT_3306_TCP_ADDR"); |
| </code></pre> |
| </div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </article> |
| </div> |
| |
| <div class="unit one-fifth hide-on-mobiles"> |
| <aside> |
| |
| |
| <h4>OPENSHIFT PLUG-IN FOR ECLIPSE CHE</h4> |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class=""><a href="../../../docs/openshift/config/index.html">OpenShift Install</a></li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="current"><a href="../../../docs/openshift/user-guide/index.html">OpenShift Use</a></li> |
| |
| |
| |
| </ul> |
| |
| |
| |
| |
| |
| </aside> |
| </div> |
| |
| |
| <div class="clear"></div> |
| |
| </div> |
| </section> |
| |
| |
| |
| <script> |
| var anchorForId = function (id) { |
| var anchor = document.createElement("a"); |
| anchor.className = "header-link"; |
| anchor.href = "#" + id; |
| anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>"; |
| anchor.title = "Permalink"; |
| return anchor; |
| }; |
| |
| var linkifyAnchors = function (level, containingElement) { |
| var headers = containingElement.getElementsByTagName("h" + level); |
| for (var h = 0; h < headers.length; h++) { |
| var header = headers[h]; |
| |
| if (typeof header.id !== "undefined" && header.id !== "") { |
| header.appendChild(anchorForId(header.id)); |
| } |
| } |
| }; |
| |
| document.onreadystatechange = function () { |
| if (this.readyState === "complete") { |
| var contentBlock = document.getElementsByClassName("artik")[0] || document.getElementsByClassName("openshift")[0] || document.getElementsByClassName("tutorials")[0] || document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0]; |
| if (!contentBlock) { |
| return; |
| } |
| for (var level = 1; level <= 6; level++) { |
| linkifyAnchors(level, contentBlock); |
| } |
| } |
| }; |
| </script> |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |