xlcp/deploy/scripts/init-permissions.sh
tangweijie bc40155ef0 chore: 添加部署配置及文档
- 新增 deploy/ 目录包含 Docker 部署配置、数据库脚本、部署脚本
- 更新 .gitignore 忽略 deploy 构建产物
- 添加 AGENTS.md AI Agent 指南
- 添加项目构建脚本 build.sh
2026-01-22 21:10:49 +08:00

49 lines
885 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
# 初始化目录权限
init_permissions() {
log_info "初始化目录权限..."
# 创建必要的目录
mkdir -p data/{mysql,redis,upload}
mkdir -p logs/{backend,nginx}
# 设置目录权限为 777开发环境
# 这样任何容器用户都可以写入
chmod -R 777 data/ logs/
log_success "目录权限已设置"
}
# 检查是否在正确的目录
if [ ! -f "docker-compose.yml" ]; then
echo "错误: 请在 deploy 目录下运行此脚本"
exit 1
fi
init_permissions
log_success "初始化完成!"
log_info "目录结构:"
ls -la data/ logs/