From b180ebd9f654331453fabd87b99d6668b866b9f6 Mon Sep 17 00:00:00 2001 From: maoshen Date: Fri, 10 Apr 2026 13:48:16 +0000 Subject: [PATCH] =?UTF-8?q?deploy:=20=E6=9C=AC=E5=9C=B0=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=AE=8C=E6=88=90=20-=20Gunicorn=20+=20Nginx=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TOOLS.md | 9 ++ .../__pycache__/wsgi.cpython-312.pyc | Bin 662 -> 662 bytes city-manual/deploy.sh | 80 ++++++++++++++++++ city-manual/gunicorn_start.sh | 3 + 4 files changed, 92 insertions(+) create mode 100644 city-manual/deploy.sh create mode 100644 city-manual/gunicorn_start.sh diff --git a/TOOLS.md b/TOOLS.md index 7abe61a..917779e 100644 --- a/TOOLS.md +++ b/TOOLS.md @@ -58,3 +58,12 @@ Add whatever helps you do your job. This is your cheat sheet. - **数据库**: cssc - **用户**: coder - **密码**: 825670wl + +## 云服务器 + +### 城市手册部署 + +- **主机**: cssc.datalibstar.com +- **用户**: mashen +- **密码**: 825670@MashenClaw +- **状态**: ⚠️ SSH 密码认证失败,需要 SSH Key diff --git a/city-manual/backend/city_manual/__pycache__/wsgi.cpython-312.pyc b/city-manual/backend/city_manual/__pycache__/wsgi.cpython-312.pyc index 41c6a5f2c341d4bc20088ff1733e190c7bb75c70..f72253010553fdf2d3b6dae382c931c59b4e245a 100644 GIT binary patch delta 19 ZcmbQnI*pa>vp1v3Bu delta 19 ZcmbQnI*pa /etc/systemd/system/city-manual.service << EOF +[Unit] +Description=City Manual Gunicorn Service +After=network.target + +[Service] +User=root +Group=root +WorkingDirectory=/root/.openclaw/workspace/city-manual/backend +ExecStart=/usr/bin/gunicorn --access-logfile - --workers 3 --bind unix:/run/city-manual.sock city_manual.wsgi:application +Restart=always + +[Install] +WantedBy=multi-user.target +EOF + +systemctl daemon-reload +systemctl enable city-manual +systemctl start city-manual + +# 5. 配置 Nginx +echo "🌐 配置 Nginx..." +cat > /etc/nginx/sites-available/city-manual << 'EOF' +server { + listen 80; + server_name cssc.datalibstar.com; + + location = /favicon.ico { access_log off; log_not_found off; } + + location /static/ { + alias /root/.openclaw/workspace/city-manual/backend/static/; + } + + location /media/ { + alias /root/.openclaw/workspace/city-manual/backend/media/; + } + + location / { + include proxy_params; + proxy_pass http://unix:/run/city-manual.sock; + } +} +EOF + +ln -sf /etc/nginx/sites-available/city-manual /etc/nginx/sites-enabled/ +nginx -t +systemctl restart nginx + +# 6. 导入示例数据 +echo "📊 导入示例数据..." +python3 manage.py seed_data + +echo "" +echo "✅ 部署完成!" +echo "" +echo "📍 访问地址:http://cssc.datalibstar.com" +echo "📍 Admin: http://cssc.datalibstar.com/admin" +echo "📍 测试账号:demo / demo123" diff --git a/city-manual/gunicorn_start.sh b/city-manual/gunicorn_start.sh new file mode 100644 index 0000000..9703756 --- /dev/null +++ b/city-manual/gunicorn_start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd /root/.openclaw/workspace/city-manual/backend +exec gunicorn --workers 3 --bind 0.0.0.0:8000 city_manual.wsgi:application