This project is useful if you want to try RHAMT on an OpenShift instance.
If you just want to test RHAMT using the images we have made available in the docker.io repository, go straight to the OpenShift template deployment section.
If you have made some changes to RHAMT and you want to test them on an OpenShift instance, in the next paragraph you'll find all the information for building your own docker images so that you're free to test your code.
There's also the case that you don't have an OpenShift instance available and, in this scenario, Red Hat Container Development Kit can help you working locally on your machine with any need for an OpenShift instance to test your changes to the code. In this case please follow the instructions in the Working with Red Hat Container Development Kit section.
For building this project and creating Docker images you have to have a Docker instance running locally on your machine so that you can pull the built images.
Next you'll find some basic instructions to install Docker based on your local OS.
- Install Docker:
$ sudo dnf install docker
- Configure
docker
group (ref. Manage Docker as a non-root user):$ sudo groupadd docker
$ sudo usermod -aG docker $USER
- Log out and log back in so that your group membership is re-evaluated
- Test Docker is working:
$ docker run hello-world
For any issue related to installation, you can refer to Docker documentation.
For any other platform you can follow the detailed instructions provided in the Install Docker guide from Docker.
You need an account on https://hub.docker.com in order to push your images and have them available in the docker.io repository.
So sign up yourself to Docker Hub at https://hub.docker.com taking care that the Docker ID you choose will be the <your_docker_id>
value in the next steps.
- Build this project:
$ mvn clean install -Ddocker.name.windup.web=<your_docker_id>/windup-web-openshift -Ddocker.name.windup.web.executor=<your_docker_id>/windup-web-openshift-messaging-executor
- Push images to docker hub:
$ docker login
$ docker push <your_docker_id>/windup-web-openshift
$ docker push <your_docker_id>/windup-web-openshift-messaging-executor
If you want you can also set the tag for the built images (e.g. if you are working on a specific branch and you want to create images tagged with the branch name), you just have to add the tag name to the docker.name.windup.web
and docker.name.windup.web.executor
system properties' values (i.e. from the above example -Ddocker.name.windup.web=<your_docker_id>/windup-web-openshift:tag_value -Ddocker.name.windup.web.executor=<your_docker_id>/windup-web-openshift-messaging-executor:tag_value
)
Now that your images are available on docker.io repository, you have to reference them in RHAMT template in order to use these images in the deployments.
- open
./web/templates/web-template.json
in an IDE or text editor - change all the
"image"
values to point todocker.io/<your_docker_id>/
instead ofdocker.io/windup3/
There are two different ways for deploying RHAMT on OpenShift based upon if you have cluster-admin privileges
: if you have those privileges you can decide to follow Template deployment in OpenShift catalog (because you can operate on the default openshift
project) or Import template in Openshift Web Console otherwise you can just go with the latter approach (Import template in Openshift Web Console)
- login to Openshift:
$ oc login
- create the template:
$ oc create -f ./web/templates/web-template.json -n openshift
Now, if you go to OpenShift Web Console home page, you'll see the Red Hat Application Migration Toolkit (ref. screenshot-0) in the list of the available templates and so you can deploy it to a project just like any other template.
screenshot-0: in OpenShift Web Console (v3.7)
Browse Catalog
page you can see the Red Hat Application Migration Toolkit 4.1
icon (4th row, 2nd column)
- copy the raw content of file web-template.json
- paste it in the "Import YAML / JSON" wizard in Openshift Web Console (ref. screenshot-1)
- save and wait for the deployment to end
screenshot-1: in OpenShift Web Console (v3.7)
Import YAML / JSON
wizard you can paste template raw content
If you want to build locally your own images without the need to push them to the Docker repository, you can use Red Hat Container Development Kit (CDK).
"Red Hat Container Development Kit provides a pre-built Container Development Environment based on Red Hat Enterprise Linux to help you develop container-based applications quickly." (ref. Red Hat Container Development Kit documentation).
For installing CDK, please refer to the https://developers.redhat.com web site where you can find the Hello World! guide.
Once you have a fully working CDK instance, you can follow the next steps:
- [optional]
$ systemctl stop docker
(do this only if you have Docker running on your machine) $ minishift docker-env
to display the command you need to type into your shell in order to configure your Docker client since the command output will differ depending on OS and shell type- execute the command from the step before
$ docker ps
to test that it's working fine and you can see in output a list of running containers$ oc login -u developer -p whatever
to login to CDK OpenShift (the-p
password parameter can really be whatever value you want for thedeveloper
pre-built user in the CDK)$ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)
to log into the CDK OpenShift Docker registry$ mvn clean install -Ddocker.name.windup.web=$(minishift openshift registry)/$(oc project -q)/windup-web-openshift:latest -Ddocker.name.windup.web.executor=$(minishift openshift registry)/$(oc project -q)/windup-web-openshift-messaging-executor:latest
to build the Docker images for this project with the right tags to push them to CDK OpenShift Docker registry$ docker push $(minishift openshift registry)/$(oc project -q)/windup-web-openshift
to push the image to the registry to create an image stream$ docker push $(minishift openshift registry)/$(oc project -q)/windup-web-openshift-messaging-executor
to push the image to the registry to create an image stream- now, before proceeding, you have to follow the above instructions about OpenShift template deployment
- once you have successufully deployed, you can change the deployments to point to your local images.
Go toDeployments
web page and:- choose
rhamt-web-console
deployment page - select
Actions
=>Edit
from the top right button (ref.) - check the
Deploy images from an image stream tag
box and select the values for theImage Stream Tag
comboboxes selecting your project's name asNamespace
,windup-web-openshift
forImage Stream
andlatest
forTag
- push the
Save
button at the bottom of the page - repeat these steps for
rhamt-web-console-executor
deployment usingwindup-web-openshift-messaging-executor
asImage Stream
combox value
- choose
Now your deployments are using the Docker images you have built locally on your machine and, whenever you update these images, new deployments will be triggered automatically when docker push
command executes.
If you need more informations about how to interact with the CDK OpenShift Docker registry, please refer to the Accessing the OpenShift Docker Registry guide.