| @ -0,0 +1,20 @@ | |||||
| include ../servicios/.env | |||||
| export IMG_VERSION = ${VERSION} | |||||
| # limpia todo | |||||
| all: imagen clean install | |||||
| imagen: | |||||
| cd ../servicios; make | |||||
| install: | |||||
| -kubectl create -f pv-local-libros.yaml | |||||
| -kubectl create -f libros-prod-persistentvolumeclaim.yaml | |||||
| -envsubst < libros-deployment.yaml |kubectl create -f - | |||||
| clean: | |||||
| -envsubst < libros-deployment.yaml |kubectl delete -f - | |||||
| -kubectl delete -f libros-prod-persistentvolumeclaim.yaml | |||||
| -kubectl delete -f pv-local-libros.yaml | |||||
| prueba: | |||||
| @echo $(VERSION) | |||||
| @ -0,0 +1 @@ | |||||
| kubectl exec -ti deployment.apps/libros -- /bin/bash | |||||
| @ -0,0 +1,65 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: libros | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: http | |||||
| port: 5000 | |||||
| nodePort: 30340 | |||||
| targetPort: libros | |||||
| selector: | |||||
| app: libros | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: libros | |||||
| labels: | |||||
| app: libros | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: libros | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: libros | |||||
| spec: | |||||
| containers: | |||||
| - args: | |||||
| - gunicorn | |||||
| - --bind | |||||
| - 0.0.0.0:5000 | |||||
| - libros:create_app() | |||||
| name: libros | |||||
| image: registry.reymota.es/libros:$IMG_VERSION | |||||
| env: | |||||
| - name: VERSION | |||||
| value: "$IMG_VERSION" | |||||
| - name: ENVIRONMENT | |||||
| value: "Producción" | |||||
| ports: | |||||
| - containerPort: 5000 | |||||
| name: libros | |||||
| resources: {} | |||||
| volumeMounts: | |||||
| - mountPath: /libros/instance | |||||
| name: libros-instance | |||||
| - mountPath: /libros/migrations | |||||
| name: libros-migrations | |||||
| imagePullSecrets: | |||||
| - name: myregistrykey | |||||
| restartPolicy: Always | |||||
| volumes: | |||||
| - name: libros-instance | |||||
| persistentVolumeClaim: | |||||
| claimName: libros-instance | |||||
| - name: libros-migrations | |||||
| persistentVolumeClaim: | |||||
| claimName: libros-migrations | |||||
| status: {} | |||||
| @ -0,0 +1,30 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| creationTimestamp: null | |||||
| labels: | |||||
| io.kompose.service: libros-instance | |||||
| name: libros-instance | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 100Mi | |||||
| status: {} | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| creationTimestamp: null | |||||
| labels: | |||||
| io.kompose.service: libros-migrations | |||||
| name: libros-migrations | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 50Mi | |||||
| status: {} | |||||
| @ -0,0 +1,28 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: libros-instance-folder | |||||
| labels: | |||||
| app: libros | |||||
| spec: | |||||
| capacity: | |||||
| storage: 100Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/libros/instance" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: libros-migrations-folder | |||||
| labels: | |||||
| app: libros | |||||
| spec: | |||||
| capacity: | |||||
| storage: 50Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/libros/migrations" | |||||
| @ -0,0 +1,28 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: libros-instance-folder | |||||
| labels: | |||||
| app: libros | |||||
| spec: | |||||
| capacity: | |||||
| storage: 100Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/libros/instance" | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: libros-migrations-folder | |||||
| labels: | |||||
| app: libros | |||||
| spec: | |||||
| capacity: | |||||
| storage: 50Mi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/libros/migrations" | |||||
| @ -0,0 +1 @@ | |||||
| docker run -it creylopez/libros:1.0 bash | |||||
| @ -0,0 +1 @@ | |||||
| VERSION=1.0 | |||||
| @ -0,0 +1,8 @@ | |||||
| install: | |||||
| echo "Creando imagen con version ${IMG_VERSION}" | |||||
| docker build --no-cache -t registry.reymota.es/libros:${IMG_VERSION} . | |||||
| docker push registry.reymota.es/libros:${IMG_VERSION} | |||||