Skip to content

Instantly share code, notes, and snippets.

View ualmtorres's full-sized avatar

Manolo Torres ualmtorres

  • Universidad de Almería
  • Almería, Spain
View GitHub Profile
@ualmtorres
ualmtorres / docker-compose-calificaciones.yml
Created November 13, 2020 16:11
Archivo docker-compose.yml para ejemplo Calificaciones
version: '2'
services:
calificaciones-api:
container_name: calificaciones-api
restart: always
image: ualmtorres/calificaciones-api:v0
ports:
- "80:80"
volumes:
- ./api:/var/www/html
@ualmtorres
ualmtorres / books.service.ts
Created September 19, 2020 18:02
Planteamiento Servicio
import { Injectable } from '@nestjs/common';
@Injectable()
export class BooksService {
findAll(): any {
return 'findAll funcionando';
}
findBook(bookId: string): any {
return `findBook funcionando con ${bookId}`;
#!/bin/bash
kubectl apply -f deployment-sgbd.yml
kubectl apply -f deployment-sgapi.yml
kubectl apply -f deployment-sgapp.yml
kubectl apply -f services.yml
kubectl get deployments -n demo --watch
kubectl get services -n demo --watch
EXTERNAL_IP=`kubectl get services -n demo | grep "sgapp" | awk '{print $4}'`
echo -e "Abre en un navegador la EXTERNAL-IP: \033[0;31m${EXTERNAL_IP} \033[0;39m del servicio sgapp"
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: sgapi
namespace: demo
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: sgapi
#!/bin/bash
kubectl apply -f deployment-sgbd.yml
kubectl apply -f deployment-sgapi.yml
kubectl apply -f deployment-sgapp.yml
kubectl apply -f services.yml
kubectl get deployments -n demo --watch
kubectl get services -n demo --watch
EXTERNAL_IP=`kubectl get services -n demo | grep "sgapp" | awk '{print $4}'`
echo -e "Abre en un navegador la EXTERNAL-IP: \033[0;31m${EXTERNAL_IP} \033[0;39m del servicio sgapp"
apiVersion: v1
kind: Service
metadata:
name: mysql
namespace: demo
spec:
type: ClusterIP
ports:
- port: 3306
selector:
#!/bin/bash
kubectl apply -f deployment-sgbd.yml
kubectl apply -f deployment-sgapi.yml
kubectl apply -f deployment-sgapp.yml
kubectl get deployments -n demo --watch
sudo kubectl port-forward -n demo `kubectl get pods -n demo | grep 'sgapp' | awk '{print $1}'` 80:80
apiVersion: apps/v1
kind: Deployment
metadata:
name: sgapp
namespace: demo
labels:
app: sgapp
spec:
revisionHistoryLimit: 2
strategy:
apiVersion: apps/v1
kind: Deployment
metadata:
name: sgapi
namespace: demo
labels:
app: sgapi
spec:
revisionHistoryLimit: 2
strategy:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
namespace: demo
spec:
selector:
matchLabels:
app: mysql
template: