Celestino Rey 10 місяців тому
батько
коміт
a252900a95

+ 0 - 7
Fleet/15-namespace.yaml

@@ -1,7 +0,0 @@
-###################################################
-# Namespace finanzas
-###################################################
-apiVersion: v1
-kind: Namespace
-metadata:
-  name: finanzas

+ 0 - 8
Fleet/20-reg-secret.yaml

@@ -1,8 +0,0 @@
-apiVersion: v1
-kind: Secret
-metadata:
-  name: myregistrykey
-  namespace: finanzas
-data:
-  .dockerconfigjson: ewoJImF1dGhzIjogewoJCSJyZWdpc3RyeS5yZXltb3RhLmVzIjogewoJCQkiYXV0aCI6ICJZM0psZVd4dmNHVjZPbEpsZVMweE1UYzIiCgkJfQoJfQp9
-type: kubernetes.io/dockerconfigjson

+ 0 - 15
Fleet/25-env-prod-configmap.yaml

@@ -1,15 +0,0 @@
-apiVersion: v1
-data:
-  DEBUG: "True"
-  ENTORNO: "Producción"
-  # APP_VERSION: 16.0.0
-  SECRET_KEY: change_me
-  SQL_HOST: postgresql
-  SQL_PORT: "5432"
-  DATABASE: postgres
-kind: ConfigMap
-metadata:
-  labels:
-    io.kompose.service: web-env-prod
-  name: env-prod
-  namespace: finanzas

+ 0 - 11
Fleet/30-env-prod-db-configmap.yaml

@@ -1,11 +0,0 @@
-apiVersion: v1
-data:
-  POSTGRES_DB: finanzas
-  POSTGRES_PASSWORD: Dsa-0213
-  POSTGRES_USER: creylopez
-kind: ConfigMap
-metadata:
-  labels:
-    io.kompose.service: db-env-prod-db
-  name: env-prod-db
-  namespace: finanzas

+ 0 - 74
Fleet/35-pv-local-finanzas.yaml

@@ -1,74 +0,0 @@
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: finanzas-media-folder
-  namespace: finanzas
-  labels:
-    app: finanzas
-spec:
-  capacity:
-    storage: 100Mi
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/mnt/Externo/finanzas/media"
----
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: finanzas-finanzas-migrations-folder
-  namespace: finanzas
-  labels:
-    app: finanzas
-spec:
-  capacity:
-    storage: 52Mi
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/mnt/Externo/finanzas/migrations/finanzas"
----
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: finanzas-reymotausers-migrations-folder
-  namespace: finanzas
-  labels:
-    app: finanzas
-spec:
-  capacity:
-    storage: 53Mi
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/mnt/Externo/finanzas/migrations/reymotausers"
----
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: finanzas-static-folder
-  namespace: finanzas
-  labels:
-    app: finanzas
-spec:
-  capacity:
-    storage: 70Mi
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/mnt/Externo/finanzas/static"
----
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: finanzas-pg-folder
-  namespace: finanzas
-  labels:
-    app: finanzas
-spec:
-  capacity:
-    storage: 200Mi
-  accessModes:
-    - ReadWriteOnce
-  hostPath:
-    path: "/mnt/Externo/finanzas/pg"

+ 0 - 47
Fleet/40-finanzas-prod-persistentvolumeclaim.yaml

@@ -1,47 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  creationTimestamp: null
-  labels:
-    io.kompose.service: finanzas-media
-  name: finanzas-media
-  namespace: finanzas
-spec:
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: 100Mi
-status: {}
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  creationTimestamp: null
-  labels:
-    io.kompose.service: finanzas-reymotausers-migrations
-  name: finanzas-reymotausers-migrations
-  namespace: finanzas
-spec:
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: 53Mi
-status: {}
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  creationTimestamp: null
-  labels:
-    io.kompose.service: finanzas-finanzas-migrations
-  name: finanzas-finanzas-migrations
-  namespace: finanzas
-spec:
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: 52Mi
-status: {}

+ 0 - 13
Fleet/43-static-volume-persistentvolumeclaim.yaml

@@ -1,13 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  labels:
-    io.kompose.service: static-volume
-  name: static-volume
-  namespace: finanzas
-spec:
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: 70Mi

+ 0 - 13
Fleet/45-postgres-data-persistentvolumeclaim.yaml

@@ -1,13 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  labels:
-    io.kompose.service: postgres-data
-  name: postgres-data
-  namespace: finanzas
-spec:
-  accessModes:
-    - ReadWriteOnce
-  resources:
-    requests:
-      storage: 100Mi

+ 0 - 52
Fleet/55-db-deployment.yaml

@@ -1,52 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  annotations:
-    kompose.cmd: kompose convert
-    kompose.version: 1.34.0 (cbf2835db)
-  labels:
-    io.kompose.service: postgresql
-  name: postgresql
-  namespace: finanzas
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      io.kompose.service: postgresql
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      annotations:
-        kompose.cmd: kompose convert
-        kompose.version: 1.34.0 (cbf2835db)
-      labels:
-        io.kompose.service: postgresql
-    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: postgresql
-          volumeMounts:
-            - mountPath: /var/lib/postgresql/data
-              name: postgres-data
-      restartPolicy: Always
-      volumes:
-        - name: postgres-data
-          persistentVolumeClaim:
-            claimName: postgres-data

+ 0 - 17
Fleet/60-db-service.yaml

@@ -1,17 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert
-    kompose.version: 1.34.0 (cbf2835db)
-  labels:
-    io.kompose.service: postgresql
-  name: postgresql
-  namespace: finanzas
-spec:
-  ports:
-    - name: "5432"
-      port: 5432
-      targetPort: 5432
-  selector:
-    io.kompose.service: postgresql

+ 0 - 20
Fleet/65-nginx-service.yaml

@@ -1,20 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert
-    kompose.version: 1.34.0 (cbf2835db)
-  labels:
-    io.kompose.service: nginx
-  name: nginx
-  namespace: finanzas
-spec:
-  type: NodePort
-  ports:
-    - name: "1337"
-      port: 1337
-      nodePort: 30342
-      targetPort: 80
-  selector:
-    io.kompose.service: nginx
-

+ 0 - 105
Fleet/70-finanzas-deployment.yaml

@@ -1,105 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  name: finanzas
-  namespace: finanzas
-spec:
-  ports:
-    - name: "8000"
-      port: 8000
-      targetPort: 8000
-  selector:
-    app: finanzas
----
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: finanzas
-  namespace: finanzas
-  labels:
-    app: finanzas
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: finanzas
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      labels:
-        app: finanzas
-    spec:
-      containers:
-      - args:
-          - gunicorn
-          - misfinanzas.wsgi:application
-          - --bind
-          - 0.0.0.0:8000
-        name: finanzas
-        image: registry.reymota.es/finanzas-x86_64:0.46
-        env:
-        - name: IMG_VERSION
-          value: "0.46"
-        - name: OPENSHIFT
-          value: "False"
-        - name: ENVIRONMENT
-          valueFrom:
-            configMapKeyRef:
-              key: ENTORNO
-              name: env-prod
-        - name: DEBUG
-          valueFrom:
-            configMapKeyRef:
-              key: DEBUG
-              name: env-prod
-#        - name: APP_VERSION
-#          valueFrom:
-#            configMapKeyRef:
-#              key: APP_VERSION
-#              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
-        ports:
-        - containerPort: 8000
-          protocol: TCP
-        volumeMounts:
-        - mountPath: /app/src/mediafiles
-          name: finanzas-media
-        - mountPath: /app/src/finanzas/migrations
-          name: finanzas-finanzas-migrations
-        - mountPath: /app/src/reymotausers/migrations
-          name: finanzas-reymotausers-migrations
-
-        - mountPath: /app/src/staticfiles
-          name: static-volume
-      imagePullSecrets:
-      - name: myregistrykey
-      restartPolicy: Always
-      volumes:
-      - name: finanzas-media
-        persistentVolumeClaim:
-          claimName: finanzas-media
-      - name: finanzas-finanzas-migrations
-        persistentVolumeClaim:
-          claimName: finanzas-finanzas-migrations
-      - name: finanzas-reymotausers-migrations
-        persistentVolumeClaim:
-          claimName: finanzas-reymotausers-migrations
-      - name: static-volume
-        persistentVolumeClaim:
-          claimName: static-volume
-status: {}

+ 0 - 46
Fleet/75-nginx-deployment.yaml

@@ -1,46 +0,0 @@
-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: finanzas
-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-finanzas-x86_64:1.4
-          name: nginx
-          ports:
-            - containerPort: 80
-              protocol: TCP
-          volumeMounts:
-            - mountPath: /app/src/staticfiles
-              name: static-volume
-            - mountPath: /app/src/mediafiles
-              name: finanzas-media
-      imagePullSecrets:
-      - name: myregistrykey
-      restartPolicy: Always
-      volumes:
-        - name: static-volume
-          persistentVolumeClaim:
-            claimName: static-volume
-        - name: finanzas-media
-          persistentVolumeClaim:
-            claimName: finanzas-media

+ 0 - 31
Fleet/80-finanzas-ingress.yaml

@@ -1,31 +0,0 @@
-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: finanzas
-  namespace: finanzas
-spec:
-  defaultBackend:
-    service:
-      name: nginx
-      port:
-        number: 1337
-  ingressClassName: nginx
-  rules:
-    - host: finanzas.rancher.reymota.lab
-status:
-  loadBalancer: {}

+ 0 - 22
entrypoint.sh

@@ -1,22 +0,0 @@
-#!/bin/bash
-
-# Este es para K8S
-
-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 "$@"

+ 0 - 4
nginx/Dockerfile

@@ -1,4 +0,0 @@
-FROM nginx:1.25
-
-RUN rm /etc/nginx/conf.d/default.conf
-COPY nginx.conf /etc/nginx/conf.d

+ 0 - 8
nginx/Makefile

@@ -1,8 +0,0 @@
-install:
-
-	echo "Creando imagen con version '${IMG_NGINX_VERSION}' para la arquitectura '${ARQUITECTURA}' en el registry '${REGISTRY}'"
-
-	docker build --no-cache -t ${REGISTRY}/nginx-finanzas-${ARQUITECTURA}:${IMG_NGINX_VERSION} .
-	docker push ${REGISTRY}/nginx-finanzas-${ARQUITECTURA}:${IMG_NGINX_VERSION}
-
-

+ 0 - 26
nginx/nginx.conf

@@ -1,26 +0,0 @@
-upstream finanzas {
-    server finanzas:8000;
-}
-
-server {
-
-    listen 80;
-
-    location / {
-        proxy_pass http://finanzas;
-        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-        proxy_set_header Host $http_host;
-        proxy_redirect off;
-        client_max_body_size 100M;
-    }
-
-    location /static/ {
-        alias /app/src/staticfiles/;
-    }
-
-    location /media/ {
-        alias /app/src/mediafiles/;
-    }
-
-}
-

+ 0 - 46
src/misfinanzas/settings.py

@@ -12,8 +12,6 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
 
 import os
 from pathlib import Path
-import logging
-
 
 APP_NAME = "Finanzas"
 APP_VERSION = os.environ.get("APP_VERSION", "17.0.10")  # Valor por defecto si no está definido
@@ -172,48 +170,4 @@ LOGOUT_REDIRECT_URL = 'dashboard'
 
 AUTH_USER_MODEL = "reymotausers.ReyMotaUser"
 
-LOGGING = {
-    'version': 1,
-    'disable_existing_loggers': False,
-    'formatters': {
-        'verbose': {
-            'format': '{levelname} {asctime} {module} {message}',
-            'style': '{',
-        },
-        'simple': {
-            'format': '{levelname} {message}',
-            'style': '{',
-        },
-    },
-    'handlers': {
-        'console': {
-            'level': 'DEBUG',
-            'class': 'logging.StreamHandler',
-            'formatter': 'simple',
-        },
-        'file': {
-            'level': 'DEBUG',
-            'class': 'logging.FileHandler',
-            'filename': '/dev/null',
-            'formatter': 'verbose',
-        },
-        'mail_admins': {
-            'level': 'ERROR',
-            'class': 'django.utils.log.AdminEmailHandler',
-        },
-    },
-    'loggers': {
-        'django': {
-            'handlers': ['file'],
-            'level': 'DEBUG',
-            'propagate': True,
-        },
-        'django.request': {
-            'handlers': ['mail_admins'],
-            'level': 'ERROR',
-            'propagate': False,
-        },
-    },
-}
-
 RECURRENTES_API_TOKEN = 'mi-token-secreto-superseguro'