# Eclipse Che
:::success
pour simplifier les besoins d'installation lors des formations
https://hackmd.io/@ffloreth/eclipse-che-educode-2019#/
> [name=Fabrice Flore-Thébault]
> [time=Educode, Bruxelles, 2019]
:::success
:::
<!-- .slide: data-background="https://www.heise.de/imgs/18/2/1/2/2/4/3/1/eclipse_che-c1c3e15925835c4b.jpeg" data-background-opacity="1" -->
---
## À propos
:::info
> [name=Fabrice Flore-Thébault]
* [x] Formation d'historien.
* [x] Adepte des logiciels libres.
* [x] Sysadmin, devops, automatisation IT.
* [x] Technical writer chez Red Hat.
* [x] Committer chez Eclipse Foundation.
* [ ] Écrire la documentation d'Eclipse Che.
:::
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2018/12/che-is-really-hot.jpg" data-background-opacity="0.9" -->
---
## Le besoin
:::info
des environnements de travail fonctionnels et homogènes
:::
:::danger
* [ ] pré-requis pour les participants:
* [ ] télécharger les ressources.
* [ ] installer les outils.
* [ ] premières heures de la formation:
* [ ] rendre fonctionnel l'environnement de travail
* [ ] chacun à son tour
:::
<!-- .slide: data-background="http://techgenix.com/tgwordpress/wp-content/uploads/2004/01/exchange.jpg" data-background-opacity="0.3" -->
Note:
Il est toujours compliqué de préparer un environnement de développement pour un atelier ou un cours. Il faut s'assurer que les participants ont bien suivi les recommandations pour les pré-requis, qu'ils ont bien téléchargé toutes les ressources nécessaires et ont été en mesure d'installer tous les outils.
En général, les premières heures sont passées à rendre les environnements de travail de tout le monde fonctionnels, au lieu de commencer tout de suite avec le réel contenu de la formation.
---
## La solution apportée par Eclipse Che
:::success
reproductibilité des environnements de développement
:::
<!-- .slide: data-background="http://techgenix.com/tgwordpress/wp-content/uploads/2004/01/exchange.jpg" data-background-opacity="0.8" -->
----
## Eclipse Che
:::success
L'utilisateur dispose directement dans son navigateur web d'un éditeur de texte complet, du code source nécessaire à son travail, et d'un environnement pour tester son application.
* [x] environnement de développement intégré (IDE)
* [x] plate-forme de développement collaborative
* [x] nativement basée sur Kubernetes.
:::
----
## Pour le travail en groupe
:::success
* [x] tout le monde dispose du même environnement
* [x] facile.
* [x] rapide.
* [x] accès ultérieur.
:::
---
## Préparation par l'enseignant
:::info
* [ ] Un compte par participant sur [Eclipse Che hébergé](https://che.openshift.io) (ou une instance dédiée).
* [ ] Créer un environnement par formation.
* [ ] Publier la définition de l'environnement.
* [ ] Distribuer le lien aux participants.
:::
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2019/03/overview-eclipse-che_lead.png" data-background-opacity="0.3" -->
----
## Languages supportés
:::info
Les languages de programmation les plus courants sont disponibles directement depuis l'interface.
:::
:::success
.NET Core - Apache Camel - Django - Go - Java - NodeJS - PHP - Python
:::
:::danger
Le language doit pouvoir fonctionner dans un conteneur sur un orchestrateur Kubernetes.
:::
----
## Définir un environnement adapté
:::info
Un fichier YAML appelé `devfile`.
La communauté propose des examples.
:::
----
{%gist themr0c/ef8e59a162748a8be07e900b6401e6a8%}
<!-- .slide: data-background="https://andrewlock.net/content/images/2017/04/yaml-banner.jpg" data-background-opacity="0.3" -->
----
## Publication de la définition de l'environnement
:::info
Accessible comme une ressource web.
:::
:::success
* [x] https://gist.github.com/themr0c/ef8e59a162748a8be07e900b6401e6a8
:::
<!-- .slide: data-background="https://www.heise.de/imgs/18/2/1/2/2/4/3/1/eclipse_che-c1c3e15925835c4b.jpeg" data-background-opacity="0.3" -->
---
## Utilisation par les participants
:::success
* [x] Un compte sur [Eclipse Che hébergé](https://che.openshift.io) (ou une instance dédiée).
* [x] Utiliser le `devfile.yaml` pour créer leur propre environnement.
:::
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2019/03/overview-eclipse-che_lead.png" data-background-opacity="0.3" -->
----
## Démarrer l'environnement
:::info
```
<URL de Che>/f?url=<URL du devfile>
```
:::
:::success
Exemple: https://che.openshift.io/f?url=https://gist.githubusercontent.com/themr0c/ef8e59a162748a8be07e900b6401e6a8/raw/8802c20743cde712bbc822521463359a60d1f7a9/devfile.yaml
:::
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2019/03/overview-eclipse-che_lead.png" data-background-opacity="0.9" -->
---
## Les avantages ?
:::success
* [x] Pas de temps perdu à télécharger, installer et configurer les outils.
* [x] Les participants sont opérationnels en un clic.
* [x] Les environnements des participants sont homogènes.
* [x] Les environnements des participants restent disponibles après le cours.
:::
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2019/01/EclipseChe_Logo.png" data-background-opacity="0.5" -->
---
## Questions ?
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2019/01/EclipseChe_Logo.png" data-background-opacity="0.5" -->
---
## Définitions
----
:::info
> [name=https://www.eclipse.org/che/]
> Eclipse Che is a Kubernetes-native IDE and developer collaboration platform built for teams and organizations.
:::
<!-- .slide: data-background="https://developers.redhat.com/blog/wp-content/uploads/2019/01/EclipseChe_Logo.png" data-background-opacity="0.9" -->
----
## IDE
:::info
Integrated Development environment
* [x] Collaboration: Pull/push code, Git Version control system
* [x] Edit code: editor, extensible with *plug-ins*
* [x] Run code: *Language servers*
* [x] Debug code: *Debug servers*
:::
<!-- .slide: data-background="https://patentimages.storage.googleapis.com/US20050097508A1/US20050097508A1-20050505-D00000.png" data-background-opacity="0.9" -->
----
## Kubernetes
> [name=https://kubernetes.io/]
> Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
> It groups containers that make up an application into logical units for easy management and discovery.
<!-- .slide: data-background="https://www.shapeblock.com/wp-content/uploads/2018/10/openshift-vs-kubernetes-1.jpg" data-background-opacity="0.9" -->
----
## Containerized applications
https://github.com/cncf/landscape/blob/master/README.md#trail-map
<!-- .slide: data-background="https://raw.githubusercontent.com/cncf/trailmap/master/CNCF_TrailMap_latest.png" data-background-opacity="0.5" data-background-position="top" -->
---
## Installer Eclipse Che avec Code-Ready Containers
----
## Install CRC
1. Download CRC and pull-secret from https://cloud.redhat.com/openshift/install/crc/installer-provisioned
2. Uncompress the archive
```bash=
$ tar xvf crc-linux-amd64.tar.xz
```
3. Install the binary in your $PATH
```bash=
$ cp crc-linux-1.0.0-beta.3-amd64/crc ~/.local/bin/
```
----
## Install crc prerequisites
```bash=
$ crc setup
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Caching oc binary
INFO Setting up virtualization
INFO Setting up KVM
INFO Installing libvirt service and dependencies
INFO Adding user to libvirt group
INFO Enabling libvirt
INFO Starting libvirt service
INFO Installing crc-driver-libvirt
INFO Removing older system-wide crc-driver-libvirt
INFO Setting up libvirt 'crc' network
INFO Starting libvirt 'crc' network
INFO Writing Network Manager config for crc
[sudo] password for ffloreth:
INFO Writing dnsmasq config for crc
INFO Unpacking bundle from the CRC binary
```
----
## Start crc
```bash=
$ crc start --pull-secret-file ~/Downloads/crc/pull-secret --memory 12288
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Checking if oc binary is cached
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Checking if user is part of libvirt group
INFO Checking if libvirt is enabled
INFO Checking if libvirt daemon is running
INFO Checking if crc-driver-libvirt is installed
INFO Checking if libvirt 'crc' network is available
INFO Checking if libvirt 'crc' network is active
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Checking if CRC bundle is cached in '$HOME/.crc'
INFO Loading bundle: crc_libvirt_4.1.11.crcbundle ...
INFO Extracting bundle: crc_libvirt_4.1.11.crcbundle ...
INFO Creating VM ...
INFO Verifying validity of the cluster certificates ...
INFO Check internal and public dns query ...
INFO Copying kubeconfig file to instance dir ...
INFO Adding user's pull secret and cluster ID ...
INFO Starting OpenShift cluster ... [waiting 3m]
INFO To access the cluster using 'oc', run 'eval $(crc oc-env) && oc login -u kubeadmin -p 78UVa-zNj5W-YB62Z-ggxGZ https://api.crc.testing:6443'
INFO Access the OpenShift web-console here: https://console-openshift-console.apps-crc.testing
INFO Login to the console with user: kubeadmin, password: 78UVa-zNj5W-YB62Z-ggxGZ
```
----
## Restart crc after a reboot
```bash=
crc start --pull-secret-file ~/Downloads/crc/pull-secret
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Checking if oc binary is cached
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Checking if user is part of libvirt group
INFO Checking if libvirt is enabled
INFO Checking if libvirt daemon is running
INFO Checking if crc-driver-libvirt is installed
INFO Checking if libvirt 'crc' network is available
INFO Checking if libvirt 'crc' network is active
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Checking if CRC bundle is cached in '$HOME/.crc'
INFO Starting stopped VM ...
INFO Verifying validity of the cluster certificates ...
INFO Check internal and public dns query ...
INFO Starting OpenShift cluster ... [waiting 3m]
INFO To access the cluster using 'oc', run 'eval $(crc oc-env) && oc login -u kubeadmin -p 78UVa-zNj5W-YB62Z-ggxGZ https://api.crc.testing:6443'
INFO Access the OpenShift web-console here: https://console-openshift-console.apps-crc.testing
INFO Login to the console with user: kubeadmin, password: 78UVa-zNj5W-YB62Z-ggxGZ
CodeReady Containers instance is running
```
----
## Install chectl
```bash=
$ bash <(curl -sL https://www.eclipse.org/che/chectl/)
chectl script requires superuser access.
You will be prompted for your password by sudo.
[sudo] password for ffloreth:
Downloading https://github.com/che-incubator/chectl/releases/download/20190814170217/chectl-linux-x64.tar.gz...
############################################################################################################### 100,0%
SUCCESS: chectl installed to /usr/local/bin/chectl
SUCCESS: installation log written in /home/remote/ffloreth/Downloads/crc/chectl-install.log
chectl/7.0.0 linux-x64 node-v10.16.2
```
----
## Login to OpenShift CLI
```bash=
$ eval $(crc oc-env) && oc login -u kubeadmin -p 78UVa-zNj5W-YB62Z-ggxGZ https://api.crc.testing:6443
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y
Login successful.
You don't have any projects. You can try to create a new project, by running
oc new-project <projectname>
```
----
## Start Che with `chectl`
```bash=
$ chectl server:start --platform=openshift --domain=.apps-crc.testing
✔ ✈️ Openshift preflight checklist
✔ Verify if oc is installed...done.
✔ Verify if openshift is running...done.
✔ Verify domain is set...set to .apps-crc.testing.
✔ 🏃 Running the Che Operator
✔ Copying operator resources...done.
✔ Create Namespace (che)...It already exist.
✔ Create ServiceAccount che-operator in namespace che...It already exist.
✔ Create Role che-operator in namespace che...It already exist.
✔ Create RoleBinding che-operator in namespace che...It already exist.
✔ Create CRD checlusters.org.eclipse.che...It already exist.
✔ Waiting 5 seconds for the new Kubernetes resources to get flushed...done.
✔ Create deployment che-operator in namespace che...It already exist.
✔ Create Che Cluster eclipse-che in namespace che...It already exist.
✔ ✅ Post installation checklist
✔ PostgreSQL pod bootstrap
✔ scheduling...done.
✔ downloading images...done.
✔ starting...done.
✔ Keycloak pod bootstrap
✔ scheduling...done.
✔ downloading images...done.
✔ starting...done.
✔ Devfile registry pod bootstrap
✔ scheduling...done.
✔ downloading images...done.
✔ starting...done.
✔ Plugin registry pod bootstrap
✔ scheduling...done.
✔ downloading images...done.
✔ starting...done.
✔ Che pod bootstrap
✔ scheduling...done.
✔ downloading images...done.
✔ starting...done.
✔ Retrieving Che Server URL...http://che-che.apps-crc.testing
✔ Che status check
Command server:start has completed successfully.
```
----
## Browse Che Web-UI
* Navigate to http://che-che.apps-crc.testing
* user: admin
* password: admin
* preferred browser: Chrome. Firefox appears to be poorly supported. [TBC]
{"metaMigratedAt":"2023-06-15T00:19:32.891Z","metaMigratedFrom":"YAML","title":"Eclipse Che, pour simplifier les besoins d'installation lors des formations","breaks":true,"description":"View the slide with \"Slide Mode\".","lang":"fr","slideOptions":"{\"data-background\":\"https://www.heise.de/imgs/18/2/1/2/2/4/3/1/eclipse_che-c1c3e15925835c4b.jpeg\",\"parallaxBackgroundImage\":\"https://www.heise.de/imgs/18/2/1/2/2/4/3/1/eclipse_che-c1c3e15925835c4b.jpeg\",\"parallaxBackgroundSize\":\"3071px 2023px\",\"parallaxBackgroundOpacity\":\"0.2\",\"theme\":\"league\"}","contributors":"[{\"id\":\"257f65c0-3756-4d07-ab0d-dcc80cd9931e\",\"add\":23695,\"del\":8861}]"}