diff --git a/.gitignore b/.gitignore index 29e61d4..120ced4 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,7 @@ Thumbs.db # OpenCode .opencode/ + +# Server inventory +ansible/inventory/hosts.yml +ansible/inventory/group_vars/all.yml diff --git a/README.md b/README.md index 23e0cc2..1bf0d8d 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,14 @@ tjhlp-gitea/ ```bash cd ansible -# 编辑 inventory/hosts.yml 填入服务器地址 -# 编辑 inventory/group_vars/all.yml 修改域名、密码等 +cp inventory/hosts.yml.example inventory/hosts.yml +cp inventory/group_vars/all.yml.example inventory/group_vars/all.yml +``` + +编辑 ansible/inventory/hosts.yml 填入服务器地址 +编辑 ansible/inventory/group_vars/all.yml 修改域名、密码等 + +```bash ansible-playbook playbook.yml ``` diff --git a/ansible/inventory/group_vars/all.yml.example b/ansible/inventory/group_vars/all.yml.example new file mode 100644 index 0000000..ccfd136 --- /dev/null +++ b/ansible/inventory/group_vars/all.yml.example @@ -0,0 +1,42 @@ +--- +# ============================================================================= +# Gitea 答疑平台部署变量 +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Gitea 基础配置 +# ----------------------------------------------------------------------------- +# 留空则自动获取最新版本, 填写则使用指定版本(如 "1.25.1") +gitea_version: "" + +gitea_http_port: 3000 +gitea_domain: "gitea.example.com" # 替换为实际域名或 IP +gitea_app_name: "同济大学高级语言程序设计答疑平台" + +# ----------------------------------------------------------------------------- +# Gitea 管理员账号(首次部署自动创建, 部署后请修改密码) +# ----------------------------------------------------------------------------- +gitea_admin_user: "admin" +gitea_admin_password: "ChangeMe!2026" # 部署后务必修改 +gitea_admin_email: "shenjian@tongji.edu.cn" + +# ----------------------------------------------------------------------------- +# PostgreSQL 数据库配置 +# ----------------------------------------------------------------------------- +postgresql_version: 18 +gitea_db_name: "gitea" +gitea_db_user: "gitea" +gitea_db_password: "change_this_db_password" # 请修改为强密码 + +# ----------------------------------------------------------------------------- +# Webhook 配置 +# ----------------------------------------------------------------------------- +gitea_webhook_allowed_hosts: "*" +gitea_webhook_skip_tls: "false" + +# ----------------------------------------------------------------------------- +# 安全密钥(留空则自动生成, 生成后建议记录保存) +# ----------------------------------------------------------------------------- +gitea_secret_key: "" +gitea_internal_token: "" +gitea_lfs_jwt_secret: "" diff --git a/ansible/inventory/hosts.yml.example b/ansible/inventory/hosts.yml.example new file mode 100644 index 0000000..1569faf --- /dev/null +++ b/ansible/inventory/hosts.yml.example @@ -0,0 +1,7 @@ +--- +all: + hosts: + gitea-server: + ansible_host: 192.168.1.100 # 替换为实际服务器 IP + ansible_user: root # 替换为实际 SSH 用户 + # ansible_ssh_private_key_file: ~/.ssh/id_rsa