All checks were successful
/ build-docker-image (push) Successful in 15s
171 lines
5.0 KiB
Markdown
171 lines
5.0 KiB
Markdown
# Gitea
|
||
|
||
- [Links](#links)
|
||
- [Backup And Restore](#backup-and-restore)
|
||
- [Gitea dump from docker host](#gitea-dump-from-docker-host)
|
||
- [nginx](#nginx)
|
||
- [act runner](#act-runner)
|
||
- [act runner (Official)](#act-runner-official)
|
||
- [Docker Compose](#docker-compose)
|
||
- [custom act runner - network-stack](#custom-act-runner---network-stack)
|
||
- [workflows - actions](#workflows---actions)
|
||
- [Other References](#other-references)
|
||
|
||
## Links
|
||
|
||
- [Homepage](https://gitea.io/)
|
||
- [Documentation](https://docs.gitea.io)
|
||
- [API](https://try.gitea.io/api/swagger)
|
||
- [GitHub](https://github.com/go-gitea)
|
||
|
||
## Backup And Restore
|
||
|
||
_Source - https://docs.gitea.io/en-us/backup-and-restore/_
|
||
|
||
### Gitea dump from docker host
|
||
|
||
```bash
|
||
# exec -> execute
|
||
# -u -> container name
|
||
# -w -> working directory on container
|
||
# bash -c "x" -> execute bash with command x
|
||
|
||
/usr/bin/docker exec -u git -w /tmp/backups gitea bash -c "/app/gitea/gitea dump"
|
||
|
||
|
||
|
||
#export to import to postgres (migrating from mysql to postgres)
|
||
sudo docker exec -u git -it -w /tmp gitea bash -c '/app/gitea/gitea dump -d postgres'
|
||
|
||
```
|
||
|
||
## nginx
|
||
|
||
```bash
|
||
location / {
|
||
proxy_pass http://git_limbosolutions_com-gitea:80;
|
||
proxy_redirect off;
|
||
proxy_set_header Host $http_host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header X-Forwarded-Protocol $scheme;
|
||
proxy_set_header X-Url-Scheme $scheme;
|
||
}
|
||
```
|
||
|
||
## act runner
|
||
|
||
### act runner (Official)
|
||
|
||
#### Docker Compose
|
||
|
||
``` yaml
|
||
...
|
||
gitea:
|
||
image: gitea/gitea
|
||
...
|
||
|
||
runner:
|
||
image: gitea/act_runner
|
||
restart: always
|
||
depends_on:
|
||
- gitea
|
||
volumes:
|
||
- ./data/act_runner:/data
|
||
- /var/run/docker.sock:/var/run/docker.sock
|
||
environment:
|
||
- GITEA_INSTANCE_URL=<instance url>
|
||
# When using Docker Secrets, it's also possible to use
|
||
# GITEA_RUNNER_REGISTRATION_TOKEN_FILE to pass the location.
|
||
# The env var takes precedence.
|
||
# Needed only for the first start.
|
||
- GITEA_RUNNER_REGISTRATION_TOKEN=<registration token>
|
||
```
|
||
|
||
### custom act runner - network-stack
|
||
|
||
**🚀 Purpose**
|
||
|
||
This container equips the Gitea Actions runner with a network‑aware toolchain, making it suitable for continuous deployments in environments where Docker‑in‑Docker or elevated privileges are not available.
|
||
|
||
- Kubernetes‑friendly: ships with kubectl and supporting utilities so it can interact directly with clusters.
|
||
- No privileged mode required: avoids the need for Docker socket mounts or root escalation.
|
||
- CI/CD ready: includes SSH, Ansible, Node.js, rsync, rclone, and envsubst for orchestration, templating, and asset transfer.
|
||
|
||
**📦 Installed packages**
|
||
|
||
- 🛡️ openssh-client, 🌐 curl, ⚙️ ansible, 🟦 nodejs, 🔄 rclone, 📤 rsync, and 🔧 envsubst via Alpine’s apk package manager
|
||
- 🔑 SSH and curl → remote access and HTTP requests
|
||
- ⚙️ Ansible → configuration management and automation
|
||
- 🟦 Node.js → JavaScript runtime for workflows
|
||
- 🔄 Rclone and rsync → file synchronization and transfer
|
||
- 🔧 envsubst → environment variable substitution in templates
|
||
- ☸️ kubectl → fetches the latest stable Kubernetes CLI directly from Google Cloud Storage
|
||
|
||
**Docker pull**
|
||
|
||
``` bash
|
||
docker pull git.limbosolutions.com/kb/gitea/act_runner:0.2.13-network-stack
|
||
```
|
||
|
||
[Dockerfile source file.](./runners/act-runner-network-stack/Dockerfile)
|
||
|
||
## workflows - actions
|
||
|
||
**limbo public actions:**
|
||
|
||
- kubectl-setup - setups kube config
|
||
|
||
This example is running custom act runner([custom act runner - network-stack](#custom-act-runner---network-stack)) to deploy to kubernetes cluster without using docker.
|
||
|
||
```yaml
|
||
name: Example of workflow using limbo public actions
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
|
||
- main
|
||
pull_request:
|
||
jobs:
|
||
deploy:
|
||
runs-on: runner-label
|
||
env:
|
||
GITHUB_TEMP: ${{ runner.temp }}
|
||
|
||
steps:
|
||
|
||
- name: Checkout code
|
||
uses: actions/checkout@v3
|
||
|
||
- name: Fetch limbo public actions
|
||
env:
|
||
RUNNER_TEMP: "${{ runner.temp }}"
|
||
WORKSPACE: "${{ gitea.workspace }}"
|
||
run: |
|
||
curl -fsSL https://git.limbosolutions.com/kb/gitea/raw/branch/main/cloud-scripts/setup-limbo-actions.sh | bash 2>&1
|
||
|
||
- name: Setup kubectl
|
||
uses: ./.gitea/limbo_actions/kubectl-setup
|
||
with:
|
||
kube_server: ${{ secrets.KUBE_SERVER }}
|
||
kube_ca_base64: ${{ secrets.KUBE_CA_BASE64 }}
|
||
kube_token: ${{ secrets.KUBE_TOKEN }}
|
||
|
||
- name: Deploy Kubernetes
|
||
shell: bash
|
||
env:
|
||
secrets_example: "${{ secrets.secrets_example }}"
|
||
|
||
run: |
|
||
kubectl apply -f ./deploy/deployment.yaml \
|
||
&& envsubst < ./deploy/service.template.yaml | kubectl apply -f -
|
||
```
|
||
|
||
|
||
## Other References
|
||
|
||
- [git.limbosolution.com](https://git.limbosolutions.com)
|
||
- [git.limbosolution.com - repo](https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com)
|
||
|