sohrab- / mule4-openshift

Mule:Unwrapped 4
MIT License
7 stars 8 forks source link

Mule Soft Application Image building failing #7

Closed Charbak closed 3 years ago

Charbak commented 3 years ago

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"

sohrab- commented 3 years ago

@Charbak, are you running this on Windows? I normally see that error when a script is copied into the container from Windows and the CRLF line ending are not compatible with Linux inside the container. Some code editors allow you to fix this on Windows, I believe.

Charbak commented 3 years ago

@sohrab- I am using OC clinet running on windows 10 and pushing that to OCP cluster running externally to IBM cloud. For application image creation, I cant see Docker file. From where it is getting the steps when executing

Build the image! oc start-build buildConfig/sample-app --from-file=./target/sample-app-1.0.0-SNAPSHOT-mule-application.jar --wait --follow

Charbak commented 3 years ago

@sohrab- I converted build.YAML and deploy.YAML under /openshift folder to LF through Visual Studio. But still it is getting stuck 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-5 status is "Failed"

Can you pls highlight from where it is taking the steps. I cant find docker file under sample-app folder.

Charbak commented 3 years ago

@sohrab- I again build the image and again trigger to create application image after converting all YAML to LF. It fails with below error. Can you check now.

STEP 8: RUN /usr/local/s2i/assemble ---> Moving Mule App to deployment directory... mv: cannot move '/deployments/src/sample-app-1.0.0-SNAPSHOT-mule-application.jar' to '/opt/mule/apps/': No such file or directory 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-6 status is "Failed"

sohrab- commented 3 years ago

Sorry, I think my instructions weren't clear.

  1. Update only assemble script to convert the line ending
  2. Rebuild the base image again
  3. Build mule app and run OpenShift build

There is no Dockerfile because this using s2i.

Charbak commented 3 years ago

@sohrab- Already did. But assemble script is failing.

Base image built was successful but application image is failing.

Adding transient rw bind mount for /run/secrets/rhsm STEP 1: FROM image-registry.openshift-image-registry.svc:5000/openshift/mule4@sha256:39e53fa55ac6bfb8fd4568fe3baca4f48b22be1240da10d15b87528010864832 STEP 2: LABEL "io.openshift.build.image"="image-registry.openshift-image-registry.svc:5000/openshift/mule4@sha256:39e53fa55ac6bfb8fd4568fe3baca4f48b22be1240da10d15b87528010864832" "io.openshift.build.source-location"="/tmp/build/inputs" "io.openshift.s2i.destination"="/deployments" STEP 3: ENV OPENSHIFT_BUILD_NAME="sample-app-6" 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 ---> Moving Mule App to deployment directory... mv: cannot move '/deployments/src/sample-app-1.0.0-SNAPSHOT-mule-application.jar' to '/opt/mule/apps/': No such file or directory 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-6 status is "Failed"

Charbak commented 3 years ago

@sohrab- I fixed the issue this way. I added creation of the directory in docker file. Rebuilt the base image and run the application image and it works...

RUN \
  mkdir -p ${MULE_HOME}/apps && chown -R 185:root ${MULE_HOME}/apps \
  # Install Mule server
  && unzip /tmp/mule-ee-distribution-standalone-${MULE_VERSION}.zip -d /opt \
    && ln -s /opt/mule-enterprise-standalone-${MULE_VERSION} ${MULE_HOME} \

But getting the exception as accessing the application. /usr/local/s2i/run: line 15: /opt/jboss/container/maven/default//scl-enable-maven: No such file or directory Starting the Java application using /opt/jboss/container/java/run/run-java.sh ... INFO exec -a 'mule' java -javaagent:/usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -Dmule.home=/opt/mule -Dmule.base=/opt/mule -Djava.net.preferIPv4Stack=TRUE -Dmvel2.disable.jit=TRUE -Dorg.glassfish.grizzly.nio.transport.TCPNIOTransport.max-receive-buffer-size=1048576 -Dorg.glassfish.grizzly.nio.transport.TCPNIOTransport.max-send-buffer-size=1048576 -Dorg.quartz.scheduler.skipUpdateCheck=true -Dmule.metadata.cache.entryTtl.minutes=10 -Dmule.metadata.cache.expirationInterval.millis=5000 -Dlog4j2.disable.jmx=true -Djava.locale.providers=COMPAT,CLDR,SPI -Djava.library.path=/opt/mule/lib/boot -Dwrapper.native_library=wrapper -Xms94m -Xmx375m -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=256m -XX:MetaspaceSize=128m -XX:+ExitOnOutOfMemoryError -cp ".:/opt:/opt/mule-licence:/opt/mule-app-properties:/opt/mule/conf:/opt/mule/lib/boot/*" org.mule.runtime.module.reboot.MuleContainerBootstrap
Error: Could not find or load main class org.mule.runtime.module.reboot.MuleContainerBootstrap

I am using "mule-ee-distribution-standalone-4.3.0-20210224.zip" as runtime. I cant find exact "mule-ee-distribution-standalone-4.3.0-20210322.zip" in the distribution list. Is the problem due to that?

Charbak commented 3 years ago

@sohrab- Can you pls see about this error after rollout deployment Error: Could not find or load main class org.mule.runtime.module.reboot.MuleContainerBootstrap

miosman commented 3 years ago

Hi @Charbak, you shouldn't need to create the apps directory as it is part of the mule-ee runtime. If you expand the zip file of a mule 4.3 standalone runtime locally you should see a directory structure similar to this. Screenshot 2021-05-10 234743

If the file you got doesn't have this structure, it is likely the cause of the errors you are facing.

Charbak commented 3 years ago

@miosman Thanks for the response.

I downloaded the mule-ee runtime zip file from https://github.com/mulesoft/mule/releases File name: mule-4.3.0-20210322.zip

I cant see the directory structure you pasted above in the downloaded file. Am I downloading from correct location?

Also the name of the Zip files that you mentioned "mule-ee-distribution-standalone-4.3.0-20210322.zip" not matching what I downloaded. This is the structure if I unzip locally. image

miosman commented 3 years ago

The files in that git repo you mentioned don't contain the full runtime. The full mule ee runtime can be downloaded from Anypoint Support site if you have a subscription or through https://www.mulesoft.com/lp/dl/mule-esb-enterprise for a 30 day trial. If the version of the runtime file doesn't match the version in the Dockerfile, you just need to adjust the version argument within the dockerfile.

Charbak commented 3 years ago

@miosman Atlast it gets deployed on Openshift cluster.

image

If I hit the route link , route is showing "Connection Time Out". How to test the application if you can guide.

miosman commented 3 years ago

@Charbak The sample application only has one endpoint on /api/v1/somethings so you should be able to hit the endpoint from your route on http:///api/v1/somethings

Charbak commented 3 years ago

@miosman Yes, Openshift route is giving me the below url http://sample-app-openshift.sol-arc-bootcamp-232932-f72ef11f3ab089a8c677044eb28292cd-0000.sjc03.containers.appdomain.cloud/api/v1/somethings

When hit the URL, it is giving timed out error. image

miosman commented 3 years ago

This looks like an issue with the openshift cluster router check if you cluster allows external routes on that domain or not. As far as the sample application is concerned you can skip the route and hit the application directly by either doing a proxy forward from the commandline or going into the pod terminal from the openshift webconsole and hitting the local endpoint http://localhost:8085/api/v1/somethings with curl.

Charbak commented 3 years ago

Thanku @miosman ...at last it is working!

Charbak commented 3 years ago

Closing the defect and thanks for your support.