- About
- Installing OpenShift locally (on a macOS, using Minishift)
- Installing (Xhye)
- Installing (Minishift)
- Configuring
- Starting
- Restarting Minishift without parameters
- Testing the oc command
- Running a Docker container (hello-world)
- Getting ip
- Deploying a Node.js application
- Fast Iterative Java Development on OpenShift/Kubernetes Using Rsync
- Stoping
- Removing (Minishift)
- Removing (Xhyve)
- Building microservices
- More references
The intention in the steps and references pointed out in this document is to simplify your self study about OpenShift and microservices.
The steps were designed to run the latest OpenShift version (v1.5.0-alpha.3) available at "2025-04-23 01:23:23 -0700".
About the author: http://j.mp/whoispj
$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ brew tap caskroom/versions
$ brew cask install minishift-beta
$ minishift version
$ minishift config set memory 7168
$ minishift config set cpus 4
$ minishift config set v 999
$ minishift config view
-
Starting:
$ openshift_version=v1.5.0-alpha.3 $ minishift start --openshift-version=$openshift_version --logtostderr --show-libmachine-logs $ minishift status
-
This will starts Minishift using the default OpenShift version (v1.4.1)
$ minishift stop $ minishift start
-
To configure Minishift to start OpenShift with version v1.5.0-alpha.3 do:
$ minishift stop $ tree ~/.minishift | less $ minishift config set openshift-version $openshift_version
-
View config and restart Minishift:
$ minishift config view $ minishift start
-
Configuring PATH to find
oc
command:
$ tree ~/.minishift | less $ f=~/.bash_profile $ echo "export PATH=~/.minishift/cache/oc/$openshift_version:\$PATH" >> $f $ source $f $ echo $PATH
-
Getting projects:
$ oc get projects
$ eval $(minishift docker-env)
$ docker run hello-world
$ docker ps -a
$ docker images
$ docker rmi -f hello-world
$ docker images
$ oc new-app https://github.com/openshift/nodejs-ex -l name=myapp
$ oc logs -f bc/nodejs-ex &
$ open -a Firefox https://$(minishift ip):8443
-
The comand
oc logs
(above) will take some time …
$ docker images
$ oc get pods
$ oc expose svc/nodejs-ex
$ curl http://nodejs-ex-myproject.$(minishift ip).xip.io
$ IMAGE=registry.access.redhat.com/jboss-eap-7/eap70-openshift
$ REPO=https://github.com/paulojeronimo/openshift-javaee-helloworld
$ git clone $REPO
$ cd ${REPO##*/}
$ oc new-app $IMAGE~$REPO
$ oc logs -f bc/${REPO##*/} # it will take some time ...
$ oc expose service ${REPO##*/}
$ mvn package -Popenshift
$ oc get pods # To get the name of the running pod you will sync to
$ oc rsync --include="ROOT.war" --exclude="*" target/ <pod_name>:/deployments/ --no-perms=true --watch # Replace <pod_name> with the value from the previous step
$ rm -rf ~/.{minishift,kubes}
$ brew cask remove minishift
-
Refs:
-
Cloning and going to REPO dir:
$ REPO=https://github.com/redhat-helloworld-msa/hola $ git clone $REPO && cd $_ $ tree
-
Running locally (via Maven):
$ log=/tmp/hola.log $ mvn wildfly-swarm:run &> $log & $ tail -f $log & $ open http://localhost:8080/api/hola $ kill %1
-
Running in Docker:
$ mvn clean $ mvn package wildfly-swarm:package $ find . -name 'hola*.jar' $ cat Dockerfile $ docker build -t redhatmsa/hola . $ docker images $ docker run redhatmsa/hola &> $log & $ kill %3 $ docker run -e JAVA_OPTIONS=-Xmx1g redhatmsa/hola &> $log & $ !-2
-
Removing "Exited" "redhatmsa/hola" containers:
$ docker ps -a $ !! | awk '$2 == "redhatmsa/hola" { print $1 }' $ docker rm $(!!) $ !-3
-
Deploy on OpenShift (via
oc
):
$ oc new-app redhatmsa/hola -e JAVA_OPTIONS=Xmx1g $ oc env dc/hola JAVA_OPTIONS=-Xmx200m
-
Running in OpenShift (via Maven/Fabric8)
$ mvn clean package docker:build fabric8:json fabric8:apply
Finishing tail
:
$ kill %2
-
Refs:
-
Other ways to install OpenShift locally:
-
v JUG hagouts:
-
Book Reading Club: "Building Microservices" by Sam Newman (Part 1), (Part 2), (Part 3)
-
-
Other DFJUG hangouts (pt-br)
-