Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.compile.nullAnalysis.mode": "disabled"
}
52 changes: 52 additions & 0 deletions auth-api-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-api
labels:
app: auth-api
spec:
minReadySeconds: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
replicas: 1
selector:
matchLabels:
app: auth-api
template:
metadata:
labels:
app: auth-api
spec:
containers:
- name: auth-api
image: xoten/auth-api:1.0.0
env:
- name: JWT_SECRET
value: "PRFT"
- name: AUTH_API_PORT
value: "8000"
- name: USERS_API_ADDRESS
value: "http://svc-users-api.default.svc.cluster.local:8083"

ports:
- containerPort: 8000

---
apiVersion: v1
kind: Service
metadata:
name: svc-auth-api
labels:
app: auth-api
spec:
selector:
app: auth-api
type: NodePort
ports:
- protocol: TCP
port: 8000
targetPort: 8000
name: http
18 changes: 18 additions & 0 deletions auth-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.9-alpine
WORKDIR /go/src/app
EXPOSE 8000
# Definir las variables de entorno necesarias para la aplicación
ENV JWT_SECRET=PRFT \
ZIPKIN_URL=http://zipkin:9411/api/v2/spans \
AUTH_API_PORT=8000 \
USERS_API_ADDRESS=http://users-api:8083

RUN apk --no-cache add curl git && \
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

COPY . .
RUN dep ensure

RUN go build -o auth-api

CMD /go/src/app/auth-api
56 changes: 56 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: "3"
services:
frontend:
build: ./frontend
image: xoten/frontend:1.0.1
depends_on:
- zipkin
- auth-api
- todos-api
- users-api
ports:
- 8080:8080

auth-api:
build: ./auth-api
image: xoten/auth-api:1.0.1
ports:
- 8000:8000
depends_on:
- zipkin
- users-api
todos-api:
build: ./todos-api
image: xoten/todos-api:1.0.1
ports:
- 8082:8082
depends_on:
- zipkin
- redis_queue

users-api:
build: ./users-api
image: xoten/users-api:1.0.1
ports:
- 8083:8083
depends_on:
- zipkin

log-message-processor:
build: ./log-message-processor
image: xoten/log-message-processor:1.0.1
depends_on:
- zipkin
- redis_queue

zipkin:
image: openzipkin/zipkin
ports:
- 9411:9411

redis_queue:
ports:
- 6379:6379
image: redis


58 changes: 58 additions & 0 deletions front-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
labels:
app: frontend
spec:
minReadySeconds: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: xoten/frontend:1.0.0
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 5

env:
- name: AUTH_API_ADDRESS
value: "http://svc-auth-api.default.svc.cluster.local:8000"
- name: PORT
value: "8080"
- name: TODO_API_ADDRESS
value: "http://svc-todo-api.default.svc.cluster.local:8082"
ports:
- containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
name: svc-frontend
labels:
app: frontend
spec:
selector:
app: frontend
type: LoadBalancer
ports:
- protocol: TCP
port: 8080
targetPort: 8080
name: http
17 changes: 17 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:8-alpine


EXPOSE 8080

ENV PORT=8080
ENV AUTH_API_ADDRESS=http://auth-api:8000
ENV TODOS_API_ADDRESS=http://todos-api:8082
ENV ZIPKIN_URL=http://zipkin:9411/api/v2/spans
WORKDIR /usr/src/app

COPY package.json ./
RUN npm install

COPY . .

CMD ["sh", "-c", "npm start" ]
35 changes: 35 additions & 0 deletions log-message-processor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: lmp
labels:
app: lmp
spec:
minReadySeconds: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
replicas: 1
selector:
matchLabels:
app: lmp
template:
metadata:
labels:
app: lmp
spec:
containers:
- name: lmp
image: xoten/log-message-proccessor:1.0.0
env:
- name: JWT_SECRET
value: "PRFT"
- name: REDIS_HOST
value: "svc-redis.default.svc.cluster.local"
- name: REDIS_PORT
value: "6379"
- name: REDIS_CHANNEL
value: "log_channel"

14 changes: 14 additions & 0 deletions log-message-processor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.6-alpine

WORKDIR /usr/src/app
ENV REDIS_HOST=redis_queue \
REDIS_PORT=6379 \
ZIPKIN_URL=http://zipkin:9411/api/v2/spans \
REDIS_CHANNEL=log_channel
RUN apk add --no-cache build-base
COPY requirements.txt .
RUN pip3 install -r requirements.txt

COPY main.py .

CMD ["python3","-u","main.py"]
43 changes: 43 additions & 0 deletions redis-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
labels:
app: redis
spec:
minReadySeconds: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis
ports:
- containerPort: 6379

---
apiVersion: v1
kind: Service
metadata:
name: svc-redis
labels:
app: redis
spec:
selector:
app: redis
ports:
- protocol: TCP
port: 6379
targetPort: 6379
name: http
76 changes: 76 additions & 0 deletions todo-api-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-api
labels:
app: todo-api
spec:
minReadySeconds: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
replicas: 1
selector:
matchLabels:
app: todo-api
template:
metadata:
labels:
app: todo-api
spec:
containers:
- name: todo-api
image: xoten/todos-api:1.0.0
# command: ["sh", "-c", "touch /tmp/healthy && sleep 86400"]
# readinessProbe:
# exec:
# command:
# - cat
# - /tmp/healthy
# initialDelaySeconds: 5
# periodSeconds: 3
env:
- name: JWT_SECRET
value: "PRFT"
- name: REDIS_HOST
value: "svc-redis.default.svc.cluster.local"
- name: REDIS_PORT
value: "6379"
- name: REDIS_CHANNEL
value: "log_channel"
- name: ZIPKIN_URL
value: "http://svc-zipkin.default.svc.cluster.local:9411/api/v2/spans"
readinessProbe:
tcpSocket:
port: 8082
initialDelaySeconds: 5
periodSeconds: 5
# livenessProbe:
# httpGet:
# path: /todos
# port: 8082
# httpHeaders:
# - name: Authorization
# value: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTgzNDQwODEsImZpcnN0bmFtZSI6IkZvbyIsImxhc3RuYW1lIjoiQmFyIiwicm9sZSI6IkFETUlOIiwidXNlcm5hbWUiOiJhZG1pbiJ9.ibWxHUGzsQOsDTHQfzzk-H9fepuQoX_IVN0_UnBx3p4
# periodSeconds: 5
# initialDelaySeconds: 10
ports:
- containerPort: 8082
---
apiVersion: v1
kind: Service
metadata:
name: svc-todo-api
labels:
app: todo-api
spec:
selector:
app: todo-api
type: NodePort
ports:
- protocol: TCP
port: 8082
targetPort: 8082
name: http
Loading