diff --git a/ReyMotaAppsDj/K8S/Makefile b/ReyMotaAppsDj/K8S/Makefile index a08fbf5..08d7e4d 100644 --- a/ReyMotaAppsDj/K8S/Makefile +++ b/ReyMotaAppsDj/K8S/Makefile @@ -1,7 +1,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') #export REGISTRY=registry.cube.local export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.1 +export IMG_VERSION = 0.3 export IMG_NGINX_VERSION = 1.0 # limpia todo diff --git a/ReyMotaAppsDj/K8S/nginx-service.yaml b/ReyMotaAppsDj/K8S/nginx-service.yaml index 8cfea42..1e8742f 100644 --- a/ReyMotaAppsDj/K8S/nginx-service.yaml +++ b/ReyMotaAppsDj/K8S/nginx-service.yaml @@ -13,7 +13,7 @@ spec: ports: - name: "1337" port: 1337 - nodePort: 30340 + nodePort: 30341 targetPort: 80 selector: io.kompose.service: nginx diff --git a/ReyMotaAppsDj/K8S/pv-local-reymota.yaml b/ReyMotaAppsDj/K8S/pv-local-reymota.yaml index de513b7..9cc8a33 100644 --- a/ReyMotaAppsDj/K8S/pv-local-reymota.yaml +++ b/ReyMotaAppsDj/K8S/pv-local-reymota.yaml @@ -16,7 +16,7 @@ spec: apiVersion: v1 kind: PersistentVolume metadata: - name: reymota-migrations-folder + name: reymota-lyrics-migrations-folder namespace: reymota labels: app: reymota @@ -26,7 +26,52 @@ spec: accessModes: - ReadWriteOnce hostPath: - path: "/mnt/Externo/reymota/migrations" + 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 diff --git a/ReyMotaAppsDj/K8S/reymota-deployment.yaml b/ReyMotaAppsDj/K8S/reymota-deployment.yaml index 99db711..d334954 100644 --- a/ReyMotaAppsDj/K8S/reymota-deployment.yaml +++ b/ReyMotaAppsDj/K8S/reymota-deployment.yaml @@ -104,8 +104,16 @@ spec: volumeMounts: - mountPath: /app/reymota/mediafiles name: reymota-media + + - mountPath: /app/reymota/lyrics/migrations + name: reymota-lyrics-migrations - mountPath: /app/reymota/repostajes/migrations - name: reymota-migrations + name: reymota-repostajes-migrations + - mountPath: /app/reymota/libros/migrations + name: reymota-libros-migrations + - mountPath: /app/reymota/reymotausers/migrations + name: reymota-reymotausers-migrations + - mountPath: /app/reymota/staticfiles name: static-volume imagePullSecrets: @@ -115,9 +123,18 @@ spec: - name: reymota-media persistentVolumeClaim: claimName: reymota-media - - name: reymota-migrations + - name: reymota-lyrics-migrations persistentVolumeClaim: - claimName: reymota-migrations + claimName: reymota-lyrics-migrations + - name: reymota-repostajes-migrations + persistentVolumeClaim: + claimName: reymota-repostajes-migrations + - name: reymota-libros-migrations + persistentVolumeClaim: + claimName: reymota-libros-migrations + - name: reymota-reymotausers-migrations + persistentVolumeClaim: + claimName: reymota-reymotausers-migrations - name: static-volume persistentVolumeClaim: claimName: static-volume diff --git a/ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml b/ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml index ab0f958..e20ef2d 100644 --- a/ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml +++ b/ReyMotaAppsDj/K8S/reymota-prod-persistentvolumeclaim.yaml @@ -19,8 +19,24 @@ kind: PersistentVolumeClaim metadata: creationTimestamp: null labels: - io.kompose.service: reymota-migrations - name: reymota-migrations + io.kompose.service: reymota-libros-migrations + name: reymota-libros-migrations + namespace: reymota +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 51Mi +status: {} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: reymota-lyrics-migrations + name: reymota-lyrics-migrations namespace: reymota spec: accessModes: @@ -29,4 +45,35 @@ spec: 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: {} diff --git a/ReyMotaAppsDj/reymota/db.sqlite3 b/ReyMotaAppsDj/reymota/db.sqlite3 deleted file mode 100644 index f315c3e..0000000 Binary files a/ReyMotaAppsDj/reymota/db.sqlite3 and /dev/null differ diff --git a/ReyMotaAppsDj/reymota/reymota/settings.py b/ReyMotaAppsDj/reymota/reymota/settings.py index 24048c4..db3ad51 100644 --- a/ReyMotaAppsDj/reymota/reymota/settings.py +++ b/ReyMotaAppsDj/reymota/reymota/settings.py @@ -26,8 +26,7 @@ SECRET_KEY = 'django-insecure-vu#zk4g8pj-qoov#8^i$&s8n_ipp2r3h+o$z1w(1%d=6+i@erm # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] - +ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") # Application definition @@ -80,16 +79,18 @@ WSGI_APPLICATION = 'reymota.wsgi.application' # Database -# https://docs.djangoproject.com/en/5.1/ref/settings/#databases - +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + "default": { + "ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"), + "NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"), + "USER": os.environ.get("SQL_USER", "user"), + "PASSWORD": os.environ.get("SQL_PASSWORD", "password"), + "HOST": os.environ.get("SQL_HOST", "localhost"), + "PORT": os.environ.get("SQL_PORT", "5432"), } } - # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators