diff --git a/.github/workflows/deploy_q1.yaml b/.github/workflows/deploy_q1.yaml new file mode 100644 index 000000000..20585bd8f --- /dev/null +++ b/.github/workflows/deploy_q1.yaml @@ -0,0 +1,19 @@ +name: Deploy q1 +on: + workflow_dispatch: + push: + branches: + - 'q1/**' + - 'Q1/**' + +jobs: + build_and_deploy: + name: "Build and deploy to q1" + permissions: + contents: "read" + id-token: "write" + uses: navikt/bidrag-workflow/.github/workflows/deploy.yaml@main + secrets: inherit + with: + nais_variabler_filnavn: q1.yaml + diff --git a/.github/workflows/deploy_q2.yaml b/.github/workflows/deploy_q2.yaml new file mode 100644 index 000000000..a1f821923 --- /dev/null +++ b/.github/workflows/deploy_q2.yaml @@ -0,0 +1,19 @@ +name: Deploy q2 +on: + workflow_dispatch: + push: + branches: + - 'q2/**' + - 'Q2/**' + +jobs: + build_and_deploy: + name: "Build and deploy to q2" + permissions: + contents: "read" + id-token: "write" + uses: navikt/bidrag-workflow/.github/workflows/deploy.yaml@main + secrets: inherit + with: + nais_variabler_filnavn: q2.yaml + diff --git a/.github/workflows/deploy_q4.yaml b/.github/workflows/deploy_q4.yaml new file mode 100644 index 000000000..b65b3b2b5 --- /dev/null +++ b/.github/workflows/deploy_q4.yaml @@ -0,0 +1,23 @@ +name: Deploy q4 +on: + workflow_dispatch: + push: + branches: +# - '**' + - '!main' + - '!q1/**' + - '!Q1/**' + - '!q2/**' + - '!Q2/**' + +jobs: + build_and_deploy: + name: "Build and deploy to q4" + permissions: + contents: "read" + id-token: "write" + uses: navikt/bidrag-workflow/.github/workflows/deploy.yaml@main + secrets: inherit + with: + nais_variabler_filnavn: q4.yaml + diff --git a/.nais/feature.yaml b/.nais/feature.yaml index 09babe39f..efb71c93d 100644 --- a/.nais/feature.yaml +++ b/.nais/feature.yaml @@ -1,7 +1,9 @@ name: bidrag-behandling-feature ingresses: - https://bidrag-behandling-feature.intern.dev.nav.no +min_replicas: 1 env: + SPRING_PROFILES_ACTIVE: live,nais,database-legacy BIDRAG_PERSON_URL: https://bidrag-person-feature.dev-fss-pub.nais.io/bidrag-person BIDRAG_PERSON_SCOPE: dev-fss.bidrag.bidrag-person-feature BIDRAG_GRUNNLAG_URL: http://bidrag-grunnlag-feature diff --git a/.nais/main.yaml b/.nais/main.yaml index ae1bd325d..37ca11832 100644 --- a/.nais/main.yaml +++ b/.nais/main.yaml @@ -1,7 +1,9 @@ name: bidrag-behandling ingresses: - https://bidrag-behandling.intern.dev.nav.no +min_replicas: 2 env: + SPRING_PROFILES_ACTIVE: live,nais,database-legacy BIDRAG_PERSON_URL: https://bidrag-person.dev-fss-pub.nais.io/bidrag-person BIDRAG_PERSON_SCOPE: dev-fss.bidrag.bidrag-person BIDRAG_GRUNNLAG_URL: http://bidrag-grunnlag diff --git a/.nais/nais.yaml b/.nais/nais.yaml index c119ee57c..8b0fcd8ad 100644 --- a/.nais/nais.yaml +++ b/.nais/nais.yaml @@ -34,6 +34,9 @@ spec: secureLogs: enabled: true image: {{ image }} + replicas: + min: {{min_replicas}} + max: 4 liveness: path: /actuator/health initialDelay: 60 diff --git a/.nais/prod.yaml b/.nais/prod.yaml index 2a119d8f0..ce3e9cd65 100644 --- a/.nais/prod.yaml +++ b/.nais/prod.yaml @@ -1,7 +1,9 @@ name: bidrag-behandling ingresses: - https://bidrag-behandling.intern.nav.no +min_replicas: 2 env: + SPRING_PROFILES_ACTIVE: live,nais,database-legacy BIDRAG_PERSON_URL: https://bidrag-person.prod-fss-pub.nais.io/bidrag-person BIDRAG_PERSON_SCOPE: prod-fss.bidrag.bidrag-person BIDRAG_GRUNNLAG_URL: http://bidrag-grunnlag diff --git a/.nais/q1.yaml b/.nais/q1.yaml new file mode 100644 index 000000000..e17bda570 --- /dev/null +++ b/.nais/q1.yaml @@ -0,0 +1,73 @@ +name: bidrag-behandling-q1 +ingresses: + - https://bidrag-behandling-q1.intern.dev.nav.no +min_replicas: 1 +env: + SPRING_PROFILES_ACTIVE: live,nais,database-new + BIDRAG_PERSON_URL: https://bidrag-person-feature.dev-fss-pub.nais.io/bidrag-person + BIDRAG_PERSON_SCOPE: dev-fss.bidrag.bidrag-person-feature + BIDRAG_GRUNNLAG_URL: http://bidrag-grunnlag-feature + BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag-feature + BIDRAG_FORSENDELSE_URL: http://bidrag-dokument-forsendelse-feature + BIDRAG_FORSENDELSE_SCOPE: dev-gcp.bidrag.bidrag-dokument-forsendelse-feature + BIDRAG_TILGANGSKONTROLL_URL: http://bidrag-tilgangskontroll-feature + BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll-feature + BIDRAG_STONAD_URL: http://bidrag-stonad-q1 + BIDRAG_STONAD_SCOPE: dev-gcp.bidrag.bidrag-stonad-q1 + BIDRAG_VEDTAK_URL: http://bidrag-vedtak-q1 + BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak-q1 + BIDRAG_BBM_URL: https://bidrag-bbm-feature.dev-fss-pub.nais.io + BIDRAG_BBM_SCOPE: dev-fss.bidrag.bidrag-bbm-feature + BIDRAG_DOKUMENT_PRODUKSJON_URL: http://bidrag-dokument-produksjon + BIDRAG_DOKUMENT_PRODUKSJON_SCOPE: dev-gcp.bidrag.bidrag-dokument-produksjon + BIDRAG_DOKUMENT_URL: https://bidrag-dokument-feature.dev-fss-pub.nais.io/bidrag-dokument + BIDRAG_DOKUMENT_SCOPE: dev-fss.bidrag.bidrag-dokument-feature + BIDRAG_SAK_URL: https://bidrag-sak-feature.dev-fss-pub.nais.io/bidrag-sak + BIDRAG_SAK_SCOPE: dev-fss.bidrag.bidrag-sak-feature + TOPIC_VEDTAK: bidrag.vedtak-q1 + BIDRAG_ORGANISASJON_SCOPE: dev-fss.bidrag.bidrag-organisasjon-feature + BIDRAG_ORGANISASJON_URL: https://bidrag-organisasjon-feature.dev-fss-pub.nais.io/bidrag-organisasjon + BIDRAG_SJABLON_URL: https://bidrag-sjablon.dev-fss-pub.nais.io/bidrag-sjablon + ARBEID_OG_INNTEKT_URL: https://arbeid-og-inntekt-q1.dev-fss-pub.nais.io/api/v2 + GRUNNLAG_MIN_ANT_MINUTTER_SIDEN_FORRIGE_INNHENTING: 1 + KODEVERK_URL: https://kodeverk-api.nav.no + JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 +kafka: + pool: nav-dev +azure_access_inbound: + - application: bidrag-ui-feature + namespace: bidrag + cluster: dev-fss + - application: bisys + namespace: bidrag + cluster: dev-fss + - application: bidrag-dokument-forsendelse-feature + namespace: bidrag + cluster: dev-gcp + - application: bidrag-dokument-bestilling-feature + namespace: bidrag + cluster: dev-gcp +database: + dbname: bidrag-behandling-q1 + autoResize: true + tier: db-f1-micro +outbound-access-apps: + - bidrag-stonad-q1 + - bidrag-vedtak-q1 + - bidrag-dokument-produksjon + - bidrag-grunnlag-feature + - bidrag-dokument-forsendelse-feature + - bidrag-tilgangskontroll-feature + - bidrag-dokument-produksjon-feature +outbound-access-hosts: + - bidrag-dokument-feature.dev-fss-pub.nais.io + - bidrag-person-feature.dev-fss-pub.nais.io + - bidrag-organisasjon-feature.dev-fss-pub.nais.io + - bidrag-sjablon-feature.dev-fss-pub.nais.io + - arbeid-og-inntekt-q1.dev-fss-pub.nais.io + - kodeverk-api.nav.no + - bidrag-unleash-api.nav.cloud.nais.io + - bidrag-bbm-feature.dev-fss-pub.nais.io +unleash: + env: development + secret_name: bidrag-behandling-unleash-api-token \ No newline at end of file diff --git a/.nais/q2.yaml b/.nais/q2.yaml new file mode 100644 index 000000000..066237d34 --- /dev/null +++ b/.nais/q2.yaml @@ -0,0 +1,72 @@ +name: bidrag-behandling-q2 +ingresses: + - https://bidrag-behandling-q2.intern.dev.nav.no +min_replicas: 1 +env: + SPRING_PROFILES_ACTIVE: live,nais,database-new + BIDRAG_PERSON_URL: https://bidrag-person.dev-fss-pub.nais.io/bidrag-person + BIDRAG_PERSON_SCOPE: dev-fss.bidrag.bidrag-person + BIDRAG_GRUNNLAG_URL: http://bidrag-grunnlag + BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag + BIDRAG_FORSENDELSE_URL: http://bidrag-dokument-forsendelse + BIDRAG_FORSENDELSE_SCOPE: dev-gcp.bidrag.bidrag-dokument-forsendelse + BIDRAG_TILGANGSKONTROLL_URL: http://bidrag-tilgangskontroll + BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll + BIDRAG_STONAD_URL: http://bidrag-stonad-q2 + BIDRAG_STONAD_SCOPE: dev-gcp.bidrag.bidrag-stonad-q2 + BIDRAG_VEDTAK_URL: http://bidrag-vedtak-q2 + BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak-q2 + BIDRAG_BBM_URL: https://bidrag-bbm.dev-fss-pub.nais.io + BIDRAG_BBM_SCOPE: dev-fss.bidrag.bidrag-bbm + BIDRAG_DOKUMENT_PRODUKSJON_URL: http://bidrag-dokument-produksjon + BIDRAG_DOKUMENT_PRODUKSJON_SCOPE: dev-gcp.bidrag.bidrag-dokument-produksjon + BIDRAG_DOKUMENT_URL: https://bidrag-dokument.dev-fss-pub.nais.io/bidrag-dokument + BIDRAG_DOKUMENT_SCOPE: dev-fss.bidrag.bidrag-dokument + BIDRAG_SAK_URL: https://bidrag-sak.dev-fss-pub.nais.io/bidrag-sak + BIDRAG_SAK_SCOPE: dev-fss.bidrag.bidrag-sak + TOPIC_VEDTAK: bidrag.vedtak-q2 + BIDRAG_ORGANISASJON_SCOPE: dev-fss.bidrag.bidrag-organisasjon + BIDRAG_ORGANISASJON_URL: https://bidrag-organisasjon.dev-fss-pub.nais.io/bidrag-organisasjon + BIDRAG_SJABLON_URL: https://bidrag-sjablon.dev-fss-pub.nais.io/bidrag-sjablon + ARBEID_OG_INNTEKT_URL: https://arbeid-og-inntekt-q1.dev-fss-pub.nais.io/api/v2 + GRUNNLAG_MIN_ANT_MINUTTER_SIDEN_FORRIGE_INNHENTING: 1 + KODEVERK_URL: https://kodeverk-api.nav.no + JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 +kafka: + pool: nav-dev +azure_access_inbound: + - application: bidrag-ui + namespace: bidrag + cluster: dev-fss + - application: bisys + namespace: bidrag + cluster: dev-fss + - application: bidrag-dokument-forsendelse + namespace: bidrag + cluster: dev-gcp + - application: bidrag-dokument-bestilling + namespace: bidrag + cluster: dev-gcp +database: + dbname: bidrag-behandling-q2 + autoResize: true + tier: db-f1-micro +outbound-access-apps: + - bidrag-grunnlag + - bidrag-stonad-q2 + - bidrag-dokument-forsendelse + - bidrag-tilgangskontroll + - bidrag-vedtak-q2 + - bidrag-dokument-produksjon +outbound-access-hosts: + - bidrag-dokument.dev-fss-pub.nais.io + - bidrag-person.dev-fss-pub.nais.io + - bidrag-organisasjon.dev-fss-pub.nais.io + - bidrag-sjablon.dev-fss-pub.nais.io + - arbeid-og-inntekt.dev-fss-pub.nais.io + - kodeverk-api.nav.no + - bidrag-unleash-api.nav.cloud.nais.io + - bidrag-bbm.dev-fss-pub.nais.io +unleash: + env: development + secret_name: bidrag-behandling-unleash-api-token \ No newline at end of file diff --git a/.nais/q4.yaml b/.nais/q4.yaml new file mode 100644 index 000000000..904a05a82 --- /dev/null +++ b/.nais/q4.yaml @@ -0,0 +1,72 @@ +name: bidrag-behandling-q4 +ingresses: + - https://bidrag-behandling-q4.intern.dev.nav.no +min_replicas: 1 +env: + SPRING_PROFILES_ACTIVE: live,nais,database-new + BIDRAG_PERSON_URL: https://bidrag-person-feature.dev-fss-pub.nais.io/bidrag-person + BIDRAG_PERSON_SCOPE: dev-fss.bidrag.bidrag-person-feature + BIDRAG_GRUNNLAG_URL: http://bidrag-grunnlag-feature + BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag-feature + BIDRAG_FORSENDELSE_URL: http://bidrag-dokument-forsendelse-feature + BIDRAG_FORSENDELSE_SCOPE: dev-gcp.bidrag.bidrag-dokument-forsendelse-feature + BIDRAG_TILGANGSKONTROLL_URL: http://bidrag-tilgangskontroll-feature + BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll-feature + BIDRAG_STONAD_URL: http://bidrag-stonad-q4 + BIDRAG_STONAD_SCOPE: dev-gcp.bidrag.bidrag-stonad-q4 + BIDRAG_VEDTAK_URL: http://bidrag-vedtak-q4 + BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak-q4 + BIDRAG_BBM_URL: https://bidrag-bbm-feature.dev-fss-pub.nais.io + BIDRAG_BBM_SCOPE: dev-fss.bidrag.bidrag-bbm-feature + BIDRAG_DOKUMENT_PRODUKSJON_URL: http://bidrag-dokument-produksjon + BIDRAG_DOKUMENT_PRODUKSJON_SCOPE: dev-gcp.bidrag.bidrag-dokument-produksjon + BIDRAG_DOKUMENT_URL: https://bidrag-dokument-feature.dev-fss-pub.nais.io/bidrag-dokument + BIDRAG_DOKUMENT_SCOPE: dev-fss.bidrag.bidrag-dokument-feature + BIDRAG_SAK_URL: https://bidrag-sak-feature.dev-fss-pub.nais.io/bidrag-sak + BIDRAG_SAK_SCOPE: dev-fss.bidrag.bidrag-sak-feature + TOPIC_VEDTAK: bidrag.vedtak-q4 + BIDRAG_ORGANISASJON_SCOPE: dev-fss.bidrag.bidrag-organisasjon-feature + BIDRAG_ORGANISASJON_URL: https://bidrag-organisasjon-feature.dev-fss-pub.nais.io/bidrag-organisasjon + BIDRAG_SJABLON_URL: https://bidrag-sjablon.dev-fss-pub.nais.io/bidrag-sjablon + ARBEID_OG_INNTEKT_URL: https://arbeid-og-inntekt-q1.dev-fss-pub.nais.io/api/v2 + GRUNNLAG_MIN_ANT_MINUTTER_SIDEN_FORRIGE_INNHENTING: 1 + KODEVERK_URL: https://kodeverk-api.nav.no + JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 +kafka: + pool: nav-dev +azure_access_inbound: + - application: bidrag-ui + namespace: bidrag + cluster: dev-fss + - application: bisys + namespace: bidrag + cluster: dev-fss + - application: bidrag-dokument-forsendelse + namespace: bidrag + cluster: dev-gcp + - application: bidrag-dokument-bestilling + namespace: bidrag + cluster: dev-gcp +database: + dbname: bidrag-behandling-q4 + autoResize: true + tier: db-f1-micro +outbound-access-apps: + - bidrag-grunnlag + - bidrag-stonad-q4 + - bidrag-dokument-forsendelse + - bidrag-tilgangskontroll + - bidrag-vedtak-q4 + - bidrag-dokument-produksjon +outbound-access-hosts: + - bidrag-dokument.dev-fss-pub.nais.io + - bidrag-person.dev-fss-pub.nais.io + - bidrag-organisasjon.dev-fss-pub.nais.io + - bidrag-sjablon.dev-fss-pub.nais.io + - arbeid-og-inntekt.dev-fss-pub.nais.io + - kodeverk-api.nav.no + - bidrag-unleash-api.nav.cloud.nais.io + - bidrag-bbm.dev-fss-pub.nais.io +unleash: + env: development + secret_name: bidrag-behandling-unleash-api-token \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bb6162ea3..75b0dc248 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,5 +3,4 @@ LABEL maintainer="Team Bidrag" \ email="bidrag@nav.no" COPY ./target/bidrag-behandling-*.jar app.jar -ENV SPRING_PROFILES_ACTIVE=nais EXPOSE 8080 diff --git a/initEnv.sh b/initEnv.sh index a62975988..7a0213696 100755 --- a/initEnv.sh +++ b/initEnv.sh @@ -1,2 +1,7 @@ +#!/bin/bash kubectx dev-gcp -kubectl exec --tty deployment/bidrag-behandling-feature printenv | grep -E 'AZURE_|_URL|SCOPE|UNLEASH' | grep -v -e 'BIDRAG_FORSENDELSE_URL' -e 'BIDRAG_TILGANGSKONTROLL_URL' -e 'BIDRAG_GRUNNLAG_URL' -e 'BIDRAG_VEDTAK_SCOPE' -e 'BIDRAG_VEDTAK_URL' -e 'BIDRAG_BBM_URL' > src/test/resources/application-lokal-nais-secrets.properties \ No newline at end of file + +deployment="deployment/bidrag-behandling" +[ "$1" == "q1" ] && deployment="deployment/bidrag-behandling-feature" +echo "Henter miljøparametere fra deployment: $deployment" +kubectl exec --tty $deployment printenv | grep -E 'AZURE_|_URL|SCOPE|UNLEASH' | grep -v -e 'BIDRAG_FORSENDELSE_URL' -e 'BIDRAG_TILGANGSKONTROLL_URL' -e 'BIDRAG_GRUNNLAG_URL' -e 'BIDRAG_VEDTAK_SCOPE' -e 'BIDRAG_VEDTAK_URL' -e 'BIDRAG_STONAD_URL' > src/test/resources/application-lokal-nais-secrets.properties \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 942729634..049505419 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -144,7 +144,11 @@ spring.kafka: enableAutoCommit: false listener: ackMode: RECORD + + +--- spring: + config.activate.on-profile: database-legacy datasource: type: com.zaxxer.hikari.HikariDataSource url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_DATABASE}?user=${DB_USERNAME}&password=${DB_PASSWORD} @@ -158,4 +162,28 @@ spring: enabled: true locations: classpath:/db/migration jpa: - database: postgresql \ No newline at end of file + database: postgresql + +--- +spring: + config.activate.on-profile: database-new + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: ${DB_JDBC_URL} + hikari: + idle-timeout: 10001 + max-lifetime: 30001 + connectionTimeout: 1000 + maximum-pool-size: 10 + minimum-idle: 1 + data-source-properties: + ssl: true + sslmode: ${DB_SSLMODE} + sslcert: ${DB_SSLCERT} + sslkey: ${DB_SSLKEY_PK8} + sslrootcert: ${DB_SSLROOTCERT} + flyway: + enabled: true + locations: classpath:/db/migration + jpa: + database: postgresql diff --git a/src/main/resources/db/migration/ignorert_V1.0.0__baseline.sql b/src/main/resources/db/migration/ignorert_V1.0.0__baseline.sql new file mode 100644 index 000000000..033fe2794 --- /dev/null +++ b/src/main/resources/db/migration/ignorert_V1.0.0__baseline.sql @@ -0,0 +1,457 @@ +/* + DB-skjema baseline per 19.01.2024 + + DDL er hentet med: + >pg_dump --schema-only --no-owner --no-privileges -U cloudsqliamuser -F t bidrag-behandling | gzip >behandling_dump-$(date +%Y-%m-%d).tar.gz + + */ + + +CREATE TYPE public.avslag_type AS ENUM ( + 'ANNET_AVSLAG', + 'PGA_BARNEPENSJ', + 'BARNS_EKTESKAP', + 'BARNS_INNTEKT', + 'PGA_YTELSE_FTRL', + 'FULLT_UNDERH_OFF', + 'IKKE_OMSORG', + 'IKKE_OPPH_I_RIKET', + 'MANGL_DOK', + 'PGA_SAMMENFL', + 'OPPH_UTLAND', + 'UTENL_YTELSE' + ); + + +-- +-- Name: soknad_fra_type; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE public.soknad_fra_type AS ENUM ( + 'BM_I_ANNEN_SAK', + 'BARN_18_AAR', + 'NAV_BIDRAG', + 'FYLKESNEMDA', + 'NAV_INTERNASJONAL', + 'KOMMUNE', + 'KONVERTERING', + 'BIDRAGSMOTTAKER', + 'NORSKE_MYNDIGHET', + 'BIDRAGSPLIKTIG', + 'UTENLANDSKE_MYNDIGHET', + 'VERGE', + 'TRYGDEETATEN_INNKREVING', + 'KLAGE_ANKE' + ); + + +-- +-- Name: CAST (character varying AS public.avslag_type); Type: CAST; Schema: -; Owner: - +-- + +CREATE CAST (character varying AS public.avslag_type) WITH INOUT AS IMPLICIT; + + +-- +-- Name: CAST (character varying AS public.soknad_fra_type); Type: CAST; Schema: -; Owner: - +-- + +CREATE CAST (character varying AS public.soknad_fra_type) WITH INOUT AS IMPLICIT; + + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: barn_i_husstand; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.barn_i_husstand ( + id bigint NOT NULL, + behandling_id bigint NOT NULL, + med_i_saken boolean, + ident character varying(20), + navn text, + foedselsdato date NOT NULL +); + + +-- +-- Name: barn_i_husstand_periode; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.barn_i_husstand_periode ( + id bigint NOT NULL, + barn_i_husstand_id bigint NOT NULL, + dato_fom date, + dato_tom date, + kilde text, + bostatus text DEFAULT 'MED_FORELDER'::text NOT NULL +); + + +-- +-- Name: behandling; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.behandling ( + id bigint NOT NULL, + virkningsdato date, + aarsak text, + dato_fom date, + dato_tom date, + saksnummer character varying(7), + behandler_enhet character(4), + mottattdato date DEFAULT now() NOT NULL, + virkningstidspunktbegrunnelse_vedtak_og_notat text, + virkningstidspunktbegrunnelse_kun_notat text, + boforholdsbegrunnelse_vedtak_og_notat text, + boforholdsbegrunnelse_kun_notat text, + inntektsbegrunnelse_vedtak_og_notat text, + inntektsbegrunnelse_kun_notat text, + vedtakstype text DEFAULT (NOT NULL::boolean), + soknad_fra public.soknad_fra_type DEFAULT 'BIDRAGSMOTTAKER'::public.soknad_fra_type NOT NULL, + stonadstype text, + engangsbeloptype text, + vedtaksid bigint, + soknadsid bigint DEFAULT '-1'::integer NOT NULL, + soknad_ref_id bigint, + opprettet_tidspunkt timestamp without time zone DEFAULT now() NOT NULL, + deleted boolean DEFAULT false NOT NULL, + grunnlagspakkeid bigint, + opprettet_av text DEFAULT ''::text NOT NULL, + opprettet_av_navn text, + kildeapplikasjon text DEFAULT 'bisys'::text NOT NULL, + grunnlag_sist_innhentet timestamp without time zone +); + + +-- +-- Name: behandling_barn_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.barn_i_husstand ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.behandling_barn_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: behandling_barn_periode_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.barn_i_husstand_periode ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.behandling_barn_periode_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: behandling_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.behandling ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.behandling_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + +-- +-- Name: grunnlag; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.grunnlag ( + id bigint NOT NULL, + behandling_id bigint NOT NULL, + data jsonb, + innhentet timestamp without time zone DEFAULT now(), + type text, + aktiv timestamp without time zone +); + + +-- +-- Name: inntekt; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.inntekt ( + id bigint NOT NULL, + behandling_id bigint NOT NULL, + ta_med boolean NOT NULL, + inntektsrapportering text, + dato_fom date, + dato_tom date, + ident text NOT NULL, + belop numeric DEFAULT 0 NOT NULL, + kilde character varying(15), + gjelder_barn character varying(11), + opprinnelig_fom date, + opprinnelig_tom date +); + + +-- +-- Name: inntekt_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.inntekt ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.inntekt_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: inntektspost; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.inntektspost ( + id bigint NOT NULL, + inntekt_id bigint NOT NULL, + belop numeric DEFAULT 0 NOT NULL, + kode text, + visningsnavn text, + inntektstype character varying(50) +); + + +-- +-- Name: inntekt_post_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.inntektspost ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.inntekt_post_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: opplysninger_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.grunnlag ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.opplysninger_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: rolle; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.rolle ( + id bigint NOT NULL, + ident character varying(20), + opprettet timestamp without time zone, + behandling_id bigint NOT NULL, + foedselsdato date, + rolletype text, + deleted boolean DEFAULT false NOT NULL, + navn character varying(200) +); + + +-- +-- Name: rolle_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.rolle ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.rolle_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: sivilstand; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivilstand ( + id bigint NOT NULL, + behandling_id bigint NOT NULL, + dato_fom date, + dato_tom date, + kilde character varying(25), + sivilstand text +); + + +-- +-- Name: sivilstand_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +ALTER TABLE public.sivilstand ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.sivilstand_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 + ); + + +-- +-- Name: barn_i_husstand_periode behandling_barn_periode_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.barn_i_husstand_periode + ADD CONSTRAINT behandling_barn_periode_pkey PRIMARY KEY (id); + + +-- +-- Name: barn_i_husstand behandling_barn_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.barn_i_husstand + ADD CONSTRAINT behandling_barn_pkey PRIMARY KEY (id); + + +-- +-- Name: behandling behandling_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.behandling + ADD CONSTRAINT behandling_pkey PRIMARY KEY (id); + +-- +-- Name: inntekt inntekt_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.inntekt + ADD CONSTRAINT inntekt_pkey PRIMARY KEY (id); + + +-- +-- Name: inntektspost inntekt_post_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.inntektspost + ADD CONSTRAINT inntekt_post_pkey PRIMARY KEY (id); + + +-- +-- Name: grunnlag opplysninger_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.grunnlag + ADD CONSTRAINT opplysninger_pkey PRIMARY KEY (id); + + +-- +-- Name: rolle rolle_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.rolle + ADD CONSTRAINT rolle_pkey PRIMARY KEY (id); + + +-- +-- Name: sivilstand sivilstand_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sivilstand + ADD CONSTRAINT sivilstand_pkey PRIMARY KEY (id); + + +-- +-- Name: behandling behandling_protect; Type: RULE; Schema: public; Owner: - +-- + +CREATE RULE behandling_protect AS + ON DELETE TO public.behandling DO INSTEAD NOTHING; + + +-- +-- Name: rolle rolle_protect; Type: RULE; Schema: public; Owner: - +-- + +CREATE RULE rolle_protect AS + ON DELETE TO public.rolle DO INSTEAD NOTHING; + + +-- +-- Name: barn_i_husstand_periode fk_barn_i_husstand_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.barn_i_husstand_periode + ADD CONSTRAINT fk_barn_i_husstand_id FOREIGN KEY (barn_i_husstand_id) REFERENCES public.barn_i_husstand(id); + + +-- +-- Name: barn_i_husstand fk_behandling_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.barn_i_husstand + ADD CONSTRAINT fk_behandling_id FOREIGN KEY (behandling_id) REFERENCES public.behandling(id); + + +-- +-- Name: grunnlag fk_behandling_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.grunnlag + ADD CONSTRAINT fk_behandling_id FOREIGN KEY (behandling_id) REFERENCES public.behandling(id); + + +-- +-- Name: inntekt fk_behandling_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.inntekt + ADD CONSTRAINT fk_behandling_id FOREIGN KEY (behandling_id) REFERENCES public.behandling(id); + + +-- +-- Name: rolle fk_behandling_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.rolle + ADD CONSTRAINT fk_behandling_id FOREIGN KEY (behandling_id) REFERENCES public.behandling(id); + + +-- +-- Name: sivilstand fk_behandling_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sivilstand + ADD CONSTRAINT fk_behandling_id FOREIGN KEY (behandling_id) REFERENCES public.behandling(id); + + +-- +-- Name: inntektspost fk_inntekt_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.inntektspost + ADD CONSTRAINT fk_inntekt_id FOREIGN KEY (inntekt_id) REFERENCES public.inntekt(id); + + +-- +-- PostgreSQL database dump complete +-- +GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO cloudsqliamuser; \ No newline at end of file diff --git a/src/test/kotlin/no/nav/bidrag/behandling/BehandlingAppTest.kt b/src/test/kotlin/no/nav/bidrag/behandling/BehandlingAppTest.kt index 856b5e006..230132a5d 100644 --- a/src/test/kotlin/no/nav/bidrag/behandling/BehandlingAppTest.kt +++ b/src/test/kotlin/no/nav/bidrag/behandling/BehandlingAppTest.kt @@ -19,7 +19,7 @@ fun main(args: Array) { WireMockServer(WireMockConfiguration.wireMockConfig().dynamicPort().dynamicHttpsPort()) wireMockServer.start() val app = SpringApplication(BehandlingAppTest::class.java) - app.setAdditionalProfiles("test") + app.setAdditionalProfiles("test", "database-legacy") app.run(*args) wireMockServer.resetAll() diff --git a/src/test/kotlin/no/nav/bidrag/behandling/BidragBehandlingLocal.kt b/src/test/kotlin/no/nav/bidrag/behandling/BidragBehandlingLocal.kt index 04fd90d37..0069dc657 100644 --- a/src/test/kotlin/no/nav/bidrag/behandling/BidragBehandlingLocal.kt +++ b/src/test/kotlin/no/nav/bidrag/behandling/BidragBehandlingLocal.kt @@ -14,6 +14,6 @@ class BidragBehandlingLocal fun main(args: Array) { val app = SpringApplication(BidragBehandlingLocal::class.java) - app.setAdditionalProfiles("local", "nais", "Lokal-nais-secrets") + app.setAdditionalProfiles("local", "nais", "Lokal-nais-secrets", "database-legacy") app.run(*args) } diff --git a/src/test/resources/application-local.yaml b/src/test/resources/application-local.yaml index bd9c37890..db13bce88 100644 --- a/src/test/resources/application-local.yaml +++ b/src/test/resources/application-local.yaml @@ -1,11 +1,4 @@ -BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll-feature -BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag-feature -BIDRAG_FORSENDELSE_URL: https://bidrag-dokument-forsendelse.intern.dev.nav.no -BIDRAG_GRUNNLAG_URL: https://bidrag-grunnlag-feature.intern.dev.nav.no -BIDRAG_PERSON_URL: https://bidrag-person.dev.adeo.no -BIDRAG_TILGANGSKONTROLL_URL: https://bidrag-tilgangskontroll-feature.intern.dev.nav.no -GRUNNLAG_INNHENTE_SIVILSTAND_AUTOMATISK: true GRUNNLAG_MIN_ANT_MINUTTER_SIDEN_FORRIGE_INNHENTING: 1 AZURE_APP_TENANT_ID: 966ac572-f5b7-4bbe-aa88-c76419c0f851 AZURE_APP_CLIENT_ID: @@ -13,8 +6,31 @@ AZURE_APP_CLIENT_SECRET: unset server.port: 8990 NAIS_APP_NAME: bidrag-behandling DB_HOST: localhost -DB_PORT: 5432 +#DB_PORT: 5432 DB_DATABASE: bidrag-behandling + +DB_PORT: 5454 +DB_USERNAME: cloudsqliamuser +DB_PASSWORD: admin + +# jpa: +# properties: +# hibernate: +# format_sql: true +# show-sql: true + + +KAFKA_BOOTSTRAP_SERVERS: localhost:9092 +KAFKA_GROUP_ID: bidrag-behandling +KAFKA_BROKERS: localhost:9092 +TOPIC_VEDTAK: bidrag.vedtak-lokal +UNLEASH_SERVER_API_ENV: development +UNLEASH_SERVER_API_PROJECTS: default +UNLEASH_SERVER_API_TYPE: CLIENT +KODEVERK_URL: https://kodeverk-api.nav.no + +UNLEASH_SERVER_API_URL: https://bidrag-unleash-api.nav.cloud.nais.io + spring: kafka: bootstrap-servers: ${KAFKA_BROKERS} @@ -25,18 +41,86 @@ spring: listener: ackMode: RECORD +--- +spring: + config: + activate: + on-profile: localdev -KAFKA_BOOTSTRAP_SERVERS: localhost:9092 -KAFKA_GROUP_ID: bidrag-behandling -KAFKA_BROKERS: localhost:9092 -TOPIC_VEDTAK: bidrag.vedtak-lokal -UNLEASH_SERVER_API_ENV: development -UNLEASH_SERVER_API_PROJECTS: default -UNLEASH_SERVER_API_TYPE: CLIENT +#PERSON_SCOPE: dev-fss.bidrag.bidrag-person-feature +BIDRAG_FORSENDELSE_SCOPE: dev-gcp.bidrag.bidrag-dokument-forsendelse +#BIDRAG_PERSON_URL: https://bidrag-person-feature.dev.adeo.no +#BIDRAG_FORSENDELSE_URL: http://localhost:8999 +BIDRAG_STONAD_URL: https://bidrag-stonad-syntetisk.intern.dev.nav.no +BIDRAG_STONAD_SCOPE: dev-gcp.bidrag.bidrag-stonad-syntetisk +BIDRAG_BBM_URL: https://bidrag-bbm.dev-fss-pub.nais.io +BIDRAG_BBM_SCOPE: dev-fss.bidrag.bidrag-bbm +BIDRAG_FORSENDELSE_URL: https://bidrag-dokument-forsendelse.intern.dev.nav.no +BIDRAG_TILGANGSKONTROLL_URL: https://bidrag-tilgangskontroll.intern.dev.nav.no +BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll +BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag +BIDRAG_GRUNNLAG_URL: https://bidrag-grunnlag.intern.dev.nav.no BIDRAG_SAK_URL: https://bidrag-sak.dev.intern.nav.no/bidrag-sak +BIDRAG_DOKUMENT_PRODUKSJON_URL2: https://bidrag-dokument-produksjon.intern.dev.nav.no +BIDRAG_DOKUMENT_PRODUKSJON_URL: http://localhost:8183 +BIDRAG_DOKUMENT_PRODUKSJON_SCOPE: dev-gcp.bidrag.bidrag-dokument-produksjon +BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak-syntetisk BIDRAG_VEDTAK_URL: http://localhost:8889 -BIDRAG_VEDTAK_URL2: https://bidrag-vedtak.intern.dev.nav.no -BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak +BIDRAG_VEDTAK_SCOP2E: dev-gcp.bidrag.bidrag-vedtak BIDRAG_SAK_SCOPE: dev-fss.bidrag.bidrag-sak -UNLEASH_SERVER_API_URL: https://bidrag-unleash-api.nav.cloud.nais.io -KODEVERK_URL: https://kodeverk-api.nav.no \ No newline at end of file +BIDRAG_DOKUMENT_URL: https://bidrag-dokument.dev-fss-pub.nais.io/bidrag-dokument +BIDRAG_DOKUMENT_SCOPE: dev-fss.bidrag.bidrag-dokument +--- +spring: + config: + activate: + on-profile: q2 +BIDRAG_FORSENDELSE_SCOPE: dev-gcp.bidrag.bidrag-dokument-forsendelse +BIDRAG_STONAD_URL: https://bidrag-stonad-syntetisk.intern.dev.nav.no +BIDRAG_STONAD_SCOPE: dev-gcp.bidrag.bidrag-stonad-syntetisk +BIDRAG_BBM_URL: https://bidrag-bbm.dev-fss-pub.nais.io +BIDRAG_BBM_SCOPE: dev-fss.bidrag.bidrag-bbm +BIDRAG_FORSENDELSE_URL: https://bidrag-dokument-forsendelse.intern.dev.nav.no +BIDRAG_TILGANGSKONTROLL_URL: https://bidrag-tilgangskontroll.intern.dev.nav.no +BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll +BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag +BIDRAG_GRUNNLAG_URL: https://bidrag-grunnlag.intern.dev.nav.no +BIDRAG_SAK_URL: https://bidrag-sak.dev.intern.nav.no/bidrag-sak +BIDRAG_DOKUMENT_PRODUKSJON_URL: https://bidrag-dokument-produksjon.intern.dev.nav.no +BIDRAG_DOKUMENT_PRODUKSJON_SCOPE: dev-gcp.bidrag.bidrag-dokument-produksjon +BIDRAG_VEDTAK_URL: https://bidrag-vedtak-syntetisk.intern.dev.nav.no +BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak-syntetisk +BIDRAG_SAK_SCOPE: dev-fss.bidrag.bidrag-sak +BIDRAG_DOKUMENT_URL: https://bidrag-dokument.dev-fss-pub.nais.io/bidrag-dokument +BIDRAG_DOKUMENT_SCOPE: dev-fss.bidrag.bidrag-dokument +--- +spring: + config: + activate: + on-profile: q1 +BIDRAG_FORSENDELSE_SCOPE: dev-gcp.bidrag.bidrag-dokument-forsendelse-feature +BIDRAG_STONAD_URL: https://bidrag-stonad.intern.dev.nav.no +BIDRAG_STONAD_SCOPE: dev-gcp.bidrag.bidrag-stonad +BIDRAG_BBM_URL: https://bidrag-bbm-feature.dev-fss-pub.nais.io +BIDRAG_BBM_SCOPE: dev-fss.bidrag.bidrag-bbm-feature +BIDRAG_FORSENDELSE_URL: https://bidrag-dokument-forsendelse-feature.intern.dev.nav.no +BIDRAG_TILGANGSKONTROLL_URL: https://bidrag-tilgangskontroll-feature.intern.dev.nav.no +BIDRAG_TILGANGGSKONTROLL_SCOPE: dev-gcp.bidrag.bidrag-tilgangskontroll-feature +BIDRAG_GRUNNLAG_SCOPE: dev-gcp.bidrag.bidrag-grunnlag-feature +BIDRAG_GRUNNLAG_URL: https://bidrag-grunnlag-feature.intern.dev.nav.no +BIDRAG_SAK_URL: https://bidrag-sak-feature.dev.intern.nav.no/bidrag-sak +BIDRAG_SAK_SCOPE: dev-fss.bidrag.bidrag-sak-feature +BIDRAG_DOKUMENT_PRODUKSJON_URL: https://bidrag-dokument-produksjon.intern.dev.nav.no +BIDRAG_DOKUMENT_PRODUKSJON_SCOPE: dev-gcp.bidrag.bidrag-dokument-produksjon +BIDRAG_VEDTAK_URL: https://bidrag-vedtak.intern.dev.nav.no +BIDRAG_VEDTAK_SCOPE: dev-gcp.bidrag.bidrag-vedtak +BIDRAG_DOKUMENT_URL: https://bidrag-dokument-feature.dev-fss-pub.nais.io/bidrag-dokument +BIDRAG_DOKUMENT_SCOPE: dev-fss.bidrag.bidrag-dokument-feature +#logging: +# level: +# org: +# hibernate: +# type: +# descriptor: +# sql: trace +# flywaydb: debug \ No newline at end of file