From 36b1e905f020063319818b262ed2650dccc19269 Mon Sep 17 00:00:00 2001 From: creylopez Date: Fri, 10 Jan 2025 09:35:43 +0000 Subject: [PATCH 1/4] Debug --- gestion_reservas/gestion_reservas/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gestion_reservas/gestion_reservas/settings.py b/gestion_reservas/gestion_reservas/settings.py index 85c5668..ab7d8c8 100644 --- a/gestion_reservas/gestion_reservas/settings.py +++ b/gestion_reservas/gestion_reservas/settings.py @@ -94,6 +94,7 @@ DATABASES = { } } +print("ENGINE: ", ENGINE) # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators From edb0cbd34a562fc016d0eb3ed0665f0a901b618c Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 10 Jan 2025 18:47:40 +0100 Subject: [PATCH 2/4] Punto de partida --- K8S/db-deployment.yaml | 4 +++- K8S/jugaralpadel-prod-persistentvolumeclaim.yaml | 3 +++ K8S/postgres-data-persistentvolumeclaim.yaml | 1 + K8S/static-volume-persistentvolumeclaim.yaml | 1 + Makefile | 8 -------- 5 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 Makefile diff --git a/K8S/db-deployment.yaml b/K8S/db-deployment.yaml index eba7712..15a2353 100644 --- a/K8S/db-deployment.yaml +++ b/K8S/db-deployment.yaml @@ -9,6 +9,8 @@ metadata: name: db namespace: jugaralpadel spec: + securityContext: + fsGroup: GROUP_ID replicas: 1 selector: matchLabels: @@ -43,7 +45,7 @@ spec: image: postgres:15 name: db volumeMounts: - - mountPath: /var/lib/postgresql/data + - mountPath: /var/lib/postgresql/data:z name: postgres-data restartPolicy: Always volumes: diff --git a/K8S/jugaralpadel-prod-persistentvolumeclaim.yaml b/K8S/jugaralpadel-prod-persistentvolumeclaim.yaml index d8c2c1a..5b6d11e 100644 --- a/K8S/jugaralpadel-prod-persistentvolumeclaim.yaml +++ b/K8S/jugaralpadel-prod-persistentvolumeclaim.yaml @@ -12,6 +12,7 @@ spec: resources: requests: storage: 100Mi + storageClassName: lvms-vg1 status: {} --- apiVersion: v1 @@ -28,6 +29,7 @@ spec: resources: requests: storage: 50Mi + storageClassName: lvms-vg1 status: {} --- apiVersion: v1 @@ -44,4 +46,5 @@ spec: resources: requests: storage: 53Mi + storageClassName: lvms-vg1 status: {} diff --git a/K8S/postgres-data-persistentvolumeclaim.yaml b/K8S/postgres-data-persistentvolumeclaim.yaml index c1576e0..8d4c5ca 100644 --- a/K8S/postgres-data-persistentvolumeclaim.yaml +++ b/K8S/postgres-data-persistentvolumeclaim.yaml @@ -11,3 +11,4 @@ spec: resources: requests: storage: 100Mi + storageClassName: lvms-vg1 diff --git a/K8S/static-volume-persistentvolumeclaim.yaml b/K8S/static-volume-persistentvolumeclaim.yaml index 85c1fb7..3779636 100644 --- a/K8S/static-volume-persistentvolumeclaim.yaml +++ b/K8S/static-volume-persistentvolumeclaim.yaml @@ -11,3 +11,4 @@ spec: resources: requests: storage: 70Mi + storageClassName: lvms-vg1 diff --git a/Makefile b/Makefile deleted file mode 100644 index 41e19a2..0000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -install: - - echo "Creando imagen con version '${IMG_VERSION}' para la arquitectura '${ARQUITECTURA}' en el registry '${REGISTRY}'" - - docker build --no-cache -t ${REGISTRY}/jugaralpadel-${ARQUITECTURA}:${IMG_VERSION} . - docker push ${REGISTRY}/jugaralpadel-${ARQUITECTURA}:${IMG_VERSION} - - From 14ce6414546393685e00114ffa078e97662961f0 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 10 Jan 2025 19:13:56 +0100 Subject: [PATCH 3/4] Quito el print de settings --- gestion_reservas/gestion_reservas/settings.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/gestion_reservas/gestion_reservas/settings.py b/gestion_reservas/gestion_reservas/settings.py index ab7d8c8..a5b3df0 100644 --- a/gestion_reservas/gestion_reservas/settings.py +++ b/gestion_reservas/gestion_reservas/settings.py @@ -94,8 +94,6 @@ DATABASES = { } } -print("ENGINE: ", ENGINE) - # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators From f104acf04123f1f890ba2b143ad593990d30e177 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 10 Jan 2025 19:35:14 +0100 Subject: [PATCH 4/4] Ajusto dockerfile para usuario app --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 511a6a2..4bd9a00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,14 +35,13 @@ FROM python:3.11.4-slim-buster # create directory for the app user -RUN mkdir -p /app +ENV APP_HOME=/app +RUN mkdir -p $APP_HOME/gestion_reservas/staticfiles # create the app user -#RUN addgroup --system app && adduser --system --group app +RUN addgroup --system app && adduser --system --group app # create the appropriate directories -ENV APP_HOME=/app -RUN mkdir -p $APP_HOME WORKDIR $APP_HOME # install system dependencies @@ -56,15 +55,14 @@ RUN pip install --no-cache /wheels/* # copy entrypoint.sh COPY ./entrypoint.sh . - # copy project COPY . $APP_HOME # chown all the files to the app user -#RUN chown -R app:app $APP_HOME +RUN chown -R app:app $APP_HOME # change to the app user -#USER app +USER app WORKDIR $APP_HOME/gestion_reservas # run entrypoint.sh