认识
官网:https://about.gitea.com/
文档:https://docs.gitea.com/
仓库:https://github.com/go-gitea/gitea/
Gitea is a community fork of the popular self-hosted Git service Gogs. We’re a growing group of former Gogs users and contributors who found the single-maintainer management model of Gogs frustrating and thus decided to make an effort to build a more open and faster development model. 简而言之,Gitea 类似于 GitLab 是个开源的 DevOps 平台,基于 Git 进行代码托管。
组成
配置文件 app.ini
Configuration Cheat Sheet | https://docs.gitea.com/administration/config-cheat-sheet
构建
v1.23.8 | on Kubernetes | with Helm Chart
How to change SSh git clone url?
https://docs.gitea.com/installation/install-on-kubernetes
Giteat v1.23.8, Kubernetes v1.30.0-tke.9, Helm Chart version 12.0.0
我们使用自建的 MySQL 数据库,针对 Giteat v1.23.8 版本,我们使用 MySQL 8.0.37 版本。原因在于,
- 我们 PostgreSQL 经验较少,其官方 Chart 不处理数据库服务升级。
- 复用已有 MySQL 数据库实例,降低资源消耗。
数据库初始化操作 | Database Preparation / MySQL | https://docs.gitea.com/installation/database-prep
CREATE USER 'gitea'@'%' IDENTIFIED BY 'WOJsfAYKFHOXSW0'; CREATE DATABASE gitea CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin'; GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'; FLUSH PRIVILEGES;
执行 Gitea Helm Chart 安装:
helm repo add gitea-charts https://dl.gitea.com/charts/ helm repo update gitea-charts helm pull gitea-charts/gitea helm show values ./gitea-12.0.0.tgz > gitea-12.0.0.tgz.helm-values.yaml vim gitea-12.0.0.tgz.helm-values.yaml ... global.storageClass: ... persistence.storageClass: ... gitea.admin.username: ... gitea.admin.password: ... valkey-cluster.enabled: false ... valkey.enabled: true ... postgresql-ha.enabled: false ... postgresql.enabled: false ... gitea.config.database: # https://gitea.com/gitea/helm-gitea#external-database ... gitea.config.server.SSH_DOMAIN: # 修改 SSH 域名 ... ingress:
用户管理
默认管理账户:
- 通过 Helm Chart 安装,可通过 values.yaml 来配置 admin 账号及密码;
- There is no default password during the install process you would be prompted to create a user, otherwise the first user registered to Gitea becomes the admin. —— https://github.com/go-gitea/gitea/issues/4120
- 或,通过 gitea admin user create 命令 —— https://docs.gitea.com/next/administration/command-line#admin
接入 Light LDAP lldap 认证:
- 参考文档 https://github.com/lldap/lldap/blob/main/example_configs/gitea.md
- 同步用户:Site Administration / Maintenance / Dashboard / Maintenance Operations / Synchronize exernal user data
- 若未同步用户,首次登陆时将会提示用户名密码错误。再次点击登陆时,将会登陆成功。
提高 LDAP 同步频率,使用户尽快生效 | https://forum.gitea.com/t/trigger-synchronize-external-user-data-programmatically/3466
... gitea: ... config: ... cron.sync_external_users: ENABLED: true RUN_AT_START: false NOTICE_ON_SUCCESS: false SCHEDULE: "@every 1m" UPDATE_EXISTING: true ... ... ...
性质
- Code Hosting
- Code Review
- CI/CD
- Project Management
- Artifact Repository
- Multilingual Support
- Lightweight and Fast
- Easy Deployment and Maintenance
- Security
- Open Source Community Support
API Usage and
https://docs.gitea.com/next/development/api-usage
认证方法:
- HTTP basic authentication
- token=… parameter in URL query string
- access_token=… parameter in URL query string
- Authorization: token … header in HTTP headers
SDK | https://gitea.com/gitea/awesome-gitea#sdk
- for Java
- https://github.com/zeripath/java-gitea-api
- https://codeberg.org/gitnex/tea4j-autodeploy
- 根据我们的了解,并结合我们的诉求,我们决定使用 HTTP API 来访问 Gitea 服务。
参考
从 Gogs vs Gitea 看中外文化差异 | Wolfogre’s Blog
go-gitea/gitea: Git with a cup of tea, painless self-hosted git service
Welcome to Gitea – Blog
What is Gitea?