Skip to content

Commit

Permalink
Added a volume for Portalbackend logs. (#168)
Browse files Browse the repository at this point in the history
Co-authored-by: Kostas Filippopolitis <[email protected]>
Co-authored-by: Julien D <[email protected]>
  • Loading branch information
3 people authored Aug 23, 2024
1 parent aa908a2 commit 79ebec8
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/portalbackend-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
with:
python-version: 3.8

- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Deploy portalbackend and exareme2
working-directory: ./dev/
run: bash start.sh
Expand All @@ -32,5 +38,3 @@ jobs:
- name: Run the federation info tests
working-directory: ./dev/
run: pytest tests/test_federation_info.py


2 changes: 0 additions & 2 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.7'

services:
exareme2_local_rabbitmq:
image: madgik/exareme2_rabbitmq:${EXAREME2}
Expand Down
4 changes: 2 additions & 2 deletions dev/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ echo -n "Waiting for containers to start ..."
sleep 10

echo -n "Loading data into exareme2 db ..."
docker exec dev_exareme2_global_mipdb_1 mipdb init
docker exec dev_exareme2_local_mipdb_1 /bin/bash -c "mipdb init && mipdb load-folder /opt/data"
docker exec dev-exareme2_global_mipdb-1 mipdb init
docker exec dev-exareme2_local_mipdb-1 /bin/bash -c "mipdb init && mipdb load-folder /opt/data"

sleep 10

Expand Down
2 changes: 1 addition & 1 deletion dev/tests/test_federation_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def test_federation_info():
cmd = f"docker logs dev_portalbackend_1 | python3 ../federation_info.py show-portal-backend-audit-entries"
cmd = f"docker logs dev-portalbackend-1 | python3 ../federation_info.py show-portal-backend-audit-entries"
res = subprocess.run(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
Expand Down
52 changes: 52 additions & 0 deletions kubernetes/templates/portalbackend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,53 @@ spec:
requests:
storage: {{ .Values.portalbackend.storage.storage0.data_size }}

---
apiVersion: v1
kind: PersistentVolume
metadata:
name: portalbackend-logs-vol0
namespace: {{ .Values.namespace }}
labels:
storage: portalbackend-logs-storage0
spec:
capacity:
storage: {{ .Values.portalbackend.logs.storage0.data_size }}
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: k8s-local-storage
hostPath:
path: {{ .Values.portalbackend.logs.storage0.data_path }}
type: DirectoryOrCreate
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: master
operator: In
values:
- "true"

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: portalbackend-logs-claim0
namespace: {{ .Values.namespace }}
labels:
storage: portalbackend-logs-storage0
spec:
selector:
matchLabels:
storage: portalbackend-logs-storage0
storageClassName: k8s-local-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.portalbackend.logs.storage0.data_size }}

---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -121,6 +168,9 @@ spec:
- name: portalbackend-claim0
persistentVolumeClaim:
claimName: portalbackend-claim0
- name: portalbackend-logs-claim0
persistentVolumeClaim:
claimName: portalbackend-logs-claim0
containers:
- name: portalbackend-db
image: {{ .Values.portalbackend_db.image.name }}:{{ .Values.portalbackend_db.image.version }}
Expand All @@ -147,6 +197,8 @@ spec:
volumeMounts:
- name: portalbackend-claim0
mountPath: /opt/portal/api
- name: portalbackend-logs-claim0
mountPath: /var/log/portalbackend
env:
- name: LOG_LEVEL
valueFrom:
Expand Down
6 changes: 5 additions & 1 deletion kubernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ portalbackend:
ALGORITHM_UPDATE_INTERVAL: 60 # seconds
image:
name: hbpmip/portal-backend
version: 8.0.4
version: 8.0.6
storage:
storage0:
data_path: /opt/mip-deployment/config
data_size: 100Mi
logs:
storage0:
data_path: /opt/mip-deployment/logs
data_size: 1Gi

gateway_db:
image:
Expand Down

0 comments on commit 79ebec8

Please sign in to comment.