Skip to content

Commit 44ca83f

Browse files
Jorgen-5Jorgen-5tilen1976mmwinther
authored
Upgrade to spring 3 (#373)
* Upgrade to spring 3 * Update test config for search * fix testcontainer error * set up qa job test * correct typo * correct typo * correct typo * correct * trigger run * trigger run * do not use klass-forvaltning * do not use klass-forvaltning * rename file * correct paths * correct paths * use existing db * trigger run * add type * test prop * test db * test * add open search * remove open search * try to connect to database * try to connect to database * changes has been made - new instance * add props * db failing use h2 * db failing use h2-inmemory * test new network policy * trigger job * try without flyway * Update colima setup * Started fixing test config * test same config as klass forvaltning * test open search * try adding env values - remove solr * update open search access * network policy set in nais-test dapla-metadata * network policy still not set in nais-test dapla-metadata * add variables to properties * correct * klass dev * trigger klass dev * trigger klass dev * trigger klass dev * trigger klass dev * try fix injection value * try fix injection value * remove ttl value * fix * test manual workflow * test manual workflow * test manual workflow * test manual workflow * test manual workflow * Update test config * Remove unsused file * update and trigger klass-dev * update and trigger klass-dev * test profile * use klass solr for now * remove solr * kubernetes labels must be strings * use env values * remove empty valueFrom * set properties * update properties * remove time to live - add properties * Added mock search * test open search config * test network policy * undo changes - must set up for test * test url open search * test network policy * dynamic app name * add workflow dispatch * add workflow dispatch * correct * more vars * add different properties * add profile * use env * update test * add password and username opensearch * correct prop * test smaller index * test smaller index * indexing always results in connection closed * update access level opensearch * add logging * add more logging * set opensearch client values * add SSL * try with ssl conditionally * refactor test * refactor config * update properties name * refactor * refactor * add v3 instance * remove klass dev * Fix so it can use https * Fix replacement logic * Fix opensearch url * Remove remaining vulnerabilities (#385) * update snake yaml * not deploy on every push * update apache commons lang * update google guava * update google guava for both root and shared * update commons-lang3 * changes to sections has been made and we will now assume result should be equal * update zonky from 2.1.0 to 2.1.1 to remove transitive vulnerability * update rest-assured from 5.4.0 to 5.5.6 and commons-io from 2.15.1 to 2.20.0 to remove transitive vulnerability * remove apacheds-server-jndi-version - unused dependency * use google distroless image * exclude duplicated transitive dependencies with vulnerabilities * re add exclusions - testcontainers failed * try to run just on ubuntu - dont trigger build new instance * use dependency management to ensure safe version of commons-lang3 * Add indexing service * Merge * Remove unused dependencies (#388) * Remove h2 * Remove checkstyle and findbugs * Remove MariaDB * Remove ping * Migration tests not dependent on /ping * Fix profile activation property (#390) * Add stemming * Tune search * Try enable search integration test * Add distroless image for klass api * Feat/strategy for indexing and updating search (#400) * remove duplicated code * log * possible reindex as strategy * possible set up job * set up scheduled indexing * add make method * test scheduling * set up scheduled job in separate service * set permission to admin to access refresh * reset permission * rename service * add test * rename - add docstring * delete test * test scheduled job every hour * update distroless image * Remove refresh * reindex every night * Remove reference to deleted module * Simplify docker compose * Create constants * Use constants * add destroy method to bean * Change to use constructor injection * Fix sonar issue * Fix error * Fix itemId * Private constructor * Constructor injection * Fix error * Update klass-shared/src/main/resources/application-postgres-embedded.properties Co-authored-by: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> * Set generated keys to true to make postgres dialect tests not fail * Change enviornment variables * Fix typo * Fix envs * Remove elastic uri in properties * Update workflow and Nais for Spring Boot v3 (#403) * delete files * add opensearch to klass nais api * remove solr and use correct profiles * Reset klass-api prod manifest --------- Co-authored-by: Jorgen-5 <rlj@ssb.no> Co-authored-by: Cecilie Seim <68303562+tilen1976@users.noreply.github.com> Co-authored-by: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com>
1 parent 1c0a52d commit 44ca83f

File tree

125 files changed

+1584
-2454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1584
-2454
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ pgdata/
4747
/out/
4848
.designer/designer-theme.css
4949
klass.log*
50-
/.checkstyle
5150
.dccache
5251

5352
**/initdb/*.sql

.nais/test/klass-api.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ spec:
2727
- name: klass
2828
env:
2929
- name: SPRING_PROFILES_ACTIVE
30-
value: api, postgres, solr-remote, skip-indexing
31-
- name: SPRING_DATA_SOLR_HOST
32-
value: http://klass-solr/solr
30+
value: api, postgres, remote-open-search
3331
- name: KLASS_ENV_CLIENT_KLASS_MAIL_URL
3432
value: http://klass-mail
3533
- name: JAVA_TOOL_OPTIONS
@@ -38,8 +36,10 @@ spec:
3836
accessPolicy:
3937
outbound:
4038
rules:
41-
- application: klass-solr
4239
- application: klass-mail
40+
openSearch:
41+
access: readwrite
42+
instance: klass-search
4343

4444
prometheus:
4545
enabled: true

Makefile

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,19 @@ build-clean-klass-api:
5454
popd; \
5555
${sdk} env clear
5656

57-
.PHONY: run-klass-forvaltning-local
58-
run-klass-forvaltning-local:
59-
pushd klass-forvaltning && \
60-
${sdk} env && \
61-
mvn spring-boot\:run; \
62-
popd; \
63-
${sdk} env clear
64-
6557
.PHONY: run-klass-forvaltning-local-postgres
6658
run-klass-forvaltning-local-postgres:
6759
pushd klass-forvaltning && \
6860
${sdk} env && \
69-
mvn spring-boot\:run -Dspring.profiles.active=postgres-local,hardcoded-user,embedded-solr,frontend,skip-indexing,small-import,ad-offline; \
61+
mvn spring-boot\:run -Dspring-boot.run.profiles=frontend,postgres-local,hardcoded-user,mock-search,mock-mailserver,small-import,skip-indexing; \
7062
popd; \
7163
${sdk} env clear
7264

7365
.PHONY: run-klass-forvaltning-local-postgres-search
7466
run-klass-forvaltning-local-postgres-search:
7567
pushd klass-forvaltning && \
7668
${sdk} env && \
77-
mvn spring-boot\:run -Dspring.profiles.active=postgres-local,hardcoded-user,frontend,skip-indexing,small-import,ad-offline,remote-solr -Dklass.env.search.solr.url=http://localhost:8983/solr/; \
69+
mvn spring-boot\:run -Dspring-boot.run.profiles=frontend,postgres-local,hardcoded-user,mock-mailserver,small-import,skip-indexing,remote-solr -Dklass.env.search.solr.url=http://localhost:8983/solr/; \
7870
popd; \
7971
${sdk} env clear
8072

@@ -83,19 +75,11 @@ run-klass-forvaltning-local-postgres-search:
8375
run-klass-api-local-postgres:
8476
pushd klass-api && \
8577
${sdk} env && \
86-
mvn spring-boot\:run -Dspring.profiles.active=postgres-local,hardcoded-user,embedded-solr,mock-mailserver,api,skip-indexing,small-import,ad-offline; \
78+
mvn spring-boot\:run -Dspring-boot.run.profiles=api,postgres-local,hardcoded-user,mock-search,mock-mailserver,small-import; \
8779
popd; \
8880
${sdk} env clear
8981

9082

91-
# The environment variable KLASS_ENV_SECURITY_IGNORED must be set to "/**" in order to skip authentication
92-
run-klass-api-local-mariadb:
93-
pushd klass-api && \
94-
${sdk} env && \
95-
mvn spring-boot\:run -Dspring.profiles.active=mariadb,hardcoded-user,embedded-solr,mock-mailserver,skip-indexing,small-import,ad-offline; \
96-
popd; \
97-
${sdk} env clear
98-
9983
.PHONY: start-klass-forvaltning-docker
10084
start-klass-forvaltning-docker:
10185
docker compose $(COMPOSE_FILE) --profile frontend up --build -d
@@ -137,11 +121,10 @@ logs-klass-api:
137121
stop-klass-api-docker:
138122
docker compose $(COMPOSE_FILE) --profile api down -v
139123

140-
.PHONY: start-klass-api-search-docker
141-
start-klass-api-search-docker:
142-
docker compose $(COMPOSE_FILE) --profile api-search up --build -d
143-
144-
.PHONY: stop-klass-api-search-docker
145-
stop-klass-api-search-docker:
146-
docker compose $(COMPOSE_FILE) --profile api-search down -v
124+
.PHONY: start-klass-api-open-search-docker
125+
start-klass-api-open-search-docker:
126+
docker compose $(COMPOSE_FILE) --profile open-search up --build -d
147127

128+
.PHONY: stop-klass-api-open-search-docker
129+
stop-klass-api-open-search-docker:
130+
docker compose $(COMPOSE_FILE) --profile open-search down -v

README.md

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,6 @@ klass-forvaltning/target/klass-forvaltning-{Version}.war
2727
klass-solr/klass-solr-{Version}.zip (WiP)
2828
```
2929

30-
## Server configuration
31-
32-
Klass was made with Tomcat in mind and configuration on servers are done in `tomcat.conf` (usually found in ~tomcat/conf)
33-
variables in `application properties` will be overridden/replaced with properties found in `tomcat.conf`
34-
ex. the value for `klass.env.mariadb.password` will be replaced with the value from `KLASS_ENV_MARIADB_PASSWORD`.
35-
36-
please note that `.` is replaced with `_` in the tomcat config.
37-
38-
A typical `tomcat.conf` would contain the following
39-
40-
```
41-
SPRING_PROFILES_ACTIVE=mariadb
42-
KLASS_ENV_MARIADB_INSTANCE=mysql-server
43-
KLASS_ENV_MARIADB_PASSWORD=Password
44-
KLASS_ENV_LOGGING_PATH=/var/log/tomcat
45-
```
46-
4730
## Database
4831

4932
Klass is configured to use Flyway for database initialising and migration.
@@ -134,29 +117,7 @@ Build the app: `make build-klass-api`
134117

135118
#### Docker compose
136119

137-
Service `klass-api` requires a prebuild tagged image.
138-
139-
Run command in `klass-api` module:
140-
141-
```
142-
docker build -t target-postgres-image:latest .
143-
```
144-
145-
This service depends on a Postgresql db container.
146-
147-
For testing with MariaDB build `klass-api` with `klass-shared` version `3.0.5-master-SNAPSHOT`.
148-
149-
This will build klass-api without running tests:
150-
151-
```
152-
mvn clean install -DskipTests -pl klass-api
153-
```
154-
155-
And build mariadb image in klass-api module:
156-
157-
```
158-
docker build -t source-mariadb-image:latest .
159-
```
120+
TODO
160121

161122
### Klass Forvaltning
162123

@@ -172,13 +133,24 @@ Visit <http://127.0.0.1:8081/klassui>
172133

173134
### Spring profiles
174135

175-
Klass API and Klass Forvaltning utilize Spring boot and heavily rely on Spring Profiles to make development and debugging easier. See _application.properties_ for the available profiles.
136+
Klass API and Klass Forvaltning utilize Spring boot and heavily rely on Spring Profiles to make development and debugging easier.
137+
below is a quick summary of the profiles available (see _application.properties_ for more details)
138+
139+
```
140+
# Application profiles:
141+
#----------------------
142+
# Profiles for production
143+
# production = no test beans and only Active Directory login
144+
#
145+
# Profiles for development
146+
# ad-offline = will only use test/embeded AD (apacheDS) [Forvaltning only]
147+
# small-import = imports a small number of classifications from legacy system, useful during development
148+
# mock-mailserver = outgoing emails are only logged
149+
```
176150
177151
### Build profiles
178152
179-
we have created custom profiles for time-consuming tests that can be toggled on and off to help speed up compile time during development.
180153
The profile named `documentation` will generate API documentation with AsciiDoc (default: enabled)
181-
We also have a custom profile (`testbench`) for running GUI tests using TestBench (Vaadin licensed product).
182154
183155
### Run / Debug
184156

build_tools/checkstyle.xml

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)