chore: 提交deploy文件,step.run修改为相对路径
Some checks failed
Deploy to K3s / deploy (push) Failing after 16s
Some checks failed
Deploy to K3s / deploy (push) Failing after 16s
This commit is contained in:
@@ -21,13 +21,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push backend image
|
- name: Build and push backend image
|
||||||
run: |
|
run: |
|
||||||
cd /workspace/tone/tonePage/apps/backend
|
cd apps/backend
|
||||||
docker build -t localhost:5000/backend:latest .
|
docker build -t localhost:5000/backend:latest .
|
||||||
docker push localhost:5000/backend:latest
|
docker push localhost:5000/backend:latest
|
||||||
|
|
||||||
- name: Build and push frontend image
|
- name: Build and push frontend image
|
||||||
run: |
|
run: |
|
||||||
cd /workspace/tone/tonePage/apps/frontend
|
cd apps/frontend
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg API_BASE="http://backend-service:3001" \
|
--build-arg API_BASE="http://backend-service:3001" \
|
||||||
-t localhost:5000/frontend:latest .
|
-t localhost:5000/frontend:latest .
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy to K3s
|
- name: Deploy to K3s
|
||||||
run: |
|
run: |
|
||||||
cd /workspace/tone/tonePage/apps/deploy
|
cd apps/deploy
|
||||||
kubectl apply -f postgres-deployment.yaml
|
kubectl apply -f postgres-deployment.yaml
|
||||||
kubectl apply -f backend-deployment.yaml
|
kubectl apply -f backend-deployment.yaml
|
||||||
kubectl apply -f frontend-deployment.yaml
|
kubectl apply -f frontend-deployment.yaml
|
||||||
|
|||||||
77
apps/deploy/backend-deployment.yaml
Normal file
77
apps/deploy/backend-deployment.yaml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: backend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: backend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: backend
|
||||||
|
image: localhost:5000/backend:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 3001
|
||||||
|
env:
|
||||||
|
- name: DATABASE_HOST
|
||||||
|
value: "postgres-service"
|
||||||
|
- name: DATABASE_PORT
|
||||||
|
value: "5432"
|
||||||
|
- name: DATABASE_NAME
|
||||||
|
value: "tone_page"
|
||||||
|
- name: DATABASE_USERNAME
|
||||||
|
value: "tone_page"
|
||||||
|
- name: DATABASE_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: DATABASE_PASSWORD
|
||||||
|
- name: ALIYUN_ACCESS_KEY_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: ALIYUN_ACCESS_KEY_ID
|
||||||
|
- name: ALIYUN_ACCESS_KEY_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: ALIYUN_ACCESS_KEY_SECRET
|
||||||
|
- name: ALIYUN_OSS_STS_ROLE_ARN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: ALIYUN_OSS_STS_ROLE_ARN
|
||||||
|
- name: WEBAUTHN_RP_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: WEBAUTHN_RP_ID
|
||||||
|
- name: WEBAUTHN_ORIGIN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: WEBAUTHN_ORIGIN
|
||||||
|
- name: WEBAUTHN_RP_NAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: backend-secret
|
||||||
|
key: WEBAUTHN_RP_NAME
|
||||||
|
- name: NODE_ENV
|
||||||
|
value: "production"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: backend-service
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: backend
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 3001
|
||||||
|
targetPort: 3001
|
||||||
13
apps/deploy/backend-secret.yaml
Normal file
13
apps/deploy/backend-secret.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: backend-secret
|
||||||
|
type: Opaque
|
||||||
|
# stringData:
|
||||||
|
# DATABASE_PASSWORD:
|
||||||
|
# ALIYUN_ACCESS_KEY_ID:
|
||||||
|
# ALIYUN_ACCESS_KEY_SECRET:
|
||||||
|
# ALIYUN_OSS_STS_ROLE_ARN:
|
||||||
|
# WEBAUTHN_RP_ID:
|
||||||
|
# WEBAUTHN_ORIGIN:
|
||||||
|
# WEBAUTHN_RP_NAME:
|
||||||
32
apps/deploy/frontend-deployment.yaml
Normal file
32
apps/deploy/frontend-deployment.yaml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: frontend
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: frontend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: frontend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: frontend
|
||||||
|
image: localhost:5000/frontend:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: frontend-service
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 3000
|
||||||
|
targetPort: 3000
|
||||||
|
nodePort: 30000
|
||||||
|
selector:
|
||||||
|
app: frontend
|
||||||
42
apps/deploy/postgres-deployment.yaml
Normal file
42
apps/deploy/postgres-deployment.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: postgres
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: postgres
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: postgres
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: postgres
|
||||||
|
image: postgres:17-alpine
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: postgres-secret
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgres-storage
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
volumes:
|
||||||
|
- name: postgres-storage
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/postgres-data
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: postgres-service
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: postgres
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5432
|
||||||
|
targetPort: 5432
|
||||||
12
apps/deploy/postgres-nodeport.yaml
Normal file
12
apps/deploy/postgres-nodeport.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: postgres-nodeport
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 5432
|
||||||
|
targetPort: 5432
|
||||||
|
nodePort: 30001
|
||||||
|
selector:
|
||||||
|
app: postgres
|
||||||
9
apps/deploy/postgres-secret.yaml
Normal file
9
apps/deploy/postgres-secret.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: postgres-secret
|
||||||
|
type: Opaque
|
||||||
|
# stringData:
|
||||||
|
# POSTGRES_USER:
|
||||||
|
# POSTGRES_PASSWORD:
|
||||||
|
# POSTGRES_DB:
|
||||||
Reference in New Issue
Block a user