Add deployment script and documentation
This commit is contained in:
35
DEPLOYMENT.md
Normal file
35
DEPLOYMENT.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# 井字过三关游戏 - 部署文档
|
||||||
|
|
||||||
|
## 部署说明
|
||||||
|
|
||||||
|
### 自动部署
|
||||||
|
使用提供的部署脚本进行自动部署:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./deploy.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### 手动部署
|
||||||
|
1. 将项目文件复制到Web服务器目录(通常是 `/var/www/html/`)
|
||||||
|
2. 确保Web服务器有适当的读取权限
|
||||||
|
3. 访问 `http://<server-ip>/tic-tac-toe/` 来玩这个游戏
|
||||||
|
|
||||||
|
## 内网访问
|
||||||
|
游戏已部署到内网,可以通过以下地址访问:
|
||||||
|
- http://192.168.120.110/tic-tac-toe/
|
||||||
|
|
||||||
|
## 服务器要求
|
||||||
|
- Web服务器 (Apache, Nginx, 或其他支持静态文件服务的服务器)
|
||||||
|
- 无需后端,纯前端应用
|
||||||
|
- 支持现代浏览器 (Chrome, Firefox, Safari, Edge)
|
||||||
|
|
||||||
|
## 验证部署
|
||||||
|
1. 检查页面是否正确加载
|
||||||
|
2. 测试游戏功能是否正常
|
||||||
|
3. 验证分数统计是否正常工作
|
||||||
|
4. 测试响应式设计在移动设备上是否正常
|
||||||
|
|
||||||
|
## 维护
|
||||||
|
- 游戏数据存储在本地浏览器中 (localStorage)
|
||||||
|
- 不需要数据库或其他后端服务
|
||||||
|
- 更新只需替换文件即可
|
||||||
37
deploy.sh
Executable file
37
deploy.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Deployment script for Tic Tac Toe Game
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
SOURCE_DIR="/home/node/clawd/tic-tac-toe-game"
|
||||||
|
TARGET_DIR="/var/www/html/tic-tac-toe" # Standard web directory
|
||||||
|
LOG_FILE="/var/log/tic-tac-toe-deploy.log"
|
||||||
|
|
||||||
|
# Log function
|
||||||
|
log() {
|
||||||
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create target directory if it doesn't exist
|
||||||
|
if [ ! -d "$TARGET_DIR" ]; then
|
||||||
|
mkdir -p "$TARGET_DIR"
|
||||||
|
log "Created target directory: $TARGET_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy files to target directory
|
||||||
|
cp -r "$SOURCE_DIR"/* "$TARGET_DIR/"
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log "Successfully deployed Tic Tac Toe Game to $TARGET_DIR"
|
||||||
|
echo "Deployment completed successfully!"
|
||||||
|
echo "Game is available at: http://192.168.120.110/tic-tac-toe/"
|
||||||
|
else
|
||||||
|
log "Failed to deploy Tic Tac Toe Game"
|
||||||
|
echo "Deployment failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set proper permissions
|
||||||
|
chmod -R 644 "$TARGET_DIR"/*
|
||||||
|
chmod -R 755 "$TARGET_DIR"
|
||||||
|
|
||||||
|
echo "Deployment process finished."
|
||||||
Reference in New Issue
Block a user