From 7b5932ab52511539620cb85e196d8288fb5a2043 Mon Sep 17 00:00:00 2001 From: Klara M Helgemo Date: Fri, 5 Jul 2024 14:52:44 +0200 Subject: [PATCH] Prodsette endringer i dev (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump org.springdoc:springdoc-openapi-ui from 1.7.0 to 1.8.0 (#144) Bumps org.springdoc:springdoc-openapi-ui from 1.7.0 to 1.8.0. --- updated-dependencies: - dependency-name: org.springdoc:springdoc-openapi-ui dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump com.squareup.okhttp3:okhttp from 4.11.0 to 4.12.0 (#145) * Bump com.squareup.okhttp3:okhttp from 4.11.0 to 4.12.0 Bumps [com.squareup.okhttp3:okhttp](https://github.com/square/okhttp) from 4.11.0 to 4.12.0. - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-4.11.0...parent-4.12.0) --- updated-dependencies: - dependency-name: com.squareup.okhttp3:okhttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * oppdatering prometheus --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Klara M Helgemo * Bump softprops/action-gh-release from 1 to 2 in /.github/workflows (#146) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Klara M Helgemo * Legg til generativ KI merking * Oppgrader til Java 21 (#153) * Bump org.testcontainers:postgresql from 1.19.7 to 1.19.8 (#155) Bumps [org.testcontainers:postgresql](https://github.com/testcontainers/testcontainers-java) from 1.19.7 to 1.19.8. - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.19.7...1.19.8) --- updated-dependencies: - dependency-name: org.testcontainers:postgresql dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Oppgraderer databasen til postgres 15 i dev (#159) * Oppgrader til Java 21 * Prodsette oppgradering Java 21 (#154) * Bump org.springdoc:springdoc-openapi-ui from 1.7.0 to 1.8.0 (#144) Bumps org.springdoc:springdoc-openapi-ui from 1.7.0 to 1.8.0. --- updated-dependencies: - dependency-name: org.springdoc:springdoc-openapi-ui dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump com.squareup.okhttp3:okhttp from 4.11.0 to 4.12.0 (#145) * Bump com.squareup.okhttp3:okhttp from 4.11.0 to 4.12.0 Bumps [com.squareup.okhttp3:okhttp](https://github.com/square/okhttp) from 4.11.0 to 4.12.0. - [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md) - [Commits](https://github.com/square/okhttp/compare/parent-4.11.0...parent-4.12.0) --- updated-dependencies: - dependency-name: com.squareup.okhttp3:okhttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * oppdatering prometheus --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Klara M Helgemo * Bump softprops/action-gh-release from 1 to 2 in /.github/workflows (#146) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Klara M Helgemo * Legg til generativ KI merking * Oppgrader til Java 21 (#153) --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sondre Larsen Ovrid <111113539+slovrid@users.noreply.github.com> Co-authored-by: Mathias S. Müller <85442404+Mathiamu@users.noreply.github.com> * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sondre Larsen Ovrid <111113539+slovrid@users.noreply.github.com> Co-authored-by: Mathias S. Müller <85442404+Mathiamu@users.noreply.github.com> * Postgres 15 (#161) * Oppgrader til Java 21 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Forklarende tekst i Readme * Migrering til Postgres 15 (#162) * Oppgrader til Java 21 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Migrerer databasen i dev til pg15 * Forklarende tekst i Readme * Forbereder appen for å kopiere data fra gammel til ny db i prod --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sondre Larsen Ovrid <111113539+slovrid@users.noreply.github.com> Co-authored-by: Mathias S. Müller <85442404+Mathiamu@users.noreply.github.com> --- .nais/application/application-config-prod.yaml | 4 ++-- README.md | 16 ++++++++++++++++ pom.xml | 2 +- .../config/DatabaseMigrationConfig.java | 2 +- .../java/no/nav/veilarboppgave/util/DbUtils.java | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.nais/application/application-config-prod.yaml b/.nais/application/application-config-prod.yaml index 382b336..7dc08a6 100644 --- a/.nais/application/application-config-prod.yaml +++ b/.nais/application/application-config-prod.yaml @@ -8,8 +8,8 @@ metadata: spec: image: {{image}} replicas: - min: 2 - max: 4 + min: 0 + max: 0 cpuThresholdPercentage: 75 port: 8080 webproxy: true diff --git a/README.md b/README.md index 32608c9..2f9ed7c 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,19 @@ Interne henvendelser kan sendes via Slack i kanalen #po-arbeidsoppfølging. ## Kode generert av GitHub Copilot Dette repoet bruker GitHub Copilot til å generere kode. +## PostgreSQL +Innloggingsinformasjon til databasen: https://vault.adeo.no/ + +Dev: vault read postgresql/preprod-fss/creds/veilarboppgave-pg15-dev-admin + +Ting å passe på ved oppgradering av databasen: +1. Lag PR i repo database-iac, eksempel https://github.com/navikt/database-iac/pull/592 Ny database får gjerne nytt navn, eks veilarboppgave-pg15 +I repoet database-iac finner du bla hostnavn og port +2. Lag PR i repo vault.iac, eksempel: https://github.com/navikt/vault-iac/pull/5514 +Ny database må legges inn i terraform/teams/pto/apps/veilarboppgave.yml og i terraform/teams/pto/pto.yml, både under dev og prod +3. I dev: Du kan opprette tabeller i den nye databasen ved å ta ut DDlene fra gammel db, og tilpasse skriptet med nytt navn. Kjør skriptet. +4. I dev: Bruk Import/Export og Copy table to.. (F5) Dobbeltklikk på public i ny database, og kopier. Da kopieres data med riktig user (ikke deg selv) +5. I dev: Vault: Sjekk at url til ny database stemmer med det som er satt i database-iac. Gå inn i Secrets kv/preprod/fss og velg veilarboppgave , q1. +Hvis ikke VEILARBOPPGAVE_DB_URL er riktig, velg Edit secret og sett riktige verdier. +6. Oppdater koden med riktig databasenavn, se f.eks https://github.com/navikt/veilarboppgave/pull/160/files + diff --git a/pom.xml b/pom.xml index 94034d1..45cef45 100644 --- a/pom.xml +++ b/pom.xml @@ -168,7 +168,7 @@ org.testcontainers postgresql - 1.19.7 + 1.19.8 test diff --git a/src/main/java/no/nav/veilarboppgave/config/DatabaseMigrationConfig.java b/src/main/java/no/nav/veilarboppgave/config/DatabaseMigrationConfig.java index 16de92d..28afcf5 100644 --- a/src/main/java/no/nav/veilarboppgave/config/DatabaseMigrationConfig.java +++ b/src/main/java/no/nav/veilarboppgave/config/DatabaseMigrationConfig.java @@ -27,7 +27,7 @@ public void migrateDb() { Flyway.configure() .dataSource(dataSource) - .initSql(format("SET ROLE \"veilarboppgave-%s-admin\"", environment)) + .initSql(format("SET ROLE \"veilarboppgave-pg15-%s-admin\"", environment)) .load() .migrate(); } diff --git a/src/main/java/no/nav/veilarboppgave/util/DbUtils.java b/src/main/java/no/nav/veilarboppgave/util/DbUtils.java index f49fee6..39c4b75 100644 --- a/src/main/java/no/nav/veilarboppgave/util/DbUtils.java +++ b/src/main/java/no/nav/veilarboppgave/util/DbUtils.java @@ -27,7 +27,7 @@ public static HikariConfig createDataSourceConfig(String dbUrl) { @SneakyThrows private static DataSource createVaultRefreshDataSource(HikariConfig config) { String environment = isProduction().orElse(false) ? "prod" : "dev"; - String role = String.join("-", APPLICATION_NAME, environment, "admin"); + String role = String.join("-", APPLICATION_NAME, "pg15", environment, "admin"); return HikariCPVaultUtil.createHikariDataSourceWithVaultIntegration(config, getMountPath(), role); }