Oracle-test 4.x SQL Data Loading Guide
The latest version of oracle-test no longer has any sql files loaded at startup. Any service that needs oracle-test will have to stage their sql files so that oracle-test can load them without overwriting the sql files other dependencies load. This can be accomplished in similar ways with HMP based services and skaffold/kustomize based service. The path /docker-entrypoint-initdb.d/ in the docker container automatically run any sql or shell scripts.
HMP based projects
Below is an example using callback-serivce for how to configure a HMP based project.
metadata.yaml
oracle-test:
volumeMounts:
- source: db
target: /docker-entrypoint-initdb.d/
Service module pom.xml
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-db-scripts</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>package</phase>
<configuration>
<resources>
<resource>
<directory>${project.build.directory}/db</directory>
<includes>
<include>**/*.sql</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}/helm/callback-service-${project.version}/charts/oracle-test-${oracletest.version}/volumes/db/callback</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
Kustomize based projects
kubernetes/components/dev/callback-db/data-oracle-test.yaml
configMapGenerator:
- name: callback-service-app-config
behavior: merge
envs:
- application.env
- name: callback-oracle-test-db-configs
files:
- callback-db/sql/001-callback.sql
- callback-db/sql/002-callback.sql
- callback-db/sql/003-callback.sql
- callback-db/sql/004-callback.sql
- callback-db/sql/005-callback.sql
- callback-db/sql/006-callback.sql
- callback-db/sql/007-callback.sql
- callback-db/sql/008-callback-1.8.4.sql
kubernetes/components/dev/kustomization.yaml
containers:
- name: oracle-test-v4
volumeMounts:
- name: callback-oracle-test-db-configs
mountPath: /docker-entrypoint-initdb.d/callback
Service module pom.xml
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-db-scripts</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>package</phase>
<configuration>
<resources>
<resource>
<directory>${project.build.directory}/db</directory>
<includes>
<include>**/*.sql</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.basedir}/../kubernetes/components/dev/callback-db/</outputDirectory>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>