Skip to content

Commit

Permalink
change oracle image into gvenzl/oracle-free:23.5-slim
Browse files Browse the repository at this point in the history
  • Loading branch information
naive-zhang committed Nov 25, 2024
1 parent abf9837 commit d688b47
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,39 @@

package org.apache.kyuubi.engine.jdbc.oracle

import com.dimafeng.testcontainers.OracleContainer
import org.testcontainers.utility.DockerImageName
// import java.time.Duration

import com.dimafeng.testcontainers.GenericContainer
import org.testcontainers.containers.wait.strategy.{Wait, WaitAllStrategy}

import org.apache.kyuubi.engine.jdbc.WithJdbcServerContainer

trait WithOracleContainer extends WithJdbcServerContainer {

private val oracleDockerImage = "gvenzl/oracle-xe:18.4.0-slim"
private val oraclePort = 1521
private val ports = Seq(oraclePort)
private val oracleDockerImage = "gvenzl/oracle-free:23.5-slim"
private val oracleUsernameKey = "APP_USER"
private val oraclePasswordKey = "APP_USER_PASSWORD"
protected val oracleUserName = "kyuubi"
protected val oraclePassword = "oracle"

override val containerDef = OracleContainer.Def(
dockerImageName = DockerImageName.parse(oracleDockerImage),
username = oracleUserName,
password = oraclePassword)
override val containerDef: GenericContainer.Def[GenericContainer] = GenericContainer.Def(
dockerImage = oracleDockerImage,
exposedPorts = ports,
waitStrategy = new WaitAllStrategy()
// .withStartupTimeout(Duration.ofMinutes(1))
.withStrategy(Wait.forListeningPort())
.withStrategy(Wait.forLogMessage(
"Completed: Pluggable database FREEPDB1 opened read write", 1))
,
env = Map(
oraclePasswordKey -> oraclePassword,
oracleUsernameKey -> oracleUserName,
"ORACLE_RANDOM_PASSWORD" -> "true"))

protected def oracleJdbcUrl: String = withContainers { container =>
val queryServerHost: String = container.host
val queryServerPort: Int = container.mappedPort(oraclePort)
s"jdbc:oracle:thin:@//$queryServerHost:$queryServerPort/FREEPDB1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ trait WithOracleEngine extends WithJdbcEngine with WithOracleContainer {
override def withKyuubiConf: Map[String, String] = withContainers { container =>
Map(
ENGINE_SHARE_LEVEL.key -> "SERVER",
ENGINE_JDBC_CONNECTION_URL.key -> container.jdbcUrl,
ENGINE_JDBC_CONNECTION_USER.key -> container.username,
ENGINE_JDBC_CONNECTION_PASSWORD.key -> container.password,
ENGINE_JDBC_CONNECTION_URL.key -> oracleJdbcUrl,
ENGINE_JDBC_CONNECTION_USER.key -> oracleUserName,
ENGINE_JDBC_CONNECTION_PASSWORD.key -> oraclePassword,
ENGINE_TYPE.key -> "jdbc",
ENGINE_JDBC_SHORT_NAME.key -> "oracle",
FRONTEND_BIND_HOST.key -> "0.0.0.0",
Expand Down

0 comments on commit d688b47

Please sign in to comment.