Files
compose-gitea/README.md
2025-01-25 09:37:56 +01:00

98 lines
2.0 KiB
Markdown

# Basic git & drone docker-compose config
* can be run on single node setup or in swarm
## howto
### single node
#### start container
```bash
docker compose up -d
```
#### stop container (and remove)
```bash
docker compose down
```
#### view logs
```bash
docker compose logs -f
```
#### reload config
```bash
docker compose restart
```
### swarm
#### start aka deploy
hint: drone fails to start until git auth source is created and set in vars
```bash
docker stack deploy -c docker-compose.yml git
```
#### stop container aka service
```bash
docker service rm git_git
docker service rm git_drone
```
#### view logs
```bash
docker service logs git_git -f
docker service logs git_drone -f
```
#### reload config (no downtime if replica 2 or more)
```bash
docker service update git_git --force
docker service update git_drone --force
```
## example caddy config
```
git.example.com {
reverse_proxy git:3000
}
```
## CI Deployment
Since version 1.19.x Gitea has a CI handler integrated.
These CI handler is mostly compatible with Github Actions.
Runner Setup: https://docs.gitea.com/usage/actions/act-runner
Usage: https://docs.gitea.com/usage/actions/quickstart
```
wget -O act_runner https://dl.gitea.com/act_runner/0.2.11/act_runner-0.2.11-linux-amd64
chmod +x act_runner
./act_runner --version
./act_runner generate-config > config.yml
# interactive setup
# ./act_runner --config config.yml register
./act_runner register --no-interactive --instance https://git.your.domain/ --token <token>
# ./act_runner register --no-interactive --instance <instance_url> --token <registration_token> --name <runner_name> --labels <runner_labels>
./act_runner --config config.yml daemon
```
Service File
```
[Unit]
Description=Gitea Actions runner
Documentation=https://gitea.com/gitea/act_runner
After=docker.service
[Service]
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yaml
ExecReload=/bin/kill -s HUP $MAINPID
WorkingDirectory=/var/lib/act_runner
TimeoutSec=0
RestartSec=10
Restart=always
User=act_runner
[Install]
WantedBy=multi-user.target
```