Giter Club home page Giter Club logo

mule4-openshift's Introduction

Mule 4 on OpenShift

This is the companion repository to Mule on OpenShift: Part 2 - Build & Deploy blog post.

Here you will find:

  • image: An OpenShift-ready Mule 4 base image
  • sample-app: A sample Mule 4 application to build and deploy on top of the base image

Refer to the README file in each directory for more details.

Environment

This repo has been tested with Red Hat OpenShift Container Platform 3.11.

You may gain access to an instance by either signing up for OpenShift Online or running minishift as part of Red Hat CDK locally.

See Red Hat CDK Guide for tips on how to use CDK with this repo.

Caveat

Please note that some features, typically present in a production-ready image, have been stripped away in order to simplify the implementation for educational purposes. Examples include:

  • Pre-process application archive to
    • Remove any sensitive information
    • Align to container-friendly logging configuration
  • Enable properties encryption/decryption
  • Remove any JARs that score high in Common Vulnerability Scoring System (CVSS)
  • Add any common user libraries, not shipped with the runtime
  • CI/CD assets

mule4-openshift's People

Contributors

devnotfound avatar fefore avatar miosman avatar sohrab- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mule4-openshift's Issues

An Unwrapped Mule 4.2.x?

Hey Sohrab-,
Believe you said in your blog that the 4.2.x runtime breaks this approach.
Are you still keen on using the org.mule.runtime.module.reboot.MuleContainerBootstrap class and running the container with a process signature almost identical to the stock MuleSoft approach?
Accepting PR's?

Cheers

Understanding of this application

Hi Sohrab ,

Thanks for the article .

I see the repo where this mule sample-app is basic app .

What i want to achieve is that I have spring boot application , which i want to run in mule runtime inside docker container?

I don't know is i am thinking right way . Can you tell me can we run java spring boot application in mule runtime.

Also why we need mule runtime app?

I know it silly question but i have read lot of block not able to clear

JDK files link missing and microdnf entitlement certificates

Hi Sohrab,

I was reproducing the tutorial (thanks for putting that content together!) and while building the images to deploy Mule on Openshift I realised that the repository link to OpenJDK's tree ends-up missing. I worked-around that by cloning the 'java' repository from fabric8io-images and replaced in the image repo. Thought of raising this issue to note that as well as to ask for a help on the RH subscription-manager related issue (at the end of the image build).

Have you seen this error before ?

Cheers,

Jose

(process:421): librhsm-WARNING **: 09:40:37.165: Found 0 entitlement certificates
error: (--enablerepo) repo rhel-7-server-rpms not found

======= All detailed logs below:

joalmaraz@myhost:Mulesoft joalmaraz$ git clone https://github.com/sohrab-/mule4-openshift
Cloning into 'mule4-openshift'...
remote: Enumerating objects: 61, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 61 (delta 18), reused 40 (delta 7), pack-reused 0
Unpacking objects: 100% (61/61), done.
joalmaraz@myhost:Mulesoft joalmaraz$ oc import-image openshift/rhel-minimal:7.6 --from=registry.access.redhat.com/rhel-minimal:7.6 --confirm -n openshift
imagestream.image.openshift.io/rhel-minimal imported

Name: rhel-minimal
Namespace: openshift
Created: 4 minutes ago
Labels:
Annotations: openshift.io/image.dockerRepositoryCheck=2019-06-14T09:14:40Z
Docker Pull Spec: image-registry.openshift-image-registry.svc:5000/openshift/rhel-minimal
Image Lookup: local=false
Unique Images: 1
Tags: 1

7.6
tagged from registry.access.redhat.com/rhel-minimal:7.6

  • registry.access.redhat.com/rhel-minimal@sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f
    4 minutes ago

Image Name: rhel-minimal:7.6
Docker Image: registry.access.redhat.com/rhel-minimal@sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f
Name: sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f
Created: 2 seconds ago
Annotations: image.openshift.io/dockerLayersOrder=ascending
Image Size: 32.27MB in 2 layers
Layers: 32.26MB sha256:479fd70922a1968a7cd372cf254dd758f69cd249e97b61df33a9baf552c8b78d
1.182kB sha256:66ff9d46295ba757d3f3e604920a8df8e8e372549c05e8ee6a7cf0a4a0855423
Image Created: 2 weeks ago
Author: Red Hat, Inc.
Arch: amd64
Command: /bin/bash
Working Dir:
User:
Exposes Ports:
Docker Labels: architecture=x86_64
authoritative-source-url=registry.access.redhat.com
build-date=2019-05-30T15:39:47.794690
com.redhat.build-host=cpt-0007.osbs.prod.upshift.rdu2.redhat.com
com.redhat.component=rhel7-atomic-container
com.redhat.license_terms=https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel
description=The Red Hat Enterprise Linux Base image is designed to be a minimal, fully supported base image where several of the traditional operating system components such as python an systemd have been removed. The Atomic Image also includes a simple package manager called microdnf which can add/update packages as needed.
distribution-scope=public
io.k8s.description=The Red Hat Enterprise Linux Base image is designed to be a minimal, fully supported base image where several of the traditional operating system components such as python an systemd have been removed. The Atomic Image also includes a simple package manager called microdnf which can add/update packages as needed.
io.k8s.display-name=Red Hat Enterprise Linux 7
io.openshift.tags=minimal rhel7
name=rhel7-atomic
release=305
summary=Provides the latest release of Red Hat Enterprise Linux 7 in a minimal, fully supported base image where several of the traditional operating system components such as python an systemd have been removed.
url=https://access.redhat.com/containers/#/registry.access.redhat.com/rhel7-atomic/images/7.6-305
vcs-ref=0acab30b67d90ceb0f078456e79ea2b81792baea
vcs-type=git
vendor=Red Hat, Inc.
version=7.6
Environment: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
container=oci

joalmaraz@myhost:Mulesoft joalmaraz$ oc apply -f openshift/build.yaml
error: the path "openshift/build.yaml" does not exist
joalmaraz@myhost:Mulesoft joalmaraz$ ls
mule4-openshift
joalmaraz@myhost:Mulesoft joalmaraz$ cd mule4-openshift/
.git/ .gitmodules LICENSE README.md REDHAT_CDK.md image/ sample-app/
joalmaraz@myhost:Mulesoft joalmaraz$ cd mule4-openshift/image/
joalmaraz@myhost:image joalmaraz$ oc apply -f openshift/build.yaml
imagestream.image.openshift.io/mule4 unchanged
buildconfig.build.openshift.io/mule4 configured
joalmaraz@myhost:image joalmaraz$ oc start-build buildConfig/mule4 --from-dir=. --wait --follow
Uploading directory "." as binary input for the build ...
..
Uploading finished
build.build.openshift.io/mule4-2 started
Receiving source from STDIN as archive ...
Replaced Dockerfile FROM image registry.access.redhat.com/rhel-minimal:7.6
Caching blobs under "/var/cache/blobs".

Pulling image registry.access.redhat.com/rhel-minimal@sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f ...
Getting image source signatures
Copying blob sha256:66ff9d46295ba757d3f3e604920a8df8e8e372549c05e8ee6a7cf0a4a0855423
Copying blob sha256:479fd70922a1968a7cd372cf254dd758f69cd249e97b61df33a9baf552c8b78d
Copying config sha256:4364d4c393fff2812bc91d2776c5a553ee5a384f14316bf84ed7f0811eb1e0d8
Writing manifest to image destination
Storing signatures
STEP 1: FROM registry.access.redhat.com/rhel-minimal@sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f
STEP 2: ARG JAVA_VERSION=1.8.0
--> 4e38322d5be4815859fe50a2498f537e405107133c6e18efc06786c530222248
STEP 3: ARG MULE_VERSION=4.1.5
--> f1253173d5037f4709f0b0f891c08bf13eb7e0a515e910e83441b29bdaa64924
STEP 4: ARG AGENT_BOND_VERSION=1.2.0
--> eccba1aafe88f134061974fc4904ea99d0ac1f01f764eca00275b69adf93debd
STEP 5: ENV JAVA_MAJOR_VERSION=8 JAVA_HOME=/usr/lib/jvm/jre MULE_HOME=/opt/mule DEPLOYMENTS_DIR=/deployments S2I_SCRIPTS_DIR=/usr/local/s2i JAVA_APP_NAME=mule JAVA_APP_DIR=${MULE_HOME} JAVA_LIB_DIR=/opt JAVA_MAIN_CLASS=org.mule.runtime.module.launcher.MuleContainer
--> e406439926dc11bfcf439b065af73cce223d7904087214b668550d68e8113d02
STEP 6: LABEL maintainer="sohrab" name="mule4" summary="Mule:Unwrapped 4 on mininmal RHEL" description="Source To Image (S2I) Mule:Unwrapped image for Red Hat OpenShift" io.k8s.display-name="Mule:Unwrapped 4" io.k8s.description="Source To Image (S2I) Mule:Unwrapped image for Red Hat OpenShift" io.openshift.s2i.destination="${DEPLOYMENTS_DIR}" io.openshift.s2i.scripts-url="image://${S2I_SCRIPTS_DIR}" io.openshift.tags="mule,java"
--> c6fea41212146d8a5c57b02d4269cf27289699c40282a43380f99af9df9a18fa
STEP 7: EXPOSE 8778 9779
--> 13d00f0355528407d2b0bb09d1430e1d43788e54f0d5c3f1d99135842ce42a64
STEP 8: CMD ["/deployments/run-java.sh"]
--> 34eaa161debd968ce157db0b1952bd2cf279016549c3ba4f14d287a010cfe1d3
STEP 9: USER root
--> f00cb89f47576467a80f84b29e170ecd75f97482d2d359e4a42204dab5e58416
STEP 10: COPY fabric8-java-images/images/jboss/openjdk8/jdk/agent-bond-opts /opt/agent-bond-opts
error: build error: error building at STEP "COPY fabric8-java-images/images/jboss/openjdk8/jdk/agent-bond-opts /opt/agent-bond-opts": no files found matching "/tmp/build/inputs/fabric8-java-images/images/jboss/openjdk8/jdk/agent-bond-opts": no such file or directory
error: the build default/mule4-2 status is "Failed"

joalmaraz@myhost:image joalmaraz$ ls
Dockerfile README.md assemble classpath fabric8-java-images openshift run run-java-options

joalmaraz@myhost:image joalmaraz$ git clone https://github.com/fabric8io-images/java/
Cloning into 'java'...
remote: Enumerating objects: 214, done.
remote: Counting objects: 100% (214/214), done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 1483 (delta 98), reused 199 (delta 92), pack-reused 1269
Receiving objects: 100% (1483/1483), 186.21 KiB | 333.00 KiB/s, done.
Resolving deltas: 100% (873/873), done.
joalmaraz@myhost:image joalmaraz$ rm -rf fabric8-java-images
joalmaraz@myhost:image joalmaraz$ mv java/ fabric8-java-images
joalmaraz@myhost:image joalmaraz$ ls -la fabric8-java-images/
total 56
drwxr-xr-x 11 joalmaraz 2064491805 352 14 Jun 19:21 .
drwxr-xr-x 12 joalmaraz 2064491805 384 14 Jun 19:21 ..
drwxr-xr-x 12 joalmaraz 2064491805 384 14 Jun 19:21 .git
-rw-r--r-- 1 joalmaraz 2064491805 35 14 Jun 19:21 .gitignore
-rw-r--r-- 1 joalmaraz 2064491805 11347 14 Jun 19:21 LICENSE
-rw-r--r-- 1 joalmaraz 2064491805 1631 14 Jun 19:21 README.md
drwxr-xr-x 4 joalmaraz 2064491805 128 14 Jun 19:21 blocks
-rw-r--r-- 1 joalmaraz 2064491805 554 14 Jun 19:21 fish-pepper.yml
drwxr-xr-x 5 joalmaraz 2064491805 160 14 Jun 19:21 images
-rw-r--r-- 1 joalmaraz 2064491805 1592 14 Jun 19:21 images.yml
drwxr-xr-x 5 joalmaraz 2064491805 160 14 Jun 19:21 templates
joalmaraz@myhost:image joalmaraz$ ls fabric8-java-images/images/jboss/openjdk
openjdk7/ openjdk8/
joalmaraz@myhost:image joalmaraz$ ls fabric8-java-images/images/jboss/openjdk8/jdk/
Dockerfile README.md agent-bond-opts jmx_exporter_config.yml run-java.sh
joalmaraz@myhost:image joalmaraz$ ls fabric8-java-images/images/jboss/openjdk8/jdk/
Dockerfile README.md agent-bond-opts jmx_exporter_config.yml run-java.sh
joalmaraz@myhost:image joalmaraz$ ls fabric8-java-images/images/jboss/openjdk8/jdk/
joalmaraz@myhost:image joalmaraz$
joalmaraz@myhost:image joalmaraz$
joalmaraz@myhost:image joalmaraz$ ls
Dockerfile README.md assemble classpath fabric8-java-images openshift run run-java-options

----- After JDK location fix

joalmaraz@myhost:image joalmaraz$ oc start-build buildConfig/mule4 --from-dir=. --wait --follow
Uploading directory "." as binary input for the build ...
.........
Uploading finished
build.build.openshift.io/mule4-5 started
Receiving source from STDIN as archive ...
Replaced Dockerfile FROM image registry.access.redhat.com/rhel-minimal:7.6
Caching blobs under "/var/cache/blobs".

Pulling image registry.access.redhat.com/rhel-minimal@sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f ...
Getting image source signatures
Copying blob sha256:479fd70922a1968a7cd372cf254dd758f69cd249e97b61df33a9baf552c8b78d
Copying blob sha256:66ff9d46295ba757d3f3e604920a8df8e8e372549c05e8ee6a7cf0a4a0855423
Copying config sha256:4364d4c393fff2812bc91d2776c5a553ee5a384f14316bf84ed7f0811eb1e0d8
Writing manifest to image destination
Storing signatures
STEP 1: FROM registry.access.redhat.com/rhel-minimal@sha256:047376a92086620bcdabc31049bcf2d586809228a544f3a0320ed6a730845c4f
STEP 2: ARG JAVA_VERSION=1.8.0
--> 3fe66e50d1f83a5ec4a9c7792d084ce4cdc8048178e7e79295fb65efaf1e51e9
STEP 3: ARG MULE_VERSION=4.2.0
--> ce98d7ccce6146f0a1e255231b4858333492fe625ad0bb0818bd18d121135ff8
STEP 4: ARG AGENT_BOND_VERSION=1.2.0
--> 3360556a53a9cfe54b3d4e0060c2849b06c2e7a1fa16cc9feca5ee30b6a75a6b
STEP 5: ENV JAVA_MAJOR_VERSION=8 JAVA_HOME=/usr/lib/jvm/jre MULE_HOME=/opt/mule DEPLOYMENTS_DIR=/deployments S2I_SCRIPTS_DIR=/usr/local/s2i JAVA_APP_NAME=mule JAVA_APP_DIR=${MULE_HOME} JAVA_LIB_DIR=/opt JAVA_MAIN_CLASS=org.mule.runtime.module.launcher.MuleContainer
--> 0a3ae5fb12ffef58c9ef89e3c824b6bb8d46dee706019415d0be5429b286bfeb
STEP 6: LABEL maintainer="sohrab" name="mule4" summary="Mule:Unwrapped 4 on mininmal RHEL" description="Source To Image (S2I) Mule:Unwrapped image for Red Hat OpenShift" io.k8s.display-name="Mule:Unwrapped 4" io.k8s.description="Source To Image (S2I) Mule:Unwrapped image for Red Hat OpenShift" io.openshift.s2i.destination="${DEPLOYMENTS_DIR}" io.openshift.s2i.scripts-url="image://${S2I_SCRIPTS_DIR}" io.openshift.tags="mule,java"
--> 64eecb4f8dc19fd368420052692f6c0234bbe125911a60ad006cd7d369a2c6fe
STEP 7: EXPOSE 8778 9779
--> 252100538a1e8e8df36b954b479f82fa534712971ff94460fafd73cfe7d55527
STEP 8: CMD ["/deployments/run-java.sh"]
--> 6a4c09f0dee3ad4f31a8c6e40f67831dcae8ca0713798403ccbc52f6493447c5
STEP 9: USER root
--> 115cdfd79197cd136833b95aaacb9bc83ecbac4e1b69e3900d0837620de9d05a
STEP 10: COPY fabric8-java-images/images/jboss/openjdk8/jdk/agent-bond-opts /opt/agent-bond-opts
--> a9c935fab15950ceb19fc4670db76cfdd3e3ac061e02f21dbb9bb7f006d6f31f
STEP 11: COPY fabric8-java-images/images/jboss/openjdk8/jdk/jmx_exporter_config.yml /opt/agent-bond/
--> abc511c9b220fb3160dec99802f80b4f6a9da08ea52e837522ee7386c4777b19
STEP 12: COPY fabric8-java-images/images/jboss/openjdk8/jdk/run-java.sh ${DEPLOYMENTS_DIR}/
--> 810c376fb8c699292e05d8883a528adadc43e1b426884c5e670b09f0960e8d2f
STEP 13: COPY run-java-options classpath /opt/
--> 2a5aadee22d0895cef95f7cd2121926bb5526769bf684876df67bcc9bc1bef68
STEP 14: COPY assemble run /usr/local/s2i/
--> 9f8a05789b48d0dff045ee59eb7a12bcb7a0f2b092f20dbd5b4bf1a7d89fc673
STEP 15: COPY mule-ee-distribution-standalone-${MULE_VERSION}.tar.gz /tmp/
--> 33d07108b0f1004837a6c79425cee68a43772222a921f42285adf9c46e65b3ac
STEP 16: RUN microdnf --enablerepo=rhel-7-server-rpms --nodocs install gzip java-${JAVA_VERSION}-openjdk-headless tar unzip && tar -xvf /tmp/mule-ee-distribution-standalone-${MULE_VERSION}.tar.gz --directory /opt && ln -s /opt/mule-enterprise-standalone-${MULE_VERSION} ${MULE_HOME} && curl --fail --silent --show-error http://central.maven.org/maven2/io/fabric8/agent-bond-agent/${AGENT_BOND_VERSION}/agent-bond-agent-${AGENT_BOND_VERSION}.jar > /opt/agent-bond/agent-bond.jar && chown -R 1001:root /opt ${S2I_SCRIPTS_DIR} ${DEPLOYMENTS_DIR} && chmod -R g+rwX /opt ${S2I_SCRIPTS_DIR} ${DEPLOYMENTS_DIR} && chmod +x ${DEPLOYMENTS_DIR}/run-java.sh ${S2I_SCRIPTS_DIR}/{assemble,run} && rm -rvf /tmp/mule-ee-distribution-standalone-${MULE_VERSION}.tar.gz **&& microdnf clean all

(process:421): librhsm-WARNING **: 09:40:37.163: Found 0 entitlement certificates

(process:421): librhsm-WARNING : 09:40:37.165: Found 0 entitlement certificates
error: (--enablerepo) repo rhel-7-server-rpms not found
subprocess exited with status 1
subprocess exited with status 1
error: build error: error building at STEP "RUN microdnf --enablerepo=rhel-7-server-rpms --nodocs install gzip java-${JAVA_VERSION}-openjdk-headless tar unzip && tar -xvf /tmp/mule-ee-distribution-standalone-${MULE_VERSION}.tar.gz --directory /opt && ln -s /opt/mule-enterprise-standalone-${MULE_VERSION} ${MULE_HOME} && curl --fail --silent --show-error http://central.maven.org/maven2/io/fabric8/agent-bond-agent/${AGENT_BOND_VERSION}/agent-bond-agent-${AGENT_BOND_VERSION}.jar > /opt/agent-bond/agent-bond.jar && chown -R 1001:root /opt ${S2I_SCRIPTS_DIR} ${DEPLOYMENTS_DIR} && chmod -R g+rwX /opt ${S2I_SCRIPTS_DIR} ${DEPLOYMENTS_DIR} && chmod +x ${DEPLOYMENTS_DIR}/run-java.sh ${S2I_SCRIPTS_DIR}/{assemble,run} && rm -rvf /tmp/mule-ee-distribution-standalone-${MULE_VERSION}.tar.gz && microdnf clean all": exit status 1
error: the build default/mule4-5 status is "Failed"

Mule Soft Application Image building failing

STEP 1: FROM image-registry.openshift-image-registry.svc:5000/openshift/mule4@sha256:155d7b50801d6a58a408b89d29f9aec163de782881508c97832596a276ca845e
STEP 2: LABEL "io.openshift.build.image"="image-registry.openshift-image-registry.svc:5000/openshift/mule4@sha256:155d7b50801d6a58a408b89d29f9aec163de782881508c97832596a276ca845e" "io.openshift.build.source-location"="/tmp/build/inputs" "io.openshift.s2i.destination"="/deployments"
STEP 3: ENV OPENSHIFT_BUILD_NAME="sample-app-2" OPENSHIFT_BUILD_NAMESPACE="openshift"
STEP 4: USER root
STEP 5: COPY upload/src /deployments/src
STEP 6: RUN chown -R 185:0 /deployments/src
STEP 7: USER 185
STEP 8: RUN /usr/local/s2i/assemble
: invalid option
error: build error: error building at STEP "RUN /usr/local/s2i/assemble": error while running runtime: exit status 1
error: the build openshift/sample-app-2 status is "Failed"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.