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
38 changes: 38 additions & 0 deletions k8s/api/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 20
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: ulissesdevops/api-bootcamp-produto
ports:
- containerPort: 8080
env:
- name: MONGODB_URI
value: 'mongodb://mongouser:mongopwd@mongodb-service:27017/admin'

---

apiVersion: v1
kind: Service
metadata:
name: api-service
spec:
selector:
app: api
ports:
- port: 80
targetPort: 8080
nodePort: 30000
type: LoadBalancer

23 changes: 23 additions & 0 deletions k8s/mongodb/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb
spec:
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo:4.4.5
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: mongouser
- name: MONGO_INITDB_ROOT_PASSWORD
value: mongopwd
11 changes: 11 additions & 0 deletions k8s/mongodb/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- port: 27017
targetPort: 27017
type: ClusterIP
2 changes: 2 additions & 0 deletions src/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/

7 changes: 7 additions & 0 deletions src/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:14.16.1-alpine3.13
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["node", "app.js"]
6 changes: 3 additions & 3 deletions src/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
swagger: "2.0"
info:
description: "API de Cadastro de Produtos"
version: "1.0.0"
title: "Cadastro de Produtos"
description: "API de Cadastro de Produtos - Nova Versãoo"
version: "2.0.0"
title: "Cadastro de Produtos - Nova Versão"
contact:
email: "fabricio@veronez.dev"
paths:
Expand Down