Skip to content

Commit

Permalink
forbereder deploy til gcp (men ingen replicas)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsteinsland committed Jan 8, 2024
1 parent ec66f7d commit b250d28
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 111 deletions.
28 changes: 0 additions & 28 deletions config/gosys/prod-fss.yml

This file was deleted.

31 changes: 31 additions & 0 deletions config/gosys/prod-gcp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
kafkaPool: nav-prod
minReplicas: 0
maxReplicas: 0
azure:
enabled: true
gcp:
type: POSTGRES_15
databaseName: spre-gosys
envVarPrefix: DB
accessPolicy:
outbound:
- application: spre-gosys-pdf
external:
- dokarkiv.prod-fss-pub.nais.io
- ereg-services.prod-fss-pub.nais.io
- pdl-api.prod-fss-pub.nais.io
env:
- name: KAFKA_MAX_RECORDS
value: "50"
- name: KAFKA_MAX_POLL_INTERVAL_MS
value: "500000"
- name: JOARK_BASE_URL
value: https://dokarkiv.prod-fss-pub.nais.io
- name: JOARK_SCOPE
value: api://prod-fss.teamdokumenthandtering.dokarkiv/.default
- name: EREG_BASE_URL
value: https://ereg-services.prod-fss-pub.nais.io
- name: PDL_BASE_URL
value: https://pdl-api.prod-fss-pub.nais.io
- name: PDL_CLIENT_SCOPE
value: api://prod-fss.pdl.pdl-api/.default
42 changes: 15 additions & 27 deletions gosys/src/main/kotlin/no/nav/helse/spre/gosys/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal val objectMapper: ObjectMapper = jacksonObjectMapper()
internal val log: Logger = LoggerFactory.getLogger("spregosys")
internal val sikkerLogg: Logger = LoggerFactory.getLogger("tjenestekall")

val erUtvikling = System.getenv("NAIS_CLUSTER_NAME") == "dev-fss"
val erUtvikling = System.getenv("NAIS_CLUSTER_NAME") == "dev-gcp"

fun main() {
val rapidsConnection = launchApplication(System.getenv())
Expand All @@ -62,37 +62,25 @@ fun launchApplication(
install(HttpTimeout) { requestTimeoutMillis = 10000 }
}
val joarkClient = JoarkClient(environment.getValue("JOARK_BASE_URL"), azureClient, environment.getValue("JOARK_SCOPE"), httpClient)
val pdfBaseUrl = if (System.getenv("NAIS_CLUSTER_NAME") == "dev-gcp") {
"http://spre-gosys-pdf"
} else {
"http://spre-gosys-pdf.tbd.svc.nais.local"
}
val pdfClient = PdfClient(httpClient, pdfBaseUrl)
val pdfClient = PdfClient(httpClient, "http://spre-gosys-pdf")
val eregClient = EregClient(environment.getValue("EREG_BASE_URL"), httpClient)
val pdlClient = PdlClient(azureClient, httpClient, environment.getValue("PDL_BASE_URL"), environment.getValue("PDL_CLIENT_SCOPE"))

val dataSource = if (System.getenv("NAIS_CLUSTER_NAME") == "dev-gcp") {
val hikariConfig = HikariConfig().apply {
jdbcUrl = String.format("jdbc:postgresql://%s:%s/%s", environment.getValue("DB_HOST"), environment.getValue("DB_PORT"), environment.getValue("DB_DATABASE"))
username = environment.getValue("DB_USERNAME")
password = environment.getValue("DB_PASSWORD")
maximumPoolSize = 3
initializationFailTimeout = Duration.ofMinutes(30).toMillis()
}

val dataSource = HikariDataSource(hikariConfig)
Flyway.configure()
.dataSource(dataSource)
.lockRetryCount(-1)
.load()
.migrate()
dataSource
} else {
val dataSourceBuilder = DataSourceBuilder(readDatabaseEnvironment())
dataSourceBuilder.migrate()
dataSourceBuilder.getDataSource()
val hikariConfig = HikariConfig().apply {
jdbcUrl = String.format("jdbc:postgresql://%s:%s/%s", environment.getValue("DB_HOST"), environment.getValue("DB_PORT"), environment.getValue("DB_DATABASE"))
username = environment.getValue("DB_USERNAME")
password = environment.getValue("DB_PASSWORD")
maximumPoolSize = 3
initializationFailTimeout = Duration.ofMinutes(30).toMillis()
}

val dataSource = HikariDataSource(hikariConfig)
Flyway.configure()
.dataSource(dataSource)
.lockRetryCount(-1)
.load()
.migrate()

val duplikatsjekkDao = DuplikatsjekkDao(dataSource)

val vedtakMediator = VedtakMediator(pdfClient, joarkClient, eregClient, pdlClient)
Expand Down
17 changes: 0 additions & 17 deletions gosys/src/main/kotlin/no/nav/helse/spre/gosys/Config.kt

This file was deleted.

39 changes: 0 additions & 39 deletions gosys/src/main/kotlin/no/nav/helse/spre/gosys/DataSourceBuilder.kt

This file was deleted.

0 comments on commit b250d28

Please sign in to comment.