blog/content/docs/server/services/gitea.md

122 lines
2.2 KiB
Markdown

---
title: "Gitea"
weight: 1
# bookFlatSection: false
# bookToc: true
# bookHidden: false
# bookCollapseSection: false
# bookComments: false
# bookSearchExclude: false
---
# Gitea
## Installation
Installer le paquet `gitea`.
## Configuration
La configuration se fait dans le fichier `/etc/gitea/app.ini`.
Un exemple est fourni dans `/etc/gitea/app.example.ini`.
### Serveur
```
[server]
PROTOCOL = unix
DOMAIN = git.edgarpierre.fr
ROOT_URL = https://git.edgarpierre.fr/
STATIC_URL_PREFIX =
HTTP_ADDR = /run/gitea/gitea.socket
SSH_PORT = ***
OFFLINE_MODE = true
ENABLE_GZIP = true
ALLOW_GRACEFUL_RESTARTS = true
```
#### LFS
```
[server]
LFS_START_SERVER = true
LFS_JWT_SECRET =
```
### Base de donnée
Créer un utilisateur et une base de donnée `gitea` avec postgres.
Pour utiliser une connection par socket unix, la configuration est la suivante :
```
[database]
DB_TYPE = postgres
HOST = /run/postgresql/
NAME = gitea
USER = gitea
```
### Securité
```
[security]
INSTALL_LOCK = true
SECRET_KEY = ***
INTERNAL_TOKEN = ***
REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128
```
```
[oauth2]
ENABLE = false
```
```
[service]
DISABLE_REGISTRATION = true
```
### Logs
```
[log]
ROOT_PATH = /var/log/gitea
```
### Repositories
```
[repository]
ROOT = /var/lib/gitea/repos
DEFAULT_BRANCH = main
```
### Email
```
[mailer]
ENABLED = true
SUBJECT_PREFIX = [Gitea]
HOST = edgarpierre.fr:465
FROM = gitea@edgarpierre.fr
USER = gitea
PASSWD = ***
SEND_AS_PLAIN_TEXT = true
MAILER_TYPE = smtp
```
### Webhooks
```
[webhook]
ALLOWED_HOST_LIST = loopback,edgarpierre.fr,*.edgarpierre.fr
```
## Service
Gitea est démarré avec le service systemd `gitea.service`.
## Configuration Nginx
```
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name git.edgarpierre.fr;
include conf/00-hsts.conf;
location / {
include conf/50-proxy.conf;
proxy_pass http://unix:/run/gitea/gitea.socket;
}
}
```