Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(k8s rotten): adicionado estrutura de deploy #1

Merged
merged 1 commit into from
Apr 2, 2022
Merged
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
89 changes: 89 additions & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# deployment do MongoDB
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb
spec:
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo:5.0.5
ports:
- containerPort: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: mongouser
- name: MONGO_INITDB_ROOT_PASSWORD
value: mongopwd

---
# service do mongoDB
apiVersion: v1
kind: Service
metadata:
name: mongodb
spec:
selector:
app: mongodb
ports:
- port: 27017
type: ClusterIP

---
#Deployment da aplicação web rotten-potatoes
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: ramonmsj/rotten-potatoes:v2
ports:
- containerPort: 5000
env:
# nome do banco
- name: MONGODB_DB
value: admin
# service
- name: MONGODB_HOST
value: mongodb
# porta em string
- name: MONGODB_PORT
value: "27017"
# user (mesmo do container mongo)
- name: MONGODB_USERNAME
value: mongouser
# password ( mesma do container mongo )
- name: MONGODB_PASSWORD
value: mongopwd

---
#Service
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 5000
nodePort: 30000
type: NodePort
7 changes: 7 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
COPY . /app
EXPOSE 5000
CMD ["gunicorn", "--workers=3", "--bind", "0.0.0.0:5000", "-c", "config.py", "app:app"]
7 changes: 4 additions & 3 deletions src/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">

<title>Rotten Potatoes</title>
<title>Rotten Potatoes - 2.0</title>

<!-- Loading third party fonts -->
<link href="http://fonts.googleapis.com/css?family=Roboto:300,400,700|" rel="stylesheet" type="text/css">
Expand All @@ -21,14 +21,15 @@
<![endif]-->

</head>

<body>
<div id="site-content">
<header class="site-header">
<div class="container">
<a href="/" id="branding">
<img src="/images/logo.png" alt="" class="logo">
<div class="logo-copy">
<h1 class="site-title">Rotten Potatoes</h1>
<h1 class="site-title">Rotten Potatoes - 2.0</h1>
<small class="site-description">Review de Vídeos</small>
</div>
</a> <!-- #branding -->
Expand Down Expand Up @@ -70,4 +71,4 @@ <h1 class="site-title">Rotten Potatoes</h1>

</body>

</html>
</html>