blob: 3586210e0693c8728f7a97ac567fb86c2cc8cf9c [file]
<!-- 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>CLI Reference -
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="current">
<a href="../../../docs/index.html">Docs</a>
</li>
<li class="">
<a href="../../../docs/tutorials/multi-machine/index.html">Tutorials</a>
</li>
<li class="">
<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="current">
<a href="../../../docs/index.html">Docs</a>
</li>
<li class="">
<a href="../../../docs/tutorials/multi-machine/index.html">Tutorials</a>
</li>
<li class="">
<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="SETUP">
<ul>
<option value="../../../docs/index.html">Introduction</option>
<option value="../../../docs/setup/getting-started/index.html">Getting Started&#58 Local</option>
<option value="../../../docs/setup/getting-started-saas-cloud/index.html">Getting Started&#58 SaaS Cloud</option>
<option value="../../../docs/setup/configuration/index.html">Configuration</option>
<option value="../../../docs/setup/managing/index.html">Managing</option>
<option value="../../../docs/setup/cli/index.html">CLI Reference</option>
<option value="../../../docs/setup/glossary/index.html">Glossary</option>
<option value="../../../docs/setup/docker/index.html">Docker Installation</option>
<option value="../../../docs/setup/openshift/index.html">OpenShift Installation</option>
<option value="../../../docs/setup/selenium/index.html">How to run selenium tests</option>
</ul>
<ul>
<li class=""><a href="../../../docs/index.html">Introduction</a></li>
<li class=""><a href="../../../docs/setup/getting-started/index.html">Getting Started&#58 Local</a></li>
<li class=""><a href="../../../docs/setup/getting-started-saas-cloud/index.html">Getting Started&#58 SaaS Cloud</a></li>
<li class=""><a href="../../../docs/setup/configuration/index.html">Configuration</a></li>
<li class=""><a href="../../../docs/setup/managing/index.html">Managing</a></li>
<li class="current"><a href="../../../docs/setup/cli/index.html">CLI Reference</a></li>
<li class=""><a href="../../../docs/setup/glossary/index.html">Glossary</a></li>
<li class=""><a href="../../../docs/setup/docker/index.html">Docker Installation</a></li>
<li class=""><a href="../../../docs/setup/openshift/index.html">OpenShift Installation</a></li>
<li class=""><a href="../../../docs/setup/selenium/index.html">How to run selenium tests</a></li>
</ul>
</optgroup>
<optgroup label="WORKSPACE ADMINISTRATION">
<ul>
<option value="../../../docs/devops/intro/index.html">Introduction</option>
<option value="../../../docs/devops/runtime-stacks/index.html">Runtime Stacks</option>
<option value="../../../docs/devops/runtime-recipes/index.html">Runtime Recipes</option>
<option value="../../../docs/devops/project-samples/index.html">Project Samples</option>
<option value="../../../docs/devops/runtime-machines/index.html">Runtime Machines</option>
<option value="../../../docs/devops/volume-mounts/index.html">Volume Mounts</option>
<option value="../../../docs/devops/ws-agents/index.html">Workspace Agents</option>
<option value="../../../docs/devops/workspaces-data-model/index.html">Workspace Data Model</option>
<option value="../../../docs/devops/runtime-stacks-data-model/index.html">Runtime Stacks Data Model</option>
<option value="../../../docs/devops/project-samples-data-model/index.html">Project Samples Data Model</option>
</ul>
<ul>
<li class=""><a href="../../../docs/devops/intro/index.html">Introduction</a></li>
<li class=""><a href="../../../docs/devops/runtime-stacks/index.html">Runtime Stacks</a></li>
<li class=""><a href="../../../docs/devops/runtime-recipes/index.html">Runtime Recipes</a></li>
<li class=""><a href="../../../docs/devops/project-samples/index.html">Project Samples</a></li>
<li class=""><a href="../../../docs/devops/runtime-machines/index.html">Runtime Machines</a></li>
<li class=""><a href="../../../docs/devops/volume-mounts/index.html">Volume Mounts</a></li>
<li class=""><a href="../../../docs/devops/ws-agents/index.html">Workspace Agents</a></li>
<li class=""><a href="../../../docs/devops/workspaces-data-model/index.html">Workspace Data Model</a></li>
<li class=""><a href="../../../docs/devops/runtime-stacks-data-model/index.html">Runtime Stacks Data Model</a></li>
<li class=""><a href="../../../docs/devops/project-samples-data-model/index.html">Project Samples Data Model</a></li>
</ul>
</optgroup>
<optgroup label="USER GUIDE">
<ul>
<option value="../../../docs/ide/projects/index.html">Projects</option>
<option value="../../../docs/ide/import-a-project/index.html">Import</option>
<option value="../../../docs/ide/ssh/index.html">SSH</option>
<option value="../../../docs/ide/sync/index.html">Local IDE Sync</option>
<option value="../../../docs/ide/editor-settings/index.html">Editor</option>
<option value="../../../docs/ide/intellisense/index.html">Intellisense</option>
<option value="../../../docs/ide/commands/index.html">Commands</option>
<option value="../../../docs/ide/git-svn/index.html">Git and SVN</option>
<option value="../../../docs/ide/previews/index.html">Previews</option>
<option value="../../../docs/ide/build/index.html">Build</option>
<option value="../../../docs/ide/run/index.html">Run</option>
<option value="../../../docs/ide/sharing/index.html">Share</option>
<option value="../../../docs/ide/debug/index.html">Debug</option>
<option value="../../../docs/ide/docker/index.html">Docker</option>
<option value="../../../docs/ide/electron/index.html">Install Che Desktop Client</option>
</ul>
<ul>
<li class=""><a href="../../../docs/ide/projects/index.html">Projects</a></li>
<li class=""><a href="../../../docs/ide/import-a-project/index.html">Import</a></li>
<li class=""><a href="../../../docs/ide/ssh/index.html">SSH</a></li>
<li class=""><a href="../../../docs/ide/sync/index.html">Local IDE Sync</a></li>
<li class=""><a href="../../../docs/ide/editor-settings/index.html">Editor</a></li>
<li class=""><a href="../../../docs/ide/intellisense/index.html">Intellisense</a></li>
<li class=""><a href="../../../docs/ide/commands/index.html">Commands</a></li>
<li class=""><a href="../../../docs/ide/git-svn/index.html">Git and SVN</a></li>
<li class=""><a href="../../../docs/ide/previews/index.html">Previews</a></li>
<li class=""><a href="../../../docs/ide/build/index.html">Build</a></li>
<li class=""><a href="../../../docs/ide/run/index.html">Run</a></li>
<li class=""><a href="../../../docs/ide/sharing/index.html">Share</a></li>
<li class=""><a href="../../../docs/ide/debug/index.html">Debug</a></li>
<li class=""><a href="../../../docs/ide/docker/index.html">Docker</a></li>
<li class=""><a href="../../../docs/ide/electron/index.html">Install Che Desktop Client</a></li>
</ul>
</optgroup>
<optgroup label="PORTABLE WORKSPACES">
<ul>
<option value="../../../docs/chedir/getting-started/index.html">Chedir - Getting Started</option>
<option value="../../../docs/chedir/why/index.html">Chedir - Why Chedir?</option>
<option value="../../../docs/chedir/installation/index.html">Chedir - Installation</option>
<option value="../../../docs/chedir/project-setup/index.html">Chedir - Project Setup</option>
<option value="../../../docs/chedir/up-and-down/index.html">Chedir - Up and Down</option>
<option value="../../../docs/chedir/chefiles/index.html">Chedir - Chefile</option>
<option value="../../../docs/chedir/ssh/index.html">Chedir - SSH</option>
<option value="../../../docs/chedir/factories/index.html">Chedir - Factories</option>
<option value="">Error Generating Page Link. Contact Maintainer./docs/factory-getting-started/</option>
<option value="">Error Generating Page Link. Contact Maintainer./docs/factory-creating/</option>
<option value="">Error Generating Page Link. Contact Maintainer./docs/factory-json-reference/</option>
</ul>
<ul>
<li class=""><a href="../../../docs/chedir/getting-started/index.html">Chedir - Getting Started</a></li>
<li class=""><a href="../../../docs/chedir/why/index.html">Chedir - Why Chedir?</a></li>
<li class=""><a href="../../../docs/chedir/installation/index.html">Chedir - Installation</a></li>
<li class=""><a href="../../../docs/chedir/project-setup/index.html">Chedir - Project Setup</a></li>
<li class=""><a href="../../../docs/chedir/up-and-down/index.html">Chedir - Up and Down</a></li>
<li class=""><a href="../../../docs/chedir/chefiles/index.html">Chedir - Chefile</a></li>
<li class=""><a href="../../../docs/chedir/ssh/index.html">Chedir - SSH</a></li>
<li class=""><a href="../../../docs/chedir/factories/index.html">Chedir - Factories</a></li>
<li class=""><a href="../../../docs/factory/getting-started/index.html">Factory - Getting Started</a></li>
<li class=""><a href="../../../docs/factory/creating/index.html">Factory - Creating</a></li>
<li class=""><a href="../../../docs/factory/json-reference/index.html">Factory - JSON Reference</a></li>
</ul>
</optgroup>
<optgroup label="DEVELOPER GUIDE - REST API">
<ul>
<option value="../../../docs/assemblies/intro/index.html">Introduction</option>
<option value="../../../docs/assemblies/archetype/index.html">Archetype</option>
<option value="../../../docs/assemblies/assembly-lifecycle/index.html">Assembly Dev Lifecycle</option>
<option value="../../../docs/assemblies/plugin-lifecycle/index.html">Plugin Lifecycle</option>
<option value="../../../docs/assemblies/sdk-rest-apis/index.html">SDK REST APIs</option>
<option value="../../../docs/assemblies/sdk-class-reference/index.html">SDK Class Reference</option>
<option value="../../../docs/assemblies/sdk-dependency-injection/index.html">SDK Dependency Injection</option>
<option value="../../../docs/assemblies/sdk-dto/index.html">SDK DTOs</option>
<option value="../../../docs/assemblies/sdk-properties/index.html">SDK Properties</option>
<option value="../../../docs/assemblies/sdk-code-editors/index.html">SDK Editors</option>
<option value="../../../docs/assemblies/sdk-embed-htmljs/index.html">SDK Embedded JavaScript</option>
<option value="../../../docs/assemblies/sdk-project-types/index.html">SDK Project Types</option>
<option value="../../../docs/assemblies/sdk-actions/index.html">SDK Actions</option>
<option value="../../../docs/assemblies/sdk-services/index.html">SDK Services</option>
<option value="../../../docs/assemblies/sdk-parts/index.html">SDK Parts</option>
<option value="../../../docs/assemblies/sdk-themes/index.html">SDK Themes</option>
<option value="../../../docs/assemblies/sdk-custom-agents/index.html">SDK Custom Agents</option>
<option value="../../../docs/assemblies/sdk-language-server-protocol/index.html">SDK Language Server Protocol</option>
<option value="../../../docs/assemblies/sdk-workspace/index.html">SDK Workspace</option>
</ul>
<ul>
<li class=""><a href="../../../docs/assemblies/intro/index.html">Introduction</a></li>
<li class=""><a href="../../../docs/assemblies/archetype/index.html">Archetype</a></li>
<li class=""><a href="../../../docs/assemblies/assembly-lifecycle/index.html">Assembly Dev Lifecycle</a></li>
<li class=""><a href="../../../docs/assemblies/plugin-lifecycle/index.html">Plugin Lifecycle</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-rest-apis/index.html">SDK REST APIs</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-class-reference/index.html">SDK Class Reference</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-dependency-injection/index.html">SDK Dependency Injection</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-dto/index.html">SDK DTOs</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-properties/index.html">SDK Properties</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-code-editors/index.html">SDK Editors</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-embed-htmljs/index.html">SDK Embedded JavaScript</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-project-types/index.html">SDK Project Types</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-actions/index.html">SDK Actions</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-services/index.html">SDK Services</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-parts/index.html">SDK Parts</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-themes/index.html">SDK Themes</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-custom-agents/index.html">SDK Custom Agents</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-language-server-protocol/index.html">SDK Language Server Protocol</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-workspace/index.html">SDK Workspace</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/setup/setup-cli.md"><i class="fa fa-pencil"></i> &nbsp;Improve this page</a>
<!--<a href="https://github.com/eclipse/che/blob/master/docs/_docs/setup/setup-cli.md"><i class="fa fa-pencil"></i> &nbsp;Improve this page</a>-->
</div>
<div class="doc-title">
<h1>CLI Reference</h1>
<div class="doc-title-border">
</div>
</div>
<p>The CLI is a Docker image that comes with a collection of commands to configure, interact and start Che. The CLI also contains commands for end users to interact with workspaces such as sync and ssh.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>USAGE:
docker run -it --rm &lt;DOCKER_PARAMETERS&gt; eclipse/che-cli:&lt;version&gt; [COMMAND]
MANDATORY DOCKER PARAMETERS:
-v &lt;LOCAL_PATH&gt;:/data Where user, instance, and log data saved
OPTIONAL DOCKER PARAMETERS:
-e CHE_HOST=&lt;YOUR_HOST&gt; IP address or hostname where che will serve its users
-e CHE_PORT=&lt;YOUR_PORT&gt; Port where che will bind itself to
-e CHE_CONTAINER=&lt;YOUR_NAME&gt; Prefix name for the che container
-v &lt;LOCAL_PATH&gt;:/data/instance Where instance, user, log data will be saved
-v &lt;LOCAL_PATH&gt;:/data/backup Where backup files will be saved
-v &lt;LOCAL_PATH&gt;:/repo che git repo - uses local binaries and manifests
-v &lt;LOCAL_PATH&gt;:/assembly che assembly - uses local binaries
-v &lt;LOCAL_PATH&gt;:/sync Where remote ws files will be copied with sync command
-v &lt;LOCAL_PATH&gt;:/unison Where unison profile for optimizing sync command resides
-v &lt;LOCAL_PATH&gt;:/chedir Soure repository to convert into workspace with Chedir utility
COMMANDS:
action &lt;action-name&gt; Start action on che instance
backup Backups che configuration and data to /data/backup volume mount
config Generates a che config from vars; run on any start / restart
destroy Stops services, and deletes che instance data
dir &lt;command&gt; Use Chedir and Chefile in the directory mounted to :/chedir
download Pulls Docker images for the current che version
help This message
info Displays info about che and the CLI
init Initializes a directory with a che install
offline Saves che Docker images into TAR files for offline install
restart Restart che services
restore Restores che configuration and data from /data/backup mount
rmi Removes the Docker images for &lt;version&gt;, forcing a repull
ssh &lt;wksp-name&gt; [machine-name] SSH to a workspace if SSH agent enabled
start Starts che services
stop Stops che services
sync &lt;wksp-name&gt; Synchronize workspace with local directory mounted to :/sync
test &lt;test-name&gt; Start test on che instance
upgrade Upgrades che from one version to another with migrations and backups
version Installed version and upgrade paths
GLOBAL COMMAND OPTIONS:
--fast Skips networking, version, nightly and preflight checks
--offline Runs CLI in offline mode, loading images from disk
--debug Enable debugging of che server
--trace Activates trace output for debugging CLI
</code></pre>
</div>
<p>The CLI has three primary phases: initialization, configuration, and start. The initialization phase is executed by <code class="highlighter-rouge">init</code> and will install version-specific files into the folder mounted to <code class="highlighter-rouge">/data</code>. This includes the universal configuration file named <code class="highlighter-rouge">che.env</code>, a version identifier, and a location where configuration files will be saved. The configuration is executed by the <code class="highlighter-rouge">config</code> command and takes as input your <code class="highlighter-rouge">che.env</code> configuration file, the OS of your host, and then generates an OS-specific set of configuration files in the <code class="highlighter-rouge">/data/instance</code> folder that can be used to run an instance of Che. The configuration phase will run an initialization if a folder is not found. Every execution of the <code class="highlighter-rouge">config</code> command will overwrite the files in <code class="highlighter-rouge">/data/instance</code> with the latest configuration. This way if an admin modifies any configuration file, the instance’s configuration files will be updated to be guaranteed consistent. The CLI generates a large number of configuration files specific to running Che. The configuration files are sourced from Puppet templates that are stored in our GitHub repository under <code class="highlighter-rouge">/dockerfiles/init</code>. The start phase is executed by <code class="highlighter-rouge">start</code> and will use a configuration-generated <code class="highlighter-rouge">docker-compose-container.yml</code> file to launch Eclipse Che. The start phase always executes a <code class="highlighter-rouge">config</code> command, so any files that were edited in <code class="highlighter-rouge">/data/instance</code> will be overwritten with the generated configuration from the CLI.</p>
<p>The CLI will hide most error conditions from standard out. Internal stack traces and error output is redirected to <code class="highlighter-rouge">cli.log</code>, which is saved in the host folder where <code class="highlighter-rouge">:/data</code> is mounted.</p>
<p>You can override any value in <code class="highlighter-rouge">che.env</code> for a single execution by passing in <code class="highlighter-rouge">-e NAME=VALUE</code> on the command line. The CLI will detect the values on the command line and ignore those imported from <code class="highlighter-rouge">che.env</code>.</p>
<hr />
<p><em>action</em></p>
<p>Executes some actions on the Eclipse Che instance or on a workspace running inside Che.
For example to list all workspaces on Che, the following command can be used <code class="highlighter-rouge">action list-workspaces</code>.
To execute a command on a workspace <code class="highlighter-rouge">action execute-command &lt;workspace-name&gt; &lt;action&gt;</code> where action can be any bash command.</p>
<hr />
<p><em>backup</em></p>
<p>TARS your <code class="highlighter-rouge">/instance</code> into files and places them into <code class="highlighter-rouge">/backup</code>. These files are restoration-ready.</p>
<hr />
<p><em>config</em></p>
<p>Generates a Che instance configuration thta is placed in <code class="highlighter-rouge">/instance</code>. This command uses puppet to generate Docker Compose configuration files to run Che and its associated server. Che’s server configuration is generated as a che.properties file that is volume mounted into the Che server when it boots. This command is executed on every <code class="highlighter-rouge">start</code> or <code class="highlighter-rouge">restart</code>.</p>
<p>If you are using a <code class="highlighter-rouge">eclipse/che:&lt;version&gt;</code> image and it does not match the version that is in <code class="highlighter-rouge">/instance/che.ver</code>, then the configuration will abort to prevent you from running a configuration for a different version than what is currently installed.</p>
<p>This command respects <code class="highlighter-rouge">--no-force</code>, <code class="highlighter-rouge">--pull</code>, <code class="highlighter-rouge">--force</code>, and <code class="highlighter-rouge">--offline</code>.</p>
<hr />
<p><em>destroy</em></p>
<p>Deletes <code class="highlighter-rouge">/docs</code>, <code class="highlighter-rouge">che.env</code> and <code class="highlighter-rouge">/instance</code>, including destroying all user workspaces, projects, data, and user database. If you pass <code class="highlighter-rouge">--quiet</code> then the confirmation warning will be skipped. Passing <code class="highlighter-rouge">--cli</code> will also destroy the <code class="highlighter-rouge">cli.log</code>. By default this is left behind for traceability.</p>
<hr />
<p><em>dir</em></p>
<p>Boots a new Eclipse Che instance with a workspace for the folder <code class="highlighter-rouge">:/chedir</code> defined as volume mount in parameter.</p>
<p>If for example <code class="highlighter-rouge">$HOME/my-project</code> is given as parameter, a new Che instance will be created, using <code class="highlighter-rouge">$HOME/my-project</code> as project in the IDE.</p>
<p>So inside the IDE, <code class="highlighter-rouge">/projects</code> folder will contain a <code class="highlighter-rouge">my-project</code> folder with your host folder.
Then, any changes inside the IDE will be reflected in your host folder. And the opposite is also true, updating a file on your local computer will update the content of the file inside the IDE.</p>
<p>Other commands are <code class="highlighter-rouge">init</code>,<code class="highlighter-rouge">up</code>, <code class="highlighter-rouge">down</code>, <code class="highlighter-rouge">ssh</code> and <code class="highlighter-rouge">status</code></p>
<ul>
<li><code class="highlighter-rouge">init</code> : Initialize the directory specified and add a default <code class="highlighter-rouge">Chefile</code> file if there is none</li>
<li><code class="highlighter-rouge">up</code> : Boot Eclipse Che with workspace on folder</li>
<li><code class="highlighter-rouge">down</code> : Stop Eclipse Che and any workspaces</li>
<li><code class="highlighter-rouge">ssh</code> : Connect to the running workspace by using ssh</li>
<li><code class="highlighter-rouge">status</code> : Display if an instance of Eclipse Che is running or not for the specified folder.</li>
</ul>
<hr />
<p><em>download</em></p>
<p>Used to download Docker images that will be stored in your Docker images repository. This command downloads images that are used by the CLI as utilities, for Che to do initialization and configuration, and for the runtime images that Che needs when it starts. This command respects <code class="highlighter-rouge">--offline</code>, <code class="highlighter-rouge">--pull</code>, <code class="highlighter-rouge">--force</code>, and <code class="highlighter-rouge">--no-force</code> (default). This command is invoked by <code class="highlighter-rouge">che init</code>, <code class="highlighter-rouge">che config</code>, and <code class="highlighter-rouge">che start</code>.</p>
<p><code class="highlighter-rouge">download</code> is invoked by <code class="highlighter-rouge">che init</code> before initialization to download images for the version specified by <code class="highlighter-rouge">eclipse/che:&lt;version&gt;</code>.</p>
<p>It is possible to override the docker images used by the CLI by setting the following
environment variables:</p>
<ul>
<li><code class="highlighter-rouge">IMAGE_INIT</code> to override the default <code class="highlighter-rouge">eclipse/che-init:&lt;version&gt;</code> docker image,</li>
<li><code class="highlighter-rouge">IMAGE_CHE</code> to override the default <code class="highlighter-rouge">eclipse/che-server:&lt;version&gt;</code> docker image.</li>
</ul>
<p>For example if, for both images, you need to use to use a given tag in you own docker account, you can add the following parameters to the docker command:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>-e IMAGE_INIT=myDockerAccount/che-init:givenTag -e IMAGE_CHE=myDockerAccount/che-server:givenTag
</code></pre>
</div>
<hr />
<p><em>info</em></p>
<p>Displays system state and debugging information. <code class="highlighter-rouge">--network</code> runs a test to take your <code class="highlighter-rouge">CHE_HOST</code> value to test for networking connectivity simulating browser &gt; Che and Che &gt; workspace connectivity. <code class="highlighter-rouge">--bundle</code> will generate a support diagnostic bundle in a TAR file which includes the output of certain commands and your execution logs.</p>
<hr />
<p><em>init</em></p>
<p>Initializes an empty directory with a Che configuration and instance folder where user data and runtime configuration will be stored. You must provide a <code class="highlighter-rouge">&lt;path&gt;:/data</code> volume mount, then Che creates a <code class="highlighter-rouge">instance</code> and <code class="highlighter-rouge">backup</code> subfolder of <code class="highlighter-rouge">&lt;path&gt;</code>. You can optionally override the location of <code class="highlighter-rouge">instance</code> by volume mounting an additional local folder to <code class="highlighter-rouge">/data/instance</code>. You can optionally override the location of where backups are stored by volume mounting an additional local folder to <code class="highlighter-rouge">/data/backup</code>. After initialization, a <code class="highlighter-rouge">che.env</code> file is placed into the root of the path that you mounted to <code class="highlighter-rouge">/data</code>.</p>
<p>These variables can be set in your local environment shell before running and they will be respected during initialization:</p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="highlighter-rouge">CHE_HOST</code></td>
<td>The IP address or DNS name of the Che service. We use <code class="highlighter-rouge">eclipse/che-ip</code> to attempt discovery if not set.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">CHE_PORT</code></td>
<td>The port the Che server will run on and expose in its container for your clients to connect to.</td>
</tr>
</tbody>
</table>
<p>Che depends upon Docker images. We use Docker images to:</p>
<ol>
<li>Provide cross-platform utilites within the CLI. For example, in scenarios where we need to perform a <code class="highlighter-rouge">curl</code> operation, we use a small Docker image to perform this function. We do this as a precaution as many operating systems (like Windows) do not have curl installed.</li>
<li>Look up the master version and upgrade manifest, which is saved within the CLI docker image in the /version subfolder.</li>
<li>Perform initialization and configuration of Che such as with <code class="highlighter-rouge">eclipse/che-init</code>. This image contains templates to be installed onto your computer used by the CLI to configure Che for your specific OS.</li>
</ol>
<p>You can control how Che downloads these images with command line options. All image downloads are performed with <code class="highlighter-rouge">docker pull</code>.</p>
<table>
<thead>
<tr>
<th>Mode »»»»»</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="highlighter-rouge">--no-force</code></td>
<td>Default behavior. Will download an image if not found locally. A local check of the image will see if an image of a matching name is in your local registry and then skip the pull if it is found. This mode does not check DockerHub for a newer version of the same image.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">--pull</code></td>
<td>Will always perform a <code class="highlighter-rouge">docker pull</code> when an image is requested. If there is a newer version of the same tagged image at DockerHub, it will pull it, or use the one in local cache. This keeps your images up to date, but execution is slower.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">--force</code></td>
<td>Performs a forced removal of the local image using <code class="highlighter-rouge">docker rmi</code> and then pulls it again (anew) from DockerHub. You can use this as a way to clean your local cache and ensure that all images are new.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">--offline</code></td>
<td>Loads Docker images from <code class="highlighter-rouge">backup/*.tar</code> folder during a pre-boot mode of the CLI. Used if you are performing an installation or start while disconnected from the Internet.</td>
</tr>
</tbody>
</table>
<p>You can reinstall Che on a folder that is already initialized and preserve your <code class="highlighter-rouge">che.env</code> values by passing the <code class="highlighter-rouge">--reinit</code> flag.</p>
<hr />
<p><em>offline</em></p>
<p>Saves all of the Docker images that Che requires into <code class="highlighter-rouge">/backup/*.tar</code> files. Each image is saved as its own file. If the <code class="highlighter-rouge">backup</code> folder is available on a machine that is disconnected from the Internet and you start Che with <code class="highlighter-rouge">--offline</code>, the CLI pre-boot sequence will load all of the Docker images in the <code class="highlighter-rouge">/backup/</code> folder.</p>
<p><code class="highlighter-rouge">--list</code> option will list all of the core images and optional stack images that can be downloaded. The core system images and the CLI will always be saved, if an existing TAR file is not found. <code class="highlighter-rouge">--image:&lt;image-name&gt;</code> will download a single stack image and can be used multiple times on the command line. You can use <code class="highlighter-rouge">--all-stacks</code> or <code class="highlighter-rouge">--no-stacks</code> to download all or none of the optional stack images.</p>
<hr />
<p><em>restart</em></p>
<p>Performs a <code class="highlighter-rouge">stop</code> followed by a <code class="highlighter-rouge">start</code>, respecting <code class="highlighter-rouge">--pull</code>, <code class="highlighter-rouge">--force</code>, <code class="highlighter-rouge">--offline</code>, <code class="highlighter-rouge">--skip:config</code>, <code class="highlighter-rouge">--skip:preflight</code>, and <code class="highlighter-rouge">--skip:postflight</code>.</p>
<hr />
<p><em>restore</em></p>
<p>Restores <code class="highlighter-rouge">/instance</code> to its previous state. You do not need to worry about having the right Docker images. The normal start / stop / restart cycle ensures that the proper Docker images are available or downloaded, if not found.</p>
<p>This command will destroy your existing <code class="highlighter-rouge">/instance</code> folder, so use with caution, or set these values to different folders when performing a restore.</p>
<hr />
<p><em>rmi</em></p>
<p>Deletes the Docker images from the local registry that Che has downloaded for this version.</p>
<hr />
<p><em>ssh</em></p>
<p>Connects the current terminal where the command is started to the terminal of a machine of the workspace. If no machine is specified in the command, it will connect to the default machine which is the dev machine.
The syntax is <code class="highlighter-rouge">ssh &lt;workspace-name&gt; [machine-name]</code>
The ssh connection will work only if there is a workspace ssh key setup. A default ssh key is automatically generated when a workspace is created.</p>
<hr />
<p><em>sync</em></p>
<p>Synchronizes a workspace’s contents with a local folder mounted to :/sync
The syntax is <code class="highlighter-rouge">-v &lt;path-on-your-machine&gt;:/sync eclipse/che sync &lt;workspace-name&gt;</code></p>
<p>To get extra information, the flag <code class="highlighter-rouge">--unison-verbose</code> can be used to display log of the underlying unison tool.</p>
<hr />
<p><em>start</em></p>
<p>Starts Che and its services using <code class="highlighter-rouge">docker-compose</code>. If the system cannot find a valid configuration it will perform an <code class="highlighter-rouge">init</code>. Every <code class="highlighter-rouge">start</code> and <code class="highlighter-rouge">restart</code> will run a <code class="highlighter-rouge">config</code> to generate a new configuration set using the latest configuration. The starting sequence will perform pre-flight testing to see if any ports required by Che are currently used by other services and post-flight checks to verify access to key APIs.</p>
<p>You can skip pre-flight and post-flight checks with <code class="highlighter-rouge">--skip:preflight</code> and <code class="highlighter-rouge">--skip:postflight</code> respectively. The typical Che start sequence includes an invocation of the <code class="highlighter-rouge">config</code> method, which regenerates configuration files placed into the <code class="highlighter-rouge">/instance</code> folder. You can skip this generation with <code class="highlighter-rouge">--skip:config</code>. You can automatically print out the server logs to the console during the booting of the server by appending <code class="highlighter-rouge">--follow</code>. This flag is blocking and requires you to CTRL-C to interrupt the output.</p>
<hr />
<p><em>stop</em></p>
<p>The default stop is a graceful stop where each workspace is stopped and confirmed shutdown before stopping system services. If workspaces are configured to snap on stop, then all snaps will be completed before system service shutdown begins. You can ignore workspace stop behavior and shut down only system services with –force flag.</p>
<hr />
<p><em>test</em></p>
<p>Performs some tests on your local instance of Che. It can for example check the ability to create a workspace, start the workspace by using a custom Workspace runtime and then use it.
The list of all the tests available can be obtained by providing only <code class="highlighter-rouge">test</code> command.</p>
<hr />
<p><em>upgrade</em></p>
<p>Manages the sequence of upgrading Che from one version to another. Run <code class="highlighter-rouge">che version</code> to get a list of available versions that you can upgrade to.</p>
<p>Upgrading Che is done by using a <code class="highlighter-rouge">eclipse/che:&lt;version&gt;</code> that is newer than the version you currently have installed. For example, if you have 5.0.0-M2 installed and want to upgrade to 5.0.0-M7, then:</p>
<div class="highlighter-rouge"><pre class="highlight"><code># Get the new version of Che
docker pull eclipse/che:5.0.0-M7
# You now have two eclipse/che images (one for each version)
# Perform an upgrade - use the new image to upgrade old installation
docker run &lt;volume-mounts&gt; eclipse/che:5.0.0-M7 upgrade
</code></pre>
</div>
<p>The upgrade command has numerous checks to prevent you from upgrading Che if the new image and the old version are not compatiable. In order for the upgrade procedure to proceed, the CLI image must be newer than the value of ‘/instance/che.ver’.</p>
<p>The upgrade process: a) performs a version compatibility check, b) downloads new Docker images that are needed to run the new version of Che, c) stops Che if it is currently running triggering a maintenance window, d) backs up your installation, e) initializes the new version, and f) starts Che.</p>
<p>You can run <code class="highlighter-rouge">che version</code> to see the list of available versions that you can upgrade to.</p>
<p><code class="highlighter-rouge">--skip-backup</code> option allow to skip <a href="https://github.com/codenvy/che-docs/blob/master/src/main/_docs/setup/setup-cli.md#backup">backup</a> during update, that could be useful to speed up upgrade because <a href="https://github.com/codenvy/che-docs/blob/master/src/main/_docs/setup/setup-cli.md#backup">backup</a> can be very expensive operation if <code class="highlighter-rouge">/instace</code> folder is really big due to many user worksapces and projects.</p>
<hr />
<p><em>version</em></p>
<p>Provides information on the current version and the available versions that are hosted in Che’s repositories. <code class="highlighter-rouge">che upgrade</code> enforces upgrade sequences and will prevent you from upgrading one version to another version where data migrations cannot be guaranteed.</p>
<hr />
<h1 id="cli-development">CLI Development</h1>
<p>You can customize the CLI using a variety of techniques. This section discusses how engineers develop and test the CLI on their local machines.</p>
<h2 id="structure">Structure</h2>
<p>The Che CLI is constructed of multiple Docker images within the Che source repository.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>/dockerfiles/base # Common functions and commands
/dockerfiles/cli # CLI entrypoint, overrides, and version information
/dockerfiles/init # Manifests used to configure Che on a host installation
</code></pre>
</div>
<p>The Che CLI is authored in <code class="highlighter-rouge">bash</code>. The <code class="highlighter-rouge">cli</code> image depends upon both the <code class="highlighter-rouge">base</code> image and the <code class="highlighter-rouge">init</code> image. In the source repository, we have <code class="highlighter-rouge">build.sh</code> commands which will build these Docker images for you either one at a time or collectively as a group.</p>
<p>It can become tedious rebuilding images every time you want to test a small change to a bash script. You can avoid having to rebuild images each time for every change to a bash script by volume mounting the contents during the image execution. You cannot volume mount the <code class="highlighter-rouge">entrypoint.sh</code> file which is where each container has a launch point, but you can volume mount others:</p>
<div class="highlighter-rouge"><pre class="highlight"><code># Volume mount the contents of the base image
-v &lt;path-to-che-repo&gt;/dockerfiles/scripts/base/scripts:/base/scripts
# Volume mount the contents of the init image
-v &lt;path-to-che-repo&gt;:/repo
</code></pre>
</div>
<p>If you run the Che CLI in this configuration, then any changes made to the bash files or templates in those repositories will be used without having to first rebuild the CLI image.</p>
<h2 id="custom-cli">Custom CLI</h2>
<p>The Che CLI was designed to be overridden to allow different CLIs to be created from the same base structure. This is how Codenvy and ARTIK has an identical CLIs to Che. The CLI is created with a few minimal assets:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>/dockerfiles/cli/build.sh # Local file to build the image
/dockerfiles/cli/Dockerfile # Image definition, must FROM eclipse/che-base:nightly
/dockerfiles/cli/scripts # Contains additional commands in form of cmd_&lt;name&gt;.sh
/dockerfiles/cli/scripts/entrypoint.sh # The entrypoint of the CLI container, with usage() method
/dockerfiles/cli/scripts/cli.sh # Defines CLI-specific product names &amp; variables
/dockerfiles/cli/version # Contains version-specific data the CLI requires
</code></pre>
</div>
<p>You can add additional commands to the Che CLI beyond the base set of commands that are provided by adding a file of the name <code class="highlighter-rouge">cmd_&lt;name&gt;.sh</code> into the <code class="highlighter-rouge">scripts</code> folder. Codenvy is an <a href="https://github.com/codenvy/codenvy/tree/master/dockerfiles/cli/scripts">example that adds additional commands</a>.</p>
<p>The <code class="highlighter-rouge">version</code> folder has information that details the latest version and a sub-folder for each version that is available for installation. Each version subfolder has version-specific data that the CLI depends upon to create a manifest of Docker images that must be downloaded to support the product that is going to be run. When we generate a release of the Che CLI, we have our CI systems automatically update the <code class="highlighter-rouge">/version</code> folder with the version-specific information contained in a release.</p>
<h2 id="puppet-templates">Puppet Templates</h2>
<p>The Che CLI uses Puppet to generate OS-specific configuration files based upon environment variables set by the user either with <code class="highlighter-rouge">-e &lt;VALUE&gt;</code> options on the command line, or by modifying their <code class="highlighter-rouge">che.env</code> file. We pass all of these values into Puppet and then run a puppet configuration utility across the files contained in the <code class="highlighter-rouge">/dockerfiles/init/modules</code> and <code class="highlighter-rouge">/dockerfiles/init/manifests</code> folder to take the templates contained within the <code class="highlighter-rouge">/init</code> module, marry them with user-specific variables, and then generate an instance-specific configuration in <code class="highlighter-rouge">/instance</code>. Puppet has logic constructs that allow us to generate different kinds of constructs with logic based upon the values provided by end users.</p>
<p>This puppet-based approach allow us to simplify the outputs for end users and limit the locations where end users need to configure various parts of the system. One powerful example of this is that we generate two <code class="highlighter-rouge">docker-compose.yml</code> files from a single Puppet template. In the user’s <code class="highlighter-rouge">/instance</code> folder is <code class="highlighter-rouge">docker-compose.yml</code> and <code class="highlighter-rouge">docker-compose-container.yml</code>. The first one is a configuration file that allows a user to run Docker compose for Che on their host. They can just <code class="highlighter-rouge">docker-compose up</code> in that folder. The second file is for running Docker compose from within a container, which is what the CLI does. The syntax of Docker compose changes in each of these scenarios as the files being referenced from within the compose syntax are different. In the <code class="highlighter-rouge">init</code> image, we have a single template for Docker Compose and then apply it in two configurations using Puppet.</p>
<h2 id="cli-tests">CLI Tests</h2>
<p>There are existing <a href="https://github.com/sstephenson/bats">bats</a> tests for the Che CLI, which runs automatically with each execution of a <code class="highlighter-rouge">build.sh</code> script located in the <code class="highlighter-rouge">dockerfiles/cli</code> folder. To skip them, pass <code class="highlighter-rouge">--skip-tests</code> argument when running the build script. If you want to just run tests you can achieve it by running script <code class="highlighter-rouge">test.sh</code> located in the same folder. Tests utilizes docker image <code class="highlighter-rouge">eclipse/che-bats</code> which is build from <code class="highlighter-rouge">Dockerfile</code> placed in <code class="highlighter-rouge">dockerfiles/bats</code>.</p>
</article>
</div>
<div class="unit one-fifth hide-on-mobiles">
<aside>
<h4>SETUP</h4>
<ul>
<li class=""><a href="../../../docs/index.html">Introduction</a></li>
<li class=""><a href="../../../docs/setup/getting-started/index.html">Getting Started&#58 Local</a></li>
<li class=""><a href="../../../docs/setup/getting-started-saas-cloud/index.html">Getting Started&#58 SaaS Cloud</a></li>
<li class=""><a href="../../../docs/setup/configuration/index.html">Configuration</a></li>
<li class=""><a href="../../../docs/setup/managing/index.html">Managing</a></li>
<li class="current"><a href="../../../docs/setup/cli/index.html">CLI Reference</a></li>
<li class=""><a href="../../../docs/setup/glossary/index.html">Glossary</a></li>
<li class=""><a href="../../../docs/setup/docker/index.html">Docker Installation</a></li>
<li class=""><a href="../../../docs/setup/openshift/index.html">OpenShift Installation</a></li>
<li class=""><a href="../../../docs/setup/selenium/index.html">How to run selenium tests</a></li>
</ul>
<h4>WORKSPACE ADMINISTRATION</h4>
<ul>
<li class=""><a href="../../../docs/devops/intro/index.html">Introduction</a></li>
<li class=""><a href="../../../docs/devops/runtime-stacks/index.html">Runtime Stacks</a></li>
<li class=""><a href="../../../docs/devops/runtime-recipes/index.html">Runtime Recipes</a></li>
<li class=""><a href="../../../docs/devops/project-samples/index.html">Project Samples</a></li>
<li class=""><a href="../../../docs/devops/runtime-machines/index.html">Runtime Machines</a></li>
<li class=""><a href="../../../docs/devops/volume-mounts/index.html">Volume Mounts</a></li>
<li class=""><a href="../../../docs/devops/ws-agents/index.html">Workspace Agents</a></li>
<li class=""><a href="../../../docs/devops/workspaces-data-model/index.html">Workspace Data Model</a></li>
<li class=""><a href="../../../docs/devops/runtime-stacks-data-model/index.html">Runtime Stacks Data Model</a></li>
<li class=""><a href="../../../docs/devops/project-samples-data-model/index.html">Project Samples Data Model</a></li>
</ul>
<h4>USER GUIDE</h4>
<ul>
<li class=""><a href="../../../docs/ide/projects/index.html">Projects</a></li>
<li class=""><a href="../../../docs/ide/import-a-project/index.html">Import</a></li>
<li class=""><a href="../../../docs/ide/ssh/index.html">SSH</a></li>
<li class=""><a href="../../../docs/ide/sync/index.html">Local IDE Sync</a></li>
<li class=""><a href="../../../docs/ide/editor-settings/index.html">Editor</a></li>
<li class=""><a href="../../../docs/ide/intellisense/index.html">Intellisense</a></li>
<li class=""><a href="../../../docs/ide/commands/index.html">Commands</a></li>
<li class=""><a href="../../../docs/ide/git-svn/index.html">Git and SVN</a></li>
<li class=""><a href="../../../docs/ide/previews/index.html">Previews</a></li>
<li class=""><a href="../../../docs/ide/build/index.html">Build</a></li>
<li class=""><a href="../../../docs/ide/run/index.html">Run</a></li>
<li class=""><a href="../../../docs/ide/sharing/index.html">Share</a></li>
<li class=""><a href="../../../docs/ide/debug/index.html">Debug</a></li>
<li class=""><a href="../../../docs/ide/docker/index.html">Docker</a></li>
<li class=""><a href="../../../docs/ide/electron/index.html">Install Che Desktop Client</a></li>
</ul>
<h4>PORTABLE WORKSPACES</h4>
<ul>
<li class=""><a href="../../../docs/chedir/getting-started/index.html">Chedir - Getting Started</a></li>
<li class=""><a href="../../../docs/chedir/why/index.html">Chedir - Why Chedir?</a></li>
<li class=""><a href="../../../docs/chedir/installation/index.html">Chedir - Installation</a></li>
<li class=""><a href="../../../docs/chedir/project-setup/index.html">Chedir - Project Setup</a></li>
<li class=""><a href="../../../docs/chedir/up-and-down/index.html">Chedir - Up and Down</a></li>
<li class=""><a href="../../../docs/chedir/chefiles/index.html">Chedir - Chefile</a></li>
<li class=""><a href="../../../docs/chedir/ssh/index.html">Chedir - SSH</a></li>
<li class=""><a href="../../../docs/chedir/factories/index.html">Chedir - Factories</a></li>
<li class=""><a href="../../../docs/factory/getting-started/index.html">Factory - Getting Started</a></li>
<li class=""><a href="../../../docs/factory/creating/index.html">Factory - Creating</a></li>
<li class=""><a href="../../../docs/factory/json-reference/index.html">Factory - JSON Reference</a></li>
</ul>
<h4>DEVELOPER GUIDE - REST API</h4>
<ul>
<li class=""><a href="../../../docs/assemblies/intro/index.html">Introduction</a></li>
<li class=""><a href="../../../docs/assemblies/archetype/index.html">Archetype</a></li>
<li class=""><a href="../../../docs/assemblies/assembly-lifecycle/index.html">Assembly Dev Lifecycle</a></li>
<li class=""><a href="../../../docs/assemblies/plugin-lifecycle/index.html">Plugin Lifecycle</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-rest-apis/index.html">SDK REST APIs</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-class-reference/index.html">SDK Class Reference</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-dependency-injection/index.html">SDK Dependency Injection</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-dto/index.html">SDK DTOs</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-properties/index.html">SDK Properties</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-code-editors/index.html">SDK Editors</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-embed-htmljs/index.html">SDK Embedded JavaScript</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-project-types/index.html">SDK Project Types</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-actions/index.html">SDK Actions</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-services/index.html">SDK Services</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-parts/index.html">SDK Parts</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-themes/index.html">SDK Themes</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-custom-agents/index.html">SDK Custom Agents</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-language-server-protocol/index.html">SDK Language Server Protocol</a></li>
<li class=""><a href="../../../docs/assemblies/sdk-workspace/index.html">SDK Workspace</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>