Skip to content

Commit cbe46e6

Browse files
Jorgen-5Jorgen-5
andauthored
Working solr implementation (#246)
* Remove remote-solr profile * Remove remote-solr profile * Add enviornment variables * Fix inbound application * Deploy solr * Correct inbound name * Changing url * Redeploy klass solr * Test with solr-remote profile * Changed docker-compose to use a tagged image * Add solr group * Disable read only filesystem * Change deploy image * Remove async * Increase memory * Increase memory * Revert memory increase * Increase memory * Change solr port * Remove async indexing * Make SearchIndexPopulator transactional * Revert search changes * Change solr url * Remove unused url * Change url * Change url * Change url * Fix typo * Increase memory * Remove memory set by env * Change log level * Manual deploy for solr, and skip indexing --------- Co-authored-by: Jorgen-5 <rlj@ssb.no>
1 parent fa3267a commit cbe46e6

File tree

7 files changed

+31
-26
lines changed

7 files changed

+31
-26
lines changed

.github/workflows/klass-solr-build-and-deploy.yaml renamed to .github/workflows/klass-solr-deploy.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
name: Klass-solr deploy
22

33
on:
4-
push:
5-
branches:
6-
- nais-migration
7-
paths:
8-
- "klass-solr/**"
9-
4+
workflow_dispatch:
105

116
jobs:
127
deploy:
@@ -26,5 +21,5 @@ jobs:
2621
env:
2722
CLUSTER: test
2823
RESOURCE: .nais/test/klass-solr.yaml # same list as in changed-files step above
29-
WORKLOAD_IMAGE: europe-north1-docker.pkg.dev/${{ secrets.NAIS_MANAGEMENT_PROJECT_ID }}/dapla-metadata/klass-solr:5.5.2-custom
30-
VAR: image=europe-north1-docker.pkg.dev/${{ secrets.NAIS_MANAGEMENT_PROJECT_ID }}/dapla-metadata/klass-solr:5.5.2-custom
24+
WORKLOAD_IMAGE: europe-north1-docker.pkg.dev/${{ secrets.NAIS_MANAGEMENT_PROJECT_ID }}/dapla-metadata/klass-solr:5.5.2
25+
VAR: image=europe-north1-docker.pkg.dev/${{ secrets.NAIS_MANAGEMENT_PROJECT_ID }}/dapla-metadata/klass-solr:5.5.2

.nais/test/klass-api.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ spec:
1818
max: 1
1919
resources:
2020
requests:
21-
cpu: 20m
22-
memory: 400Mi
21+
cpu: 400m
22+
memory: 1024Mi
23+
limits:
24+
memory: 2048Mi
2325
gcp:
2426
sqlInstances:
2527
- type: POSTGRES_17
@@ -28,9 +30,10 @@ spec:
2830
- name: klass
2931
env:
3032
- name: SPRING_PROFILES_ACTIVE
31-
value: api, postgres, remote-solr
33+
value: api, postgres, solr-remote, skip-indexing
3234
- name: SPRING_DATA_SOLR_HOST
33-
value: http://klass-solr:8983/solr
35+
value: http://klass-solr/solr
36+
3437

3538

3639
accessPolicy:

.nais/test/klass-solr.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ metadata:
66
namespace: dapla-metadata
77
labels:
88
team: dapla-metadata
9+
annotations:
10+
nais.io/read-only-file-system: "false"
11+
nais.io/run-as-user: "8983"
12+
nais.io/run-as-group: "8983"
913
spec:
1014
image: "{{ image }}"
1115
port: 8983
@@ -15,13 +19,15 @@ spec:
1519
max: 1
1620
resources:
1721
requests:
18-
cpu: 20m
19-
memory: 400Mi
22+
cpu: 400m
23+
memory: 1024Mi
24+
limits:
25+
memory: 2048Mi
2026

2127
accessPolicy:
2228
inbound:
2329
rules:
24-
- application: klass-solr
30+
- application: klass
2531

2632
liveness:
2733
path: /solr/admin/cores?action=STATUS
@@ -36,4 +42,4 @@ spec:
3642
startup:
3743
path: /solr/admin/cores?action=STATUS
3844
port: 8983
39-
initialDelay: 60
45+
initialDelay: 60

klass-api/src/main/resources/application-postgres.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ spring.datasource.hikari.validation-timeout=3000
1313

1414
spring.jpa.show-sql=true
1515
spring.jpa.properties.hibernate.format_sql=true
16-
logging.level.org.hibernate.SQL=DEBUG
17-
logging.level.org.hibernate.type.descriptor.sql=TRACE
1816
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
1917

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
klass.env.search.solr.url=http://${klass.env.search.solr.instance}:${klass.env.search.solr.port}/solr/Klass
1+
klass.env.search.solr.url=http://klass-solr/solr/Klass
22
klass.env.search.solr.core=Klass

klass-shared/docker-compose.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,11 @@ services:
109109
POSTGRES_USER: klass
110110
POSTGRES_INSTANCE: postgresql
111111
solr:
112-
build:
113-
context: .
114-
dockerfile: ../klass-solr/Dockerfile
112+
image: klass-shared-solr:5.5.2
115113
container_name: solr
116-
profiles: [ search ]
114+
profiles: [search]
117115
ports:
118116
- "8983:8983"
119-
volumes:
120-
- solr_data:/opt/solr/server/solr
121117
mem_limit: 4g
122118
volumes:
123119
pgdata:

klass-solr/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
FROM solr:5.5.2
22

3+
USER root
4+
35
COPY src/main/resources/solr/embedded/Klass /opt/solr/server/solr/mycores/Klass
46

5-
CMD ["solr-precreate", "Klass"]
7+
RUN rm -rf /opt/solr/server/solr/mycores/Klass/data/index/* && \
8+
chown -R solr:solr /opt/solr/server/solr/mycores/Klass
9+
10+
USER solr
11+
12+
CMD ["solr-precreate", "Klass"]

0 commit comments

Comments
 (0)