# Devfile Registry *The Devfile Registry is based off of the Eclipse Che Devfile Registry and the base code can be found at [https://github.com/eclipse/che-devfile-registry](https://github.com/eclipse/che-devfile-registry)* - This registry holds the definitions of all the available devfiles in the Atlas system. It also holds the Dockerfiles to build the images that the devfiles themselves depend on. *The devfile Dockerfiles are based off of dockerfiles that are kept in the eclipse che dockerfiles project at [https://github.com/eclipse/che-dockerfiles](https://github.com/eclipse/che-dockerfiles)* --- ## Prerequisites ### To install necessary prerequisites 1. At the root directory of the ***che-tools*** source, run ```./install_prerequisites.sh``` from the terminal. 2. Log out and back in, if instructed to by the output of the preceeding step See [Atlas install_prerequisites notes](../che-tools/README.md) for detailed info. ([View github](https://github.com/optilogic/che-tools/blob/master/README.md) version) --- ## Opti-build ### This image can be built with ```opti-build.sh```. The valid command line options are - ```-t``` or ```-tag``` is the tag for the docker image(s) to be built (*i.e. 192.168.1.6:5000/atlas-che:**TAG***) - ```-r``` or ```-registry``` is the location of the Docker registry to publish the images too. Only specify this flag if you don't want to use your local registry - ```-n``` or ```--name``` is the name of the image to be built. This can be left blank as the script has a default value already specified. --- ## HOW TO BUILD/PREPARE THE IMAGE FOR DEPLOYMENT ### To build the Devfile Registry (```devfile-registry```) image - The images that are of importance are the ones listed in the ```IMAGE_NAMES``` list and the registry image itself. - In the root directory of this project, run ```./opti-build.sh -r ${REGISTRY} -t ${TAG}``` from the terminal - ```-r``` or ```--registry``` is the location of the registry you want to publish the image to (i.e. ```192.168.1.8:5000```) - ```-t``` or ```--tag``` is the tag given to the image to be built (i.e. ```7.12.3```) - This will execute build each of the images in the ```IMAGE_NAMES``` list and then build the devfile-registry image itself. ### *Please note that if you wish to only build a specific image (in addition to the registry image), please ensure that the proper lines are commented in the ```IMAGE_NAMES``` list.* --- ## HOW THE REGISTRIES WORK The Devfile and Plugin registries are libraries of metadata files. These files contain configurations and locations of images and/or other files that the particular devfile or plugin may require. Not every update requires a re-deploy of the registry. - Requires Re-deployment - Update of the .yaml metadata file - Addition of a new .yaml metadata file - ***DOES NOT*** Require Re-deployment - Update of a docker image that the devfile/plugin requires - Update of a file that the devfile/plugin requires ### *Please note that the images and/or files that the devfiles/plugins require are hosted in either a docker registry or other file share, and therefore, as long as their names/tags don't change, they can be updated independently of the registry itself.* [![Master Build Status](https://ci.centos.org/buildStatus/icon?subject=master&job=devtools-che-devfile-registry-build-master/)](https://ci.centos.org/job/devtools-che-devfile-registry-build-master/) [![Nightly Build Status](https://ci.centos.org/buildStatus/icon?subject=nightly&job=devtools-che-devfile-registry-nightly/)](https://ci.centos.org/job/devtools-che-devfile-registry-nightly/) [![Release Build Status](https://ci.centos.org/buildStatus/icon?subject=release&job=devtools-che-devfile-registry-release/)](https://ci.centos.org/job/devtools-che-devfile-registry-release/) [![Preview Release Build Status](https://ci.centos.org/buildStatus/icon?subject=release-preview&job=devtools-che-devfile-registry-release-preview/)](https://ci.centos.org/job/devtools-che-devfile-registry-release-preview/) # Eclipse Che devfile registry This repository holds ready-to-use Devfiles for different languages and technologies. ## Build registry container image This repository contains a `build.sh` script at its root that can be used to build the registry: ``` Usage: ./build.sh [OPTIONS] Options: --help Print this message. --tag, -t [TAG] Docker image tag to be used for image; default: 'nightly' --registry, -r [REGISTRY] Docker registry to be used for image; default 'quay.io' --organization, -o [ORGANIZATION] Docker image organization to be used for image; default: 'eclipse' --offline Build offline version of registry, with all artifacts included cached in the registry; disabled by default. --rhel Build using the rhel.Dockerfile (UBI images) instead of default ``` By default, the built registry will be tagged `quay.io/eclipse/che-devfile-registry:nightly`, and will be built with offline mode disabled. This script listens to the `BUILDER` variable, and will use the tool specified there to build the image. For example: ```sh BUILDER=buildah ./build.sh ``` will force the build to use `buildah`. If `BUILDER` is not specified, the script will try to use `podman` by default. If `podman` is not installed, then `buildah` will be chosen. If neither `podman` nor `buildah` are installed, the script will finally try to build with `docker`. Note that the Dockerfiles in this repository utilize multi-stage builds, so Docker version 17.05 or higher is required. ### Offline and airgapped registry images Using the `--offline` option in `build.sh` will build the registry to contain `zip` files for all projects referenced, which is useful for running Che in clusters that may not have access to GitHub. When building the offline registry, the docker build will 1. Clone all git projects referenced in devfiles, and 2. `git archive` them in the `/resources` path, making them available to workspaces. When deploying this offline registry, it is necessary to set the environment variable `CHE_DEVFILE_REGISTRY_URL` to the URL of the route/endpoint that exposes the devfile registry, as devfiles need to be rewritten to point to internally hosted zip files. ## Deploy the registry to OpenShift You can deploy the registry to Openshift as follows: ```bash oc new-app -f deploy/openshift/che-devfile-registry.yaml \ -p IMAGE="quay.io/eclipse/che-devfile-registry" \ -p IMAGE_TAG="nightly" \ -p PULL_POLICY="Always" ``` ## Kubernetes You can deploy Che devfile registry on Kubernetes using [helm](https://docs.helm.sh/). For example if you want to deploy it in the namespace `kube-che` and you are using `minikube` you can use the following command. ```bash NAMESPACE="kube-che" DOMAIN="$(minikube ip).nip.io" helm upgrade --install che-devfile-registry \ --debug \ --namespace ${NAMESPACE} \ --set global.ingressDomain=${DOMAIN} \ ./deploy/kubernetes/che-devfile-registry/ ``` You can use the following command to uninstall it. ```bash helm delete --purge che-devfile-registry ``` ## Run the registry ```bash docker run -it --rm -p 8080:8080 quay.io/eclipse/che-devfile-registry:nightly ``` ## CI The following [CentOS CI jobs](https://ci.centos.org/) are associated with the repository: - [`master`](https://ci.centos.org/job/devtools-che-devfile-registry-build-master/) - builds CentOS images on each commit to the [`master`](https://github.com/eclipse/che-devfile-registry/tree/master) branch and pushes them to [quay.io](https://quay.io/organization/eclipse). - [`nightly`](https://ci.centos.org/job/devtools-che-devfile-registry-nightly/) - builds CentOS images and pushes them to [quay.io](https://quay.io/organization/eclipse) on a daily basis from the [`master`](https://github.com/eclipse/che-devfile-registry/tree/master) branch. The `nightly` version of the devfile registry is used by default by the `nightly` version of the [Eclipse Che](https://github.com/eclipse/che), which is also built on a daily basis by the [`all-che-docker-images-nightly`](all-che-docker-images-nightly/) CI job. - [`release`](https://ci.centos.org/job/devtools-che-devfile-registry-release/) - builds CentOS and corresponding RHEL images from the [`release`](https://github.com/eclipse/che-devfile-registry/tree/release) branch. CentOS images are public and pushed to [quay.io](https://quay.io/organization/eclipse). RHEL images are also pushed to quay.io, but to the private repositories and then used by the ["Hosted Che"](https://www.eclipse.org/che/docs/che-7/hosted-che/) devfile registry - https://che-devfile-registry.openshift.io/. - [`release-preview`](https://ci.centos.org/job/devtools-che-devfile-registry-release-preview/) - builds CentOS and corresponding RHEL images from the [`release-preview`](https://github.com/eclipse/che-devfile-registry/tree/release-preview) branch and automatically updates ["Hosted Che"](https://www.eclipse.org/che/docs/che-7/hosted-che/) staging devfile registry deployment based on the new version of images - https://che-devfile-registry.prod-preview.openshift.io/. CentOS images are public and pushed to [quay.io](https://quay.io/organization/eclipse). RHEL images are also pushed to quay.io, but to the private repositories. ### License Che is open sourced under the Eclipse Public License 2.0.