ããã«ã¡ã¯ãRed Hat Middleware Technical Account Managerã®ã¤ã¢ã³ã§ãã
Technical Account Manager (TAM)ã¨ãã¦ãã客æ§ã®ã·ã¹ãã ã®å®å®ç¨¼åããããããã«ç§ã¯ãæ¥ã ã客æ§ããã®ãµãã¼ãã±ã¼ã¹ã«å¯¾å¿ãã¦ãã¾ãã ãã®ä¸ã§ãã客æ§ã®ç°å¢ãã¢ããªãç¾è±¡ãªã©ãéããã«åç¾ãã¦åå ã¨å¯¾å¿æ¹æ³ãæä¾ãããã¨ãå¿ããã¦ãã¾ãã
ç©çãµã¼ãã¼ãä»®æ³ãã·ã³ä¸ã®ããã«ã¦ã§ã¢ããå©ç¨ãã¦ããå ´åã¯ãèªåã®ãã¼ã«ã«ç°å¢ã§å²ã¨ç°¡åã«åç¾ç°å¢ãç«ã¡ä¸ãããã¾ãããæè¿ã¯OpenShiftä¸ã®ã¢ããªã®åãåãããå¢ãã¦ãã¾ããã OpenShift Local (æ§å: CodeReady Containers)ãç¨ãã¦æ¤è¨¼ç¨ã®OpenShiftç°å¢ãç«ã¡ä¸ãããã¨ãã§ãã¾ãããèµ·åããã®ã«æéããããPCã®ãªã½ã¼ã¹ãçµæ§å¿ è¦ã§ãã ãã ã¢ããªãã¤ã¡ã¼ã¸åããã³ã³ãããèµ·åãããã ããªã®ã§ããããã£ã¨ããããæ¹ããªãã§ããããï¼
OpenShiftç°å¢ä¸ã§ã¢ããªã±ã¼ã·ã§ã³ããããã¤ããæã¯ãã¢ããªãã½ã¼ã¹ãããã«ãããSource-To-Image (s2i)ã®ä»çµã¿ããã使ç¨ããããã¨æãã¾ãã ä¸ã ããä»çµã¿ã§ãOpenShiftç°å¢ããªãã¦ãããã¼ã«ã«ã§å©ç¨ãããã¨ãã§ãã¾ãï¼
ç®æ¬¡
- ç®æ¬¡
- æ¨å¥¨ç°å¢
- Podmanã«ã¤ãã¦
- s2iã§ã®ã¢ããªã¤ã¡ã¼ã¸ä½æ
- ã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã®ä½æ
- Stupid s2i/container Tricks
- ã¾ã¨ã
æ¨å¥¨ç°å¢
Source-To-Imageããã¼ã«ã«PCã§å®è¡ããããã«ã¯ãã³ã³ããã¨ã³ã¸ã³ãå¿ è¦ã§ãã Dockerã¨Podmanããã使ããã¦ãã¾ãã å½è¨äºã§ã¯ãFedora 35ä¸ã® Podman ã使ç¨ãã¾ãã
ãªããPodmanã®ã³ãã³ãã©ã¤ã³ãã¼ã«ã¯Dockerã¨äºææ§ãããã¾ãã®ã§ãDockerã§å®è¡ããå ´åã¯podman
ãdocker
ã«ç½®ãæãã¦é ããã°ä½¿ããã¨æãã¾ãã
Podmanã«ã¤ãã¦
å½è¨äºã§ã¯ãPodmanã®è©³ç´°ã«ã¯è§¦ãã¾ãããããèå³ãããæ¹ã«ã¯ãå¼ç¤¾ãæä¾ãã¦ãããã¬ã¼ãã³ã°ã®åè¬ããæ¤è¨é ããã°å¹¸ãã§ãã ã¾ããRed Hat Developerã¢ã«ã¦ã³ãããæã¡ã®æ¹ã¯ãdevelopers.redhat.comããé»åæ¸ç±ãç¡åã§ãã¦ã³ãã¼ãã§ãã¾ãã Podmanå ¥éã¨ãã¦Podman In Actionããããããã¾ãã
s2iã§ã®ã¢ããªã¤ã¡ã¼ã¸ä½æ
ã¾ãã¯ãææ°ã®s2i
ãã¤ããªãSource-To-Imageã®ãªãã¸ããªãããã¦ã³ãã¼ãããå±éãã¾ãã
ã¾ãããµã³ãã«ã¢ããªã¨ãã¦ãJBoss Enterprise Application Platform (EAP)ã®Quickstartsã®ä¸ã®helloworld-rs(åç´ãªRESTãµã¼ãã¹)ãå©ç¨ããã®ã§ã jboss-eap-quickstarts ãªãã¸ããªããã¼ã«ã«ã«clone
ãã jboss-eap-quickstarts ãã£ã¬ã¯ããªã«ç§»åãã¾ãã
$ git clone https://github.com/jboss-developer/jboss-eap-quickstarts.git ... $ cd jboss-eap-quickstarts
s2i
ã使ãããã«ã¯ããã«ãã¼ã¤ã¡ã¼ã¸ãå¿
è¦ã§ãã
OpenShiftã¨åãRed Hatãæä¾ãã¦ããJBoss EAP 7.4ãã«ãã¼ã¤ã¡ã¼ã¸ã使ãã¾ãã
$ podman pull registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8:latest
NOTE: registry.redhat.ioãããã¦ã³ãã¼ãããããã«ã¯ãpodman login registry.redhat.io
ã使ã£ã¦Red Hatã¢ã«ã¦ã³ãã«ãã°ã¤ã³ããå¿
è¦ãããã¾ãã
æºåãã§ãããã以ä¸ã®s2i
ã³ãã³ãã使ã£ã¦ã helloworld-rs ã®ã¢ããªããã«ãããã¤ã¡ã¼ã¸ãä½æãã¾ãã
æçµã¤ã¡ã¼ã¸å㯠localhost/eap-app:latest
ã«ãªãã¾ãã
s2i build . registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 eap-app \ --copy \ --pull-policy never \ -e GALLEON_PROVISION_LAYERS=jaxrs-server \ -e GALLEON_PROVISION_DEFAULT_FAT_SERVER=true \ -e MAVEN_ARGS_APPEND="-f helloworld-rs/pom.xml" \ -e MAVEN_S2I_ARTIFACT_DIRS=helloworld-rs/target
NOTE: OpenShiftã¨éã£ã¦ãããã¤ãã®$MAVEN_...
ã®ç°å¢å¤æ°ãæå®ãã¦ãã¾ãã
Quickstartsã®ã½ã¼ã¹ã®ãµããã£ã¬ã¯ããªã®ä¸ã® helloworld-rs ããã«ãããããã«å¿
è¦ã§ãã
ã¢ããªã®ã½ã¼ã¹ã³ã¼ãã¯ã½ã¼ã¹ãã£ã¬ã¯ããªç´ä¸ã«ããå ´åã¯ãå¥ãã£ã¬ã¯ããªã® pom.xml ãªã©ãæå®ããªãã¦ãè¯ãã§ãã
ãã«ãã¼ã¤ã¡ã¼ã¸ããã³ã³ãããèµ·åãããMavenã®ãã«ããå§ã¾ãã¾ãã
Checking if image "registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8" is available locally ... Checking if image "registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8" is available locally ... Provisioning WildFly server... INFO Performing Maven build in /opt/jboss/container/wildfly/s2i/galleon/provisioning/generic_layers INFO Using MAVEN_OPTS -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.713 s [INFO] Finished at: 2023-01-22T12:27:45Z [INFO] ------------------------------------------------------------------------ INFO Copying deployments from helloworld-rs/target to /deployments... '/tmp/src/helloworld-rs/target/ROOT.war' -> '/deployments/ROOT.war' INFO Cleaning up source directory (/tmp/src) INFO Copying server to /s2i-output INFO Linking /opt/eap to /s2i-output Build completed successfully
s2i
ã®ãã«ããå®äºããããæ°ãã eap-app ã¤ã¡ã¼ã¸ããã¼ã«ã«ã®ãªãã¸ããªã«ä½æããã¾ãã
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/eap-app latest 6c2779ffb971 43 seconds ago 1.15 GB registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 latest a34c07e25cbf 6 weeks ago 1.01 GB
ãã®ã¤ã¡ã¼ã¸ã¯ãã®ã¾ã¾å®è¡ã§ãã¾ãã
$ podman run --rm \ --name eap \ -p 18080:8080 \ -e ENABLE_ACCESS_LOG=true \ localhost/eap-app:latest \ /opt/eap/bin/openshift-launch.sh
ã¢ããªã®åä½ã確èªãã¾ãã
$ curl -w "\n" http://localhost:18080/rest.json {"result":"Hello World!"}
ã³ã³ããèµ·åæã«$ENABLE_ACCESS_LOG
ã®ç°å¢å¤æ°ãæå®ããã®ã§ãã³ã³ããã®æ¨æºåºåã«ä»¥ä¸ã®ãããªã¢ã¯ã»ã¹ãã°ãåºã¾ãã
$ podman logs --tail=10 eap ... 12:29:14,076 INFO [io.undertow.accesslog] (default task-1) 10.0.2.100 - - [22/Jan/2023:12:29:14 +0000] - "GET /rest/json HTTP/1.1" 200 25
ããã§ãOpenShiftã¨åæ§ã®s2i
ä»çµã¿ã使ã£ã¦ãã¢ããªã®ã¤ã¡ã¼ã¸ãä½æããèµ·åã§ãã¾ããã
ã§ããããã ãã§ã¯ããã¾ããã
ã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã®ä½æ
å ã«ä½ã£ãã¢ããªã®ã¤ã¡ã¼ã¸ã®ãµã¤ãºãã覧ã«ãªãã¾ããã§ããããï¼ 1GBã»ã©ã¨ãªã£ã¦ãã¾ãããã«ãã¼ã¤ã¡ã¼ã¸ã¨ã»ã¼åããµã¤ãºã§ãã
ãã«ãã¼ã¤ã¡ã¼ã¸ã®ä¸ã«ã¢ããªãè¼ããã ãã§ãã®ã§ãã¢ããªã«å¿ è¦ã§ã¯ãªããã«ãé¢é£ã®ãã¡ã¤ã«(Maven, s2i)ãå«ã¾ãã¦ãã¾ãã ãã¼ã«ã«ã§ã®æ¤è¨¼ã ããªã®ã§ããµã¤ãºããããªã«åé¡ã§ã¯ãªãããããã¾ããããOpenShiftã¨åæ§ã®ã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã使ã£ã¦ã¤ã¡ã¼ã¸ãä½æã§ãã¾ãã
é常ã®OpenShiftä¸ã®ãã«ãã¯ããã«ãããä½æããã¢ã¼ãã£ãã¡ã¯ããèªåçã«ã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã«ã³ãã¼ãã¦ããã¾ããããã¼ã«ã«ã®å ´åã¯èªåçã«ã§ãã¾ããã
jboss-eap-quickstarts ãã£ã¬ã¯ããªã« .s2i/bin ãã£ã¬ã¯ããªãä½ã£ã¦ãä¸ã® assemble-runtime ãã¡ã¤ã«ãä½ã£ã¦ãä¸èº«ã以ä¸ã®ããã«è¨å®ãã¾ãã
#!/usr/bin/env bash mkdir /opt/eap cp -r /home/jboss/s2i/s2i-output/server/* /opt/eap chown -R jboss:root /opt/eap && chmod -R ug+rwX /opt/eap
NOTE: assemble-runtimeã®ã³ãã³ãã¯OpenShiftã®eap74-basic-s2i.jsonãã³ãã¬ã¼ããåç §ãã¦ä½æãã¾ããã
chmod u+x .s2i/bin/assemble-runtime
ã§å®è¡å¯è½ã«ãã¾ãã
ã¾ããã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ãpull
ãã¾ãããã
$ podman pull registry.redhat.io/jboss-eap-7/eap74-openjdk11-runtime-openshift-rhel8
ãããã§ããããååã®s2i
ã³ãã³ãã«runtime
ã¤ã¡ã¼ã¸é¢é£ã®ãªãã·ã§ã³ã足ãã¦å®è¡ãã¾ãã
$ s2i build /path/to/jboss-eap-quickstarts registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 eap-app \ --runtime-artifact /s2i-output:s2i \ --runtime-image registry.redhat.io/jboss-eap-7/eap74-openjdk11-runtime-openshift-rhel8 \ --runtime-pull-policy never --copy \ --pull-policy never \ -e GALLEON_PROVISION_LAYERS=jaxrs-server \ -e GALLEON_PROVISION_DEFAULT_FAT_SERVER=true \ -e MAVEN_ARGS_APPEND="-f helloworld-rs/pom.xml" \ -e MAVEN_S2I_ARTIFACT_DIRS=helloworld-rs/target
å®è¡ããã¨ãs2i
ã¯ååã¨åæ§ã«ã¢ããªããã«ããã¾ããããã«ãã®ã¢ã¼ãã£ãã¡ã¯ããå«ã¾ãã¦ãã /s2i-output ãã£ã¬ã¯ããªãã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã® /home/jboss/s2i ãã£ã¬ã¯ããªã«ãã¦ã³ããã¾ãã
ãã®å¾ãç¨æãã assemble-runtime ã¹ã¯ãªãããåãããã«ãçµæã /opt/eap ã«ã³ãã¼ãã¾ãã
æå¾ã«ã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã eap-app ã¨ãã¦ãã¼ã«ã«ãªãã¸ããªã«ããã·ã¥ãã¾ãã
åºæ¥ä¸ãã£ã eap-app ã¤ã¡ã¼ã¸ã«ã¯Maven, s2iãªã©ã®ãã«ãé¢é£ã®ãã¡ã¤ã«ããªãã®ã§ããã«ãã¼ã¤ã¡ã¼ã¸ã®å ´åãããµã¤ãºãå°ããã§ãã¾ãã
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/eap-app latest 352389a94bf3 15 seconds ago 814 MB registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 latest a34c07e25cbf 6 weeks ago 1.01 GB registry.redhat.io/jboss-eap-7/eap74-openjdk11-runtime-openshift-rhel8 latest 164d988e5c07 6 weeks ago 532 MB
Stupid s2i/container Tricks
ãã«ãã®å éå
ããã¾ã§æ¥ã¦ãæ°ås2i
ã§ã¢ããªããã«ããã¦æ°ã¥ãããã¨æãã¾ãããæ¯åä¾åã¢ã¸ã¥ã¼ã«ã®ãã¦ã³ãã¼ããå¿
è¦ã¨ãªããæéãããã£ã¦ãã¾ãã
ãµãã¼ãã¨ã³ã¸ãã¢ã¨ãã¦ãç¾è±¡ãåç¾ããæã¯ãã³ã¼ããä¿®æ£ããå®è¡ãããã¨ãä½åãç¹°ãè¿ãã®ã§ãs2i
ã®ãã«ããå éãããããã«ãã«è¦ãã¦ããæéãçãã¦æ©ãåç¾ãããã¨ãã§ãã¾ãã
ãã«ãã¼ã¤ã¡ã¼ã¸ã¯ /tmp/artifacts/m2 ããã¼ã«ã«Mavenãªãã¸ããªã¨ãã¦ä½¿ç¨ãã¦ãã¾ãã
ãã®ãããã³ã³ããç¨ã®ããªã¥ã¼ã ã /tmp/artifacts ã«ãã¦ã³ãããã°ããã¦ã³ãã¼ãããä¾åã¢ã¸ã¥ã¼ã«ãä»å¾ã®ãã«ãã§ãåå©ç¨ã§ãã¾ãã
s2i
ã®-v
ãªãã·ã§ã³ã§ããªã¥ã¼ã ãã¦ã³ããæå®ã§ãã¾ãã
$ podman volume create eap-build-repo $ s2i build . registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 eap-app \ --copy \ --pull-policy never \ -e GALLEON_PROVISION_LAYERS=jaxrs-server \ -e GALLEON_PROVISION_DEFAULT_FAT_SERVER=true \ -e MAVEN_ARGS_APPEND="-f helloworld-rs/pom.xml" \ -e MAVEN_S2I_ARTIFACT_DIRS=helloworld-rs/target \ -v "eap-build-repo:/tmp/artifacts"
ããä¸åº¦s2i build
ã³ãã³ããå®è¡ããã¨ãã¢ããªã®ãã«ããããã«çµããã¾ãã
latest以å¤ã®ã¤ã¡ã¼ã¸ã®å©ç¨æ¹æ³
å½è¨äºãæ¸ããæã®eap74-openjdk11-openshift-rhel8ã¤ã¡ã¼ã¸ã¯JBoss EAP 7.4.8ã使ç¨ãã¦ãã¾ããã ä¾ãã°ãã客æ§ã®ç°å¢ã«åããã¦ã7.4.2ã使ãããå ´åã¯ã©ãããã°ããã§ããããï¼
æ®å¿µãªããã以ä¸ã®ãããªã³ãã³ãã使ã£ã¦ãããã«ãã¼ã¤ã¡ã¼ã¸ã®latest
ã使ç¨ããã¦ãã¾ãã¾ãã
$ s2i build . registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8:7.4.2 eap-app \ ...
ããã§ã¤ã¡ã¼ã¸ã®ã¿ã°ã使ãã¾ãï¼
以ä¸ã®ã³ãã³ãã§jboss-eap-7/eap74-openjdk11-openshift-rhel8:7.4.2
ã¤ã¡ã¼ã¸ãlocalhost/eap74-openjdk11-openshift-rhel8:latest
ã¨ãã¦ã¿ã°ä»ããã¾ãã
$ podman pull registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8:7.4.2 $ podman tag registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8:7.4.2 localhost/eap74-openjdk11-openshift-rhel8:latest
ã¿ã°ä»ãããããs2i build
ã³ãã³ãã§æ°è¦ã«ã¿ã°ä»ãããã¤ã¡ã¼ã¸ã使ãã¾ãã
$ s2i build . localhost/eap74-openjdk11-openshift-rhel8 eap-app \ ...
Source-To-Imageã¯localhost/eap74-openjdk11-openshift-rhel8:latest
ã使ãã¾ããããã®ã¿ã°ã¯å®ã¯jboss-eap-7/eap74-openjdk11-openshift-rhel8:7.4.2
ãæãã¦ãã¾ãã®ã§ãJBoss EAP 7.4.2ã®ã¤ã¡ã¼ã¸ãåºæ¥ä¸ããã¾ãã
ãã®ããæ¹ã¯ã©ã³ã¿ã¤ã ã¤ã¡ã¼ã¸ã«ãé©ç¨ã§ãã¾ãã
ãã¼ã¿ãã¼ã¹ãã©ã¤ãå°å ¥
OpenShiftã¨åãs2iä»çµã¿ã§ãã®ã§ãç°å¢å¤æ°ã使ã£ã¦ããã¼ã¿ãã¼ã¹ãã©ã¤ãã®å°å ¥ã¨è¨å®ãè¡ãã¾ãã
ä»åã®ãµã³ãã«ã¢ããªã¯ãã¼ã¿ãã¼ã¹ã使ã£ã¦ãã¾ãããããããæã¡ã®ã¢ããªããã¼ã¿ãã¼ã¹ã使ã£ã¦ããå ´åã®è¨å®æ¹æ³ãç´¹ä»ãã¾ãã
NOTE: 以ä¸ã®æé ã¯Getting Started with JBoss EAP for OpenShift Container Platform Red Hat JBoss Enterprise Application Platform 7.4ã®Datasourcesç« ãåç §ãã¦ä½æãã¾ããã
ã¾ãã¯ã jboss-eap-quickstarts ãã£ã¬ã¯ããªã« extensions ãã£ã¬ã¯ããªãä½æãã¾ãã ãã®ä¸ã«ã modules/org/postgresql/main ãã£ã¬ã¯ããªãä½æãã¾ãã
extensions/modules/org/postgresql/main ã®ä¸ã«PostgreSQL 14ã®JDBCãã©ã¤ãã¼(è¨äºä½æå½æ㯠postgresql-42.5.1.jar)ãç½®ãã¾ãã åããã£ã¬ã¯ããªã« module.xml ãä½æããä¸èº«ã以ä¸ã®ããã«è¨å®ãã¾ãã
NOTE: resource-root
ã®path
å±æ§ããã¦ã³ãã¼ãããJDBCãã©ã¤ãã¼ã®ãã¡ã¤ã«åã«è¨å®ãã¾ãã
<?xml version="1.0" ?> <module xmlns="urn:jboss:module:1.1" name="org.postgresql"> <resources> <resource-root path="postgresql-42.5.1.jar"/> </resources> <dependencies> <module name="wildflyee.api"/> <module name="sun.jdk"/> <module name="ibm.jdk"/> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
extensions/drivers.env ãã¡ã¤ã«ãä½ã£ã¦ãä¸èº«ã以ä¸ã«ãã¾ãã ãã®ãã¡ã¤ã«ã¯EAPèµ·åæã®ãã¼ã¿ãã¼ã¹ãã©ã¤ãã¼ã®ç»é²ã«ä½¿ç¨ããã¾ãã
DRIVER DRIVERS=POSTGRES POSTGRES_DRIVER_NAME=postgresql POSTGRES_DRIVER_MODULE=org.postgresql POSTGRES_DRIVER_CLASS=org.postgresql.Driver POSTGRES_XA_DATASOURCE_CLASS=org.postgresql.xa.PGXADataSource
æå¾ã« extensions/install.sh ãä½ãã¾ãã ãã®ãã¡ã¤ã«ã¯Source-To-Buildã®ä¸ã§å®è¡ããã modules ãµããã£ã¬ã¯ããªã /opt/eap/modules ã«ã³ãã¼ãã drivers.env ã /opt/eap/bin/openshift ã«ã³ãã¼ãã¾ãã
NOTE: install.sh
ã®è©³ç´°ã¯Modules, Drivers, and Generic Deploymentsããåç
§ãã ããã
#!/bin/bash injected_dir=$1 source /usr/local/s2i/install-common.sh install_modules ${injected_dir}/modules configure_drivers ${injected_dir}/drivers.env
æçµçã« extensions ãã£ã¬ã¯ããªã®æ§æã¯ä»¥ä¸ã®ããã«ãªãã¾ãã
extensions âââ drivers.env âââ install.sh âââ modules âââ org âââ postgresql âââ main âââ module.xml âââ postgresql-42.5.1.jar
ããã§s2i build
ãå®è¡ãã¦ãã¢ããªã®ã¤ã¡ã¼ã¸ãä½æãã¾ãã
NOTE: ä»åã¯$CUSTOM_INSTALL_DIRECTORIES
ã®ç°å¢å¤æ°ãæå®ãã¦ãã¾ãã
$ s2i build /path/to/jboss-eap-quickstarts registry.redhat.io/jboss-eap-7/eap74-openjdk11-openshift-rhel8 eap-app \ --copy \ --pull-policy never \ -e GALLEON_PROVISION_LAYERS=jaxrs-server \ -e GALLEON_PROVISION_DEFAULT_FAT_SERVER=true \ -e MAVEN_ARGS_APPEND="-f helloworld-rs/pom.xml" \ -e MAVEN_S2I_ARTIFACT_DIRS=helloworld-rs/target \ -e CUSTOM_INSTALL_DIRECTORIES=extensions ... INFO Copying deployments from helloworld-rs/target to /deployments... '/tmp/src/helloworld-rs/target/ROOT.war' -> '/deployments/ROOT.war' INFO Processing ImageSource mounts: extensions INFO Processing ImageSource from /tmp/src/extensions INFO Cleaning up source directory (/tmp/src) INFO Copying server to /s2i-output INFO Linking /opt/eap to /s2i-output Build completed successfully
s2i
ã¯ç¡äºã« extensions ãã£ã¬ã¯ããªã® install.sh ãå®è¡ã§ãã¾ããã
èµ·åããæã¯ãç°å¢å¤æ°ãç¨ãã¦ãã¼ã¿ã½ã¼ã¹ãè¨å®ãã¾ãã
$ podman run \ --rm \ --name eap \ -p 18080:8080 \ -e ENABLE_ACCESS_LOG=true \ -e DB_SERVICE_PREFIX_MAPPING=test-postgresql=TEST \ -e TEST_NONXA=true \ -e TEST_CONNECTION_CHECKER=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker \ -e TEST_EXCEPTION_SORTER=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter \ -e TEST_USERNAME=postgres \ -e TEST_PASSWORD=changeme \ -e TEST_POSTGRESQL_SERVICE_HOST=localhost \ -e TEST_POSTGRESQL_SERVICE_PORT=5432 \ -e TEST_DATABASE=test \ localhost/eap-app:latest \ /opt/eap/bin/openshift-launch.sh
EAPã®CLIã使ã£ã¦ããã¼ã¿ã½ã¼ã¹ãä½æããããã¨ã確èªã§ãã¾ãããå®éã®ãã¼ã¿ãã¼ã¹ããªããããæ¥ç¶ãã¹ããè¡ãã¨ã¨ã©ã¼ã«ãªãã¾ãã
$ podman exec eap /opt/eap/bin/jboss-cli.sh -c "/subsystem=datasources/data-source=test_postgresql-TEST:test-connection-in-pool" { "outcome" => "failed", "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid", "rolled-back" => true }
ãã¼ã«ã«ç°å¢ã§ãEAPã¨ãã¼ã¿ãã¼ã¹ã試ãããããã§ããã
EAPã¨ãã¼ã¿ãã¼ã¹ã®Podä½æ
Podmanã®æ©è½ã®ä¸ã¤ã¨ãã¦ãè¤æ°ã³ã³ãããä¸ã¤Podã¨ãã¦ç®¡çãããã¨ãå¯è½ã§ã(Kubernetesã¨åããããªæ¦å¿µã§ã)ã ãã®æ©è½ãç¨ãã¦ãPostgreSQLã¨EAPã®2ã¤ã®ã³ã³ãããèµ·åãããäºãã«æ¥ç¶ã§ããããã«ãã¾ãã
3ã¤ã®ã³ãã³ãã使ã£ã¦ãPodãä½æãã¦ãPostgreSQLã¨EAPã®ã³ã³ãããPodã®ä¸ã«ä½æãã¾ãã
$ podman pod create -n eap \ -p 18080:8080 $ podman create \ --pod eap \ --name postgres \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=changeme \ -e POSTGRES_DB=test \ postgres:14 $ podman create \ --pod eap \ --name eap-app \ -e ENABLE_ACCESS_LOG=true \ -e DB_SERVICE_PREFIX_MAPPING=test-postgresql=TEST \ -e TEST_NONXA=true \ -e TEST_CONNECTION_CHECKER=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker \ -e TEST_EXCEPTION_SORTER=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter \ -e TEST_USERNAME=postgres \ -e TEST_PASSWORD=changeme \ -e TEST_POSTGRESQL_SERVICE_HOST=localhost \ -e TEST_POSTGRESQL_SERVICE_PORT=5432 \ -e TEST_DATABASE=test \ localhost/eap-app:latest \ /opt/eap/bin/openshift-launch.sh
ä½æããPodãpodman pod start eap
ã§èµ·åãã¾ãã
2ã¤ã³ã³ãããèµ·åãããã¨ã確èªã§ãã¾ãã
NOTE: pause
ã®ã³ã³ãã㯠cgroups ã®åå空éã管çããããã®ãã®ã§ãPodmanãèªåçã«èµ·å/åæ¢ãã¾ãã
$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d27be4db5138 k8s.gcr.io/pause:3.5 39 seconds ago Up 27 seconds ago 0.0.0.0:18080->8080/tcp d15a4ef315f2-infra 2e7170d72f23 docker.io/library/postgres:14 postgres 39 seconds ago Up 26 seconds ago 0.0.0.0:18080->8080/tcp postgres 205e1e9c1691 localhost/eap-app:latest /opt/eap/bin/open... 39 seconds ago Up 26 seconds ago 0.0.0.0:18080->8080/tcp eap-app
ä»åã¯ããã¼ã¿ãã¼ã¹ã¸ã®æ¥ç¶ãã¹ããè¡ãã¨ãæåãã¾ãã
$ podman exec eap-app \ /opt/eap/bin/jboss-cli.sh -c "/subsystem=datasources/data-source=test_postgresql-TEST:test-connection-in-pool" { "outcome" => "success", "result" => [true] }
Podãåæ¢ãããå ´åã¯podman pod stop eap
ãå®è¡ãã¾ãã
ã¾ã¨ã
OpenShiftç°å¢ã使ããã¦ããs2iã®ä»çµã¿ãã³ã³ããæè¡ã使ã£ã¦ããã¼ã«ã«ã§è²ã æ¤è¨¼ãããã¨ãå¯è½ã§ãã ã客æ§ã®ç°å¢ãç¾è±¡ãããã«åç¾ããåå 究æãè¡ããã¨ã¯TAMã¨ãã¦èªãã«æãã¾ãã