diff --git a/.gitignore b/.gitignore index 76a7578..2d2036f 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,6 @@ prime/ # A Makefile for custom make targets Makefile.local + +# Local deployment secrets +/contrib/roncarve/.env diff --git a/contrib/roncarve/.env.example b/contrib/roncarve/.env.example new file mode 100644 index 0000000..4bdfab6 --- /dev/null +++ b/contrib/roncarve/.env.example @@ -0,0 +1,2 @@ +# Copy this file to .env and replace the placeholder with the SMTP password. +GITEA__mailer__PASSWD=replace-with-tencent-ses-smtp-password diff --git a/contrib/roncarve/README.md b/contrib/roncarve/README.md index d59179f..fd7c69f 100644 --- a/contrib/roncarve/README.md +++ b/contrib/roncarve/README.md @@ -1,5 +1,11 @@ # Gita 本地 Docker +复制 `.env.example` 为 `.env`,并填写腾讯云邮件推送 SMTP 密码: + +```powershell +Copy-Item contrib/roncarve/.env.example contrib/roncarve/.env +``` + 启动: ```powershell @@ -10,8 +16,12 @@ docker compose -f contrib/roncarve/compose.local.yaml up -d --build 首次启动会进入安装页面。完成初始化后,管理员账号和数据保存在 `roncarve-gita-local-data` 卷中;SSH 地址为 `ssh://git@localhost:2222`。 +邮件默认使用腾讯云香港区 `smtp.qcloudmail.com:465`,发信地址为 `noreply@git.roncarve.com`,密码仅保存在不纳入 Git 的 `.env` 文件中。 + 停止但保留数据: ```powershell docker compose -f contrib/roncarve/compose.local.yaml down ``` + +生产环境使用 `compose.production.yaml`,通过外部 `gateway_gateway` 网络接入现有 Caddy,数据目录为 `/opt/gita/data`。 diff --git a/contrib/roncarve/compose.local.yaml b/contrib/roncarve/compose.local.yaml index 134a855..481956e 100644 --- a/contrib/roncarve/compose.local.yaml +++ b/contrib/roncarve/compose.local.yaml @@ -6,6 +6,8 @@ services: image: roncarve/gita:1.27.2-local container_name: roncarve-gita-local restart: unless-stopped + env_file: + - .env ports: - "127.0.0.1:3300:3000" - "127.0.0.1:2222:22" @@ -24,7 +26,14 @@ services: GITEA__server__SSH_PORT: "2222" GITEA__server__ROOT_URL: http://localhost:3300/ GITEA__service__DISABLE_REGISTRATION: "true" + GITEA__service__ENABLE_NOTIFY_MAIL: "true" GITEA__service__ENABLE_PASSKEY_AUTHENTICATION: "false" + GITEA__mailer__ENABLED: "true" + GITEA__mailer__PROTOCOL: smtps + GITEA__mailer__SMTP_ADDR: smtp.qcloudmail.com + GITEA__mailer__SMTP_PORT: "465" + GITEA__mailer__FROM: '"代码协作平台-海南荣刻科技有限公司" ' + GITEA__mailer__USER: noreply@git.roncarve.com GITEA__openid__ENABLE_OPENID_SIGNIN: "false" GITEA__openid__ENABLE_OPENID_SIGNUP: "false" GITEA__ui__DEFAULT_THEME: gitea-light diff --git a/contrib/roncarve/compose.production.yaml b/contrib/roncarve/compose.production.yaml new file mode 100644 index 0000000..db7cb4d --- /dev/null +++ b/contrib/roncarve/compose.production.yaml @@ -0,0 +1,58 @@ +services: + gita: + build: + context: ../.. + dockerfile: Dockerfile + image: roncarve/gita:1.27.2-production + container_name: gitea + hostname: git.roncarve.com + restart: unless-stopped + env_file: + - .env + ports: + - "2222:22" + environment: + USER_UID: "1000" + USER_GID: "1000" + GITEA_WORK_DIR: /data/gita + GITEA_CUSTOM: /data/gita + GITEA____APP_NAME: Gita 代码协作平台 + GITEA__database__DB_TYPE: sqlite3 + GITEA__database__PATH: /data/gita/gita.db + GITEA__server__PROTOCOL: http + GITEA__server__HTTP_ADDR: 0.0.0.0 + GITEA__server__HTTP_PORT: "3000" + GITEA__server__DOMAIN: git.roncarve.com + GITEA__server__SSH_DOMAIN: git.roncarve.com + GITEA__server__SSH_PORT: "2222" + GITEA__server__ROOT_URL: https://git.roncarve.com/ + GITEA__security__INSTALL_LOCK: "true" + GITEA__service__DISABLE_REGISTRATION: "true" + GITEA__service__ENABLE_NOTIFY_MAIL: "true" + GITEA__service__ENABLE_PASSKEY_AUTHENTICATION: "false" + GITEA__mailer__ENABLED: "true" + GITEA__mailer__PROTOCOL: smtps + GITEA__mailer__SMTP_ADDR: smtp.qcloudmail.com + GITEA__mailer__SMTP_PORT: "465" + GITEA__mailer__FROM: '"代码协作平台-海南荣刻科技有限公司" ' + GITEA__mailer__ENVELOPE_FROM: noreply@git.roncarve.com + GITEA__mailer__USER: noreply@git.roncarve.com + GITEA__openid__ENABLE_OPENID_SIGNIN: "false" + GITEA__openid__ENABLE_OPENID_SIGNUP: "false" + GITEA__ui__DEFAULT_THEME: gitea-light + GITEA__ui_0x2E_meta__AUTHOR: Hainan Roncarve Technology Co., Ltd. + GITEA__ui_0x2E_meta__DESCRIPTION: Gita 代码协作平台 + GITEA__ui_0x2E_meta__KEYWORDS: roncarve,gita,go,git,code-collaboration + volumes: + - /opt/gita/data:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + networks: + gateway: + aliases: + - gitea + +networks: + gateway: + external: true + name: gateway_gateway