From 8f6bf98c549b68e3d04d4bfc33182f763f66df55 Mon Sep 17 00:00:00 2001 From: Cato Olsen Date: Thu, 19 Dec 2024 11:10:12 +0100 Subject: [PATCH] change/docker-compose-localhost (#3703) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lagt til docker-compose.yml for lokal kjøring av applikasjoner. --- apps/brreg-stub/docker-compose.sql | 2 ++ apps/brreg-stub/docker-compose.yml | 11 ++++++++ apps/dolly-backend/docker-compose.yml | 28 +++++++++++++++++++ .../docker-compose.yml | 11 ++++++++ ...earchConfig.java => OpenSearchConfig.java} | 2 +- .../config/OpenSearchLocalConfig.java | 4 +-- .../config/SecurityConfig.java | 2 +- .../organisasjon-forvalter/docker-compose.yml | 18 ++++++++++++ apps/pdl-forvalter/docker-compose.yml | 18 ++++++++++++ apps/person-search-service/docker-compose.yml | 11 ++++++++ .../config/SecurityConfig.java | 2 +- .../src/main/resources/application-local.yml | 1 + apps/testnav-ident-pool/README.md | 1 - .../tps-messaging-service/docker-compose.mqsc | 2 ++ apps/tps-messaging-service/docker-compose.yml | 16 +++++++++++ .../src/main/resources/application.yml | 2 +- apps/udi-stub/docker-compose.sql | 2 ++ apps/udi-stub/docker-compose.yml | 11 ++++++++ 18 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 apps/brreg-stub/docker-compose.sql create mode 100644 apps/brreg-stub/docker-compose.yml create mode 100644 apps/dolly-backend/docker-compose.yml create mode 100644 apps/oppsummeringsdokument-service/docker-compose.yml rename apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/{OpensearchConfig.java => OpenSearchConfig.java} (95%) create mode 100644 apps/organisasjon-forvalter/docker-compose.yml create mode 100644 apps/pdl-forvalter/docker-compose.yml create mode 100644 apps/person-search-service/docker-compose.yml create mode 100644 apps/tps-messaging-service/docker-compose.mqsc create mode 100644 apps/tps-messaging-service/docker-compose.yml create mode 100644 apps/udi-stub/docker-compose.sql create mode 100644 apps/udi-stub/docker-compose.yml diff --git a/apps/brreg-stub/docker-compose.sql b/apps/brreg-stub/docker-compose.sql new file mode 100644 index 00000000000..a1386159aed --- /dev/null +++ b/apps/brreg-stub/docker-compose.sql @@ -0,0 +1,2 @@ +SELECT 'CREATE DATABASE "testnav-brregstub"' +WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'testnav-brregstub')\gexec \ No newline at end of file diff --git a/apps/brreg-stub/docker-compose.yml b/apps/brreg-stub/docker-compose.yml new file mode 100644 index 00000000000..f129389717a --- /dev/null +++ b/apps/brreg-stub/docker-compose.yml @@ -0,0 +1,11 @@ +services: + + postgresql: + image: postgres + network_mode: host + shm_size: 128mb + environment: + POSTGRES_PASSWORD: "" + POSTGRES_HOST_AUTH_METHOD: trust + volumes: + - ./docker-compose.sql:/docker-entrypoint-initdb.d/init.sql \ No newline at end of file diff --git a/apps/dolly-backend/docker-compose.yml b/apps/dolly-backend/docker-compose.yml new file mode 100644 index 00000000000..dc1ab075853 --- /dev/null +++ b/apps/dolly-backend/docker-compose.yml @@ -0,0 +1,28 @@ +services: + + cloud_sql_proxy: + image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.2 + network_mode: host + command: + - "dolly-dev-ff83:europe-north1:testnav-dolly-backend-local" + - "--credentials-file=/application_default_credentials.json" + - "--run-connection-test" + volumes: + - type: bind + # Set a variable $DOLLY_APPLICATION_CREDENTIALS. We don't use + # GOOGLE_APPLICATION_CREDENTIALS, as this causes an extra step during login. + # + # - $HOME/.config/gcloud/application_default_credentials.json for Linux/macOS. + # - $APPDATA/gcloud/application_default_credentials.json for Windows. + source: $DOLLY_APPLICATION_CREDENTIALS + target: /application_default_credentials.json + + opensearch: + image: opensearchproject/opensearch:latest + ports: + - "9200:9200" + - "9600:9600" + environment: + discovery.type: single-node + plugins.security.disabled: "true" + OPENSEARCH_INITIAL_ADMIN_PASSWORD: YLAgOm}rz#o6#Aq \ No newline at end of file diff --git a/apps/oppsummeringsdokument-service/docker-compose.yml b/apps/oppsummeringsdokument-service/docker-compose.yml new file mode 100644 index 00000000000..70976e5ec07 --- /dev/null +++ b/apps/oppsummeringsdokument-service/docker-compose.yml @@ -0,0 +1,11 @@ +services: + + opensearch: + image: opensearchproject/opensearch:latest + ports: + - "9200:9200" + - "9600:9600" + environment: + discovery.type: single-node + plugins.security.disabled: "true" + OPENSEARCH_INITIAL_ADMIN_PASSWORD: YLAgOm}rz#o6#Aq \ No newline at end of file diff --git a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpensearchConfig.java b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchConfig.java similarity index 95% rename from apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpensearchConfig.java rename to apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchConfig.java index 3bbf79940de..5b23d339530 100644 --- a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpensearchConfig.java +++ b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchConfig.java @@ -12,7 +12,7 @@ @Profile("prod") @Configuration -public class OpensearchConfig extends AbstractOpenSearchConfiguration { +public class OpenSearchConfig extends AbstractOpenSearchConfiguration { @Value("${open.search.username}") private String username; diff --git a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchLocalConfig.java b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchLocalConfig.java index f04ec573dc7..b83369e9649 100644 --- a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchLocalConfig.java +++ b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/OpenSearchLocalConfig.java @@ -1,6 +1,5 @@ package no.nav.testnav.apps.oppsummeringsdokumentservice.config; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.opensearch.client.RestHighLevelClient; import org.opensearch.data.client.orhlc.AbstractOpenSearchConfiguration; @@ -9,13 +8,12 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; -import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import java.time.Duration; @Slf4j @Configuration -@Profile("dev") +@Profile("local") public class OpenSearchLocalConfig extends AbstractOpenSearchConfiguration { @Value("${open.search.uri}") diff --git a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/SecurityConfig.java b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/SecurityConfig.java index e2ff569c353..880f7ce71f9 100644 --- a/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/SecurityConfig.java +++ b/apps/oppsummeringsdokument-service/src/main/java/no/nav/testnav/apps/oppsummeringsdokumentservice/config/SecurityConfig.java @@ -13,7 +13,7 @@ @EnableWebSecurity @Configuration -@Profile({ "prod", "dev" }) +@Profile({ "prod", "local" }) public class SecurityConfig { @Bean diff --git a/apps/organisasjon-forvalter/docker-compose.yml b/apps/organisasjon-forvalter/docker-compose.yml new file mode 100644 index 00000000000..15dda33be52 --- /dev/null +++ b/apps/organisasjon-forvalter/docker-compose.yml @@ -0,0 +1,18 @@ +services: + + cloud_sql_proxy: + image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.2 + network_mode: host + command: + - "dolly-dev-ff83:europe-north1:testnav-organisasjon-forvalter-local" + - "--credentials-file=/application_default_credentials.json" + - "--run-connection-test" + volumes: + - type: bind + # Set a variable $DOLLY_APPLICATION_CREDENTIALS. We don't use + # GOOGLE_APPLICATION_CREDENTIALS, as this causes an extra step during login. + # + # - $HOME/.config/gcloud/application_default_credentials.json for Linux/macOS. + # - $APPDATA/gcloud/application_default_credentials.json for Windows. + source: $DOLLY_APPLICATION_CREDENTIALS + target: /application_default_credentials.json \ No newline at end of file diff --git a/apps/pdl-forvalter/docker-compose.yml b/apps/pdl-forvalter/docker-compose.yml new file mode 100644 index 00000000000..797d32042e7 --- /dev/null +++ b/apps/pdl-forvalter/docker-compose.yml @@ -0,0 +1,18 @@ +services: + + cloud_sql_proxy: + image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.2 + network_mode: host + command: + - "dolly-dev-ff83:europe-north1:testnav-pdl-forvalter-local" + - "--credentials-file=/application_default_credentials.json" + - "--run-connection-test" + volumes: + - type: bind + # Set a variable $DOLLY_APPLICATION_CREDENTIALS. We don't use + # GOOGLE_APPLICATION_CREDENTIALS, as this causes an extra step during login. + # + # - $HOME/.config/gcloud/application_default_credentials.json for Linux/macOS. + # - $APPDATA/gcloud/application_default_credentials.json for Windows. + source: $DOLLY_APPLICATION_CREDENTIALS + target: /application_default_credentials.json \ No newline at end of file diff --git a/apps/person-search-service/docker-compose.yml b/apps/person-search-service/docker-compose.yml new file mode 100644 index 00000000000..70976e5ec07 --- /dev/null +++ b/apps/person-search-service/docker-compose.yml @@ -0,0 +1,11 @@ +services: + + opensearch: + image: opensearchproject/opensearch:latest + ports: + - "9200:9200" + - "9600:9600" + environment: + discovery.type: single-node + plugins.security.disabled: "true" + OPENSEARCH_INITIAL_ADMIN_PASSWORD: YLAgOm}rz#o6#Aq \ No newline at end of file diff --git a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/SecurityConfig.java b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/SecurityConfig.java index be570dd7772..3ec05c5b72c 100644 --- a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/SecurityConfig.java +++ b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/config/SecurityConfig.java @@ -12,7 +12,7 @@ @EnableWebSecurity @Configuration -@Profile({ "prod", "dev" }) +@Profile({ "prod", "local" }) public class SecurityConfig { @Bean diff --git a/apps/person-search-service/src/main/resources/application-local.yml b/apps/person-search-service/src/main/resources/application-local.yml index 897ae1309cd..2ce8cadd46f 100644 --- a/apps/person-search-service/src/main/resources/application-local.yml +++ b/apps/person-search-service/src/main/resources/application-local.yml @@ -1,5 +1,6 @@ AZURE_APP_CLIENT_ID: ${sm://azure-app-client-id} AZURE_APP_CLIENT_SECRET: ${sm://azure-app-client-secret} +TOKEN_X_ISSUER: https://tokenx.dev-gcp.nav.cloud.nais.io spring: config: diff --git a/apps/testnav-ident-pool/README.md b/apps/testnav-ident-pool/README.md index 5e48730185e..7276b546d44 100644 --- a/apps/testnav-ident-pool/README.md +++ b/apps/testnav-ident-pool/README.md @@ -7,5 +7,4 @@ Identer kan frigjøres og benyttes om igjen ## Lokal kjøring * [Generelt.](../../docs/local_general.md) * [Secret Manager.](../../docs/local_secretmanager.md) -* [Lokal PostgreSQL.](../../docs/local_db.md) diff --git a/apps/tps-messaging-service/docker-compose.mqsc b/apps/tps-messaging-service/docker-compose.mqsc new file mode 100644 index 00000000000..4464c8fda19 --- /dev/null +++ b/apps/tps-messaging-service/docker-compose.mqsc @@ -0,0 +1,2 @@ +DEFINE CHANNEL('Q1_TESTNAV_TPS_MSG_S') CHLTYPE(SVRCONN) MCAUSER('app') REPLACE +SET CHLAUTH('Q1_TESTNAV_TPS_MSG_S') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(REQUIRED) DESCR('Allows connection via APP channel') ACTION(REPLACE) \ No newline at end of file diff --git a/apps/tps-messaging-service/docker-compose.yml b/apps/tps-messaging-service/docker-compose.yml new file mode 100644 index 00000000000..0e9c4d822a0 --- /dev/null +++ b/apps/tps-messaging-service/docker-compose.yml @@ -0,0 +1,16 @@ +services: + + mq: + image: icr.io/ibm-messaging/mq:latest + environment: + LICENSE: accept + MQ_QMGR_NAME: QM1 + MQ_APP_USER: app + MQ_APP_PASSWORD: passw0rd + MQ_ADMIN_USER: admin + MQ_ADMIN_PASSWORD: passw0rd + ports: + - "127.0.0.1:1414:1414" + - "127.0.0.1:9443:9443" + volumes: + - ./docker-compose.mqsc:/etc/mqm/20-config.mqsc \ No newline at end of file diff --git a/apps/tps-messaging-service/src/main/resources/application.yml b/apps/tps-messaging-service/src/main/resources/application.yml index 56048e1677b..c36f3d7945a 100644 --- a/apps/tps-messaging-service/src/main/resources/application.yml +++ b/apps/tps-messaging-service/src/main/resources/application.yml @@ -15,7 +15,7 @@ spring: aad: issuer-uri: ${AAD_ISSUER_URI}/v2.0 jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys - accepted-audience: ${AZURE_APP_CLIENT_ID}, api:// ${AZURE_APP_CLIENT_ID} + accepted-audience: ${AZURE_APP_CLIENT_ID}, api://${AZURE_APP_CLIENT_ID} springdoc: swagger-ui: diff --git a/apps/udi-stub/docker-compose.sql b/apps/udi-stub/docker-compose.sql new file mode 100644 index 00000000000..8d652f93cba --- /dev/null +++ b/apps/udi-stub/docker-compose.sql @@ -0,0 +1,2 @@ +SELECT 'CREATE DATABASE "testnav-udistub"' +WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'testnav-udistub')\gexec \ No newline at end of file diff --git a/apps/udi-stub/docker-compose.yml b/apps/udi-stub/docker-compose.yml new file mode 100644 index 00000000000..f129389717a --- /dev/null +++ b/apps/udi-stub/docker-compose.yml @@ -0,0 +1,11 @@ +services: + + postgresql: + image: postgres + network_mode: host + shm_size: 128mb + environment: + POSTGRES_PASSWORD: "" + POSTGRES_HOST_AUTH_METHOD: trust + volumes: + - ./docker-compose.sql:/docker-entrypoint-initdb.d/init.sql \ No newline at end of file