ajuste no drone.yml
This commit is contained in:
parent
1ddae9a4e3
commit
2524863ad8
2 changed files with 4 additions and 140 deletions
36
.drone.yml
36
.drone.yml
|
|
@ -2,9 +2,6 @@ kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: deploy-backend
|
name: deploy-backend
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
# ETAPA 1 - BUILD E PUSH PARA O HARBOR (PLUGIN DOCKER)
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-and-push-backend
|
- name: build-and-push-backend
|
||||||
image: plugins/docker:latest
|
image: plugins/docker:latest
|
||||||
|
|
@ -17,11 +14,7 @@ steps:
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
registry: in.gohorsejobs.com
|
registry: in.gohorsejobs.com
|
||||||
|
|
||||||
# FORMATO EXATO DO SEU HARBOR:
|
|
||||||
# <projeto>/<repositorio>
|
|
||||||
repo: gohorsejobs/gohorsejobs-backend
|
repo: gohorsejobs/gohorsejobs-backend
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
|
|
||||||
|
|
@ -31,13 +24,8 @@ steps:
|
||||||
insecure: true
|
insecure: true
|
||||||
insecure_skip_verify: true
|
insecure_skip_verify: true
|
||||||
debug: true
|
debug: true
|
||||||
|
mtu: 0
|
||||||
|
|
||||||
# <<< CORREÇÃO DO TRAVAMENTO NO PUSH >>>
|
|
||||||
mtu: 1400
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
# ETAPA 2 – DEPLOY BACKEND NO K3S
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
- name: deploy-backend
|
- name: deploy-backend
|
||||||
image: bitnami/kubectl:latest
|
image: bitnami/kubectl:latest
|
||||||
|
|
||||||
|
|
@ -51,27 +39,7 @@ steps:
|
||||||
KUBERNETES_CLIENT_KEY:
|
KUBERNETES_CLIENT_KEY:
|
||||||
from_secret: K3S_CLIENT_KEY
|
from_secret: K3S_CLIENT_KEY
|
||||||
|
|
||||||
DB_HOST: { from_secret: DB_HOST }
|
|
||||||
DB_PORT: { from_secret: DB_PORT }
|
|
||||||
DB_USER: { from_secret: DB_USER }
|
|
||||||
DB_PASSWORD: { from_secret: DB_PASSWORD }
|
|
||||||
DB_NAME: { from_secret: DB_NAME }
|
|
||||||
DB_SSLMODE: { from_secret: DB_SSLMODE }
|
|
||||||
|
|
||||||
AWS_REGION: { from_secret: AWS_REGION }
|
|
||||||
AWS_ACCESS_KEY_ID: { from_secret: AWS_ACCESS_KEY_ID }
|
|
||||||
AWS_SECRET_ACCESS_KEY: { from_secret: AWS_SECRET_ACCESS_KEY }
|
|
||||||
AWS_ENDPOINT: { from_secret: AWS_ENDPOINT }
|
|
||||||
S3_BUCKET: { from_secret: S3_BUCKET }
|
|
||||||
|
|
||||||
JWT_SECRET: { from_secret: JWT_SECRET }
|
|
||||||
ENV: { from_secret: ENV }
|
|
||||||
CORS_ORIGINS: { from_secret: CORS_ORIGINS }
|
|
||||||
MAX_UPLOAD_SIZE: { from_secret: MAX_UPLOAD_SIZE }
|
|
||||||
UPLOAD_DIR: { from_secret: UPLOAD_DIR }
|
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
- echo "Creating kubeconfig…"
|
|
||||||
- mkdir -p ~/.kube
|
- mkdir -p ~/.kube
|
||||||
|
|
||||||
- |
|
- |
|
||||||
|
|
@ -97,6 +65,6 @@ steps:
|
||||||
current-context: drone-context
|
current-context: drone-context
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- echo "Applying manifests..."
|
- echo "Deploying backend..."
|
||||||
- kubectl apply -f k8s/backend-deployment.yaml
|
- kubectl apply -f k8s/backend-deployment.yaml
|
||||||
- kubectl apply -f k8s/backend-service.yaml
|
- kubectl apply -f k8s/backend-service.yaml
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,12 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: gohorse-backend
|
app: gohorse-backend
|
||||||
|
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: gohorse-backend
|
app: gohorse-backend
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: backend
|
- name: backend
|
||||||
|
|
@ -25,111 +27,5 @@ spec:
|
||||||
- name: NODE_ENV
|
- name: NODE_ENV
|
||||||
value: "production"
|
value: "production"
|
||||||
|
|
||||||
# -------------------------
|
|
||||||
# VARIÁVEIS DO BACKEND
|
|
||||||
# -------------------------
|
|
||||||
- name: DB_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: DB_HOST
|
|
||||||
- name: DB_PORT
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: DB_PORT
|
|
||||||
- name: DB_USER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: DB_USER
|
|
||||||
- name: DB_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: DB_PASSWORD
|
|
||||||
- name: DB_NAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: DB_NAME
|
|
||||||
- name: DB_SSLMODE
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: DB_SSLMODE
|
|
||||||
|
|
||||||
- name: JWT_SECRET
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: JWT_SECRET
|
|
||||||
|
|
||||||
- name: AWS_REGION
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: AWS_REGION
|
|
||||||
- name: AWS_ACCESS_KEY_ID
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: AWS_ACCESS_KEY_ID
|
|
||||||
- name: AWS_SECRET_ACCESS_KEY
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: AWS_SECRET_ACCESS_KEY
|
|
||||||
- name: AWS_ENDPOINT
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: AWS_ENDPOINT
|
|
||||||
- name: S3_BUCKET
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: S3_BUCKET
|
|
||||||
|
|
||||||
- name: CORS_ORIGINS
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: CORS_ORIGINS
|
|
||||||
- name: MAX_UPLOAD_SIZE
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: MAX_UPLOAD_SIZE
|
|
||||||
- name: UPLOAD_DIR
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: backend-env
|
|
||||||
key: UPLOAD_DIR
|
|
||||||
|
|
||||||
# HEALTHCHECKS
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /health
|
|
||||||
port: 3000
|
|
||||||
initialDelaySeconds: 5
|
|
||||||
periodSeconds: 10
|
|
||||||
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /health
|
|
||||||
port: 3000
|
|
||||||
initialDelaySeconds: 15
|
|
||||||
periodSeconds: 20
|
|
||||||
|
|
||||||
# RESOURCES
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: "200m"
|
|
||||||
memory: "256Mi"
|
|
||||||
limits:
|
|
||||||
cpu: "1"
|
|
||||||
memory: "512Mi"
|
|
||||||
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: harbor-registry
|
- name: harbor-registry
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue