2025-10-16 17:50:23 +02:00

104 lines
2.9 KiB
Markdown

# Gitea
## Description
This docker compose run gitea and his runner on docker
## Requierments
### Folder
```bash
sudo mkdir -p /home/docker/gitea/data
sudo mkdir -p /home/docker/gitea/postgres
sudo mkdir -p /home/docker/gitea/runner/data
```
### Files
```bash
sudo touch /home/docker/gitea/runner/config.yaml
```
### Certificats
Copy crt and key files on `/home/docker/certs/`
## Apache
### http-gitea.conf
```
<VirtualHost *:80>
ServerName gitea.gmolab.net
ServerAlias gitea
CustomLog logs/gitea_access_log common
ErrorLog logs/gitea_error_log
# redirect to https
RewriteEngine on
RewriteCond %{SERVER_NAME} =gitea [OR]
RewriteCond %{SERVER_NAME} =gitea.gmolab.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
```
### https-gitea.conf
```
##
## SSL Virtual Host Context
##
# General setup for the virtual host
<VirtualHost *:443>
ServerName gitea.gmolab.net
ServerAlias gitea
CustomLog logs/gitea_access_log common
ErrorLog logs/gitea_error_log
# SSL
SSLEngine on
SSLHonorCipherOrder on
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4
# Enable HTTP/2, if available
Protocols h2 http/1.1
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
Header always set Strict-Transport-Security "max-age=63072000"
# certificats
SSLCertificateFile "/etc/httpd/auth/cert/gmolab.net.crt"
SSLCertificateKeyFile "/etc/httpd/auth/cert/gmolab.net.key"
SSLCertificateChainFile "/etc/httpd/auth/cert/gmolabCA.crt"
# proxy
SSLProxyEngine On
ProxyPreserveHost On
ProxyRequests off
ProxyPass "/" "http://127.0.0.1:3000/"
ProxyPassReverse "/" "https://127.0.0.1:3000/"
</VirtualHost>
```
### Start gitea for config
```bash
docker compose up web db
```
## Access
https://gitea.gmolab.net
## Config
Login on https://gitea.gmolab.net
Adapt the configuration as you need
**Do not forget** to config user and password admin in section `Administrator Account Settings`
### Create runner
* click on the user name at the top right of the page, **Settings** -> **Actions** -> **Runners**
* click on **Create new Runner** and copy **Registration Token**
* edit file `docker-copose.yml`and
- set variable `GITEA_RUNNER_REGISTRATION_TOKEN` with the token copied above
- set variable `GITEA_INSTANCE_URL` with URL
- set variable `GITEA_RUNNER_NAME` with the name that you want
* stop gitea
```bash
docker compose down
```
## Start gitea stack
```bash
docker compose up -d
```
---
### [1.0.0] - 2025-10-16
#### Added
- initial version by [GMo](mailto:gilles.mouchet@gmail.com)