Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
Garrett Mills | 331f5a7dd5 | 3 months ago |
Garrett Mills | 1973348040 | 2 years ago |
Garrett Mills | 1d06e9e71b | 2 years ago |
Garrett Mills | aecc379d0a | 2 years ago |
Garrett Mills | 1b4ffeae2b | 2 years ago |
Garrett Mills | 241486fc4f | 2 years ago |
Garrett Mills | 399407b15a | 2 years ago |
Garrett Mills | 316d917f6e | 2 years ago |
QiTao Weng | c09941ebe9 | 2 years ago |
@ -0,0 +1,53 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: default
|
||||
|
||||
metadata:
|
||||
labels:
|
||||
pod-security.kubernetes.io/audit: privileged
|
||||
|
||||
services:
|
||||
- name: docker daemon
|
||||
image: docker:dind
|
||||
privileged: true
|
||||
environment:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- promote
|
||||
|
||||
steps:
|
||||
- name: node.js build
|
||||
image: node:18
|
||||
commands:
|
||||
- "npm add --global pnpm"
|
||||
- pnpm i
|
||||
- pnpm run build
|
||||
|
||||
- name: container build
|
||||
image: docker:latest
|
||||
privileged: true
|
||||
commands:
|
||||
- "while ! docker stats --no-stream; do sleep 1; done"
|
||||
- "docker build -t $DOCKER_REGISTRY/glmdev/mathy ."
|
||||
- "docker push $DOCKER_REGISTRY/glmdev/mathy"
|
||||
environment:
|
||||
DOCKER_HOST: tcp://localhost:2375
|
||||
DOCKER_REGISTRY:
|
||||
from_secret: DOCKER_REGISTRY
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- promote
|
||||
|
||||
- name: k8s rollout
|
||||
image: bitnami/kubectl
|
||||
commands:
|
||||
- cd deploy && kubectl apply -f .
|
||||
- kubectl rollout -n mathy restart deployment/mathy
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- promote
|
@ -1,56 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mathy
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: mathy
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: mathy
|
||||
spec:
|
||||
containers:
|
||||
- name: mathy
|
||||
image: glmdev/mathy:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mathy-service
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
selector:
|
||||
name: mathy
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: mathy-ingress
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- mathy.glmdev.tech
|
||||
secretName: mathy-tls
|
||||
rules:
|
||||
- host: "mathy.glmdev.tech"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/"
|
||||
backend:
|
||||
service:
|
||||
name: mathy-service
|
||||
port:
|
||||
number: 80
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: mathy
|
@ -0,0 +1,12 @@
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: mathy-tls
|
||||
namespace: mathy
|
||||
spec:
|
||||
secretName: mathy-tls
|
||||
dnsNames:
|
||||
- 'crystalmath.garrettmills.dev'
|
||||
issuerRef:
|
||||
name: letsencrypt-ca
|
||||
kind: ClusterIssuer
|
@ -0,0 +1,127 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mathy
|
||||
namespace: mathy
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: mathy
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: mathy
|
||||
spec:
|
||||
containers:
|
||||
- name: mathy
|
||||
image: glmdev/mathy:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mathy-api
|
||||
namespace: mathy
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: mathy-api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: mathy-api
|
||||
spec:
|
||||
containers:
|
||||
- name: mathy
|
||||
image: glmdev/mathy-api:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: REDIS_HOST
|
||||
value: localhost
|
||||
- name: DATABASE_HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: psql-conn
|
||||
key: host
|
||||
optional: false
|
||||
- name: DATABASE_USERNAME
|
||||
value: mathy
|
||||
- name: DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: psql-conn
|
||||
key: password
|
||||
optional: false
|
||||
- name: DATABASE_NAME
|
||||
value: mathy
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
- name: redis
|
||||
image: redis:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mathy-api-service
|
||||
namespace: mathy
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: 8000
|
||||
selector:
|
||||
name: mathy-api
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mathy-service
|
||||
namespace: mathy
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
selector:
|
||||
name: mathy
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: mathy-ingress
|
||||
namespace: mathy
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- crystalmath.garrettmills.dev
|
||||
secretName: mathy-tls
|
||||
rules:
|
||||
- host: "crystalmath.garrettmills.dev"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/api"
|
||||
backend:
|
||||
service:
|
||||
name: mathy-api-service
|
||||
port:
|
||||
number: 80
|
||||
- pathType: Prefix
|
||||
path: "/"
|
||||
backend:
|
||||
service:
|
||||
name: mathy-service
|
||||
port:
|
||||
number: 80
|
Loading…
Reference in new issue