--- 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 ```ini [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 ```ini [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 : ```ini [database] DB_TYPE = postgres HOST = /run/postgresql/ NAME = gitea USER = gitea ``` ### Securité ```ini [security] INSTALL_LOCK = true SECRET_KEY = *** INTERNAL_TOKEN = *** REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128 ``` ```ini [oauth2] ENABLE = false ``` ```ini [service] DISABLE_REGISTRATION = true ``` ### Logs ```ini [log] ROOT_PATH = /var/log/gitea ``` ### Repositories ```ini [repository] ROOT = /var/lib/gitea/repos DEFAULT_BRANCH = main ``` ### Email ```ini [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 ```ini [webhook] ALLOWED_HOST_LIST = loopback,edgarpierre.fr,*.edgarpierre.fr ``` ## Service Gitea est démarré avec le service systemd `gitea.service`. ## Configuration Nginx ```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; } } ```