Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/endring-direkte-vergemaal
Browse files Browse the repository at this point in the history
  • Loading branch information
stigus committed Sep 12, 2024
2 parents 1dd0326 + 0b6141d commit 65cb02a
Show file tree
Hide file tree
Showing 141 changed files with 1,490 additions and 431 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ Eller kjør:
```

## Virtuelt miljø
Kjør kommandoen:

Kjør kommandoen:
```aiexclude
> JWK=$(cat ./mocks/jwk.json) docker compose up --build
```
JWK=$(cat ./mocks/jwk.json) docker compose up --build
Evt. i PowerShell:
```aiexclude
> $env:JWK=(Get-Content -Path ./mocks/jwk.json -Raw) ; docker compose up --build
```

Deretter kan itegrasjonstester kjøres med kommandoen:

Deretter kan itegrasjonstester kjøres med kommandoen:
```
./gradlew iTest
> ./gradlew iTest
```

NB: Dette vil kun fungere hvis appen støtter itegrasjonstester.
NB: Dette vil kun fungere hvis appen støtter integrasjonstester.


## Kode generert av GitHub Copilot
Expand Down
7 changes: 7 additions & 0 deletions apps/adresse-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ spec:
path: /internal/isAlive
periodSeconds: 30
initialDelay: 30
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 30
Expand Down
7 changes: 7 additions & 0 deletions apps/amelding-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ spec:
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 4
Expand Down
9 changes: 8 additions & 1 deletion apps/app-tilgang-analyse-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
- host: api.github.com
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-app-tilgang-analyse-service-db
Expand All @@ -34,6 +34,13 @@ spec:
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 4
Expand Down
7 changes: 7 additions & 0 deletions apps/arbeidsforhold-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ spec:
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 4
Expand Down
7 changes: 7 additions & 0 deletions apps/batch-bestilling-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ spec:
initialDelay: 30
periodSeconds: 30
failureThreshold: 500
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 30
Expand Down
7 changes: 7 additions & 0 deletions apps/brreg-stub/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ spec:
path: /isAlive
periodSeconds: 30
initialDelay: 30
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /isReady
initialDelay: 30
Expand Down
2 changes: 1 addition & 1 deletion apps/brreg-stub/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
database:
enabled: false
datasource:
url: jdbc:tc:postgresql:12:///test_database
url: jdbc:tc:postgresql:15:///test_database
username: user
password: password
jpa:
Expand Down
9 changes: 8 additions & 1 deletion apps/bruker-service/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ spec:
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 4
Expand All @@ -48,7 +55,7 @@ spec:
max: 1
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-bruker-service-dev-db
Expand Down
9 changes: 8 additions & 1 deletion apps/bruker-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ spec:
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 4
Expand All @@ -44,7 +51,7 @@ spec:
path: /internal/metrics
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-bruker-service-db
Expand Down
7 changes: 7 additions & 0 deletions apps/budpro-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ spec:
prometheus:
enabled: true
path: "/internal/prometheus"
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
initialDelay: 45
path: "/internal/health/readiness"
Expand Down
8 changes: 6 additions & 2 deletions apps/dolly-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ https://dolly-backend.intern.dev.nav.no/swagger-ui.html
## Kjør lokalt

https://dolly-backend.intern.dev.nav.no/swagger-ui.html
**NB: `naisdevice` må kjøre og være grønn.**

1. `naisdevice` må kjøre og være grønn.
2. Vault token må enten hentes manuelt fra [Vault](https://vault.adeo.no/) og settes ved kjøring som VM option `-Dspring.cloud.vault.token=<TOKEN>` eller så må du være logget inn med Vault CLI slik at token kan hentes med `vault print token` før applikasjonen kjører.

Så kjør `./gradlew clean build`

Deretter kan DollyBackendApplicationStarter startes med disse VM options:

`-Dspring.profiles.active=local --add-opens java.base/java.lang=ALL-UNNAMED -Dspring.cloud.vault.token=*TOKEN*`
```
-Dspring.profiles.active=local --add-opens java.base/java.lang=ALL-UNNAMED
```

For å kjøre tester og bygge appen lokalt må Docker (Colima kan brukes på Mac) kjøre og man er nødt til å sette disse
miljøvariablene:
Expand Down
3 changes: 1 addition & 2 deletions apps/dolly-backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ dependencies {
implementation 'no.nav.testnav.libs:data-transfer-objects'
implementation 'no.nav.testnav.libs:data-transfer-search-objects'
implementation 'no.nav.testnav.libs:reactive-core'

implementation 'org.springframework.cloud:spring-cloud-vault-config-databases'
implementation 'no.nav.testnav.libs:vault'

implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:$versions.springdoc"
implementation "io.swagger.core.v3:swagger-annotations-jakarta:$versions.swagger"
Expand Down
11 changes: 9 additions & 2 deletions apps/dolly-backend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ spec:
initialDelay: 20
periodSeconds: 2
failureThreshold: 140
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 20
Expand All @@ -98,13 +105,13 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 200m
memory: 1024Mi
limits:
memory: 2048Mi
gcp:
sqlInstances:
- type: POSTGRES_14
- type: POSTGRES_15
tier: db-custom-1-3840
name: testnav-dolly-backend-dev
databases:
Expand Down
12 changes: 10 additions & 2 deletions apps/dolly-backend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-body-size: "512m"

spec:
tokenx:
enabled: true
Expand Down Expand Up @@ -88,6 +89,13 @@ spec:
initialDelay: 20
periodSeconds: 20
failureThreshold: 900
observability:
logging:
destinations:
- id: elastic
autoInstrumentation:
enabled: true
runtime: java
readiness:
path: /internal/isReady
initialDelay: 20
Expand All @@ -98,13 +106,13 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 5000m
cpu: 250m
memory: 4096Mi
limits:
memory: 8192Mi
gcp:
sqlInstances:
- type: POSTGRES_14
- type: POSTGRES_15
tier: db-custom-2-7680
name: testnav-dolly-backend
databases:
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-backend/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ includeBuild '../../libs/security-core'
includeBuild '../../libs/servlet-core'
includeBuild '../../libs/servlet-insecure-security'
includeBuild '../../libs/servlet-security'
includeBuild '../../libs/vault'

develocity {
buildScan {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package no.nav.dolly;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import no.nav.dolly.repository.BestillingRepository;
import no.nav.dolly.repository.OrganisasjonBestillingRepository;
import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@Profile({"dev", "local", "prod"})
@RequiredArgsConstructor
@Slf4j
public class DollyBackendLifecycle implements SmartLifecycle {

private final BestillingRepository bestillingRepository;
private final OrganisasjonBestillingRepository organisasjonBestillingRepository;

private boolean isRunning = false;


@Override
public boolean isAutoStartup() {
return true;
}

@Override
public boolean isRunning() {
return isRunning;
}

@Override
public int getPhase() {
return 0;
}

@Override
@Transactional
public void start() {
isRunning = true;
var unfinishedBestilling = bestillingRepository.stopAllUnfinished();
var unfinishedOrganisasjonBestilling = organisasjonBestillingRepository.stopAllUnfinished();
log.info("Stoppet {} kjørende bestilling(er), {} kjørende organisasjonsbestilling(er)", unfinishedBestilling, unfinishedOrganisasjonBestilling);
}

@Override
public void stop() {
isRunning = false;
}

}
Loading

0 comments on commit 65cb02a

Please sign in to comment.