Skip to content

Commit 4a1bf59

Browse files
authored
Merge pull request #13 from BiobankLab/sync-fork-7
Sync fork 7
2 parents 7521719 + f4d3673 commit 4a1bf59

122 files changed

Lines changed: 3849 additions & 2595 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @neicnordic/sensitive-data-development-collaboration

.github/integration/scripts/charts/cleanup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ helm uninstall broker || true
1616
helm uninstall postgres || true
1717

1818
kubectl delete secrets api-rbac broker-sda-mq-certs broker-sda-mq-test-certs postgres-sda-db-certs postgres-sda-db-test-certs || true
19-
rm /tmp/values.yaml /tmp/c4gh.pub.pem /tmp/c4gh.sec.pem /tmp/jwt.key /tmp/jwt.pub
19+
kubectl delete deployment.apps/cega-nss || true
20+
kubectl delete cm cega-nss || true
21+
rm /tmp/values.yaml /tmp/c4gh.pub.pem /tmp/c4gh.sec.pem /tmp/jwt.key /tmp/jwt.pub /tmp/users.json || true

.github/integration/scripts/charts/dependencies.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -ex
33

44
YQ_VERSION="v4.20.1"
5-
C4GH_VERSION="$(curl --retry 100 -sL https://api.github.com/repos/neicnordic/crypt4gh/releases/latest | jq -r '.name')"
5+
C4GH_VERSION="v1.14.0"
66

77
random-string() {
88
head -c 32 /dev/urandom | base64 -w0 | tr -d '/+' | fold -w 32 | head -n 1
@@ -99,13 +99,17 @@ if [ "$1" == "local" ]; then
9999
fi
100100

101101
## update values file with all credentials
102+
if [ "$2" == "federated" ]; then
103+
yq -i '.global.schemaType = federated' "$values_file"
104+
fi
105+
102106
yq -i '
103107
.global.archive.s3AccessKey = strenv(MINIO_ACCESS) |
104108
.global.archive.s3SecretKey = strenv(MINIO_SECRET) |
105109
.global.backupArchive.s3AccessKey = strenv(MINIO_ACCESS) |
106110
.global.backupArchive.s3SecretKey = strenv(MINIO_SECRET) |
107111
.global.broker.password = strenv(MQPASSWORD) |
108-
.global.c4gh.passphrase = strenv(C4GHPASSPHRASE) |
112+
.global.c4gh.privateKeys[0].passphrase = strenv(C4GHPASSPHRASE) |
109113
.global.db.password = strenv(PGPASSWORD) |
110114
.global.inbox.s3AccessKey = strenv(MINIO_ACCESS) |
111115
.global.inbox.s3SecretKey = strenv(MINIO_SECRET) |
@@ -115,3 +119,17 @@ yq -i '
115119
' "$values_file"
116120

117121
kubectl create secret generic api-rbac --from-file=".github/integration/sda/rbac.json"
122+
123+
cat >/tmp/users.json <<EOD
124+
[
125+
{
126+
"username": "dummy@example.com",
127+
"uid": 1,
128+
"passwordHash": "\$2b\$12\$1gyKIjBc9/cT0MYkXX24xe1LjEUjNwgL4rEk8fDoO.vDQZzWkqrn.",
129+
"gecos": "dummy user",
130+
"sshPublicKey": [],
131+
"enabled": null
132+
}
133+
]
134+
EOD
135+
kubectl create configmap cega-nss --from-file=".github/integration/sda/users.py" --from-file="/tmp/users.json"

.github/integration/scripts/charts/dependencies.yaml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ spec:
9191
requests:
9292
cpu: 100m
9393
memory: 128Mi
94+
volumeMounts:
95+
- mountPath: /shared/keys
96+
name: jwt
97+
volumes:
98+
- name: jwt
99+
secret:
100+
defaultMode: 288
101+
secretName: jwk
94102
---
95103
apiVersion: v1
96104
kind: Service
@@ -140,4 +148,63 @@ spec:
140148
resources:
141149
requests:
142150
storage: 1G
143-
storageClassName: local-path
151+
storageClassName: local-path
152+
---
153+
apiVersion: apps/v1
154+
kind: Deployment
155+
metadata:
156+
name: cega-nss
157+
spec:
158+
selector:
159+
matchLabels:
160+
app: cega-nss
161+
replicas: 1
162+
template:
163+
metadata:
164+
labels:
165+
app: cega-nss
166+
spec:
167+
securityContext:
168+
runAsNonRoot: true
169+
runAsGroup: 1000
170+
runAsUser: 1000
171+
fsGroup: 1000
172+
containers:
173+
- name: cega-nss
174+
image: egarchive/lega-base:release.v0.2.0
175+
command: ["python", "/cega/users.py", "0.0.0.0", "8443", "/cega/users.json"]
176+
env:
177+
- name: CEGA_USERS_PASSWORD
178+
value: test
179+
- name: CEGA_USERS_USER
180+
value: test
181+
ports:
182+
- containerPort: 8443
183+
resources:
184+
limits:
185+
cpu: 250m
186+
memory: 256Mi
187+
requests:
188+
cpu: 100m
189+
memory: 128Mi
190+
volumeMounts:
191+
- mountPath: /cega
192+
name: app
193+
volumes:
194+
- name: app
195+
configMap:
196+
name: cega-nss
197+
---
198+
apiVersion: v1
199+
kind: Service
200+
metadata:
201+
name: cega-nss
202+
labels:
203+
app: cega-nss
204+
spec:
205+
type: ClusterIP
206+
ports:
207+
- port: 8443
208+
targetPort: 8443
209+
selector:
210+
app: cega-nss

.github/integration/scripts/charts/deploy_charts.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ if [ -z "$2" ]; then
77
fi
88

99
MQ_PORT=5672
10+
PROTOCOL=http
11+
SCHEME=HTTP
12+
GRPC_PORT=50051
1013
if [ "$3" == "true" ]; then
1114
MQ_PORT=5671
15+
PROTOCOL=https
16+
SCHEME=HTTPS
17+
GRPC_PORT=50444
1218
fi
1319

1420
dir=".github/integration/scripts/charts"
@@ -42,6 +48,10 @@ if [ "$1" == "sda-mq" ]; then
4248
--set persistence.enabled=false \
4349
--set resources=null \
4450
--wait
51+
52+
if [ "$4" == "federated" ]; then
53+
curl -kL -u "admin:$ADMINPASS" -X PUT "$PROTOCOL://broker.127.0.0.1.nip.io/api/queues/sda/from_cega"
54+
fi
4555
fi
4656

4757
if [ "$1" == "sda-svc" ]; then
@@ -52,6 +62,7 @@ if [ "$1" == "sda-svc" ]; then
5262
sync_api_user=user
5363
fi
5464
helm install pipeline charts/sda-svc \
65+
--set global.schemaType="$5" \
5566
--set image.tag="PR$2" \
5667
--set image.pullPolicy=IfNotPresent \
5768
--set global.tls.enabled="$3" \
@@ -62,6 +73,12 @@ if [ "$1" == "sda-svc" ]; then
6273
--set global.sync.api.password="$sync_api_pass" \
6374
--set global.sync.api.user="$sync_api_user" \
6475
--set global.sync.remote.host="$sync_host" \
76+
--set api.readinessProbe.httpGet.scheme="$SCHEME" \
77+
--set auth.readinessProbe.httpGet.scheme="$SCHEME" \
78+
--set download.readinessProbe.httpGet.scheme="$SCHEME" \
79+
--set s3Inbox.readinessProbe.httpGet.scheme="$SCHEME" \
80+
--set syncAPI.readinessProbe.httpGet.scheme="$SCHEME" \
81+
--set reencrypt.readinessProbe.grpc.port="$GRPC_PORT" \
6582
-f "$dir/values.yaml" \
6683
--wait
6784
fi

.github/integration/scripts/charts/k3d.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ curl --retry 100 -sLO https://dl.k8s.io/release/"$k8s"/bin/linux/amd64/kubectl
1313
chmod +x ./kubectl
1414
sudo mv ./kubectl /usr/local/bin/kubectl
1515

16-
k3d cluster create sda --image=rancher/k3s:"$k8s"-k3s1 --wait --timeout 10m
16+
k3d cluster create sda --image=rancher/k3s:"$k8s"-k3s1 --wait --timeout 10m --k3s-arg "--disable=traefik@server:0" --port "80:80@loadbalancer" --port "443:443@loadbalancer"
1717
k3d kubeconfig merge sda --kubeconfig-switch-context
1818
mkdir -p ~/.kube/ && cp ~/.config/kubeconfig-sda.yaml ~/.kube/config
1919

2020
docker build -t ghcr.io/neicnordic/sensitive-data-archive:oidc -f .github/integration/scripts/charts/Dockerfile .
21-
k3d image import ghcr.io/neicnordic/sensitive-data-archive:oidc -c sda
21+
k3d image import ghcr.io/neicnordic/sensitive-data-archive:oidc -c sda
22+
23+
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace --version 4.11.6

.github/integration/scripts/charts/values.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ global:
2525
s3Url: "http://minio.minio"
2626
s3Bucket: "archive"
2727
s3Port: 9000
28+
s3ReadyPath: "/minio/health/ready"
2829
existingClaim: archive-pvc
2930
backupArchive:
3031
storageType: "s3"
@@ -33,6 +34,7 @@ global:
3334
s3Url: "http://minio.minio"
3435
s3Bucket: "backup"
3536
s3Port: 9000
37+
s3ReadyPath: "/minio/health/ready"
3638
existingClaim: backup-pvc
3739
auth:
3840
jwtSecret: jwk
@@ -49,13 +51,15 @@ global:
4951
username: "admin"
5052
password: PLACEHOLDER_VALUE
5153
cega:
54+
host: https://cega-nss:8443/username
5255
password: PLACEHOLDER_VALUE
5356
user: PLACEHOLDER_VALUE
5457
c4gh:
5558
secretName: c4gh
56-
keyFile: c4gh.sec.pem
57-
publicFile: c4gh.pub.pem
58-
passphrase: PLACEHOLDER_VALUE
59+
publicKey: c4gh.pub.pem
60+
privateKeys:
61+
- keyName: c4gh.sec.pem
62+
passphrase: PLACEHOLDER_VALUE
5963
syncPubKey: c4gh.pub.pem
6064
db:
6165
host: "postgres-sda-db"
@@ -90,8 +94,8 @@ global:
9094
port: 50443
9195
sync:
9296
api:
93-
password: ""
94-
user: ""
97+
password: "apiuser"
98+
user: "apipass"
9599
brokerQueue: "mapping_stream"
96100
centerPrefix: "SYNC"
97101
destination:
@@ -104,7 +108,7 @@ global:
104108
bucket: "sync"
105109
region: "us-east-1"
106110
remote:
107-
host: ""
111+
host: "http://remote-sync"
108112
port: "8080"
109113
password: "pass"
110114
user: "user"
@@ -127,7 +131,7 @@ finalize:
127131
ingest:
128132
resources: null
129133
intercept:
130-
deploy: false
134+
resources: null
131135
mapper:
132136
resources: null
133137
releasetest:

.github/integration/scripts/make_sda_credentials.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ if [ ! -f "/shared/c4gh1.sec.pem" ]; then
111111
/shared/crypt4gh generate -n /shared/c4gh1 -p c4ghpass
112112
fi
113113

114+
if [ ! -f "/shared/client.sec.pem" ]; then # client key for re-encryption
115+
echo "creating client crypth4gh key"
116+
/shared/crypt4gh generate -n /shared/client -p c4ghpass
117+
fi
118+
114119
if [ ! -f "/shared/sync.sec.pem" ]; then
115120
echo "creating sync crypth4gh key"
116121
/shared/crypt4gh generate -n /shared/sync -p syncPass

.github/integration/sda-doa-posix-outbox.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
build:
1616
context: ../../postgresql
1717
container_name: postgres
18-
image: ghcr.io/neicnordic/sensitive-data-archive:PR${PR_NUMBER}-postgres
18+
image: ghcr.io/biobanklab/sensitive-data-archive:PR${PR_NUMBER}-postgres
1919
depends_on:
2020
certfixer:
2121
condition: service_completed_successfully
@@ -53,7 +53,7 @@ services:
5353
rabbitmq:
5454
build:
5555
context: ../../rabbitmq
56-
image: ghcr.io/neicnordic/sensitive-data-archive:PR${PR_NUMBER}-rabbitmq
56+
image: ghcr.io/biobanklab/sensitive-data-archive:PR${PR_NUMBER}-rabbitmq
5757
container_name: rabbitmq
5858
depends_on:
5959
certfixer:
@@ -86,7 +86,7 @@ services:
8686
container_name: doa
8787
build:
8888
context: ../../sda-doa
89-
image: ghcr.io/neicnordic/sensitive-data-archive:PR${PR_NUMBER}-doa
89+
image: ghcr.io/biobanklab/sensitive-data-archive:PR${PR_NUMBER}-doa
9090
depends_on:
9191
postgres:
9292
condition: service_healthy
@@ -130,7 +130,6 @@ services:
130130
volumes:
131131
- ../../sda-doa/src:/sda-doa/src
132132
- ../../sda-doa/pom.xml:/sda-doa/pom.xml
133-
- ../../sda-doa/settings.xml:/root/.m2/settings.xml
134133
- test_file:/sda-doa/outbox
135134
- ./tests:/tests
136135
- encryption_files:/test

.github/integration/sda-doa-s3-outbox.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
build:
1616
context: ../../postgresql
1717
container_name: postgres
18-
image: ghcr.io/neicnordic/sensitive-data-archive:PR${PR_NUMBER}-postgres
18+
image: ghcr.io/biobanklab/sensitive-data-archive:PR${PR_NUMBER}-postgres
1919
depends_on:
2020
certfixer:
2121
condition: service_completed_successfully
@@ -53,7 +53,7 @@ services:
5353
rabbitmq:
5454
build:
5555
context: ../../rabbitmq
56-
image: ghcr.io/neicnordic/sensitive-data-archive:PR${PR_NUMBER}-rabbitmq
56+
image: ghcr.io/biobanklab/sensitive-data-archive:PR${PR_NUMBER}-rabbitmq
5757
container_name: rabbitmq
5858
depends_on:
5959
certfixer:
@@ -105,16 +105,15 @@ services:
105105
condition: service_healthy
106106
entrypoint: >
107107
/bin/sh -c "
108-
/usr/bin/mc config host add s3 http://outbox:9000 minio miniostorage;
108+
/usr/bin/mc alias set s3 http://outbox:9000 minio miniostorage;
109109
/usr/bin/mc mb s3/lega;
110-
exit 0;
111110
"
112111
113112
doa:
114113
container_name: doa
115114
build:
116115
context: ../../sda-doa
117-
image: ghcr.io/neicnordic/sensitive-data-archive:PR${PR_NUMBER}-doa
116+
image: ghcr.io/biobanklab/sensitive-data-archive:PR${PR_NUMBER}-doa
118117
depends_on:
119118
postgres:
120119
condition: service_healthy
@@ -138,7 +137,6 @@ services:
138137
- CRYPT4GH_PRIVATE_KEY_PATH=test/crypt4gh.sec.pem
139138
- CRYPT4GH_PRIVATE_KEY_PASSWORD_PATH=test/crypt4gh.pass
140139
- OUTBOX_TYPE=S3
141-
- SSL_ENABLED=false
142140
- ROOT_CERT_PATH=/certs/ca.crt
143141
- CERT_PATH=/certs/client.crt
144142
- CERT_KEY=/certs/client.der
@@ -159,15 +157,17 @@ services:
159157
volumes:
160158
- ../../sda-doa/src:/sda-doa/src
161159
- ../../sda-doa/pom.xml:/sda-doa/pom.xml
162-
- ../../sda-doa/settings.xml:/root/.m2/settings.xml
163160
- ./tests:/tests
164161
- encryption_files:/test
165162
- client_certs:/certs
166163

167164
depends_on:
168-
- doa
169-
- mockauth
170-
- init-bucket
165+
doa:
166+
condition: service_started
167+
mockauth:
168+
condition: service_started
169+
init-bucket:
170+
condition: service_completed_successfully
171171
environment:
172172
- OUTBOX_TYPE=S3
173173
- DOA_URL=http://doa:8080

0 commit comments

Comments
 (0)