Compare commits

26 Commits

Author SHA1 Message Date
59529519e3 chore: 最终测试
All checks were successful
Deploy to K3s / deploy (push) Successful in 35s
2025-12-20 15:16:03 +08:00
2ca6a1ec42 debug: .....
All checks were successful
Deploy to K3s / deploy (push) Successful in 3s
2025-12-20 15:12:38 +08:00
1e3b9faa8b debug: ....
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 15:09:43 +08:00
f3e31106d0 debug: ...
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 15:06:55 +08:00
700a446e77 debug: ..
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 14:48:11 +08:00
204bcff75c debug: add
Some checks failed
Deploy to K3s / deploy (push) Failing after 3s
2025-12-20 14:43:14 +08:00
35b76b70c9 chore: ..
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 14:42:16 +08:00
05480cac6b chore: 移除调试信息
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 14:39:27 +08:00
5c103c4880 test: 修改挂载路径
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 14:38:53 +08:00
8a174fbed1 test: 手动挂载volumes
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 14:30:27 +08:00
70b48d1892 test: debug kubeconfig
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 14:27:57 +08:00
9d4607c7cd chore: ..
Some checks failed
Deploy to K3s / deploy (push) Failing after 4s
2025-12-20 13:54:15 +08:00
695577d53a chore: 提交deploy文件,step.run修改为相对路径
Some checks failed
Deploy to K3s / deploy (push) Failing after 16s
2025-12-20 13:26:22 +08:00
4ca1fb5ac9 chore: 标准化头像和网站图标
Some checks failed
Deploy to K3s / deploy (push) Failing after 1m57s
2025-12-20 13:20:18 +08:00
e4d7bc1a3a chore: ...
Some checks failed
Deploy to K3s / deploy (push) Failing after 6m24s
2025-12-20 13:00:25 +08:00
71915f415f chore: deploy.yml....
Some checks failed
Deploy to K3s / deploy (push) Failing after 1s
2025-12-20 12:56:27 +08:00
efc87cdbaf chore: 调整版本为v6
Some checks failed
Deploy to K3s / deploy (push) Failing after 15s
2025-12-20 12:53:53 +08:00
eb21556797 chore: 调整deploy.actions/checkout@v4
Some checks failed
Deploy to K3s / deploy (push) Failing after 16s
2025-12-20 12:52:13 +08:00
b9a03cb167 chore: 提交deploy.yml
Some checks failed
Deploy to K3s / deploy (push) Failing after 16s
2025-12-20 12:48:52 +08:00
4745e2b060 chore: 移除.drone.yml 2025-12-20 11:41:19 +08:00
d7ea4e52cc test: verify drone ci
Some checks are pending
continuous-integration/drone/push Build is pending
2025-12-20 01:26:59 +08:00
e233f0d8bc feat: add custom event trigger
Some checks failed
continuous-integration/drone/push Build is pending
continuous-integration/drone Build was killed
2025-12-20 01:14:07 +08:00
41944f0828 feat: remove runner labels
Some checks are pending
continuous-integration/drone/push Build is pending
2025-12-20 00:59:01 +08:00
da16cf0f04 feat: add runner labels
Some checks failed
continuous-integration/drone/push Build was killed
2025-12-20 00:55:26 +08:00
c8a78aff5d chore: 提交.drone.yml
Some checks failed
continuous-integration/drone/push Build was killed
2025-12-20 00:48:12 +08:00
97f5d8bad1 chore: 依旧修复前端dockerfile 2025-12-20 00:07:47 +08:00
13 changed files with 266 additions and 2 deletions

View File

@@ -0,0 +1,78 @@
name: Deploy to K3s
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
container:
image: localhost:5000/tiny-ci-runner:latest
env:
IMAGE_TAG: ${{ github.sha }}
KUBECONFIG: /tmp/.kube/config
steps:
- name: Write kubeconfig
run: |
mkdir -p /tmp/.kube
cat << 'EOF' > /tmp/.kube/config
${{ secrets.KUBECONFIG_DATA }}
EOF
chmod 600 /tmp/.kube/config
- name: Verify Kubernetes access
run: |
kubectl cluster-info
kubectl get nodes
- name: Checkout code
run: |
git clone --depth=1 --branch master \
https://git.tonesc.cn/tone/tonePage.git \
/workspace/tone/tonePage
cd /workspace/tone/tonePage
git log -1 --oneline
- name: Build and push backend image
run: |
cd /workspace/tone/tonePage/apps/backend
docker build -t localhost:5000/backend:${IMAGE_TAG} .
docker push localhost:5000/backend:${IMAGE_TAG}
- name: Build and push frontend image
run: |
cd /workspace/tone/tonePage/apps/frontend
docker build \
--build-arg API_BASE="http://backend-service:3001" \
-t localhost:5000/frontend:${IMAGE_TAG} .
docker push localhost:5000/frontend:${IMAGE_TAG}
- name: Deploy to K3s
run: |
cd /workspace/tone/tonePage/apps/deploy
# 基础资源
kubectl apply -f postgres-deployment.yaml
kubectl apply -f backend-deployment.yaml
kubectl apply -f frontend-deployment.yaml
# 更新镜像(触发滚动更新)
kubectl set image deployment/backend \
backend=localhost:5000/backend:${IMAGE_TAG}
kubectl set image deployment/frontend \
frontend=localhost:5000/frontend:${IMAGE_TAG}
# 等待滚动完成
kubectl rollout status deployment/backend --timeout=120s
kubectl rollout status deployment/frontend --timeout=120s
- name: Post-deploy sanity check
run: |
kubectl get pods
kubectl get svc

View 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

View 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:

View 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

View 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

View 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

View File

@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
type: Opaque
# stringData:
# POSTGRES_USER:
# POSTGRES_PASSWORD:
# POSTGRES_DB:

View File

@@ -21,6 +21,7 @@ COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.ts ./ COPY --from=builder /app/next.config.ts ./
ARG API_BASE
ENV API_BASE=$API_BASE ENV API_BASE=$API_BASE
EXPOSE 3000 EXPOSE 3000

View File

@@ -1,11 +1,10 @@
import favicon from '../favicon.ico';
import Image from 'next/image'; import Image from 'next/image';
export default function Home() { export default function Home() {
return ( return (
<div className="w-full flex-1 flex flex-col items-center justify-center"> <div className="w-full flex-1 flex flex-col items-center justify-center">
<Image <Image
src={favicon.src} src="/avatar.png"
alt="TONE's avatar" alt="TONE's avatar"
width={180} width={180}
height={180} height={180}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

View File

@@ -27,6 +27,7 @@ export default async function RootLayout({
return ( return (
<html lang="en" suppressHydrationWarning> <html lang="en" suppressHydrationWarning>
<link rel="icon" href="/favicon.ico" />
<body <body
className={`${geistSans.variable} ${geistMono.variable} antialiased min-h-screen flex flex-col`} className={`${geistSans.variable} ${geistMono.variable} antialiased min-h-screen flex flex-col`}
suppressHydrationWarning suppressHydrationWarning

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB