Code Monkey home page Code Monkey logo

open-liberty-s2i's Introduction

Open Liberty UBI-min images for OpenShift S2I

This repository contains the source for building Open Liberty Source to Image (S2I) builder and runtime images using Red Hat Universal Base Image (UBI) 7 and Java 8, Java 11, Java 17 or Java 21.

More information on S2I can be found at https://github.com/openshift/source-to-image

The built S2I image can be run using Docker.

Building the images

Images are built using docker community edition and cekit version 4. Mac OSX installation and build tips.

Cloning the repository:

$ git clone https://github.com/openliberty/open-liberty-s2i
$ cd open-liberty-s2i

Building the Open Liberty S2I images:

Run the Makefile to generate all images, or generate a single image by running:

$ cd $IMAGE_DIR
$ cekit build docker

Example values for IMAGE_DIR are images/java8/builder, images/java8/runtime, images/java11/builder, images/java11/runtime,images/java17/builder, images/java17/runtime, images/java21/builder, images/java21/runtime .

S2I Usage

To build a simple jee application using standalone S2I and then run the resulting image with Docker execute:

$ s2i build https://github.com/openshift/openshift-jee-sample openliberty/open-liberty-s2i:latest open-liberty-test
$ docker run -p 9080:9080 open-liberty-test

Accessing the application:

$ curl 127.0.0.1:9080/ROOT

S2I Runtime Images

Use the following commands to build and test a lightweight runtime image

$ s2i build git://github.com/openshift/openshift-jee-sample openliberty/open-liberty-s2i:latest open-liberty-runtime-test --runtime-image openliberty/open-liberty-s2i:20.0.0.12-runtime-java8 --runtime-artifact /opt/ol/wlp/usr/servers/defaultServer/dropins
$ docker run -p 9080:9080 open-liberty-runtime-test

More information on the Open Liberty runtime image and available options is available here.

Test

The tests for this repository check basic functionality of a JEE application built on top of the Open Liberty S2I images.

$ make test

S2I Build Behavior

If a pom.xml file is found in the root of the source tree, it will be built using maven.

If the root of the source tree contains a file named Dockerfile and a directory named maven then the build will assume that the source tree is the output of the fabric8 maven plugin

If the environment variable LIBERTY_RUNNABLE_JAR is set, the build will attempt to copy that file to /opt/ol/ol-runnable.jar. At runtime, S2I will run that jar file instead of running the normal Liberty instance.

If a server.xml file exists in the directory src/main/liberty/config it will be copied to the config directory of the Liberty instance.

If the directory src/wlp/usr exists, it will be copied to the wlp directory o the Libert instance.

All WAR, JAR, EAR, and RAR files from the build will be copied to either the apps or dropins directory the Liberty instance depending on the value of the DEPLOY_TO_APPS environment variable.

Environment variables to be used at s2i build time

The following environment variables can be passed to the S2I build process to customize Open Liberty. More information on these variables and the functions they enable can be found at https://github.com/OpenLiberty/ci.docker

  • MAVEN_MIRROR_URL
    • Description: Use the specified maven mirror to resolve dependencies
  • DEPLOY_TO_APPS
    • Description: When true, applicaton binaries will be copied to apps instead of dropins
  • TLS or SSL (SSL is deprecated)
    • Description: Enable Transport Security in Liberty by adding the transportSecurity-1.0 feature (includes support for SSL).
    • XML Snippet Location: keystore.xml.

The following environment variables are now deprecated. Support will be removed in the future.

  • HTTP_ENDPOINT
  • MP_HEALTH_CHECK
  • MP_MONITORING
    • Description: Monitor the server runtime environment and application metrics by using Liberty features mpMetrics-1.1 (implements Microprofile Metrics) and monitor-1.0.
    • XML Snippet Location: mp-monitoring.xml
    • Note: With this option, /metrics endpoint is configured without authentication to support the environments that do not yet support scraping secured endpoints.
  • IIOP_ENDPOINT
  • JMS_ENDPOINT

Server Configuration

If you want to use your own server.xml file rather than the default, it should be present in the src/main/liberty/config directory.

OpenShift oc usage

If your openshift installation doesn't already contain the Open Liberty image:

  • Adding the image streams: oc create -f imagestreams/openliberty-ubi-min.json An Open Liberty imagestream will be created.

  • When adding the Open Liberty imagestream to the openshift namespace, the OpenShift catalog is automatically populated with a the template Open Liberty allowing you to create a new build and new deployment from the OpenShift Web Console.

open-liberty-s2i's People

Contributors

brenthdaniel avatar davco01a avatar kevin-ortega avatar mbroz2 avatar scottkurz avatar thomas-mattsson avatar yselkowitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

open-liberty-s2i's Issues

microprofile

I generated a skeleton project using the generator, and stored it here my git.

It does build, run and works using the java -jar option.

S2I as well as OCP 4.3 manage to create the container image. The image does contain the build artifact when logging into the container or the pod.

However, both running it via Docker or via OCP 4.3 does not result in the URL reaching the Java Classes as it does via running it via java -jar.

II have no clue on how to proceed here. Any recommendations?

error building at STEP "RUN /usr/libexec/s2i/assemble": exit status 127

The openliberty/open-liberty-s2i:latest builder image was used in an S2I Tekton Task and the following error was outputted:

+ [[ false == \t\r\u\e ]]
+ buildah bud --storage-driver=vfs --tls-verify=false --layers -f /gen-source/Dockerfile.gen -t image-registry.openshift-image-registry.svc:5000/default/s2i-pipeline-run .
STEP 1: FROM open-liberty
Getting image source signatures
Copying blob sha256:f3e90b0b2b823eb843b3e1d2187948b54d8ff70c79db6782e5c0b87b4ef4ae6d
...truncated...
Copying config sha256:16c7b40ecf15cbb9209de51f7bd17db80477af1ea59ada67a921b5f68ea9bb66
Writing manifest to image destination
Storing signatures
STEP 2: LABEL "io.openshift.s2i.build.image"="open-liberty"       "io.openshift.s2i.build.source-location"="."
--> 0e2c97eeefd
STEP 3: USER root
--> 9fe63b87925
STEP 4: COPY upload/src /tmp/src
--> 20d9e5d32f2
STEP 5: RUN chown -R 1001:0 /tmp/src
--> 4bbb39417e0
STEP 6: USER 1001
--> 4be4c8e46e6
STEP 7: RUN /usr/libexec/s2i/assemble
/bin/sh: 1: /usr/libexec/s2i/assemble: not found
subprocess exited with status 127
subprocess exited with status 127
error building at STEP "RUN /usr/libexec/s2i/assemble": exit status 127

The STEP 7: RUN /usr/libexec/s2i/assemble Dockerfile step cannot run successfully and receives an exit status of 127. It appears as though the openliberty/open-liberty-s2i:latest builder image is missing the /usr/libexec/s2i/assemble file required by this step. Has this builder image been tested to be compatible with the S2I Tekton Task?

Provide a s2i image for Java 17

Can this s2i image provide Java 17 based s2i image?
Java 17 is a LTS Java version, so s2i users will choose Java 17 supported builder/runner image.

Provide a s2i image for Java 11

One of Open Liberty customers would like to utilise UBI open-liberty-s2i based on OpenJDK11. At the moment, it is not available. Can this s2i image be provided so that all customers can use it?

confused by Dockerfile in project root

I tried to use the s2i on a hello-world app that unfortunately included a Dockerfile in the root that I use during development locally. Apparently this puts the s2i down a path that expects pre-built binaries to be gobbled up

S2I binary build from fabric8-maven-plugin detected

Maybe this check could be a little more involved and if there are no wars/jars found go abck to the normal assembly.

oc import-image -n openshift openliberty:latest

I have update the imagestream via: oc import-image -n openshift openliberty:19.0.0.6 which leveled the imagestream up to version 19.0.0.9. The generated liberty container image then got levelled up to version 19.0.0.9

It would be even better when a development environment could stay up to date using the oc import-image -n openshift openliberty:latest command.

Need to add instructions to install odcs

When following instructions for MAC I got this error

(cekit) Davids-MacBook-Pro-3:open-liberty-s2i davidvandepol$ cekit build docker
2020-03-13 16:47:17,444 cekit WARNING You are running CEKit on an unknown platform. External dependencies suggestions may not work!
2020-03-13 16:47:17,444 cekit WARNING The certifi library (https://certifi.io/) was found, depending on the operating system configuration this may result in certificate validation issues
2020-03-13 16:47:17,445 cekit WARNING Certificate Authority (CA) bundle in use: '/Users/davidvandepol/git/open-liberty-s2i/my-vertualenv/cekit/lib/python3.7/site-packages/certifi/cacert.pem'
2020-03-13 16:47:17,679 cekit INFO Generating files for docker engine
2020-03-13 16:47:17,680 cekit INFO Initializing image descriptor...
2020-03-13 16:47:17,680 cekit ERROR Required CEKit library 'odcs-client' was not found; required module 'odcs' could not be found.

Solution after googling was

pip install odcs

might want to add to instructions on README

Need to add variable to change Maven Mirror URL

Hi
Please add support to change the base URL of a mirror used for retrieving artifacts via environment variable like MAVEN_MIRROR_URL.
It would be very useful for disconnected clusters.

Java 21 support

Hi there,

As java 21 has been released for a while now, when will there be an s2i image supporting this?

Kind regards, Asjer

Incremental builds are broken

When trying to run an incremental build with the --incremental flag the build fails with the following:
mv: cannot move '/tmp/artifacts/.m2' to '/home/default/.m2': Permission denied

.m2 already exists in /home/default hence the error.

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.