初始化

This commit is contained in:
zg
2026-07-15 16:08:17 +08:00
parent f0d70aded4
commit 4e0057ece5
89 changed files with 13512 additions and 0 deletions

32
deploy/deploy.py Normal file
View File

@@ -0,0 +1,32 @@
"""MoKeeText 部署脚本 — 上传构建产物并重建前端容器"""
import paramiko, os
key_path = os.path.expanduser('~/.ssh/id_rsa')
key = paramiko.RSAKey.from_private_key_file(key_path)
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('101.132.183.138', username='root', pkey=key, timeout=15)
# 清理旧文件
c.exec_command('rm -f /data/mokee/mokeetext/frontend/static/dist/assets/index-*.js /data/mokee/mokeetext/frontend/static/dist/assets/index-*.css 2>/dev/null')
# 上传新文件
dist = 'E:/AI/claude/new/mokeeText/frontend/static/dist'
sftp = c.open_sftp()
sftp.put(f'{dist}/index.html', '/data/mokee/mokeetext/frontend/static/dist/index.html')
for f in os.listdir(f'{dist}/assets'):
sftp.put(f'{dist}/assets/{f}', f'/data/mokee/mokeetext/frontend/static/dist/assets/{f}')
print(f'{f}')
sftp.close()
# 重建容器
_, stdout, stderr = c.exec_command('cd /data/mokee/mokeetext && docker compose up -d --build frontend 2>&1')
out = stdout.read().decode()
err = stderr.read().decode()
print(out)
if err:
print(err)
c.close()
print('部署完成')

30
deploy/docker-compose.yml Normal file
View File

@@ -0,0 +1,30 @@
version: "3.8"
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "4006:4006"
environment:
- MYSQL_HOST=${MYSQL_HOST:-10.20.1.122}
- MYSQL_PORT=${MYSQL_PORT:-3306}
- MYSQL_USER=${MYSQL_USER:-mokeetext}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-mokee.}
- MYSQL_DATABASE=${MYSQL_DATABASE:-mokeetext}
- LOG_DIR=/data/mokee/mokeetext/logs
volumes:
# 日志挂到宿主机
- /data/mokee/mokeetext/logs:/data/mokee/mokeetext/logs
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.frontend
ports:
- "3006:3006"
depends_on:
- backend
restart: unless-stopped