blob: 9e626d35f4df4274eb9bb11a6c64e7d709f639a3 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Making a workspace portable using a devfile :: Eclipse Che Documentation</title>
<link rel="canonical" href="https://www.eclipse.org/che/docs/che-7/end-user-guide/making-a-workspace-portable-using-a-devfile/">
<meta name="keywords" content="end-user-guide, making-a-workspace-portable-using-a-devfile">
<meta name="generator" content="Antora 2.3.3">
<link rel="stylesheet" href="../../../_/css/site.css">
<link rel="stylesheet" href="../../../_/css/extra.css">
<link rel="stylesheet" href="../../../_/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="icon" href="../../../favicon.ico" type="image/x-icon">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-37306001-2"></script>
<script>function gtag(){dataLayer.push(arguments)};window.dataLayer=window.dataLayer||[];gtag('js',new Date());gtag('config','UA-37306001-2')</script>
</head>
<body class="article">
<header class="header" role="banner">
<nav class="navbar">
<div class="navbar-brand">
<div class="navbar-item">
<button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button>
<img src="../../../_/img/icon-eclipse-che.svg" class="navbar-logo" alt="Eclipse Che logo">
<a href="https://www.eclipse.org/che/docs">Eclipse Che Documentation</a>
</div>
</div>
<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item hide-for-print">
<script async src="https://cse.google.com/cse.js?cx=002898025167115630151:gnr5edrg2eo"></script>
<div class="gcse-searchbox" enableAutoComplete="true"></div>
</div>
<a class="navbar-item" href="#">Home</a>
<a class="navbar-item" href="https://che.eclipse.org/">Blog</a>
<a class="navbar-item" href="https://github.com/eclipse/che">Source Code</a>
</div>
</div>
</nav>
<div class="gcse-searchresults"></div>
</header>
<div class="body">
<div class="nav-container" data-component="che-7" data-version="master">
<aside class="nav">
<div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
<h3 class="title"><a href="../../overview/introduction-to-eclipse-che/">Eclipse Che 7 Documentation</a></h3>
<ul class="nav-list">
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../overview/introduction-to-eclipse-che/">Introduction to Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../overview/che-architecture/">Che architecture</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../hosted-che/hosted-che/">Hosted Che</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<button class="nav-item-toggle"></button>
<span class="nav-text">End-user Guide</span>
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../navigating-che/">Navigating Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../navigating-che-using-the-dashboard/">Navigating Che: dashboard</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../importing-certificates-to-browsers/">Importing certificates to browsers</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../accessing-che-from-openshift-developer-perspective/">Navigating Che from OpenShift Developer Perspective</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../che-theia-ide-basics/">Che-Theia IDE basics</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../defining-custom-commands-for-che-theia/">Defining custom commands for Che-Theia</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../version-control/">Version Control</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../che-theia-troubleshooting/">Che-Theia Troubleshooting</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../workspaces-overview/">Using developer workspaces</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../configuring-a-workspace-using-a-devfile/">Configuring a workspace using a devfile</a>
</li>
<li class="nav-item is-current-page" data-depth="2">
<a class="nav-link" href="./">Making a workspace portable using a devfile</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../creating-and-configuring-a-new-workspace/">Creating and configuring a new workspace</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../importing-a-kubernetes-application-into-a-workspace/">Importing a Kubernetes application into a workspace</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../remotely-accessing-workspaces/">Remotely accessing workspaces</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../creating-a-workspace-from-code-sample/">Creating a workspace from code sample</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../creating-a-workspace-by-importing-source-code-of-a-project/">Creating a workspace by importing source code of a project</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../mounting-a-secret-as-a-file-or-an-environment-variable-into-a-workspace-container/">Mounting a secret as a file or an environment variable into a workspace container</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../customizing-developer-environments/">Customizing developer environments</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../what-is-a-che-theia-plug-in/">What is a Che-Theia plug-in</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-alternative-ides-in-che/">Using alternative IDEs in Che</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../adding-tools-to-che-after-creating-a-workspace/">Adding tools to Che after creating a workspace</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../configuring-oauth-authorization/">Configuring OAuth authorization</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../configuring-github-oauth/">Configuring GitHub OAuth</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../configuring-openshift-oauth/">Configuring OpenShift OAuth</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../using-artifact-repositories-in-a-restricted-environment/">Using artifact repositories in a restricted environment</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-maven-artifact-repositories/">Using Maven artifact repositories</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-gradle-artifact-repositories/">Using Gradle artifact repositories</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-python-artifact-repositories/">Using Python artifact repositories</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-go-artifact-repositories/">Using Go artifact repositories</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-nuget-artifact-repositories/">Using NuGet artifact repositories</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../using-npm-artifact-repositories/">Using npm artifact repositories</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../troubleshooting-che/">Troubleshooting Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../troubleshooting-slow-workspaces/">Troubleshooting slow workspaces</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../troubleshooting-network-problems/">Troubleshooting network problems</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../starting-a-che-workspace-in-debug-mode/">Starting a workspace in debug mode</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../restarting-a-che-workspace-in-debug-mode-after-start-failure/">Restarting a workspace in debug mode after start failure</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<button class="nav-item-toggle"></button>
<span class="nav-text">Installation Guide</span>
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../installation-guide/supported-platforms/">Supported platforms</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../installation-guide/configuring-the-che-installation/">Configuring the Che installation</a>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../installation-guide/installing-che/">Installing Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../installation-guide/installing-che-in-cloud/">Installing Che in cloud</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-openshift-4-using-operatorhub/">Installing Che on OpenShift 4</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-openshift-3-using-the-operator/">Installing Che on OpenShift 3</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-kubespray/">Installing Che on Kubespray</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-aws/">Installing Che on AWS</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-google-cloud-platform/">Installing Che on Google Cloud</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-microsoft-azure/">Installing Che on Microsoft Azure</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../installation-guide/installing-che-locally/">Installing Che locally</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-codeready-containers/">Installing Che on CodeReady Containers</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-docker-desktop/">Installing Che on Docker Desktop</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-minikube/">Installing Che on Minikube</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-minishift/">Installing Che on Minishift</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../installation-guide/installing-che-on-kind/">Installing Che on Kind</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/using-the-chectl-management-tool/">Using the chectl management tool</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/installing-che-in-a-restricted-environment/">Installing Che in restricted environment</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../installation-guide/advanced-configuration/">Advanced configuration</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/advanced-configuration-options-for-the-che-server-component/">Advanced configuration options for Che server</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/configuring-namespace-strategies/">Configuring namespace strategies</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/configuring-workspace-exposure-strategies/">Configuring workspace exposure strategies</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/configuring-workspaces-nodeselector/">Configuring workspaces nodeSelector</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/configuring-che-hostname/">Configuring Che hostname</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/deploying-che-with-support-for-git-repositories-with-self-signed-certificates/">Deploying Che with support for Git repositories with self-signed certificates</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/installing-che-using-storage-classes/">Installing Che using storage classes</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/configuring-storage-types/">Configuring storage types</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/importing-tls-certificates-to-che-server-java-truststore/">Importing TLS certificates to Che server Java truststore</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../installation-guide/upgrading-che/">Upgrading Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/upgrading-che-using-operatorhub/">Upgrading Che using OperatorHub</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/upgrading-che-using-the-cli-management-tool/">Upgrading Che using the CLI management tool</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../installation-guide/uninstalling-che/">Uninstalling Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/uninstalling-che-after-operatorhub-installation-using-openshift-web-console/">Using the OpenShift web console</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/uninstalling-che-after-operatorhub-installation-using-openshift-cli/">Using OpenShift CLI</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../installation-guide/uninstalling-che-after-chectl-installation/">Using chectl</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<button class="nav-item-toggle"></button>
<span class="nav-text">Administration Guide</span>
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../administration-guide/che-architecture-overview/">Che architecture</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/che-workspace-controller/">Che workspace controller</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/che-workspaces-architecture/">Che workspaces architecture</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../administration-guide/calculating-che-resource-requirements/">Calculating Che resource requirements</a>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../administration-guide/customizing-the-devfile-and-plug-in-registries/">Customizing devfile and plug-in registries</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/building-and-running-a-custom-registry-image/">Building and running a custom registry image</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/including-the-plug-in-binaries-in-the-registry-image/">Including the plug-in binaries in the registry image</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/editing-a-devfile-and-plug-in-at-runtime/">Editing a devfile and plug-in at runtime</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/using-a-visual-studio-code-extension-in-che/">Using a VS Code extension in Che</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/testing-a-visual-studio-code-extension-in-che/">Testing a VS Code extension in Che</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../administration-guide/retrieving-che-logs/">Retrieving Che logs</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/viewing-kubernetes-events/">Accessing Kubernetes events on OpenShift</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/viewing-operator-events/">Viewing the Operator events on OpenShift</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/viewing-che-server-logs/">Viewing Che server logs</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/viewing-external-service-logs/">Viewing external service logs</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/viewing-che-workspaces-logs/">Viewing Che workspaces logs</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/viewing-plug-in-broker-logs/">Viewing Plug-in broker logs</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/collecting-logs-using-chectl/">Collecting logs using chectl</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../administration-guide/monitoring-che/">Monitoring Che</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../administration-guide/tracing-che/">Tracing Che</a>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../administration-guide/managing-users/">Managing users</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/configuring-authorization/">Configuring authorization</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/removing-user-data/">Removing user data</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../administration-guide/securing-che/">Securing Che</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/authenticating-users/">Authenticating users</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/authorizing-users/">Authorizing users</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../administration-guide/backup-and-disaster-recovery/">Backup and disaster recovery</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/external-database-setup/">External database setup</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../administration-guide/persistent-volumes-backups/">Persistent Volumes backups</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../administration-guide/caching-images-for-faster-workspace-start/">Caching images for faster workspace start</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<button class="nav-item-toggle"></button>
<span class="nav-text">Contributor Guide</span>
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../contributor-guide/branding-che-theia/">Branding Che-Theia</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../contributor-guide/developing-che-theia-plug-ins/">Developing Che-Theia plug-ins</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../contributor-guide/testing-che-theia-plug-ins/">Testing Che-Theia plug-ins</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../contributor-guide/publishing-che-theia-plug-ins/">Publishing Che-Theia plug-ins</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../contributor-guide/adding-support-for-a-new-language/">Adding support for a new language</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../contributor-guide/adding-support-for-a-new-debugger/">Adding support for a new debugger</a>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../contributor-guide/che-extensibility-reference/">Che extensibility reference</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../contributor-guide/che-extension-points/">Che extension points</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../contributor-guide/che-theia-plug-in-api/">Che-Theia plug-in API</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../contributor-guide/debug-adapter-protocol/">Debug Adapter Protocol</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../contributor-guide/language-server-protocol/">Language Server Protocol</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<button class="nav-item-toggle"></button>
<span class="nav-text">Extensions</span>
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../extensions/eclipse-che4z/">Eclipse Che4z</a>
</li>
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../extensions/openshift-connector-overview/">OpenShift Connector</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../extensions/features-of-openshift-connector/">Features of OpenShift Connector</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../extensions/installing-openshift-connector-in-che/">Installing OpenShift Connector in Eclipse Che</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../extensions/authenticating-with-openshift-connector-from-che/">Authenticating with OpenShift Connector from Eclipse Che</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../extensions/creating-components-with-openshift-connector-in-che/">Creating Components with OpenShift Connector in Eclipse Che</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../extensions/connecting-source-code-from-github-to-a-openshift-component-using-openshift-connector/">Connecting source code from GitHub to a OpenShift Component</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../extensions/telemetry/">Telemetry</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="../../glossary/che-glossary/">Che glossary</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
<div class="context">
<span class="title">Eclipse Che 7 Documentation</span>
<span class="version">Stable</span>
</div>
<ul class="components">
<li class="component">
<span class="title">devfile</span>
<ul class="versions">
<li class="version is-latest">
<a href="../../../devfile/">master</a>
</li>
</ul>
</li>
<li class="component is-current">
<span class="title">Eclipse Che 7 Documentation</span>
<ul class="versions">
<li class="version is-current is-latest">
<a href="../../overview/introduction-to-eclipse-che/">Stable</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
<a href="../../overview/introduction-to-eclipse-che/" class="home-link"></a>
<nav class="breadcrumbs" aria-label="breadcrumbs">
<ul>
<li><a href="../../overview/introduction-to-eclipse-che/">Eclipse Che 7 Documentation</a></li>
<li>End-user Guide</li>
<li><a href="../workspaces-overview/">Using developer workspaces</a></li>
<li><a href="./">Making a workspace portable using a devfile</a></li>
</ul>
</nav>
<div class="edit-this-page"><a href="https://github.com/eclipse/che-docs/edit/master/modules/end-user-guide/pages/making-a-workspace-portable-using-a-devfile.adoc">Edit this Page</a></div>
</div>
<div class="content">
<article class="doc">
<h1 class="page">Making a workspace portable using a devfile</h1>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>To transfer a configured Che workspace, create and export the devfile of the workspace and load the devfile on a different host to initialize a new instance of the workspace. For detailed instructions on how to create such a devfile, see below.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="a-minimal-devfile_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#a-minimal-devfile_making-a-workspace-portable-using-a-devfile"></a>A minimal devfile</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The following is the minimum content required in a devfile:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://redhat-developer.github.io/devfile/devfile#apiversion">apiVersion</a></p>
</li>
<li>
<p><a href="https://redhat-developer.github.io/devfile/devfile#metadata">metadata name</a></p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: che-in-che-out</code></pre>
</div>
</div>
<div class="paragraph">
<p>For a complete devfile example, see <a href="https://github.com/eclipse/che/blob/master/devfile.yaml">Eclipse&#160;Che in Che devfile.yaml</a>.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title"><code>name</code> or <code>generateName</code> must be defined</div>
<div class="paragraph">
<p>Both <code>name</code> and <code>generateName</code> are optional parameters, but at least one of them must be defined. See <a href="#generating-workspace-names_making-a-workspace-portable-using-a-devfile">Generating workspace names</a>.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="generating-workspace-names_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#generating-workspace-names_making-a-workspace-portable-using-a-devfile"></a>Generating workspace names</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To specify a prefix for automatically generated workspace names, set the <code>generateName</code> parameter in the devfile:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
generateName: che-</code></pre>
</div>
</div>
<div class="paragraph">
<p>The workspace name will be in the <code>&lt;generateName&gt;YYYYY</code> format (for example, <code>che-2y7kp</code>). <code>Y</code> is random <code>[a-z0-9]</code> character.</p>
</div>
<div class="paragraph">
<p>The following naming rules apply when creating workspaces:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>When <code>name</code> is defined, it is used as the workspace name: <code>&lt;name&gt;</code></p>
</li>
<li>
<p>When only <code>generateName</code> is defined, it is used as the base of the generated name: <code>&lt;generateName&gt;YYYYY</code></p>
</li>
</ul>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>For workspaces created using a factory, defining <code>name</code> or <code>generateName</code> has the same effect. The defined value is used as the name prefix: <code>&lt;name&gt;YYYYY</code> or <code>&lt;generateName&gt;YYYYY</code>. When both <code>generateName</code> and <code>name</code> are defined, <code>generateName</code> takes precedence.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="writing-a-devfile-for-your-project_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#writing-a-devfile-for-your-project_making-a-workspace-portable-using-a-devfile"></a>Writing a devfile for a project</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This section describes how to create a minimal devfile for your project and how to include more than one projects in a devfile.</p>
</div>
<div class="sect2">
<h3 id="preparing-a-minimal-devfile_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#preparing-a-minimal-devfile_making-a-workspace-portable-using-a-devfile"></a>Preparing a minimal devfile</h3>
<div class="paragraph">
<p>A minimal devfile sufficient to run a workspace consists of the following parts:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Specification version</p>
</li>
<li>
<p>Name</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="title">Example of a minimal devfile with no project</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: minimal-workspace</code></pre>
</div>
</div>
<div class="paragraph">
<p>Without any further configuration, a workspace with the default editor is launched along with its default plug-ins, which are configured on the Che Server. Che-Theia is configured as the default editor along with the <strong>Che Machine Exec</strong> plug-in. When launching a workspace within a Git repository using a factory, the project from the given repository and branch is be created by default. The project name then matches the repository name.</p>
</div>
<div class="paragraph">
<p>Add the following parts for a more functional workspace:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>List of components: Development components and user runtimes</p>
</li>
<li>
<p>List of projects: Source code repositories</p>
</li>
<li>
<p>List of commands: Actions to manage the workspace components, such as running the development tools, starting the runtime environments, and others</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="title">Example of a minimal devfile with a project</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:
type: git
location: 'https://github.com/spring-projects/spring-petclinic.git'
components:
- type: chePlugin
id: redhat/java/latest</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="specifying-multiple-projects-in-a-devfile_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#specifying-multiple-projects-in-a-devfile_making-a-workspace-portable-using-a-devfile"></a>Specifying multiple projects in a devfile</h3>
<div class="paragraph">
<p>A single devfile can specify multiple projects. For each project, specify the type of the source repository, its location, and, optionally, the directory the project is cloned to.</p>
</div>
<div class="listingblock">
<div class="title">Example of a devfile with two projects</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: example-devfile
projects:
- name: frontend
source:
type: git
location: https://github.com/acmecorp/frontend.git
- name: backend
clonePath: src/github.com/acmecorp/backend
source:
type: git
location: https://github.com/acmecorp/backend.git</code></pre>
</div>
</div>
<div class="paragraph">
<p>In the preceding example, there are two projects defined, <code>frontend</code> and <code>backend</code>. Each project is located in its own repository. The <code>backend</code> project has a specific requirement to be cloned into the <code>src/github.com/acmecorp/backend/</code> directory under the source root (implicitly defined by the Che runtime) while the <code>frontend</code> project will be cloned into the <code>frontend/</code> directory under the source root.</p>
</div>
<div class="paragraph">
<div class="title">Additional resources</div>
<p>For a detailed explanation of all devfile component assignments and possible values, see:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/redhat-developer/devfile">Specification repository</a></p>
</li>
<li>
<p><a href="https://redhat-developer.github.io/devfile/devfile">Detailed json-schema documentation</a></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>These sample devfiles are a good source of inspiration:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/eclipse/che-devfile-registry/tree/master/devfiles">Sample devfiles for Eclipse&#160;Che workspaces used by default in the user interface</a>.</p>
</li>
<li>
<p><a href="https://github.com/redhat-developer/devfile/tree/master/samples">Sample devfiles for Eclipse&#160;Che workspaces from Red Hat Developer program</a>.</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="devfile-reference_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#devfile-reference_making-a-workspace-portable-using-a-devfile"></a>Devfile reference</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This section contains devfile reference and instructions on how to use the various elements that devfiles consist of.</p>
</div>
<div class="sect2">
<h3 id="_adding_projects_to_a_devfile"><a class="anchor" href="#_adding_projects_to_a_devfile"></a>Adding projects to a devfile</h3>
<div class="paragraph">
<p>Usually a devfile contains one or more projects. A workspace is created to develop those projects. Projects are added in the <code>projects</code> section of devfiles.</p>
</div>
<div class="paragraph">
<p>Each project in a single devfile must have:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Unique name</p>
</li>
<li>
<p>Source specified</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Project source consists of two mandatory values: <code>type</code> and <code>location</code>.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><code>type</code></dt>
<dd>
<p>The kind of project-source provider.</p>
</dd>
<dt class="hdlist1"><code>location</code></dt>
<dd>
<p>The URL of project source.</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>Che supports the following project types:</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><code>git</code></dt>
<dd>
<p>Projects with sources in Git. The location points to a clone link.</p>
</dd>
<dt class="hdlist1"><code>github</code></dt>
<dd>
<p>Same as <code>git</code> but for projects hosted on <a href="https://github.com/">GitHub</a> only. Use <code>git</code> for projects that do not use GitHub-specific features.</p>
</dd>
<dt class="hdlist1"><code>zip</code></dt>
<dd>
<p>Projects with sources in a ZIP archive. Location points to a ZIP file.</p>
</dd>
</dl>
</div>
<div class="sect3">
<h4 id="_project_source_type_git"><a class="anchor" href="#_project_source_type_git"></a>Project-source type: git</h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">source:
type: git
location: https://github.com/eclipse/che.git
startPoint: master <i class="conum" data-value="1"></i><b>(1)</b>
tag: 7.2.0
commitId: 36fe587
branch: 7.20.x
sparseCheckoutDir: core <i class="conum" data-value="2"></i><b>(2)</b></code></pre>
</div>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td><code>startPoint</code> is the general value for <code>tag</code>, <code>commitId</code>, and <code>branch</code>. The <code>startPoint</code>, <code>tag</code>, <code>commitId</code>, and <code>branch</code> parameters are mutually exclusive. When more than one is supplied, the following order is used: <code>startPoint</code>, <code>tag</code>, <code>commitId</code>, <code>branch</code>.</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td><code>sparseCheckoutDir</code> the template for the sparse checkout Git feature. This is useful when only a part of a project (typically only a single directory) is needed.</td>
</tr>
</table>
</div>
<div class="exampleblock">
<div class="title">Example 1. <code>sparseCheckoutDir</code> parameter settings</div>
<div class="content">
<div class="ulist">
<ul>
<li>
<p>Set to <code>/my-module/</code> to create only the root <code>my-module</code> directory (and its content).</p>
</li>
<li>
<p>Omit the leading slash (<code>my-module/</code>) to create all <code>my-module</code> directories that exist in the project. Including, for example, <code>/addons/my-module/</code>.</p>
<div class="paragraph">
<p>The trailing slash indicates that only directories with the given name (including their content) are created.</p>
</div>
</li>
<li>
<p>Use wildcards to specify more than one directory name. For example, setting <code>module-*</code> checks out all directories of the given project that start with <code>module-</code>.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="paragraph">
<p>For more information, see <a href="https://git-scm.com/docs/git-read-tree#_sparse_checkout">Sparse checkout in Git documentation</a>.</p>
</div>
</div>
<div class="sect3">
<h4 id="_project_source_type_zip"><a class="anchor" href="#_project_source_type_zip"></a>Project-source type: zip</h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">source:
type: zip
location: http://host.net/path/project-src.zip</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_project_clone_path_parameter_clonepath"><a class="anchor" href="#_project_clone_path_parameter_clonepath"></a>Project clone-path parameter: clonePath</h4>
<div class="paragraph">
<p>The <code>clonePath</code> parameter specifies the path into which the project is to be cloned. The path must be relative to the <code>/projects/</code> directory, and it cannot leave the <code>/projects/</code> directory. The default value is the project name.</p>
</div>
<div class="listingblock">
<div class="title">Example devfile with projects</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: my-project-dev
projects:
- name: my-project-resourse
clonePath: resources/my-project
source:
type: zip
location: http://host.net/path/project-res.zip
- name: my-project
source:
type: git
location: https://github.com/my-org/project.git
branch: develop</code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="adding-components-to-a-devfile_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#adding-components-to-a-devfile_making-a-workspace-portable-using-a-devfile"></a>Adding components to a devfile</h3>
<div class="paragraph">
<p>Each component in a single devfile must have a unique name.</p>
</div>
<div class="sect3">
<h4 id="_component_type_cheeditor"><a class="anchor" href="#_component_type_cheeditor"></a>Component type: cheEditor</h4>
<div class="paragraph">
<p>Describes the editor used in the workspace by defining its <code>id</code>. A devfile can only contain one component of the <code>cheEditor</code> type.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">components:
- alias: theia-editor
type: cheEditor
id: eclipse/che-theia/next</code></pre>
</div>
</div>
<div class="paragraph">
<p>When <code>cheEditor</code> is missing, a default editor is provided along with its default plug-ins. The default plug-ins are also provided for an explicitly defined editor with the same <code>id</code> as the default one (even if it is a different version). Che-Theia is configured as default editor along with the <strong>Che Machine Exec</strong> plug-in.</p>
</div>
<div class="paragraph">
<p>To specify that a workspace requires no editor, use the <a href="#attribute-editorfree_making-a-workspace-portable-using-a-devfile"><code>editorFree:true</code> attribute</a> in the devfile attributes.</p>
</div>
</div>
<div class="sect3">
<h4 id="_component_type_cheplugin"><a class="anchor" href="#_component_type_cheplugin"></a>Component type: chePlugin</h4>
<div class="paragraph">
<p>Describes plug-ins in a workspace by defining their <code>id</code>. It is allowed to have several <code>chePlugin</code> components.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
id: eclipse/che-machine-exec-plugin/0.0.1</code></pre>
</div>
</div>
<div class="paragraph">
<p>Both types above use an ID, which is slash-separated publisher, name and version of plug-in from the Che Plug-in registry.</p>
</div>
<div class="paragraph">
<p>List of available Eclipse{nbsp}Che plug-ins and more information about registry can be found in the <a href="https://github.com/eclipse/che-plugin-registry">Eclipse{nbsp}Che plug-in registry</a> GitHub repository.</p>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_an_alternative_component_registry"><a class="anchor" href="#_specifying_an_alternative_component_registry"></a>Specifying an alternative component registry</h4>
<div class="paragraph">
<p>To specify an alternative registry for the <code>cheEditor</code> and <code>chePlugin</code> component types, use the <code>registryUrl</code> parameter:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
registryUrl: https://my-customregistry.com
id: eclipse/che-machine-exec-plugin/0.0.1</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_a_component_by_linking_to_its_descriptor"><a class="anchor" href="#_specifying_a_component_by_linking_to_its_descriptor"></a>Specifying a component by linking to its descriptor</h4>
<div class="paragraph">
<p>An alternative way of specifying <code>cheEditor</code> or <code>chePlugin</code>, instead of using the editor or plug-in <code>id</code> (and optionally an alternative registry), is to provide a direct link to the component descriptor (typically named <code>meta.yaml</code>) by using the <code>reference</code> field:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
reference: https://raw.githubusercontent.com.../plugin/1.0.1/meta.yaml</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
It is impossible to mix the <code>id</code> and <code>reference</code> fields in a single component definition; they are mutually exclusive.
</td>
</tr>
</table>
</div>
</div>
<div class="sect3">
<h4 id="_tuning_cheplugin_component_configuration"><a class="anchor" href="#_tuning_cheplugin_component_configuration"></a>Tuning chePlugin component configuration</h4>
<div class="paragraph">
<p>A chePlugin component may need to be precisely tuned, and in such case, component preferences can be used. The example shows how to configure JVM using plug-in preferences.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> id: redhat/java/0.38.0
type: chePlugin
preferences:
java.jdt.ls.vmargs: '-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication'</code></pre>
</div>
</div>
<div class="paragraph">
<p>Preferences may also be specified as an array:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> id: redhat/java/0.38.0
type: chePlugin
preferences:
go.lintFlags: ["--enable-all", "--new"]</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_component_type_kubernetes"><a class="anchor" href="#_component_type_kubernetes"></a>Component type: kubernetes</h4>
<div class="paragraph">
<p>A complex component type that allows to apply configuration from a list of Kubernetes or OpenShift components.</p>
</div>
<div class="paragraph">
<p>The content can be provided through the <code>reference</code> attribute, which points to the file with the component content.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: mysql
type: kubernetes
reference: petclinic.yaml
selector:
app.kubernetes.io/name: mysql
app.kubernetes.io/component: database
app.kubernetes.io/part-of: petclinic</code></pre>
</div>
</div>
<div class="paragraph">
<p>Alternatively, to post a devfile with such components to REST API, the contents of the Kubernetes <code>List</code> object can be embedded into the devfile using the <code>referenceContent</code> field:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: mysql
type: kubernetes
reference: petclinic.yaml
referenceContent: |
kind: List
items:
-
apiVersion: v1
kind: Pod
metadata:
name: ws
spec:
containers:
... etc</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_overriding_container_entrypoints"><a class="anchor" href="#_overriding_container_entrypoints"></a>Overriding container entrypoints</h4>
<div class="paragraph">
<p>As with the <a href="#component-type-dockerimage_making-a-workspace-portable-using-a-devfile">understood</a> by Kubernetes).</p>
</div>
<div class="paragraph">
<p>There can be more containers in the list (contained in Pods or Pod templates of deployments). To select which containers to apply the entrypoint changes to.</p>
</div>
<div class="paragraph">
<p>The entrypoints can be defined as follows:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: appDeployment
type: kubernetes
reference: app-deployment.yaml
entrypoints:
- parentName: mysqlServer
command: ['sleep']
args: ['infinity']
- parentSelector:
app: prometheus
args: ['-f', '/opt/app/prometheus-config.yaml']</code></pre>
</div>
</div>
<div class="paragraph">
<p>The <code>entrypoints</code> list contains constraints for picking the containers along with the <code>command</code> and <code>args</code> parameters to apply to them. In the example above, the constraint is <code>parentName: mysqlServer</code>, which will cause the command to be applied to all containers defined in any parent object called <code>mysqlServer</code>. The parent object is assumed to be a top level object in the list defined in the referenced file, which is <code>app-deployment.yaml</code> in the example above.</p>
</div>
<div class="paragraph">
<p>Other types of constraints (and their combinations) are possible:</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><code>containerName</code></dt>
<dd>
<p>the name of the container</p>
</dd>
<dt class="hdlist1"><code>parentName</code></dt>
<dd>
<p>the name of the parent object that (indirectly) contains the containers to override</p>
</dd>
<dt class="hdlist1"><code>parentSelector</code></dt>
<dd>
<p>the set of labels the parent object needs to have</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>A combination of these constraints can be used to precisely locate the containers inside the referenced Kubernetes <code>List</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="_overriding_container_environment_variables"><a class="anchor" href="#_overriding_container_environment_variables"></a>Overriding container environment variables</h4>
<div class="paragraph">
<p>To provision or override entrypoints in a Kubernetes or OpenShift component, configure it in the following way:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: appDeployment
type: kubernetes
reference: app-deployment.yaml
env:
- name: ENV_VAR
value: value</code></pre>
</div>
</div>
<div class="paragraph">
<p>This is useful for temporary content or without access to editing the referenced content. The specified environment variables are provisioned into each init container and containers inside all Pods and Deployments.</p>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_mount_source_option"><a class="anchor" href="#_specifying_mount_source_option"></a>Specifying mount-source option</h4>
<div class="paragraph">
<p>To specify a project sources directory mount into container(s), use the <code>mountSources</code> parameter:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: appDeployment
type: kubernetes
reference: app-deployment.yaml
mountSources: true</code></pre>
</div>
</div>
<div class="paragraph">
<p>If enabled, project sources mounts will be applied to every container of the given component.
This parameter is also applicable for <code>chePlugin</code> type components.</p>
</div>
</div>
<div class="sect3">
<h4 id="component-type-dockerimage_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#component-type-dockerimage_making-a-workspace-portable-using-a-devfile"></a>Component type: dockerimage</h4>
<div class="paragraph">
<p>A component type that allows to define a container image-based configuration of a container in a workspace. A devfile can only contain one component of the <code>dockerimage</code> type. The <code>dockerimage</code> type of component brings in custom tools into the workspace. The component is identified by its image.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: maven
type: dockerimage
image: eclipe/maven-jdk8:latest
volumes:
- name: mavenrepo
containerPath: /root/.m2
env:
- name: ENV_VAR
value: value
endpoints:
- name: maven-server
port: 3101
attributes:
protocol: http
secure: 'true'
public: 'true'
discoverable: 'false'
memoryLimit: 1536M
command: ['tail']
args: ['-f', '/dev/null']</code></pre>
</div>
</div>
<div class="paragraph">
<p><strong>Example of a minimal <code>dockerimage</code> component</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
type: dockerimage
image: golang
memoryLimit: 512Mi
command: ['sleep', 'infinity']</code></pre>
</div>
</div>
<div class="paragraph">
<p>It specifies the type of the component, <code>dockerimage</code> and the <code>image</code> attribute names the image to be used for the component using the usual Docker naming conventions, that is, the above <code>type</code> attribute is equal to <code>docker.io/library/golang:latest</code>.</p>
</div>
<div class="paragraph">
<p>A <code>dockerimage</code> component has many features that enable augmenting the image with additional resources and information needed for meaningful integration of the <strong>tool</strong> provided by the image with Eclipse&#160;Che.</p>
</div>
</div>
<div class="sect3">
<h4 id="_mounting_project_sources"><a class="anchor" href="#_mounting_project_sources"></a>Mounting project sources</h4>
<div class="paragraph">
<p>For the <code>dockerimage</code> component to have access to the project sources, you must set the <code>mountSources</code> attribute to <code>true</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
type: dockerimage
image: golang
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']</code></pre>
</div>
</div>
<div class="paragraph">
<p>The sources is mounted on a location stored in the <code>CHE_PROJECTS_ROOT</code> environment variable that is made available in the running container of the image. This location defaults to <code>/projects</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="_container_entrypoint"><a class="anchor" href="#_container_entrypoint"></a>Container Entrypoint</h4>
<div class="paragraph">
<p>The <code>command</code> attribute of the <code>dockerimage</code> along with other arguments, is used to modify the <code>entrypoint</code> command of the container created from the image. In Eclipse&#160;Che the container is needed to run indefinitely so that you can connect to it and execute arbitrary commands in it at any time. Because the availability of the <code>sleep</code> command and the support for the <code>infinity</code> argument for it is different and depends on the base image used in the particular images, Che cannot insert this behavior automatically on its own. However, you can take advantage of this feature to, for example, start necessary servers with modified configurations, etc.</p>
</div>
</div>
<div class="sect3">
<h4 id="_persistent_storage"><a class="anchor" href="#_persistent_storage"></a>Persistent Storage</h4>
<div class="paragraph">
<p>Components of any type can specify the custom volumes to be mounted on specific locations within the image. Note that the volume names are shared across all components and therefore this mechanism can also be used to share file systems between components.</p>
</div>
<div class="paragraph">
<p>Example specifying volumes for <code>dockerimage</code> type:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: dockerimage
image: golang
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']
volumes:
- name: cache
containerPath: /.cache</code></pre>
</div>
</div>
<div class="paragraph">
<p>Example specifying volumes for <code>cheEditor</code>/<code>chePlugin</code> type:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: cheEditor
alias: theia-editor
id: eclipse/che-theia/next
env:
- name: HOME
value: $(CHE_PROJECTS_ROOT)
volumes:
- name: cache
containerPath: /.cache</code></pre>
</div>
</div>
<div class="paragraph">
<p>Example specifying volumes for <code>kubernetes</code>/<code>openshift</code> type:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: openshift
alias: mongo
reference: mongo-db.yaml
volumes:
- name: mongo-persistent-storage
containerPath: /data/db</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_container_memory_limit_for_components"><a class="anchor" href="#_specifying_container_memory_limit_for_components"></a>Specifying container memory limit for components</h4>
<div class="paragraph">
<p>To specify a container(s) memory limit for <code>dockerimage</code>, <code>chePlugin</code>, <code>cheEditor</code>, use the <code>memoryLimit</code> parameter:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
id: eclipse/che-machine-exec-plugin/0.0.1
memoryLimit: 1Gi
- type: dockerimage
image: eclipe/maven-jdk8:latest
memoryLimit: 512M</code></pre>
</div>
</div>
<div class="paragraph">
<p>This limit will be applied to every container of the given component.</p>
</div>
<div class="paragraph">
<p>For the <code>cheEditor</code> and <code>chePlugin</code> component types, RAM limits can be described in the plug-in descriptor file, typically named <code>meta.yaml</code>.</p>
</div>
<div class="paragraph">
<p>If none of them are specified, system-wide defaults will be applied (see description of <code>CHE_WORKSPACE_SIDECAR_DEFAULT__MEMORY__LIMIT__MB</code> system property).</p>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_container_memory_request_for_components"><a class="anchor" href="#_specifying_container_memory_request_for_components"></a>Specifying container memory request for components</h4>
<div class="paragraph">
<p>To specify a container(s) memory request for <code>chePlugin</code> or <code>cheEditor</code>, use the <code>memoryRequest</code> parameter:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
id: eclipse/che-machine-exec-plugin/0.0.1
memoryLimit: 1Gi
memoryRequest: 512M
- type: dockerimage
image: eclipe/maven-jdk8:latest
memoryLimit: 512M
memoryRequest: 256M</code></pre>
</div>
</div>
<div class="paragraph">
<p>This limit will be applied to every container of the given component.</p>
</div>
<div class="paragraph">
<p>For the <code>cheEditor</code> and <code>chePlugin</code> component types, RAM requests can be described in the plug-in descriptor file, typically named <code>meta.yaml</code>.</p>
</div>
<div class="paragraph">
<p>If none of them are specified, system-wide defaults are applied (see description of <code>CHE_WORKSPACE_SIDECAR_DEFAULT__MEMORY__REQUEST__MB</code> system property).</p>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_container_cpu_limit_for_components"><a class="anchor" href="#_specifying_container_cpu_limit_for_components"></a>Specifying container CPU limit for components</h4>
<div class="paragraph">
<p>To specify a container(s) CPU limit for <code>chePlugin</code>, <code>cheEditor</code> or <code>dockerimage</code> use the <code>cpuLimit</code> parameter:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
id: eclipse/che-machine-exec-plugin/0.0.1
cpuLimit: 1.5
- type: dockerimage
image: eclipe/maven-jdk8:latest
cpuLimit: 750m</code></pre>
</div>
</div>
<div class="paragraph">
<p>This limit will be applied to every container of the given component.</p>
</div>
<div class="paragraph">
<p>For the <code>cheEditor</code> and <code>chePlugin</code> component types, CPU limits can be described in the plug-in descriptor file, typically named <code>meta.yaml</code>.</p>
</div>
<div class="paragraph">
<p>If none of them are specified, system-wide defaults are applied (see description of <code>CHE_WORKSPACE_SIDECAR_DEFAULT__CPU__LIMIT__CORES</code> system property).</p>
</div>
</div>
<div class="sect3">
<h4 id="_specifying_container_cpu_request_for_components"><a class="anchor" href="#_specifying_container_cpu_request_for_components"></a>Specifying container CPU request for components</h4>
<div class="paragraph">
<p>To specify a container(s) CPU request for <code>chePlugin</code>, <code>cheEditor</code> or <code>dockerimage</code> use the <code>cpuRequest</code> parameter:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> components:
- alias: exec-plugin
type: chePlugin
id: eclipse/che-machine-exec-plugin/0.0.1
cpuLimit: 1.5
cpuRequest: 0.225
- type: dockerimage
image: eclipe/maven-jdk8:latest
cpuLimit: 750m
cpuRequest: 450m</code></pre>
</div>
</div>
<div class="paragraph">
<p>This limit will be applied to every container of the given component.</p>
</div>
<div class="paragraph">
<p>For the <code>cheEditor</code> and <code>chePlugin</code> component types, CPU requests can be described in the plug-in descriptor file, typically named <code>meta.yaml</code>.</p>
</div>
<div class="paragraph">
<p>If none of them are specified, system-wide defaults are applied (see description of <code>CHE_WORKSPACE_SIDECAR_DEFAULT__CPU__REQUEST__CORES</code> system property).</p>
</div>
</div>
<div class="sect3">
<h4 id="_environment_variables"><a class="anchor" href="#_environment_variables"></a>Environment variables</h4>
<div class="paragraph">
<p>Eclipse&#160;Che allows you to configure Docker containers by modifying the environment variables available in component&#8217;s configuration.
Environment variables are supported by the following component types: <code>dockerimage</code>, <code>chePlugin</code>, <code>cheEditor</code>, <code>kubernetes</code>, <code>openshift</code>.
In case component has multiple containers, environment variables will be provisioned to each container.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: dockerimage
image: golang
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']
env:
- name: GOPATH
value: $(CHE_PROJECTS_ROOT)/go
- type: cheEditor
alias: theia-editor
id: eclipse/che-theia/next
memoryLimit: 2Gi
env:
- name: HOME
value: $(CHE_PROJECTS_ROOT)</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="ulist">
<ul>
<li>
<p>The variable expansion works between the environment variables, and it uses the Kubernetes convention for the variable references.</p>
</li>
<li>
<p>The predefined variables are available for use in custom definitions.</p>
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The following environment variables are pre-set by the Che server:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>CHE_PROJECTS_ROOT</code>: The location of the projects directory (note that if the component does not mount the sources, the projects will not be accessible).</p>
</li>
<li>
<p><code>CHE_WORKSPACE_LOGS_ROOT__DIR</code>: The location of the logs common to all the components. If the component chooses to put logs into this directory, the log files are accessible from all other components.</p>
</li>
<li>
<p><code>CHE_API_INTERNAL</code>: The URL to the Che server API endpoint used for communication with the Che server.</p>
</li>
<li>
<p><code>CHE_WORKSPACE_ID</code>: The ID of the current workspace.</p>
</li>
<li>
<p><code>CHE_WORKSPACE_NAME</code>: The name of the current workspace.</p>
</li>
<li>
<p><code>CHE_WORKSPACE_NAMESPACE</code>: The Che namespace of the current workspace. This environment variable is the name of the user or organization that the workspace belongs to. Note that this is different from
the Kubernetes namespace or OpenShift project to which the workspace is deployed.</p>
</li>
<li>
<p><code>CHE_MACHINE_TOKEN</code>: The token used to authenticate the request against the Che server.</p>
</li>
<li>
<p><code>CHE_MACHINE_AUTH_SIGNATURE<em>PUBLIC</em>KEY</code>: The public key used to secure the communication with the Che server.</p>
</li>
<li>
<p><code>CHE_MACHINE_AUTH_SIGNATURE__ALGORITHM</code>: The encryption algorithm used in the secured communication with the Che server.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>A devfiles may only need the <code>CHE_PROJECTS_ROOT</code> environment variable to locate the cloned projects in the component&#8217;s container. More advanced devfiles might use the <code>CHE_WORKSPACE_LOGS_ROOT__DIR</code> environment variable to read the logs (for example as part of a devfile command). The environment variables used to securely access the Che server are mostly out of scope for devfiles and are present only for advanced use cases that are usually handled by the Che plug-ins.</p>
</div>
</div>
<div class="sect3">
<h4 id="endpoints_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#endpoints_making-a-workspace-portable-using-a-devfile"></a>Endpoints</h4>
<div class="paragraph">
<p>Components of any type can specify the endpoints that the Docker image exposes. These endpoints can be made accessible to the users if the Che cluster is running using a Kubernetes ingress or an OpenShift route and to the other components within the workspace. You can create an endpoint for your application or database, if your application or database server is listening on a port and you want to be able to directly interact with it yourself or you want other components to interact with it.</p>
</div>
<div class="paragraph">
<p>Endpoints have several properties as shown in the following example:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
components:
- type: dockerimage
image: golang
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']
env:
- name: GOPATH
value: $(CHE_PROJECTS_ROOT)/go
- name: GOCACHE
value: /tmp/go-cache
endpoints:
- name: web
port: 8080
attributes:
discoverable: false
public: true
protocol: http
- type: dockerimage
image: postgres
memoryLimit: 512Mi
env:
- name: POSTGRES_USER
value: user
- name: POSTGRES_PASSWORD
value: password
- name: POSTGRES_DB
value: database
endpoints:
- name: postgres
port: 5432
attributes:
discoverable: true
public: false</code></pre>
</div>
</div>
<div class="paragraph">
<p>Here, there are two Docker images, each defining a single endpoint. Endpoint is an accessible port that can be made accessible inside the workspace or also publicly (example, from the UI). Each endpoint has a name and port, which is the port on which certain server running inside the container is listening. The following are a few attributes that you can set on the endpoint:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>discoverable</code>: If an endpoint is discoverable, it means that it can be accessed using its name as the host name within the workspace containers (in the Kubernetes parlance, a service is created for it with the provided name).
55</p>
</li>
<li>
<p><code>public</code>: The endpoint will be accessible outside of the workspace, too (such endpoint can be accessed from the Che user interface). Such endpoints are publicized always on port <code>80</code> or <code>443</code> (depending on whether <code>tls</code> is enabled in Che).</p>
</li>
<li>
<p><code>protocol</code>: For public endpoints the protocol is a hint to the UI on how to construct the URL for the endpoint access. Typical values are <code>http</code>, <code>https</code>, <code>ws</code>, <code>wss</code>.</p>
</li>
<li>
<p><code>secure</code>: A boolean (defaulting to <code>false</code>) specifying whether the endpoint is put behind a JWT proxy requiring a JWT workspace token to grant access. The JWT proxy is deployed in the same Pod as the server and assumes the server listens solely on the local loopback interface, such as <code>127.0.0.1</code>.</p>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
Listening on any other interface than the local loopback poses a security risk because such server is accessible without the JWT authentication within the cluster network on the corresponding IP addresses.
</td>
</tr>
</table>
</div>
</li>
<li>
<p><code>path</code>: The URL of the endpoint.</p>
</li>
<li>
<p><code>unsecuredPaths</code>: A comma-separated list of endpoint paths that are to stay unsecured even if the <code>secure</code> attribute is set to <code>true</code>.</p>
</li>
<li>
<p><code>cookiesAuthEnabled</code>: When set to <code>true</code> (the default is <code>false</code>), the JWT workspace token is automatically fetched and included in a workspace-specific cookie to allow requests to pass through the JWT proxy.</p>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
This setting potentially allows a <a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF</a> attack when used in conjunction with a server using POST requests.
</td>
</tr>
</table>
</div>
</li>
</ul>
</div>
<div class="paragraph">
<p>When starting a new server within a component, Che autodetects this, and the UI offers to automatically expose this port as a <code>public</code> port. This is useful for debugging a web application, for example. It is impossible to do this for servers that autostart with the container (for example, a database server). For such components, specify the endpoints explicitly.</p>
</div>
<div class="paragraph">
<p>Example specifying endpoints for <code>kubernetes</code>/<code>openshift</code> and <code>chePlugin</code>/<code>cheEditor</code> types:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
components:
- type: cheEditor
alias: theia-editor
id: eclipse/che-theia/next
endpoints:
- name: 'theia-extra-endpoint'
port: 8880
attributes:
discoverable: true
public: true
- type: chePlugin
id: redhat/php/latest
memoryLimit: 1Gi
endpoints:
- name: 'php-endpoint'
port: 7777
- type: chePlugin
alias: theia-editor
id: eclipse/che-theia/next
endpoints:
- name: 'theia-extra-endpoint'
port: 8880
attributes:
discoverable: true
public: true
- type: openshift
alias: webapp
reference: webapp.yaml
endpoints:
- name: 'web'
port: 8080
attributes:
discoverable: false
public: true
protocol: http
- type: openshift
alias: mongo
reference: mongo-db.yaml
endpoints:
- name: 'mongo-db'
port: 27017
attributes:
discoverable: true
public: false</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_kubernetes_and_openshift_resources"><a class="anchor" href="#_kubernetes_and_openshift_resources"></a>Kubernetes and OpenShift resources</h4>
<div class="paragraph">
<p>Complex deployments can be described using Kubernetes or OpenShift resource lists that can be referenced in the devfile. This makes them a part of the workspace.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
<div class="ulist">
<ul>
<li>
<p>Because a Che workspace is internally represented as a single deployment, all resources from the Kubernetes or OpenShift list are merged into that single deployment.</p>
</li>
<li>
<p>Be careful when designing such lists because this can result in name conflicts and other problems.</p>
</li>
<li>
<p>Only the following subset of the Kubernetes objects are supported: <code>deployments</code>, <code>pods</code>, <code>services</code>, <code>persistent volume claims</code>, <code>secrets</code>, and <code>ConfigMaps</code>. Kubernetes Ingresses are ignored, but OpenShift routes are supported. A workspace created from a devfile using any other object types fails to start.</p>
</li>
<li>
<p>When running Che on a Kubernetes cluster, only Kubernetes lists are supported. When running Che on an OpenShift cluster, both Kubernetes or OpenShift lists are supported.</p>
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
components:
- type: kubernetes
reference: ../relative/path/postgres.yaml</code></pre>
</div>
</div>
<div class="paragraph">
<p>The preceding component references a file that is relative to the location of the devfile itself. Meaning, this devfile is only loadable by a Che factory to which you supply the location of the devfile and therefore it is able to figure out the location of the referenced Kubernetes resource list.</p>
</div>
<div class="paragraph">
<p>The following is an example of the <code>postgres.yaml</code> file.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: v1
kind: List
items:
-
apiVersion: v1
kind: Deployment
metadata:
name: postgres
labels:
app: postgres
spec:
template:
metadata:
name: postgres
app:
name: postgres
spec:
containers:
- image: postgres
name: postgres
ports:
- name: postgres
containerPort: 5432
volumeMounts:
- name: pg-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: pg-storage
persistentVolumeClaim:
claimName: pg-storage
-
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: postgres
name: postgres
spec:
ports:
- port: 5432
targetPort: 5432
selector:
app: postgres
-
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pg-storage
labels:
app: postgres
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi</code></pre>
</div>
</div>
<div class="paragraph">
<p>For a basic example of a devfile with an associated Kubernetes or OpenShift list, see <a href="https://github.com/redhat-developer/devfile/tree/master/samples/web-nodejs-with-db-sample">web-nodejs-with-db-sample</a> on redhat-developer GitHub.</p>
</div>
<div class="paragraph">
<p>If you use generic or large resource lists from which you will only need a subset of resources, you can select particular resources from the list using a selector (which, as the usual Kubernetes selectors, works on the labels of the resources in the list).</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
components:
- type: kubernetes
reference: ../relative/path/postgres.yaml
selector:
app: postgres</code></pre>
</div>
</div>
<div class="paragraph">
<p>Additionally, it is also possible to modify the entrypoints (command and arguments) of the containers present in the resource list. For details of the advanced use case, see <a href="#end-user-guide:configuring-the-workspace-and-adding-tooling.adoc#defining specific-container-images" class="page unresolved">end-user-guide:configuring-the-workspace-and-adding-tooling.adoc#defining specific-container-images</a>.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_adding_commands_to_a_devfile"><a class="anchor" href="#_adding_commands_to_a_devfile"></a>Adding commands to a devfile</h3>
<div class="paragraph">
<p>A devfile allows to specify commands to be available for execution in a workspace. Every command can contain a subset of actions, which are related to a specific component in whose container it will be executed.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml"> commands:
- name: build
actions:
- type: exec
component: mysql
command: mvn clean
workdir: /projects/spring-petclinic</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can use commands to automate the workspace. You can define commands for building and testing your code, or cleaning the database.</p>
</div>
<div class="paragraph">
<p>The following are two kinds of commands:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Che specific commands: You have full control over what component executes the command.</p>
</li>
<li>
<p>Editor specific commands: You can use the editor-specific command definitions (example: <code>tasks.json</code> and <code>launch.json</code> in Che-Theia, which is equivalent to how these files work in VS Code).</p>
</li>
</ul>
</div>
<div class="sect3">
<h4 id="_che_specific_commands"><a class="anchor" href="#_che_specific_commands"></a>Che-specific commands</h4>
<div class="paragraph">
<p>Each Che-specific command features:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>An <code>action</code> attribute that is a command to execute.</p>
</li>
<li>
<p>A <code>component</code> attribute that specifies the container in which to execute the command.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The commands are run using the default shell in the container.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
components:
- type: dockerimage
image: golang
alias: go-cli
memoryLimit: 512Mi
mountSources: true
command: ['sleep', 'infinity']
env:
- name: GOPATH
value: $(CHE_PROJECTS_ROOT)/go
- name: GOCACHE
value: /tmp/go-cache
commands:
- name: compile and run
actions:
- type: exec
component: go-cli
command: “go get -d &amp;&amp; go run main.go”
workdir: “${CHE_PROJECTS_ROOT}/src/github.com/acme/my-go-project”</code></pre>
</div>
</div>
<div class="paragraph">
<p>+</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="ulist">
<ul>
<li>
<p>If a component to be used in a command must have an alias. This alias is used to reference the component in the command definition. Example: <code>alias: go-cli</code> in the component definition and <code>component: go-cli</code> in the command definition. This ensures that Eclipse&#160;Che can find the correct container to run the command in.</p>
</li>
<li>
<p>A command can have only one action.</p>
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="sect3">
<h4 id="_editor_specific_commands"><a class="anchor" href="#_editor_specific_commands"></a>Editor-specific commands</h4>
<div class="paragraph">
<p>If the editor in the workspace supports it, the devfile can specify additional configuration in the editor-specific format. This is dependent on the integration code present in the workspace editor itself and so is not a generic mechanism. However, the default Che-Theia editor within Eclipse&#160;Che is equipped to understand the <code>tasks.json</code> and <code>launch.json</code> files provided in the devfile.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: MyDevfile
projects:
- name: my-go-project
clonePath: go/src/github.com/acme/my-go-project
source:
type: git
location: https://github.com/acme/my-go-project.git
commands:
- name: tasks
actions:
- type: vscode-task
referenceContent: &gt;
{
"version": "2.0.0",
"tasks": [
{
"label": "create test file",
"type": "shell",
"command": "touch ${workspaceFolder}/test.file"
}
]
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>This example shows association of a <code>tasks.json</code> file with a devfile. Notice the <code>vscode-task</code> type that instructs the Che-Theia editor to interpret this command as a tasks definition and <code>referenceContent</code> attribute that contains the contents of the file itself. You can also save this file separately from the devfile and use <code>reference</code> attribute to specify a relative or absolute URL to it.</p>
</div>
<div class="paragraph">
<p>In addition to the <code>vscode-task</code> commands, the Che-Theia editor understands <code>vscode-launch</code> type using which you can specify the launch configurations.</p>
</div>
</div>
<div class="sect3">
<h4 id="_command_preview_url"><a class="anchor" href="#_command_preview_url"></a>Command preview URL</h4>
<div class="paragraph">
<p>It is possible to specify a preview URL for commands that expose web UI. This URL is offered for opening when the command is executed.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">commands:
- name: tasks
previewUrl:
port: 8080 <i class="conum" data-value="1"></i><b>(1)</b>
path: /myweb <i class="conum" data-value="2"></i><b>(2)</b>
actions:
- type: exec
component: go-cli
command: "go run webserver.go"
workdir: ${CHE_PROJECTS_ROOT}/webserver</code></pre>
</div>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>TCP port where the application listens. Mandatory parameter.</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td>The path part of the URL to the UI. Optional parameter. The default is root (<code>/</code>).</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The example above opens <code>http://__&lt;server-domain&gt;__/myweb</code>, where <code><em>&lt;server-domain&gt;</em></code> is the URL to the dynamically created Kubernetes Ingress or OpenShift Route.</p>
</div>
<div class="sect4">
<h5 id="_setting_the_default_way_of_opening_preview_urls"><a class="anchor" href="#_setting_the_default_way_of_opening_preview_urls"></a>Setting the default way of opening preview URLs</h5>
<div class="paragraph">
<p>By default, a notification that asks the user about the URL opening preference is displayed.</p>
</div>
<div class="paragraph">
<p>To specify the preferred way of previewing a service URL:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Open Che preferences in <strong>File &#8594; Settings &#8594; Open Preferences</strong> and find <code>che.task.preview.notifications</code> in the <strong>Che</strong> section.</p>
</li>
<li>
<p>Choose from the list of possible values:</p>
<div class="ulist">
<ul>
<li>
<p><code>on</code>&#8201;&#8212;&#8201;enables a notification for asking the user about the URL opening preferences</p>
</li>
<li>
<p><code>alwaysPreview</code>&#8201;&#8212;&#8201;the preview URL opens automatically in the <strong>Preview</strong> panel as soon as a task is running</p>
</li>
<li>
<p><code>alwaysGoTo</code>&#8201;&#8212;&#8201;the preview URL opens automatically in a separate browser tab as soon as a task is running</p>
</li>
<li>
<p><code>off</code>&#8201;&#8212;&#8201;disables opening the preview URL (automatically and with a notification)</p>
</li>
</ul>
</div>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_devfile_attributes"><a class="anchor" href="#_devfile_attributes"></a>Devfile attributes</h3>
<div class="paragraph">
<p>Devfile attributes can be used to configure various features.</p>
</div>
<div class="sect3">
<h4 id="attribute-editorfree_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#attribute-editorfree_making-a-workspace-portable-using-a-devfile"></a>Attribute: editorFree</h4>
<div class="paragraph">
<p>When an editor is not specified in a devfile, a default is provided. When no editor is needed, use the <code>editorFree</code> attribute. The default value of <code>false</code> means that the devfile requests the provisioning of the default editor.</p>
</div>
<div class="listingblock">
<div class="title">Example of a devfile without an editor</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: myApp
type: kubernetes
reference: my-app.yaml
attributes:
editorFree: true</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_attribute_persistvolumes_ephemeral_mode"><a class="anchor" href="#_attribute_persistvolumes_ephemeral_mode"></a>Attribute: persistVolumes (ephemeral mode)</h4>
<div class="paragraph">
<p>By default, volumes and PVCs specified in a devfile are bound to a host folder to persist data even after a container restart. To disable data persistence to make the workspace faster, such as when the volume back end is slow, modify the <code>persistVolumes</code> attribute in the devfile. The default value is <code>true</code>. Set to <code>false</code> to use <code>emptyDir</code> for configured volumes and PVC.</p>
</div>
<div class="listingblock">
<div class="title">Example of a devfile with ephemeral mode enabled</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:
type: git
location: 'https://github.com/che-samples/web-java-spring-petclinic.git'
attributes:
persistVolumes: false</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_attribute_asyncpersist_asynchronous_storage"><a class="anchor" href="#_attribute_asyncpersist_asynchronous_storage"></a>Attribute: asyncPersist (asynchronous storage)</h4>
<div class="paragraph">
<p>When <code>persistVolumes</code> is set to <code>false</code> (see above), the additional attribute <code>asyncPersist</code> can be set to <code>true</code> to enable asynchronous storage. See <a href="../../installation-guide/configuring-storage-types/" class="page">Configuring storage types</a> for more details.</p>
</div>
<div class="listingblock">
<div class="title">Example of a devfile with asynchronous storage enabled</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:
type: git
location: 'https://github.com/che-samples/web-java-spring-petclinic.git'
attributes:
persistVolumes: false
asyncPersist: true</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_attribute_mergeplugins"><a class="anchor" href="#_attribute_mergeplugins"></a>Attribute: mergePlugins</h4>
<div class="paragraph">
<p>This property can be set to manually control how plugins are included in the workspace. When the property <code>mergePlugins</code> is set to <code>true</code>, Che will attempt to avoid running multiple instances of the same container by combining plugins. The default value when this property is not included in a devfile is governed by the Che configuration property <code>che.workspace.plugin_broker.default_merge_plugins</code>; adding the <code>mergePlugins: false</code> attribute to a devfile will disable plugin merging for that workspace.</p>
</div>
<div class="listingblock">
<div class="title">Example of a devfile with plugin merging disabled</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:
type: git
location: 'https://github.com/che-samples/web-java-spring-petclinic.git'
attributes:
mergePlugins: false</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="objects-supported-in-che_making-a-workspace-portable-using-a-devfile"><a class="anchor" href="#objects-supported-in-che_making-a-workspace-portable-using-a-devfile"></a>Objects supported in Eclipse&#160;Che 7.18</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The following table lists the objects that are partially supported in Eclipse&#160;Che 7.18:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 11.1111%;">
<col style="width: 11.1111%;">
<col style="width: 11.1111%;">
<col style="width: 11.1111%;">
<col style="width: 55.5556%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Object</th>
<th class="tableblock halign-left valign-top">API</th>
<th class="tableblock halign-left valign-top">Kubernetes Infra</th>
<th class="tableblock halign-left valign-top">OpenShift Infra</th>
<th class="tableblock halign-left valign-top">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Pod</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">-</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Deployment</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">-</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ConfigMap</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">-</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">PVC</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">-</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Secret</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">-</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Service</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">-</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Ingress</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kubernetes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">No</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Minishift allows you to create Ingress and it works when the host is specified (OpenShift creates a route for it). But, the <code>loadBalancer</code> IP is not provisioned. To add Ingress support for the OpenShift infrastructure node, generate routes based on the provided Ingress.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Route</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">OpenShift</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">No</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The OpenShift recipe must be made compatible with the Kubernetes Infrastructure and, instead of the provided route, generate Ingress.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Template</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">OpenShift</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Yes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Kubernetes API does not support templates. A workspace with a template in the recipe starts successfully and the default parameters are resolved.</p></td>
</tr>
</tbody>
</table>
<div class="ulist">
<div class="title">Additional resources</div>
<ul>
<li>
<p><a href="https://redhat-developer.github.io/devfile/devfile">Devfile specifications</a></p>
</li>
</ul>
</div>
</div>
</div>
</article>
<aside class="toc sidebar" data-title="Contents" data-levels="2">
<div class="toc-menu"></div>
</aside>
</div>
</main>
</div>
<footer class="footer">
<div><a href="https://www.eclipse.org" target="_blank">Eclipse Foundation</a> |
<a href="https://www.eclipse.org/legal/privacy.php" target="_blank">Privacy Policy</a> |
<a href="https://www.eclipse.org/legal/termsofuse.php" target="_blank">Terms of Use</a> |
<a href="https://www.eclipse.org/legal/epl-2.0/" target="_blank">Eclipse Public License</a> |
<a href="https://www.eclipse.org/legal" target="_blank">Legal Resources</a></div>
</footer>
<script src="../../../_/js/site.js"></script>
<script async src="../../../_/js/vendor/highlight.js"></script>
</body>
</html>