- create-oracle.xslの記載が間違っている。こちらについては本記事では正しいXSLを掲載しています。
- MDSYS所有ネットワークに限定されている。プライベート・ネットワークには対応していない模様です。MDSYS所有ネットワークはOracle Database 23aiおよびAutonomous Databaseではサポートされていないため、実質的に19c以前のデータベースでのみ利用可能になります。
CMD ["sh"]
% ls
Dockerfile ojdbc8.jar
Javadoc-Readmes ons.jar
LICENSE.txt oracle-rdf4j-adapter-4.2.1.jar
Readme.txt oraclepki.jar
V1033016-01.zip orai18n.jar
apache-tomcat-9.0.98.zip rsi.jar
eclipse-rdf4j-4.2.4 simplefan.jar
eclipse-rdf4j-4.2.4-sdk.zip ucp.jar
javadoc xdb.jar
jdk-11.0.25_linux-aarch64_bin.tar.gz xmlparserv2.jar
ojdbc8-full.tar.gz xmlparserv2_sans_jaxp_services.jar
%
podman build --file Dockerfile --tag eclipse-rdf4j:4.2.4 .
% podman build --file Dockerfile --tag eclipse-rdf4j:4.2.4 .
[1/2] STEP 1/8: FROM oraclelinux:8 AS builder
[1/2] STEP 2/8: LABEL maintainer="Aurelio Garcia-Ribeyro <aurelio.garciaribeyro@oracle.com>"
--> Using cache 716e0efefa634efbb6099d6fd06f4873af60174d701e70313faa2eaf7e1aa301
--> 716e0efefa63
[1/2] STEP 3/8: RUN dnf install -y tar
--> Using cache 442abc6d64df865102a960bd568d31818fd859b014c025149a383e92d051c09d
--> 442abc6d64df
[1/2] STEP 4/8: ENV LANG en_US.UTF-8
--> Using cache f7f45f9759d6b5311c43f7382b588d5ae7f0129f8022da39ed487592f9ab885d
--> f7f45f9759d6
[1/2] STEP 5/8: ENV JAVA_HOME=/usr/java/jdk-11
--> Using cache 2d9e6f0a80449838080b29977241b0a4ced0712f5a5cf19a186c7458aab4a476
--> 2d9e6f0a8044
[1/2] STEP 6/8: COPY *.tar.gz /tmp/
--> Using cache cbea778f3e41cb6023e8e8bf1ad71a4486491e9e2cea05322bbbfb5d12eaff18
--> cbea778f3e41
[1/2] STEP 7/8: SHELL ["/bin/bash", "-o", "pipefail", "-c"]
--> Using cache 1fd02d2e5dc5376e9a747914243122bf4d1da2de0db26f5e5c23cd576da7d320
--> 1fd02d2e5dc5
[1/2] STEP 8/8: RUN set -eux; ARCH="$(uname -m)" && if [ "$ARCH" = "x86_64" ]; then mv "$(ls /tmp/jdk-11*_linux-x64_bin.tar.gz)" /tmp/jdk.tar.gz ; JAVA_SHA256=d22d0fcca761861a1eb2f5f6eb116c933354e8b1f76b3cda189c722cc0177c98 ; else mv "$(ls /tmp/jdk-11*_linux-aarch64_bin.tar.gz)" /tmp/jdk.tar.gz ; JAVA_SHA256=3fc0d93f6363d32723c293ba5a9016e8ab27410351ed804020cfe71e87d3bc0a ; fi && echo "$JAVA_SHA256 */tmp/jdk.tar.gz" | sha256sum -c -; mkdir -p "$JAVA_HOME"; tar --extract --file /tmp/jdk.tar.gz --directory "$JAVA_HOME" --strip-components 1
--> Using cache 8638882955e4c705ed177bf527a6003b16f2bb8eb1b40a62bf368be006a81248
--> 8638882955e4
[2/2] STEP 1/7: FROM oraclelinux:8
[2/2] STEP 2/7: ENV LANG en_US.UTF-8
--> Using cache 8964bc11495eb33b855f9d79cee5244aadc444312f6eefa71dd19a2b6d5f4fbc
--> 8964bc11495e
[2/2] STEP 3/7: ENV JAVA_HOME=/usr/java/jdk-11
--> Using cache af690fa3099471930289d030dd9e65fd489cadb9d1efc991aceda9fdd8287bd6
--> af690fa30994
[2/2] STEP 4/7: ENV PATH $JAVA_HOME/bin:$PATH
--> Using cache 9673faba6264bf0613a2771c3d5da856952cf3fd4caa1bdfd444fb9d4f944225
--> 9673faba6264
[2/2] STEP 5/7: COPY --from=builder $JAVA_HOME $JAVA_HOME
--> Using cache d7b0bf61180264d094df0d235035f07d1b1ed1a20cc62f6cb965b6387765be8f
--> d7b0bf611802
[2/2] STEP 6/7: RUN set -eux; dnf -y update; dnf install -y freetype fontconfig ; rm -rf /var/cache/dnf; ln -sfT "$JAVA_HOME" /usr/java/default; ln -sfT "$JAVA_HOME" /usr/java/latest; for bin in "$JAVA_HOME/bin/"*; do base="$(basename "$bin")"; [ ! -e "/usr/bin/$base" ]; alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; done; java -Xshare:dump;
--> Using cache 9ae7f7c9cd08af81d0902995d979be82dade222b9e67cceaf425d78e019b873e
--> 9ae7f7c9cd08
[2/2] STEP 7/7: CMD ["sh"]
--> Using cache 88f354a5474f88715d804bb75a6c8e8feb232d2f61c639b0989463604b57400b
[2/2] COMMIT eclipse-rdf4j:4.2.4
--> 88f354a5474f
Successfully tagged localhost/eclipse-rdf4j:4.2.4
Successfully tagged localhost/rdf4j-workbench:5.0.3
88f354a5474f88715d804bb75a6c8e8feb232d2f61c639b0989463604b57400b
%
コンテナを作成し実行します。コンテナ内からソフトウェアのインストールに使用するアーカイブが参照できるように、カレント・ディレクトリを/opt/oracleにマップします。また、Tomcatはデフォルトの8080番ポートで接続の待ち受けをするので、8080をホスト・ポートにマップします。
echo "exit" | podman run --name oracle-rdf4j -i -p 8080:8080 -v `pwd`:/opt/oracle localhost/eclipse-rdf4j:4.2.4
podman start oracle-rdf4j
% echo "exit" | podman run --name oracle-rdf4j -i -p 8080:8080 -v `pwd`:/opt/oracle localhost/eclipse-rdf4j:4.2.4
% podman start oracle-rdf4j
oracle-rdf4j
%
コンテナに接続しTomcatをインストールします。
podman exec -it oracle-rdf4j bash
% podman exec -it oracle-rdf4j bash
[root@7b1616c7fb95 /]#
unzipをインストールします。
dnf -y install unzip
[root@7b1616c7fb95 /]# dnf -y install unzip
Oracle Linux 8 BaseOS Latest (aarch64) 26 MB/s | 122 MB 00:04
Oracle Linux 8 Application Stream (aarch64) 24 MB/s | 58 MB 00:02
Last metadata expiration check: 0:00:07 ago on Mon 23 Dec 2024 02:59:49 AM UTC.
Dependencies resolved.
=================================================================================================================
Package Architecture Version Repository Size
=================================================================================================================
Installing:
unzip aarch64 6.0-47.0.1.el8_10 ol8_baseos_latest 189 k
Transaction Summary
=================================================================================================================
Install 1 Package
Total download size: 189 k
Installed size: 474 k
Downloading Packages:
unzip-6.0-47.0.1.el8_10.aarch64.rpm 1.4 MB/s | 189 kB 00:00
-----------------------------------------------------------------------------------------------------------------
Total 1.4 MB/s | 189 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : unzip-6.0-47.0.1.el8_10.aarch64 1/1
Running scriptlet: unzip-6.0-47.0.1.el8_10.aarch64 1/1
Verifying : unzip-6.0-47.0.1.el8_10.aarch64 1/1
Installed:
unzip-6.0-47.0.1.el8_10.aarch64
Complete!
[root@7b1616c7fb95 /]#
unzip -d /opt /opt/oracle/apache-tomcat-9.0.98.zip
ln -s /opt/apache-tomcat-9.0.98 /opt/tomcat
[root@7b1616c7fb95 /]# unzip -d /opt /opt/oracle/apache-tomcat-9.0.98.zip
Archive: /opt/oracle/apache-tomcat-9.0.98.zip
creating: /opt/apache-tomcat-9.0.98/
creating: /opt/apache-tomcat-9.0.98/bin/
creating: /opt/apache-tomcat-9.0.98/conf/
creating: /opt/apache-tomcat-9.0.98/lib/
creating: /opt/apache-tomcat-9.0.98/logs/
creating: /opt/apache-tomcat-9.0.98/temp/
[中略]
inflating: /opt/apache-tomcat-9.0.98/webapps/manager/images/asf-logo.svg
inflating: /opt/apache-tomcat-9.0.98/webapps/manager/images/tomcat.svg
inflating: /opt/apache-tomcat-9.0.98/webapps/manager/index.jsp
inflating: /opt/apache-tomcat-9.0.98/webapps/manager/status.xsd
inflating: /opt/apache-tomcat-9.0.98/webapps/manager/xform.xsl
[root@7b1616c7fb95 /]# ln -s /opt/apache-tomcat-9.0.98 /opt/tomcat
[root@7b1616c7fb95 /]#
bin/catalina.shに実行フラグを立てます。
[root@7b1616c7fb95 tomcat]# cd /opt/tomcat
[root@7b1616c7fb95 tomcat]# chmod a+x bin/catalina.sh
[root@7b1616c7fb95 tomcat]#
マネージャ・アプリケーションにアクセスするユーザーadminを有効にします。conf/tomcat-users.xmlを修正します。
<!--
<user username="admin" password="<must-be-changed>" roles="manager-gui"/>
<user username="robot" password="<must-be-changed>" roles="manager-script"/>
-->
以下のようにコメントアウトを解除し、<must-be-changed>の部分にパスワードを記載します。
<user username="admin" password="********" roles="manager-gui"/>
<user username="robot" password="********" roles="manager-script"/>
webapps以下にマネージャ・アプリケーションなどが含まれています。デフォルトでは同じホストからのアクセスに制限されています。Tomcatはコンテナで実行され、ホストマシンで実行されたブラウザは、同じマシンとは認識されません。そのため、アクセス制限を解除します。
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
修正後は以下のようになります。
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
その他のアプリケーション、docs、examples、host-managerからも、同様にcontent.xmlよりアクセス制限の部分を削除します。
以下の記述を変更します。
<multipart-config>
<!-- 50 MiB max -->
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
<multipart-config>
<!-- 100 MiB max -->
<max-file-size>104857600</max-file-size>
<max-request-size>104857600</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
[root@7b1616c7fb95 tomcat]# sh bin/startup.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/java/jdk-11
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@7b1616c7fb95 tomcat]#
execute sem_apis.create_sem_network('USERS');
SQL> execute sem_apis.create_sem_network('USERS');
PL/SQL procedure successfully completed.
SQL>
<Context>
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Resource name="jdbc/OracleSemDS" auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
scope="Shareable"
type="oracle.jdbc.pool.OracleDataSource"
user="wksp_apexdev"
password="*******"
url="jdbc:oracle:thin:@host.containers.internal:1521/xepdb1"
maxActive="100"
minIdle="15"
maxIdel="15"
initialSize="15"
removeAbandonedTimeout="30"
validationQuery="select 1 from dual"
/>
</Context>
cp /opt/oracle/ojdbc8.jar /opt/tomcat/lib/
cp /opt/oracle/ucp.jar /opt/tomcat/lib/
[root@9f6375d64858 tomcat]# cp /opt/oracle/ojdbc8.jar /opt/tomcat/lib/
[root@9f6375d64858 tomcat]# cp /opt/oracle/ucp.jar /opt/tomcat/lib/
[root@9f6375d64858 tomcat]#
oracle-rdf4j-adapter-4.2.1.jarをrdf4j-serverおよびrdf4j-workbenchのWEB-INF/lib以下にコピーします。
cp /opt/oracle/oracle-rdf4j-adapter-4.2.1.jar /opt/tomcat/webapps/rdf4j-workbench/WEB-INF/lib/
[root@9f6375d64858 tomcat]# cp /opt/oracle/oracle-rdf4j-adapter-4.2.1.jar /opt/tomcat/webapps/rdf4j-server/WEB-INF/lib/
[root@9f6375d64858 tomcat]# cp /opt/oracle/oracle-rdf4j-adapter-4.2.1.jar /opt/tomcat/webapps/rdf4j-workbench/WEB-INF/lib/
[root@9f6375d64858 tomcat]#
オラクルのドキュメントの以下のステップを実行します。
[root@9f6375d64858 tomcat]# sh bin/shutdown.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/java/jdk-11
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[root@9f6375d64858 tomcat]# sh bin/startup.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/java/jdk-11
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@9f6375d64858 tomcat]#