Compare commits
24 Commits
main
...
6c4cbc7fed
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c4cbc7fed | |||
| 49d190081b | |||
| 82a5971502 | |||
| 657b305eef | |||
| f79da09e97 | |||
| 3459ef7101 | |||
| 370d409851 | |||
| 2f66c0cd94 | |||
| c872f7c6cb | |||
| dd36b2b5ba | |||
| b57e15b7d6 | |||
| 88d8ace2e8 | |||
| 2bfc501395 | |||
| 9eb54fc4ca | |||
| fffb6ddfa4 | |||
| d45a9c8d03 | |||
| dbf874fd7f | |||
| 874b2705ce | |||
| 5f28f2ef8a | |||
| 5513b14587 | |||
| 0e7c34489c | |||
| 10f7cf88d2 | |||
| 8628a12ec5 | |||
| dbe6acbf0e |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
**.env
|
*.local/*
|
||||||
_volumes
|
*.env
|
||||||
_volumes
|
*.env.d/*
|
||||||
.vscode
|
|
||||||
15
README.md
15
README.md
@@ -1,10 +1,11 @@
|
|||||||
|
|
||||||
# git.limbosolutions.com
|
# git.limbosolutions.com
|
||||||
|
|
||||||
* Arquitectura : armv7
|
## Setup
|
||||||
* docker
|
|
||||||
[compose file](docker/docker-compose.armv7.yaml)
|
|
||||||
|
|
||||||
## Backup and Restore Strategy
|
for more information check /documentation/setup.md
|
||||||
Duplicati
|
|
||||||
(more info required)
|
|
||||||
|
|
||||||
|
## Backup Strategy
|
||||||
|
|
||||||
|
Duplicati running on docker.
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# compose file
|
|
||||||
## Requirements
|
|
||||||
* [Docker Image](https://git.limbosolutions.com/marcio.fernandes/duplicati-utils/src/branch/main/docker/sqlclient.DockerFile)
|
|
||||||
|
|
||||||
|
|
||||||
# old info
|
|
||||||
## Backup
|
|
||||||
/usr/bin/docker exec -u git -w /tmp/backups gitea bash -c "/app/gitea/gitea dump"
|
|
||||||
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
services:
|
|
||||||
server:
|
|
||||||
image: kunde21/gitea-arm
|
|
||||||
container_name: gitea
|
|
||||||
environment:
|
|
||||||
- GITEA__database__DB_TYPE=mysql
|
|
||||||
- GITEA__database__HOST=db:3306
|
|
||||||
- GITEA__database__NAME=${GITEA_DB_NAME}
|
|
||||||
- GITEA__database__USER=${GITEA_DB_USER}
|
|
||||||
- GITEA__database__PASSWD=${GITEA_DB_PASSWORD}
|
|
||||||
- DISABLE_SSH=true
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- data:/data
|
|
||||||
- /etc/timezone:/etc/timezone:ro
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
#ports:
|
|
||||||
#- "3000:3000" web ui
|
|
||||||
#- "22:22" ssh
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
networks:
|
|
||||||
macvlan:
|
|
||||||
ipv4_address: ${GITEA_MACVLAN_IP}
|
|
||||||
gitea_network:
|
|
||||||
db:
|
|
||||||
image: tobi312/rpi-mariadb:10.5-ubuntu
|
|
||||||
container_name: gitea_mariadb
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
|
|
||||||
- MYSQL_USER=${GITEA_DB_USER}
|
|
||||||
- MYSQL_PASSWORD=${GITEA_DB_PASSWORD}
|
|
||||||
- MYSQL_DATABASE=${GITEA_DB_NAME}
|
|
||||||
volumes:
|
|
||||||
- db:/var/lib/mysql
|
|
||||||
- /etc/timezone:/etc/timezone:ro
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
networks:
|
|
||||||
gitea_network:
|
|
||||||
duplicati:
|
|
||||||
container_name: gitea_duplicati
|
|
||||||
image: duplicati-sqlclient
|
|
||||||
environment:
|
|
||||||
- GITEA_DB_HOST=db
|
|
||||||
- GITEA_DB_NAME=${GITEA_DB_NAME}
|
|
||||||
- GITEA_DB_USER=${GITEA_DB_USER}
|
|
||||||
- GITEA_DB_PASSWORD=${GITEA_DB_PASSWORD}
|
|
||||||
- GITEA_DB_BACKUP_TARGETFOLDER=${GITEA_DB_BACKUP_TARGETFOLDER}
|
|
||||||
volumes:
|
|
||||||
- duplicati-data:/data
|
|
||||||
- duplicati-data:/git/duplicati-data:ro
|
|
||||||
- data:/git/data:ro
|
|
||||||
- db:/git/db:ro
|
|
||||||
- db-dumps:/git/db-dumps
|
|
||||||
ports:
|
|
||||||
- 8202:8200
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
gitea_network:
|
|
||||||
volumes:
|
|
||||||
data:
|
|
||||||
db:
|
|
||||||
db-dumps:
|
|
||||||
duplicati-data:
|
|
||||||
networks:
|
|
||||||
macvlan:
|
|
||||||
external: true
|
|
||||||
name: macvlan_pub_net
|
|
||||||
gitea_network:
|
|
||||||
55
docker/docker-compose.yaml
Normal file
55
docker/docker-compose.yaml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
server:
|
||||||
|
image: gitea/gitea:1.17
|
||||||
|
container_name: gitea
|
||||||
|
environment:
|
||||||
|
- GITEA__database__DB_TYPE=mysql
|
||||||
|
- GITEA__database__HOST=db:3306
|
||||||
|
- GITEA__database__NAME=${DB_NAME}
|
||||||
|
- GITEA__database__USER=${DB_USER}
|
||||||
|
- GITEA__database__PASSWD=${DB_PASSWORD}
|
||||||
|
- DISABLE_SSH=true
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- data:/data
|
||||||
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
ports:
|
||||||
|
- ${HTTP_PORT}:3000
|
||||||
|
db:
|
||||||
|
image: mysql:8
|
||||||
|
container_name: gitea_db
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
|
||||||
|
- MYSQL_USER=${DB_USER}
|
||||||
|
- MYSQL_PASSWORD=${DB_PASSWORD}
|
||||||
|
- MYSQL_DATABASE=${DB_NAME}
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/mysql
|
||||||
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
duplicati:
|
||||||
|
container_name: gitea_duplicati
|
||||||
|
image: duplicati-sqlclient # requirement https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/sqlclient.dockerfile
|
||||||
|
environment:
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_NAME=${DB_NAME}
|
||||||
|
- DB_USER=${DB_USER}
|
||||||
|
- DB_PASSWORD=$DB_PASSWORD}
|
||||||
|
- DB_TARGETFOLDER=/git/db-dumps
|
||||||
|
volumes:
|
||||||
|
- duplicati-data:/data
|
||||||
|
- duplicati-data:/git/duplicati-data:ro
|
||||||
|
- data:/git/data:ro
|
||||||
|
- db:/git/db:ro
|
||||||
|
- db-dumps:/git/db-dumps
|
||||||
|
ports:
|
||||||
|
- 8200:8200
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
db:
|
||||||
|
db-dumps:
|
||||||
|
duplicati-data:
|
||||||
23
documentation/issue#8.md
Normal file
23
documentation/issue#8.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Feature - lxc migration
|
||||||
|
https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com/issues/8
|
||||||
|
|
||||||
|
## Development & Testing
|
||||||
|
|
||||||
|
- [x] Create LXC Container
|
||||||
|
- [ ] Restore Backup
|
||||||
|
- [ ] Validate Backup
|
||||||
|
- [ ] Recreate System from scripts
|
||||||
|
|
||||||
|
## Day 1
|
||||||
|
- [ ] Backup Current Production
|
||||||
|
- [ ] Stop Current Production
|
||||||
|
- [ ] Restore to new Production
|
||||||
|
- [ ] Change DNS Servers
|
||||||
|
- [ ] Check OK
|
||||||
|
- [ ] Production - Reativate Backup
|
||||||
|
- [ ] Production - Execute Backup
|
||||||
|
- [ ] Production - Check Backup
|
||||||
|
|
||||||
|
## Day 2
|
||||||
|
- [ ] Production - Check Daily Backup
|
||||||
|
- [ ] Delete Old Production
|
||||||
50
documentation/restore.md
Normal file
50
documentation/restore.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# Restore
|
||||||
|
|
||||||
|
[TOC]
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
- [Setup](setup.md)
|
||||||
|
- Stop all containers except duplicati
|
||||||
|
|
||||||
|
## Storage Restore
|
||||||
|
|
||||||
|
Duplicati web UI - Import backup job
|
||||||
|
note: disable schedules
|
||||||
|
|
||||||
|
### DB Engine is the same
|
||||||
|
|
||||||
|
Restore everything from backup to original folders
|
||||||
|
|
||||||
|
### DB Engine not the same
|
||||||
|
|
||||||
|
Restore everything except db_data folders (db_dumps must be included)
|
||||||
|
|
||||||
|
#### Restore Database
|
||||||
|
|
||||||
|
- Confirm if DB container is running (only db and duplicati should be running)
|
||||||
|
- Execute on duplicati bash (using portainer)
|
||||||
|
|
||||||
|
execute:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#check last files db-dumps
|
||||||
|
ls /git/db-dumps
|
||||||
|
#pick file to import (maybe the last one :))
|
||||||
|
```
|
||||||
|
|
||||||
|
import file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DB_FILE=filenametoimport
|
||||||
|
# by default duplicati container dont have de enviroment varible ${DB_ROOT_PASSWORD}
|
||||||
|
DB_ROOT_PASSWORD=youdbrootpassword
|
||||||
|
mysql -uroot -p'${DB_ROOT_PASSWORD}' ${DB_NAME} < /git/db-dumps/$DB_FILE
|
||||||
|
```
|
||||||
|
|
||||||
|
3) start all stop containers and check everyting is ok
|
||||||
|
4) Execute backup on duplicati
|
||||||
|
5) Check backup is restorable
|
||||||
|
6) Re Enable schedule backups on duplication
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
33
documentation/setup-lxc.md
Normal file
33
documentation/setup-lxc.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# LXD
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
set variables required for setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
LXC_CONTAINER_NAME=samplename
|
||||||
|
```
|
||||||
|
|
||||||
|
then execute
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## Create ubuntu container
|
||||||
|
lxc launch ubuntu $LXC_CONTAINER_NAME
|
||||||
|
|
||||||
|
## Setup container for docker
|
||||||
|
curl -s "https://git.limbosolutions.com/kb/lxc/raw/branch/main/scripts/lxc-config-docker-requirements.sh" | bash -s $LXC_CONTAINER_NAME
|
||||||
|
|
||||||
|
|
||||||
|
## update ubuntu container
|
||||||
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "apt update -y && apt upgrade -y"
|
||||||
|
|
||||||
|
## Install fuse and docker on lxc container
|
||||||
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/docker/raw/branch/main/scripts/ubuntu-fuse-setup.sh\" | bash"
|
||||||
|
|
||||||
|
#install Portainer
|
||||||
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash"
|
||||||
|
|
||||||
|
#confirm container ip address
|
||||||
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a"
|
||||||
|
|
||||||
|
```
|
||||||
39
documentation/setup.md
Normal file
39
documentation/setup.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Setup
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
_Currently hosted on an ubuntu lxc container with docker and portainer [+ information](setup-lxc.md)._
|
||||||
|
|
||||||
|
## /Services (Stacks)
|
||||||
|
|
||||||
|
### Gitea
|
||||||
|
|
||||||
|
[Docker Compose](../docker/docker-compose.yaml)
|
||||||
|
|
||||||
|
### Duplicati
|
||||||
|
|
||||||
|
- [Docker File](https://git.limbosolutions.com/kb/duplicati/docker/sqlclient.dockerfile)
|
||||||
|
- [Docker Compose](../docker/docker-compose.yaml)
|
||||||
|
|
||||||
|
### Restore
|
||||||
|
|
||||||
|
1) Execute Setup process
|
||||||
|
1) Check Every Container is ok and running
|
||||||
|
1) Stop Every Container (including portainer, if restoring portainer is a requirement) except duplicati
|
||||||
|
1) Enter Duplicati
|
||||||
|
1) Import Backjob (if possible, if not possible next steps must be adapted)
|
||||||
|
- All Imported jobs schedules must be disabled (or disable write permissions on backup host)
|
||||||
|
1) Restore all files to original location
|
||||||
|
- If database engine is diferent do not restore db_data and check restore database before next steps
|
||||||
|
1) Start Container and check if everything is ok
|
||||||
|
|
||||||
|
#### Database
|
||||||
|
|
||||||
|
Only required of database data files not recovarable (example: diferent database engine from backup)
|
||||||
|
|
||||||
|
1) Start Portainer container (if stopped in restore process)
|
||||||
|
2) Start Database container (if stopped in restore process)
|
||||||
|
3) Enter duplicati bash (by using portainer)
|
||||||
|
4) Execute Command
|
||||||
23
scripts/setup-lxc.sh
Normal file
23
scripts/setup-lxc.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## Create a container
|
||||||
|
lxc launch ubuntu $LXC_CONTAINER_NAME -p $LXC_PROFILE && \
|
||||||
|
|
||||||
|
## Setup container for docker
|
||||||
|
curl - "https://git.limbosolutions.com/kb/lxc/raw/branch/main/scripts/lxc-config-docker-requirements.sh" | bash $LXC_CONTAINER_NAME
|
||||||
|
|
||||||
|
|
||||||
|
## update container
|
||||||
|
lxc exec $LXC_CONTAINER_NAME bash -c "apt update -y && apt upgrade -y"
|
||||||
|
|
||||||
|
## Install docker on lxc container
|
||||||
|
lxc exec $LXC_CONTAINER_NAME bash -c "curl -s \"https://git.limbosolutions.com/kb/docker/raw/branch/main/scripts/ubuntu-fuse-setup.sh\" | bash "
|
||||||
|
|
||||||
|
#install Portainer
|
||||||
|
lxc exec $LXC_CONTAINER_NAME bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
3
scripts/setup.sh
Normal file
3
scripts/setup.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
chmod +x ./setup-lxc.sh
|
||||||
|
./setup-lxc.sh
|
||||||
4
scripts/web-setup.sh
Normal file
4
scripts/web-setup.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
git clone https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com
|
||||||
|
chmod +x ./git.limbosolutions.com/scripts/setup.sh
|
||||||
|
./git.limbosolutions.com/scripts/setup.sh
|
||||||
Reference in New Issue
Block a user