Premiers pas avec MiniShift

Voici mes 1ers pas avec MiniShift, la version simple et légère de OpenShift RedHat à installer sur son Windows 10. J’ai déjà quelques VM sous VirtualBox. Je vais donc continuer avec cette contrainte.

Je vais juste vérifier que la plateforme s’exécute correctement avec une application JEE (on ne se refait pas) de démonstration.

Étapes:

  1. Téléchargement sur https://github.com/minishift/minishift/releases
  2. Je l’ai décompressé dans c:\Redhat\MiniShift
  3. 1er Lancement
minishift start --vm-driver=virtualbox
Starting local OpenShift cluster using 'virtualbox' hypervisor...

L’installation ne bouge pas 🙁 . Alors, un petit RAZ est nécessaire:

minishift delete
Deleting the Minishift VM...
Minishift VM deleted.

Et suppression du répertoire .minishift/ du profile Windows.

4. 2nd lancement. C’est mieux 🙂

minishift.exe start --vm-driver virtualbox -v 5 --show-libmachine-logs
Starting local OpenShift cluster using 'virtualbox' hypervisor...
Downloading ISO 'https://github.com/minishift/minishift-b2d-iso/releases/download/v1.0.1/minishift-b2d.iso'
39.00 MB / 39.00 MB [=====================================================================================================================================================================] 100.00% 0s
Found binary path at minishift.exe
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:54024
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minishift) Calling .GetMachineName
(minishift) Calling .DriverName

[...]

Image pull complete
-- Checking Docker daemon configuration ... OK
-- Checking for available ports ... OK
-- Checking type of volume mount ...
Using Docker shared volumes for OpenShift volumes
-- Creating host directories ... OK
-- Finding server IP ...
Using 192.168.99.101 as the server IP
-- Starting OpenShift container ...
Creating initial OpenShift configuration
Starting OpenShift using container 'origin'
Waiting for API server to start listening
OpenShift server started
-- Adding default OAuthClient redirect URIs ... OK
-- Installing registry ... OK
-- Installing router ... OK
-- Importing image streams ... OK
-- Importing templates ... OK
-- Login to server ... OK
-- Creating initial project "myproject" ... OK
-- Removing temporary directory ... OK
-- Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://192.168.99.101:8443

You are logged in as:
User: developer
Password: developer

To login as administrator:
oc login -u system:admin

Making call to close driver server
(minishift) Calling .Close
Successfully made call to close driver server
(minishift) DBG | Closing plugin on server side
Making call to close connection to plugin binary
Making call to close driver server
(minishift) Calling .Close
Successfully made call to close driver server
Making call to close connection to plugin binary
(minishift) DBG | Closing plugin on server side
Making call to close driver server
(minishift) Calling .Close
Successfully made call to close driver server
Making call to close connection to plugin binary
(minishift) DBG | Closing plugin on server side

5. Ajout de l’outil de commande en ligne OC dans le PATH Windows.

set OC_HOME=C:\Users\emman\.minishift\cache\oc\v1.4.1
set PATH=%PATH%;%OC_HOME%

6. Déploiement de l’application JEE de démo

oc new-app https://github.com/openshift/jee-ex -l name=jee-example --image-stream="openshift/wildfly:10.1"
--> Found image 5bba855 (9 days old) in image stream "wildfly" in project "openshift" under tag "10.1" for "openshift/wildfly:10.1"

    WildFly 10.1.0.Final
    --------------------
    Platform for building and running JEE applications on WildFly 10.1.0.Final

    Tags: builder, wildfly, wildfly10

    * The source repository appears to match: jee
    * A source build using source code from https://github.com/openshift/jee-ex will be created
      * The resulting image will be pushed to image stream "jee-ex:latest"
      * Use 'start-build' to trigger a new build
    * This image will be deployed in deployment config "jee-ex"
    * Port 8080/tcp will be load balanced by service "jee-ex"
      * Other containers can access this service through the hostname "jee-ex"

--> Creating resources with label name=jee-example ...
    imagestream "jee-ex" created
    buildconfig "jee-ex" created
    deploymentconfig "jee-ex" created
    service "jee-ex" created
--> Success
    Build scheduled, use 'oc logs -f bc/jee-ex' to track its progress.
    Run 'oc status' to view your app.

7. Suivi de l’installation

oc logs -f bc/jee-ex
Cloning "https://github.com/openshift/jee-ex" ...
        Commit: 5e2ca5eeb2cd4221cdc4a6da14d3f7103f96332d (Merge pull request #1 from oatmealraisin/master)
        Author: Ben Parees <bparees@users.noreply.github.com>
        Date:   Wed Aug 31 17:01:31 2016 -0400

Found pom.xml... attempting to build with 'mvn package -Popenshift -DskipTests -B -s /opt/app-root/src/.m2/settings.xml'
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.27-boot2docker", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SampleApp 1.0
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[...]
[INFO] Processing war project
[INFO] Copying webapp resources [/opt/app-root/src/src/main/webapp]
[INFO] Webapp assembled in [21 msecs]
[INFO] Building war: /opt/app-root/src/target/ROOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.208 s
[INFO] Finished at: 2017-03-11T18:37:52+00:00
[INFO] Final Memory: 14M/139M
[INFO] ------------------------------------------------------------------------
Moving built war files into /wildfly/standalone/deployments for later deployment...
Moving all war artifacts from /opt/app-root/src/target directory into /wildfly/standalone/deployments for later deployment...
'/opt/app-root/src/target/ROOT.war' -> '/wildfly/standalone/deployments/ROOT.war'
Moving all ear artifacts from /opt/app-root/src/target directory into /wildfly/standalone/deployments for later deployment...
Moving all rar artifacts from /opt/app-root/src/target directory into /wildfly/standalone/deployments for later deployment...
Moving all jar artifacts from /opt/app-root/src/target directory into /wildfly/standalone/deployments for later deployment...
...done


Pushing image 172.30.190.15:5000/myproject/jee-ex:latest ...
Pushed 0/12 layers, 1% complete
...
Pushed 12/12 layers, 100% complete
Push successful

8. Exposition de l’application jee-ex

oc expose svc/jee-ex
route "jee-ex" exposed

9. Status du déploiement de jee-ex

oc login -u system:admin
Logged into "https://192.168.99.101:8443" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-system
  * myproject
    openshift
    openshift-infra

Using project "myproject".
 
oc status
In project My Project (myproject) on server https://192.168.99.101:8443

http://jee-ex-myproject.192.168.99.101.xip.io to pod port 8080-tcp (svc/jee-ex)
  dc/jee-ex deploys istag/jee-ex:latest &amp;lt;-
    bc/jee-ex source builds https://github.com/openshift/jee-ex on openshift/wildfly:10.1
    deployment #1 deployed 16 hours ago - 1 pod

10. Ouverture de l’application jee-ex: http://jee-ex-myproject.192.168.99.101.xip.io

10. Accès à la console: https://192.168.99.101:8443/console

User / Password: developer

L’application jee-ex est bien référencée et déployée.

La plateforme OpenShift via MiniShift fonctionne bien. Je vais pouvoir passer à la marche supérieure 😀 .

Laisser un commentaire