diff --git a/charts/opal-file-handler/Chart.yaml b/charts/opal-file-handler/Chart.yaml index 31a84dbf..d1da4c59 100644 --- a/charts/opal-file-handler/Chart.yaml +++ b/charts/opal-file-handler/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "1.0" description: A Helm chart for opal-file-handler App name: opal-file-handler home: https://github.com/hmcts/opal-file-handler -version: 0.0.35 +version: 0.0.36 maintainers: - name: HMCTS opal team dependencies: diff --git a/charts/opal-file-handler/values.dev.template.yaml b/charts/opal-file-handler/values.dev.template.yaml index 52bcec2b..c51baa58 100644 --- a/charts/opal-file-handler/values.dev.template.yaml +++ b/charts/opal-file-handler/values.dev.template.yaml @@ -19,5 +19,5 @@ java: OPAL_FILE_DB_PORT: 5432 RUN_DB_MIGRATION_ON_STARTUP: true FLYWAY_LOCATIONS: classpath:db/migration/allEnvs - postgresql: - enabled: true + postgresql: + enabled: true diff --git a/charts/opal-file-handler/values.yaml b/charts/opal-file-handler/values.yaml index c7320201..dfc1765a 100644 --- a/charts/opal-file-handler/values.yaml +++ b/charts/opal-file-handler/values.yaml @@ -17,7 +17,11 @@ java: - name: file-handler-POSTGRES-USER alias: OPAL_FILE_DB_USERNAME - name: file-handler-POSTGRES-DATABASE - alias: OPAL_FILE_DB_NAME - + alias: OPAL_FILE_DB_NAME + environment: RUN_DB_MIGRATION_ON_STARTUP: true + postgresql: + enabled: false + image: + tag: '17.5.0' diff --git a/docker-compose.yml b/docker-compose.yml index 1c5573aa..974e98f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ services: opal-file-db: container_name: opal-file-db - image: postgres:16 + image: postgres:17.5 restart: always environment: - POSTGRES_DB=opal-file-db diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/opal/SingletonPostgreSQLContainer.java b/src/integrationTest/java/uk/gov/hmcts/reform/opal/SingletonPostgreSQLContainer.java index bed55d57..589cb01f 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/opal/SingletonPostgreSQLContainer.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/opal/SingletonPostgreSQLContainer.java @@ -5,7 +5,7 @@ public class SingletonPostgreSQLContainer { private static final PostgreSQLContainer INSTANCE = - new PostgreSQLContainer<>("postgres:17.0") + new PostgreSQLContainer<>("postgres:17.5") .withDatabaseName("testdb") .withUsername("testuser") .withPassword("testpass"); diff --git a/src/test/java/uk/gov/hmcts/reform/opal/dev/ContainerConfiguration.java b/src/test/java/uk/gov/hmcts/reform/opal/dev/ContainerConfiguration.java new file mode 100644 index 00000000..a830aa6b --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/opal/dev/ContainerConfiguration.java @@ -0,0 +1,35 @@ +package uk.gov.hmcts.reform.opal.dev; + +import com.github.dockerjava.api.model.ExposedPort; +import com.github.dockerjava.api.model.HostConfig; +import com.github.dockerjava.api.model.PortBinding; +import com.github.dockerjava.api.model.Ports; +import org.springframework.boot.devtools.restart.RestartScope; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.Bean; +import org.testcontainers.containers.PostgreSQLContainer; + +@TestConfiguration(proxyBeanMethods = false) +public class ContainerConfiguration { + + @Bean + @ServiceConnection + @RestartScope + PostgreSQLContainer databaseContainer() { + return new PostgreSQLContainer<>("postgres:17.5") + .withCreateContainerCmdModifier(cmd -> { + cmd.withName("test-container-opal-file-db"); + cmd.withHostConfig( + new HostConfig().withPortBindings( + new PortBinding(Ports.Binding.bindPort(5434), new ExposedPort(5432)) + ) + ); + }) + .withExposedPorts(5432) + .withDatabaseName("opal-file-db") + .withUsername("opal-file") + .withPassword("opal-file") + .withReuse(true); + } +} diff --git a/src/test/java/uk/gov/hmcts/reform/opal/dev/DevApplication.java b/src/test/java/uk/gov/hmcts/reform/opal/dev/DevApplication.java new file mode 100644 index 00000000..8eb0b7e4 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/opal/dev/DevApplication.java @@ -0,0 +1,13 @@ +package uk.gov.hmcts.reform.opal.dev; + +import org.springframework.boot.SpringApplication; +import uk.gov.hmcts.reform.opal.Application; + +public class DevApplication { + + public static void main(String[] args) { + SpringApplication.from(Application::main) + .with(ContainerConfiguration.class) + .run(args); + } +}