Skip to content

Commit

Permalink
Merge branch 'master' into feature/skriv-inn-dato
Browse files Browse the repository at this point in the history
  • Loading branch information
betsytraran authored Sep 9, 2024
2 parents a1891e4 + 293b2f4 commit 6f5b838
Show file tree
Hide file tree
Showing 111 changed files with 793 additions and 51 deletions.
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
7 changes: 7 additions & 0 deletions apps/app-tilgang-analyse-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 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
7 changes: 7 additions & 0 deletions 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 Down
7 changes: 7 additions & 0 deletions 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 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
4 changes: 3 additions & 1 deletion apps/dolly-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ For å kjøre lokalt med elastic search:
```
docker run -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "plugins.security.disabled=true" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=YLAgOm}rz#o6#Aq" --name opensearch -d opensearchproject/opensearch:latest
```
Legg merke til passord `YLAgOm}rz#o6#Aq` (tilfeldig [generert](https://www.strongpasswordgenerator.org/), men må være "sterkt" ellers vil ikke OpenSearch starte).
Legg merke til passord `YLAgOm}rz#o6#Aq` (tilfeldig [generert](https://www.strongpasswordgenerator.org/), men må være "sterkt" ellers vil ikke OpenSearch starte).

Applikasjonen er avhengig av en lokal PSQL-database. For mer informasjon se [egen dokumentasjon](../../docs/local_db.md).
7 changes: 7 additions & 0 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 Down
8 changes: 8 additions & 0 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 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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,14 @@ public interface BestillingRepository extends CrudRepository<Bestilling, Long> {

@Query(value = "select * from bestilling where id = :id for update", nativeQuery = true)
Optional<Bestilling> findByIdAndLock(@Param("id") Long id);

@Modifying
@Query("""
update Bestilling b
set b.ferdig = true,
b.stoppet = true
where b.ferdig = false
""")
int stopAllUnfinished();

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@ public interface OrganisasjonBestillingRepository extends CrudRepository<Organis
int deleteBestillingWithNoChildren(@Param("bestilling") OrganisasjonBestilling bestilling);

List<OrganisasjonBestilling> findByBruker(Bruker bruker);

@Modifying
@Query("""
update OrganisasjonBestilling ob
set ob.ferdig = true
where ob.ferdig = false
""")

int stopAllUnfinished();

}
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ public List<BestillingProgress> getProgressByBestillingId(Long bestillingId) {

private String filterAvailable(Collection<String> environments) {

if (isNull(environments) || environments.isEmpty()) {
return null;
}

var miljoer = miljoerConsumer.getMiljoer().block();

if (isNull(miljoer)) {
Expand Down
11 changes: 2 additions & 9 deletions apps/dolly-backend/src/main/resources/application-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@ spring:
read-timeout: 30000
generic:
enabled: false
database:
backend: postgresql/preprod-fss
enabled: true
role: dolly-test-admin
datasource:
url: jdbc:postgresql://dev-pg.intern.nav.no:5432/dolly-test
url: jdbc:postgresql://localhost:5432/dolly-test
username: postgres
hikari:
maximum-pool-size: 3
minimum-idle: 1
driver-class-name: org.postgresql.Driver
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect

management:
endpoints:
Expand Down
7 changes: 7 additions & 0 deletions apps/dolly-frontend/config.idporten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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 Down
7 changes: 7 additions & 0 deletions apps/dolly-frontend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,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 Down
7 changes: 7 additions & 0 deletions apps/dolly-frontend/config.unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,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 Down
7 changes: 7 additions & 0 deletions apps/dolly-frontend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,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 Down
7 changes: 7 additions & 0 deletions apps/dollystatus/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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/endringsmelding-frontend/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/endringsmelding-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
Loading

0 comments on commit 6f5b838

Please sign in to comment.