115 lines
2.4 KiB
Markdown
115 lines
2.4 KiB
Markdown
# git.limbosolutions.com
|
|
|
|
Welcome to public repository of my [Git Server](https://git.limbosolutions.com)
|
|
|
|
Using [gitea](https://git.limbosolutions.com/kb/gitea) as git server and [duplicati](https://git.limbosolutions.com/kb/duplicati) for backups.
|
|
|
|
- [Requirements](#requirements)
|
|
- [Setup](#setup)
|
|
- [Backup and Restore](#backup-and-restore)
|
|
- [Duplicati - git job Options](#duplicati---git-job-options)
|
|
- [Restore Database](#restore-database)
|
|
- [Git Action](#git-action)
|
|
- [runners](#runners)
|
|
- [lxc container - proxmox](#lxc-container---proxmox)
|
|
- [act tunner](#act-tunner)
|
|
|
|
## Requirements
|
|
|
|
- Docker
|
|
- Docker Compose
|
|
- Portainer (optional)
|
|
|
|
## Setup
|
|
|
|
[Docker Compose File](docker-compose.yaml)
|
|
|
|
## Backup and Restore
|
|
|
|
Using [custom duplicati image](https://git.limbosolutions.com/kb/duplicati) to daily backups files and database with custom logs for grafana.
|
|
|
|
Docker Log.
|
|
|
|
--run-script-after=dockerlog
|
|
|
|
### Duplicati - git job Options
|
|
|
|
Create db dump.
|
|
|
|
run-script-before-required:duplicati-mysql-backup
|
|
|
|
### Restore Database
|
|
|
|
```bash
|
|
#select a file to import
|
|
ls /db-dumps
|
|
#select a file to import
|
|
DB_FILE= "file name to import"
|
|
mysql --host db -uroot -p ${MYSQL_DATABASE} < /db-dumps/$DB_FILE
|
|
#root password (root password is the enviromnent variable ${MYSQL_ROOT_PASSWORD})
|
|
```
|
|
|
|
## Git Action
|
|
|
|
## runners
|
|
|
|
## lxc container - proxmox
|
|
|
|
Template : debian-12-turnkey-core_18.1-1_amd64.tar.gz
|
|
|
|
- Unprivileged contrainer - Yes
|
|
- Nesting -Yes
|
|
|
|
```bash
|
|
# setup new lxc container with docker
|
|
|
|
apt update -y
|
|
apt upgrade -y
|
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
sh ./get-docker.sh
|
|
```
|
|
|
|
### act tunner
|
|
|
|
```bash
|
|
nano setup-act-runners.sh
|
|
```
|
|
|
|
```bash
|
|
#/bin/bash
|
|
|
|
setup(){
|
|
|
|
CONTAINER_NAME=${OWNER}_act_runner
|
|
|
|
docker container stop $CONTAINER_NAME
|
|
docker container rm $CONTAINER_NAME
|
|
|
|
docker run \
|
|
--restart=unless-stopped \
|
|
-v ${CONTAINER_NAME}_data:/data \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
-e GITEA_INSTANCE_URL=${INSTANCE_URL} \
|
|
-e GITEA_RUNNER_REGISTRATION_TOKEN=${REGISTRATION_TOKEN} \
|
|
-e GITEA_RUNNER_NAME=${OWNER}_ubuntu_default \
|
|
--name ${CONTAINER_NAME} \
|
|
-d gitea/act_runner
|
|
}
|
|
|
|
INSTANCE_URL=https://git.limbosolutions.com
|
|
OWNER=kb
|
|
REGISTRATION_TOKEN=???
|
|
setup
|
|
|
|
|
|
OWNER=????
|
|
REGISTRATION_TOKEN=???
|
|
setup
|
|
|
|
```
|
|
|
|
```bash
|
|
chmod +x setup-act-runners.sh
|
|
./setup-act-runners.sh
|
|
```
|