feat: update gitea & gitea config

This commit is contained in:
Sun-ZhenXing
2026-07-22 15:44:52 +08:00
parent 3432c9da65
commit 87a58d8d04
15 changed files with 1162 additions and 928 deletions
+49 -22
View File
@@ -2,42 +2,69 @@
[English](./README.md) | [中文](./README.zh.md)
This service sets up a Gitea service.
This stack runs Gitea 1.27.0 with the rootless image and PostgreSQL 17.6.
## Services
- `server`: The Gitea application service.
- `db`: The PostgreSQL database service.
- `gitea`: Gitea web and SSH service.
- `db`: PostgreSQL database service.
## Quick Start
Copying the example environment file is optional. Before the first startup, strongly consider changing `POSTGRES_PASSWORD`; the default is only suitable for local evaluation.
```bash
cp .env.example .env
# Edit POSTGRES_PASSWORD in .env.
docker compose up -d
```
Open <http://localhost:3000> after the services become healthy.
## Initial Setup
On the initial setup page, you need to fill in the database information:
Use these database settings on the Gitea installation page:
- Database Type: `PostgreSQL`
- Database type: `PostgreSQL`
- Host: `db:5432`
- User: `gitea`
- Password: `gitea` (default)
- Database Name: `gitea`
- User: `gitea`, or the value of `POSTGRES_USER`
- Database name: `gitea`, or the value of `POSTGRES_DB`
- Password: the value of `POSTGRES_PASSWORD`
The first registered user will have administrator privileges.
The first registered user becomes an administrator.
## Configuration
You can configure the basic information of Gitea through the `./config/app.ini` file. For example, you can disable the registration function with the following configuration:
| Variable | Default | Description |
| --- | --- | --- |
| `GITEA_VERSION` | `1.27.0-rootless` | Gitea image tag. |
| `GITEA_DB_TYPE` | `postgres` | Gitea database type. |
| `GITEA_POSTGRES_HOST` | `db:5432` | PostgreSQL address inside the Compose network. |
| `POSTGRES_VERSION` | `17.6` | PostgreSQL image version. |
| `POSTGRES_USER` | `gitea` | Database user. |
| `POSTGRES_PASSWORD` | `gitea` | Database password; change it for production. |
| `POSTGRES_DB` | `gitea` | Database name. |
| `GITEA_HTTP_PORT` | `3000` | Published Gitea HTTP port. |
| `GITEA_SSH_PORT` | `2222` | Published Gitea SSH port. |
```ini
[service]
DISABLE_REGISTRATION = true
```
### Default Ports
### Environment Variables
| Service | Host port | Container port |
| --- | --- | --- |
| Gitea HTTP | `3000` | `3000` |
| Gitea SSH | `2222` | `2222` |
| PostgreSQL | Not published | `5432` |
- `POSTGRES_USER`: The username for the PostgreSQL database, default is `gitea`.
- `POSTGRES_PASSWORD`: The password for the PostgreSQL database, default is `gitea`.
- `POSTGRES_DB`: The name of the PostgreSQL database, default is `gitea`.
## Storage
## Volumes
- `gitea_data`: Gitea repositories and application data.
- `gitea_config`: Gitea configuration.
- `postgres`: PostgreSQL database files.
- `data`: A volume for storing Gitea data.
- `config`: A volume for storing Gitea configuration.
- `postgres`: A volume for storing PostgreSQL data.
## Upgrading
Before upgrading from an older release, back up the `postgres`, `gitea_data`, and `gitea_config` volumes. Gitea automatically runs database migrations during startup; do not downgrade directly after a migration. Restore a compatible backup instead.
## Security
The Gitea application uses the rootless image. The default database password is only for local evaluation and must be changed in production. Publish the HTTP and SSH ports only when needed, and restrict their network exposure with host firewall or proxy rules.