| @ -0,0 +1,73 @@ | |||||
| # syntax=docker/dockerfile:1 | |||||
| ################## | |||||
| # BUILDER # | |||||
| ################## | |||||
| FROM python:3.11.4-slim-buster AS builder | |||||
| # set work directory | |||||
| WORKDIR /app | |||||
| # set environment variables | |||||
| ENV PYTHONDONTWRITEBYTECODE=1 | |||||
| ENV PYTHONUNBUFFERED=1 | |||||
| # install system dependencies | |||||
| RUN apt-get update && \ | |||||
| apt-get install -y --no-install-recommends gcc | |||||
| # lint | |||||
| RUN pip install --upgrade pip | |||||
| RUN pip install flake8==6.0.0 | |||||
| COPY . /app/ | |||||
| RUN flake8 --ignore=E501,F401,E126 . | |||||
| COPY ./src/requirements.txt . | |||||
| RUN pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt | |||||
| ################## | |||||
| # FINAL # | |||||
| ################## | |||||
| FROM python:3.11.4-slim-buster | |||||
| # create directory for the app user | |||||
| RUN mkdir -p /app | |||||
| # create the app user | |||||
| #RUN addgroup --system app && adduser --system --group app | |||||
| # create the appropriate directories | |||||
| ENV APP_HOME=/app | |||||
| RUN mkdir -p $APP_HOME | |||||
| #RUN mkdir -p $APP_HOME/staticfiles | |||||
| #RUN mkdir -p $APP_HOME/mediafiles | |||||
| WORKDIR $APP_HOME | |||||
| # install system dependencies | |||||
| RUN apt-get update && apt-get install -y sqlite3 netcat vim procps curl jq | |||||
| COPY --from=builder /app/wheels /wheels | |||||
| COPY --from=builder /app/requirements.txt . | |||||
| RUN pip install --upgrade pip | |||||
| 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 | |||||
| # change to the app user | |||||
| #USER app | |||||
| WORKDIR $APP_HOME/src | |||||
| # run entrypoint.sh | |||||
| ENTRYPOINT ["/app/entrypoint.sh"] | |||||
| @ -0,0 +1 @@ | |||||
| temp.json | |||||
| @ -0,0 +1,56 @@ | |||||
| export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') | |||||
| export REGISTRY=registry.reymota.es | |||||
| export IMG_VERSION = 0.56 | |||||
| export IMG_NGINX_VERSION = 1.0 | |||||
| # limpia todo | |||||
| all: imagen clean install | |||||
| imagen: | |||||
| cd ../; make | |||||
| install: | |||||
| -kubectl create -f namespace.yaml | |||||
| -kubectl create -f reg-secret.yaml | |||||
| -kubectl create -f env-prod-configmap.yaml | |||||
| -kubectl create -f env-prod-db-configmap.yaml | |||||
| -kubectl create -f pv-local-reymota.yaml | |||||
| -kubectl create -f reymota-prod-persistentvolumeclaim.yaml | |||||
| -kubectl create -f static-volume-persistentvolumeclaim.yaml | |||||
| -kubectl create -f postgres-data-persistentvolumeclaim.yaml | |||||
| -kubectl create -f db-deployment.yaml | |||||
| -kubectl create -f db-service.yaml | |||||
| -envsubst < reymota-deployment.yaml |kubectl create -f - | |||||
| -envsubst < nginx-deployment.yaml |kubectl create -f - | |||||
| -kubectl create -f nginx-service.yaml | |||||
| -kubectl create -f reymota-ingress.yaml | |||||
| clean: | |||||
| -envsubst < nginx-deployment.yaml |kubectl delete -f - | |||||
| -kubectl delete -f nginx-service.yaml | |||||
| -envsubst < reymota-deployment.yaml |kubectl delete -f - | |||||
| -kubectl delete -f db-deployment.yaml | |||||
| -kubectl delete -f db-service.yaml | |||||
| -kubectl delete -f env-prod-configmap.yaml | |||||
| -kubectl delete -f env-prod-db-configmap.yaml | |||||
| -kubectl delete -f postgres-data-persistentvolumeclaim.yaml | |||||
| -kubectl delete -f static-volume-persistentvolumeclaim.yaml | |||||
| -kubectl delete -f reymota-prod-persistentvolumeclaim.yaml | |||||
| -kubectl delete -f pv-local-reymota.yaml | |||||
| -kubectl delete -f reg-secret.yaml | |||||
| -kubectl delete -f namespace.yaml | |||||
| nginx: | |||||
| cd ../nginx; make | |||||
| backup: | |||||
| kubectl --kubeconfig /home/creylopez/.kube/config -n reymota exec -ti deployment.apps/db -- /usr/lib/postgresql/15/bin/pg_dump --username=creylopez --dbname=reymota > reymota-$(IMG_VERSION).sql | |||||
| muestra: | |||||
| -envsubst < reymota-deployment.yaml > /tmp/deployment.yaml | |||||
| @ -0,0 +1,2 @@ | |||||
| ( NAMESPACE=reymota; kubectl proxy & kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json; curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize; ) | |||||
| @ -0,0 +1,7 @@ | |||||
| sudo mkdir -p /mnt/Externo/reymota/media | |||||
| sudo mkdir -p /mnt/Externo/reymota/migrations/lyrics | |||||
| sudo mkdir -p /mnt/Externo/reymota/migrations/libros | |||||
| sudo mkdir -p /mnt/Externo/reymota/migrations/repostajes | |||||
| sudo mkdir -p /mnt/Externo/reymota/migrations/reymotausers | |||||
| sudo mkdir -p /mnt/Externo/reymota/static | |||||
| sudo mkdir -p /mnt/Externo/reymota/pg | |||||
| @ -0,0 +1,52 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: db | |||||
| name: db | |||||
| namespace: reymota | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| io.kompose.service: db | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: db | |||||
| spec: | |||||
| containers: | |||||
| - env: | |||||
| - name: POSTGRES_DB | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: POSTGRES_DB | |||||
| name: env-prod-db | |||||
| - name: POSTGRES_PASSWORD | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: POSTGRES_PASSWORD | |||||
| name: env-prod-db | |||||
| - name: POSTGRES_USER | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: POSTGRES_USER | |||||
| name: env-prod-db | |||||
| image: postgres:15 | |||||
| name: db | |||||
| volumeMounts: | |||||
| - mountPath: /var/lib/postgresql/data | |||||
| name: postgres-data | |||||
| restartPolicy: Always | |||||
| volumes: | |||||
| - name: postgres-data | |||||
| persistentVolumeClaim: | |||||
| claimName: postgres-data | |||||
| @ -0,0 +1,17 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: db | |||||
| name: db | |||||
| namespace: reymota | |||||
| spec: | |||||
| ports: | |||||
| - name: "5432" | |||||
| port: 5432 | |||||
| targetPort: 5432 | |||||
| selector: | |||||
| io.kompose.service: db | |||||
| @ -0,0 +1 @@ | |||||
| kubectl -n reymota exec -ti deployment.apps/reymota -- /bin/bash | |||||
| @ -0,0 +1 @@ | |||||
| kubectl -n reymota exec -ti deployment.apps/db -- psql --username=creylopez --dbname=reymota | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| data: | |||||
| DEBUG: "False" | |||||
| ENTORNO: "Producción" | |||||
| SECRET_KEY: change_me | |||||
| kind: ConfigMap | |||||
| metadata: | |||||
| labels: | |||||
| io.kompose.service: web-env-prod | |||||
| name: env-prod | |||||
| namespace: reymota | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| data: | |||||
| POSTGRES_DB: reymota | |||||
| POSTGRES_PASSWORD: Dsa-0213 | |||||
| POSTGRES_USER: creylopez | |||||
| kind: ConfigMap | |||||
| metadata: | |||||
| labels: | |||||
| io.kompose.service: db-env-prod-db | |||||
| name: env-prod-db | |||||
| namespace: reymota | |||||
| @ -0,0 +1,7 @@ | |||||
| ################################################### | |||||
| # Namespace reymota | |||||
| ################################################### | |||||
| apiVersion: v1 | |||||
| kind: Namespace | |||||
| metadata: | |||||
| name: reymota | |||||
| @ -0,0 +1,46 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| name: nginx | |||||
| namespace: reymota | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| io.kompose.service: nginx | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| spec: | |||||
| containers: | |||||
| - image: registry.reymota.es/nginx-reymota-x86_64:1.0 | |||||
| name: nginx | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| protocol: TCP | |||||
| volumeMounts: | |||||
| - mountPath: /app/reymota/staticfiles | |||||
| name: static-volume | |||||
| - mountPath: /app/reymota/mediafiles | |||||
| name: reymota-media | |||||
| imagePullSecrets: | |||||
| - name: myregistrykey | |||||
| restartPolicy: Always | |||||
| volumes: | |||||
| - name: static-volume | |||||
| persistentVolumeClaim: | |||||
| claimName: static-volume | |||||
| - name: reymota-media | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-media | |||||
| @ -0,0 +1,46 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| name: nginx | |||||
| namespace: reymota | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| io.kompose.service: nginx | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| spec: | |||||
| containers: | |||||
| - image: $REGISTRY/nginx-reymota-$ARQUITECTURA:$IMG_NGINX_VERSION | |||||
| name: nginx | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| protocol: TCP | |||||
| volumeMounts: | |||||
| - mountPath: /app/reymota/staticfiles | |||||
| name: static-volume | |||||
| - mountPath: /app/reymota/mediafiles | |||||
| name: reymota-media | |||||
| imagePullSecrets: | |||||
| - name: myregistrykey | |||||
| restartPolicy: Always | |||||
| volumes: | |||||
| - name: static-volume | |||||
| persistentVolumeClaim: | |||||
| claimName: static-volume | |||||
| - name: reymota-media | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-media | |||||
| @ -0,0 +1,20 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| annotations: | |||||
| kompose.cmd: kompose convert | |||||
| kompose.version: 1.34.0 (cbf2835db) | |||||
| labels: | |||||
| io.kompose.service: nginx | |||||
| name: nginx | |||||
| namespace: reymota | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: "1337" | |||||
| port: 1337 | |||||
| nodePort: 30341 | |||||
| targetPort: 80 | |||||
| selector: | |||||
| io.kompose.service: nginx | |||||
| @ -0,0 +1,13 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| labels: | |||||
| io.kompose.service: postgres-data | |||||
| name: postgres-data | |||||
| namespace: reymota | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 100Mi | |||||
| @ -0,0 +1,104 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-media-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 100Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/media" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-lyrics-migrations-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 50Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/migrations/lyrics" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-libros-migrations-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 51Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/migrations/libros" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-repostajes-migrations-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 52Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/migrations/repostajes" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-reymotausers-migrations-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 53Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/migrations/reymotausers" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-static-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 70Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/static" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: reymota-pg-folder | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| capacity: | |||||
| storage: 200Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/reymota/pg" | |||||
| @ -0,0 +1,8 @@ | |||||
| apiVersion: v1 | |||||
| kind: Secret | |||||
| metadata: | |||||
| name: myregistrykey | |||||
| namespace: reymota | |||||
| data: | |||||
| .dockerconfigjson: ewoJImF1dGhzIjogewoJCSJyZWdpc3RyeS5yZXltb3RhLmVzIjogewoJCQkiYXV0aCI6ICJZM0psZVd4dmNHVjZPbEpsZVMweE1UYzIiCgkJfQoJfQp9 | |||||
| type: kubernetes.io/dockerconfigjson | |||||
| @ -0,0 +1,139 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: reymota | |||||
| namespace: reymota | |||||
| spec: | |||||
| ports: | |||||
| - name: "8000" | |||||
| port: 8000 | |||||
| targetPort: 8000 | |||||
| selector: | |||||
| app: reymota | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: reymota | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: reymota | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| containers: | |||||
| - args: | |||||
| - gunicorn | |||||
| - reymota.wsgi:application | |||||
| - --bind | |||||
| - 0.0.0.0:8000 | |||||
| name: reymota | |||||
| image: registry.reymota.es/reymota-x86_64:0.24 | |||||
| env: | |||||
| - name: VERSION | |||||
| value: "0.24" | |||||
| - name: ENVIRONMENT | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: ENTORNO | |||||
| name: env-prod | |||||
| - name: DEBUG | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: DEBUG | |||||
| name: env-prod | |||||
| - name: DJANGO_ALLOWED_HOSTS | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: DJANGO_ALLOWED_HOSTS | |||||
| name: env-prod | |||||
| - name: CSRF_TRUSTED_ORIGINS | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: CSRF_TRUSTED_ORIGINS | |||||
| name: env-prod | |||||
| - name: SECRET_KEY | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SECRET_KEY | |||||
| name: env-prod | |||||
| - name: DATABASE | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: DATABASE | |||||
| name: env-prod | |||||
| - name: SQL_HOST | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SQL_HOST | |||||
| name: env-prod | |||||
| - name: SQL_PORT | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SQL_PORT | |||||
| name: env-prod | |||||
| - name: SQL_ENGINE | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SQL_ENGINE | |||||
| name: env-prod | |||||
| - name: SQL_DATABASE | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SQL_DATABASE | |||||
| name: env-prod | |||||
| - name: SQL_USER | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SQL_USER | |||||
| name: env-prod | |||||
| - name: SQL_PASSWORD | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: SQL_PASSWORD | |||||
| name: env-prod | |||||
| ports: | |||||
| - containerPort: 8000 | |||||
| protocol: TCP | |||||
| volumeMounts: | |||||
| - mountPath: /app/reymota/mediafiles | |||||
| name: reymota-media | |||||
| - mountPath: /app/reymota/lyrics/migrations | |||||
| name: reymota-lyrics-migrations | |||||
| - mountPath: /app/reymota/repostajes/migrations | |||||
| name: reymota-repostajes-migrations | |||||
| - mountPath: /app/reymota/reymotausers/migrations | |||||
| name: reymota-reymotausers-migrations | |||||
| - mountPath: /app/reymota/staticfiles | |||||
| name: static-volume | |||||
| imagePullSecrets: | |||||
| - name: myregistrykey | |||||
| restartPolicy: Always | |||||
| volumes: | |||||
| - name: reymota-media | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-media | |||||
| - name: reymota-lyrics-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-lyrics-migrations | |||||
| - name: reymota-repostajes-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-repostajes-migrations | |||||
| - name: reymota-reymotausers-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-reymotausers-migrations | |||||
| - name: static-volume | |||||
| persistentVolumeClaim: | |||||
| claimName: static-volume | |||||
| status: {} | |||||
| @ -0,0 +1,89 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: reymota | |||||
| namespace: reymota | |||||
| spec: | |||||
| ports: | |||||
| - name: "8000" | |||||
| port: 8000 | |||||
| targetPort: 8000 | |||||
| selector: | |||||
| app: reymota | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: reymota | |||||
| namespace: reymota | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: reymota | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: reymota | |||||
| spec: | |||||
| containers: | |||||
| - args: | |||||
| - gunicorn | |||||
| - reymota.wsgi:application | |||||
| - --bind | |||||
| - 0.0.0.0:8000 | |||||
| name: reymota | |||||
| image: $REGISTRY/reymota-$ARQUITECTURA:$IMG_VERSION | |||||
| env: | |||||
| - name: VERSION | |||||
| value: "$IMG_VERSION" | |||||
| - name: ENVIRONMENT | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: ENTORNO | |||||
| name: env-prod | |||||
| - name: DEBUG | |||||
| valueFrom: | |||||
| configMapKeyRef: | |||||
| key: DEBUG | |||||
| name: env-prod | |||||
| ports: | |||||
| - containerPort: 8000 | |||||
| protocol: TCP | |||||
| volumeMounts: | |||||
| - mountPath: /app/reymota/mediafiles | |||||
| name: reymota-media | |||||
| - mountPath: /app/reymota/lyrics/migrations | |||||
| name: reymota-lyrics-migrations | |||||
| - mountPath: /app/reymota/repostajes/migrations | |||||
| name: reymota-repostajes-migrations | |||||
| - mountPath: /app/reymota/reymotausers/migrations | |||||
| name: reymota-reymotausers-migrations | |||||
| - mountPath: /app/reymota/staticfiles | |||||
| name: static-volume | |||||
| imagePullSecrets: | |||||
| - name: myregistrykey | |||||
| restartPolicy: Always | |||||
| volumes: | |||||
| - name: reymota-media | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-media | |||||
| - name: reymota-lyrics-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-lyrics-migrations | |||||
| - name: reymota-repostajes-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-repostajes-migrations | |||||
| - name: reymota-reymotausers-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: reymota-reymotausers-migrations | |||||
| - name: static-volume | |||||
| persistentVolumeClaim: | |||||
| claimName: static-volume | |||||
| status: {} | |||||
| @ -0,0 +1,31 @@ | |||||
| apiVersion: networking.k8s.io/v1 | |||||
| kind: Ingress | |||||
| metadata: | |||||
| generation: 1 | |||||
| managedFields: | |||||
| - apiVersion: networking.k8s.io/v1 | |||||
| fieldsType: FieldsV1 | |||||
| fieldsV1: | |||||
| f:spec: | |||||
| f:defaultBackend: | |||||
| .: {} | |||||
| f:service: | |||||
| .: {} | |||||
| f:name: {} | |||||
| f:port: {} | |||||
| f:rules: {} | |||||
| manager: rancher | |||||
| operation: Update | |||||
| name: reymota | |||||
| namespace: reymota | |||||
| spec: | |||||
| defaultBackend: | |||||
| service: | |||||
| name: nginx | |||||
| port: | |||||
| number: 1337 | |||||
| ingressClassName: nginx | |||||
| rules: | |||||
| - host: reymota.rancher.reymota.lab | |||||
| status: | |||||
| loadBalancer: {} | |||||
| @ -0,0 +1,63 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| creationTimestamp: null | |||||
| labels: | |||||
| io.kompose.service: reymota-media | |||||
| name: reymota-media | |||||
| namespace: reymota | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 100Mi | |||||
| status: {} | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| creationTimestamp: null | |||||
| labels: | |||||
| io.kompose.service: reymota-lyrics-migrations | |||||
| name: reymota-lyrics-migrations | |||||
| namespace: reymota | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 50Mi | |||||
| status: {} | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| creationTimestamp: null | |||||
| labels: | |||||
| io.kompose.service: reymota-repostajes-migrations | |||||
| name: reymota-repostajes-migrations | |||||
| namespace: reymota | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 52Mi | |||||
| status: {} | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| creationTimestamp: null | |||||
| labels: | |||||
| io.kompose.service: reymota-reymotausers-migrations | |||||
| name: reymota-reymotausers-migrations | |||||
| namespace: reymota | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 53Mi | |||||
| status: {} | |||||
| @ -0,0 +1,13 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| labels: | |||||
| io.kompose.service: static-volume | |||||
| name: static-volume | |||||
| namespace: reymota | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 70Mi | |||||
| @ -0,0 +1 @@ | |||||
| docker run -it registry.reymota.es/reymota-x86_64:0.1 bash | |||||
| @ -0,0 +1,8 @@ | |||||
| install: | |||||
| echo "Creando imagen con version '${IMG_VERSION}' para la arquitectura '${ARQUITECTURA}' en el registry '${REGISTRY}'" | |||||
| docker build --no-cache -t ${REGISTRY}/reymota-${ARQUITECTURA}:${IMG_VERSION} -f Dockerfile.k8s . | |||||
| docker push ${REGISTRY}/reymota-${ARQUITECTURA}:${IMG_VERSION} | |||||
| @ -0,0 +1,20 @@ | |||||
| #!/bin/bash | |||||
| if [ "$DATABASE" = "postgres" ] | |||||
| then | |||||
| echo "Waiting for postgres..." | |||||
| while ! nc -z $SQL_HOST $SQL_PORT; do | |||||
| sleep 0.1 | |||||
| done | |||||
| echo "PostgreSQL started" | |||||
| else | |||||
| echo "la base de datos no es postgres: '$DATABASE'" | |||||
| fi | |||||
| python manage.py collectstatic --noinput | |||||
| #python manage.py flush --no-input | |||||
| #python manage.py migrate | |||||
| exec "$@" | |||||
| @ -1,5 +1,6 @@ | |||||
| from django.conf import settings | from django.conf import settings | ||||
| def app_version(request): | def app_version(request): | ||||
| return { | return { | ||||
| 'APP_VERSION': settings.APP_VERSION | 'APP_VERSION': settings.APP_VERSION | ||||