Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-ISSUE: Use image-builder and maven-m2-repo-via-http-image to build serverless-logic-web-tools-swf-dev-mode-image #2574

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

thiagoelg
Copy link
Member

This PR refactors the build process of the serverless-logic-web-tools-swf-dev-mode-image package to use our image-builder and maven-m2-repo-via-http-image tools.

With this change, the local m2 repository is served via a Docker container inside the same Docker network as the builder container, making it possible to fetch all locally built dependencies to Maven during build/install.

The dev-mode image now runs in offline mode, as the m2-repo container is unavailable during runtime. Still, all dependencies should already be available inside the container's filesystem (in /home/kogito/.m2/repository).

The --ulimit nofile=5000:5000 flags from the Docker build command were removed as image-builder doesn't support passing flags to the Docker CLI for now. If the CI breaks, we can implement it.

… serverless-logic-web-tools-swf-dev-mode-image
@thiagoelg
Copy link
Member Author

@fantonangeli can you help validate that the image still works as expected?

@fantonangeli
Copy link
Contributor

I still have to read all the code.
In OpenShift I get the error ImagePullBackOff
"Back-off pulling image "docker.io/apache/incubator-serverless-logic-web-tools-swf-dev-mode:main""

Are we supposed to wait the release to test this as it is under apache path?

Copy link
Contributor

@fantonangeli fantonangeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thiagoelg @tiagobento
The image works well for me locally but when I try it in OpenShift I get this error.
Did you manage to test it in OpenShift?

[INFO] Invoking resources:3.3.1:resources (default-resources) @ serverless-logic-web-tools-swf-deployment-quarkus-app
[INFO] Copying 230 resources from src/main/resources to target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.729 s
[INFO] Finished at: 2024-09-12T08:07:12Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.8.6:dev (default-cli) on project serverless-logic-web-tools-swf-deployment-quarkus-app: copying /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/src/main/resources/application.properties to /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/target/classes/application.properties failed with FileSystemException: /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/target/classes/application.properties: Operation not permitted -> [Help 1]

@thiagoelg
Copy link
Member Author

@fantonangeli can you provide the steps to reproduce this? I think I know how to fix it, but I need to test.

@fantonangeli
Copy link
Contributor

@thiagoelg pinged on Zulip

@thiagoelg
Copy link
Member Author

Updated the PR to include two changes:

  • Used a mounted path (/tmp/app) to copy all executable and mutable files and run the app from there (check entrypoint.sh);
  • Added the memory resource limit to 4096Mi. This allows the image to run on an OpenShift Developer Sandbox.

I tested it with a JSONGreet example, and it worked fine on the Dev UI, but the webapp that can be accessed via this "Dev Mode for Serverless Workflow" button crashed and never recovered (I'm not sure if this was happening before this change or if it's an out of memory thing).

image

The Dev UI:
image

The Dev Mode for Serverless Workflow webapp:
image

@fantonangeli
Copy link
Contributor

@thiagoelg I'm sorry I still have this error, what am I missing?

[INFO] --- quarkus-maven-plugin:3.8.6:dev (default-cli) @ serverless-logic-web-tools-swf-deployment-quarkus-app ---
[INFO] Invoking enforcer:3.4.1:enforce (enforce-maven-version) @ serverless-logic-web-tools-swf-deployment-quarkus-app
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Invoking enforcer:3.4.1:enforce (enforce-java-version) @ serverless-logic-web-tools-swf-deployment-quarkus-app
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO] Invoking remote-resources:3.2.0:process (process-resource-bundles) @ serverless-logic-web-tools-swf-deployment-quarkus-app
[INFO] Preparing remote bundle org.apache.apache.resources:apache-jar-resource-bundle:1.5
[INFO] Copying 3 resources from 1 bundle.
[INFO] Invoking resources:3.3.1:resources (default-resources) @ serverless-logic-web-tools-swf-deployment-quarkus-app
[INFO] Copying 230 resources from src/main/resources to target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.501 s
[INFO] Finished at: 2024-09-13T08:24:27Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.8.6:dev (default-cli) on project serverless-logic-web-tools-swf-deployment-quarkus-app: copying /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/src/main/resources/application.properties to /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/target/classes/application.properties failed with FileSystemException: /home/kogito/serverless-logic-web-tools-swf-deployment-quarkus-app/target/classes/application.properties: Operation not permitted -> [Help 1]
[ERROR] 

@thiagoelg
Copy link
Member Author

@fantonangeli Your OCP cluster probably cached the previous version (to always pull the image, the Deployment needs to be configured with imagePullPolicy: Always)

I've published the same image under the latest tag now. Could you try that? Thanks!

Copy link
Contributor

@fantonangeli fantonangeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well. Thanks @thiagoelg

@tiagobento tiagobento merged commit 9e7a258 into apache:main Sep 13, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants