Files
private-ai-platform/ansible/roles/gitea/README.md
Hrankin, Aleksandr (contracted) f243f440c3 init
2026-02-19 11:34:13 +00:00

110 lines
2.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Gitea Setup Notes
## 1⃣ Добавление HTTPS сертификата (Let's Encrypt + Nginx)
### Установка certbot
ставим certbot на хост (НЕ в контейнер)
``` bash
sudo apt update
sudo apt install certbot python3-certbot-nginx -y
```
### Базовый nginx конфиг (HTTP → прокси в Gitea)
Файл: `./nginx/nginx.conf`
``` nginx
server {
listen 80;
server_name gitea.quietblock.net;
location / {
proxy_pass http://gitea:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
### Получение сертификата
``` bash
sudo certbot certonly --standalone -d gitea.quietblock.net
```
Запрашивает SSL сертификат для домена через standalone режим.
После успеха сертификаты будут:
/etc/letsencrypt/live/gitea.quietblock.net/fullchain.pem
/etc/letsencrypt/live/gitea.quietblock.net/privkey.pem
### Docker nginx сервис
``` yaml
nginx:
image: nginx:stable
container_name: nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx:/etc/nginx/conf.d
- /etc/letsencrypt:/etc/letsencrypt:ro
depends_on:
- gitea
```
### Финальный nginx конфиг (HTTP → HTTPS + SSL)
``` nginx
server {
listen 80;
server_name gitea.quietblock.net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name gitea.quietblock.net;
ssl_certificate /etc/letsencrypt/live/gitea.quietblock.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/gitea.quietblock.net/privkey.pem;
location / {
proxy_pass http://gitea:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
Что происходит: - HTTP редиректится на HTTPS - nginx использует SSL
сертификаты - HTTPS проксируется в контейнер gitea
------------------------------------------------------------------------
## 2⃣ Создание администратора в Gitea
### Зайти внутрь контейнера
``` bash
docker exec -it --user git gitea /bin/bash
```
Открывает shell внутри контейнера gitea от пользователя git.
### Создать администратора
``` bash
gitea admin user create --username adminuser --password 14881488 --email you@mail.com --admin
```