Compare commits

...

22 Commits

Author SHA1 Message Date
82a5971502 . 2022-10-05 23:21:51 +01:00
657b305eef . 2022-10-05 15:12:15 +01:00
f79da09e97 . 2022-10-05 14:58:29 +01:00
3459ef7101 . 2022-10-05 14:34:40 +01:00
370d409851 . 2022-10-05 14:06:46 +01:00
2f66c0cd94 . 2022-10-05 14:02:39 +01:00
c872f7c6cb Update 'documentation/issue#8.md' 2022-10-05 13:18:18 +01:00
dd36b2b5ba Add 'documentation/issue#8.md' 2022-10-05 13:15:06 +01:00
b57e15b7d6 . 2022-10-05 11:39:37 +01:00
88d8ace2e8 Merge branch 'feature/#8-lxc' of https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com into feature/#8-lxc 2022-10-04 00:56:07 +01:00
2bfc501395 . 2022-10-04 00:49:19 +01:00
9eb54fc4ca Update 'documentation/setup.md' 2022-10-01 17:11:02 +01:00
fffb6ddfa4 Update 'documentation/restore.md' 2022-10-01 17:02:45 +01:00
d45a9c8d03 Update 'documentation/restore.md' 2022-10-01 17:01:08 +01:00
dbf874fd7f Update 'documentation/restore.md' 2022-10-01 16:59:33 +01:00
874b2705ce Update 'documentation/restore.md' 2022-10-01 16:58:58 +01:00
5f28f2ef8a Update 'documentation/restore.md' 2022-10-01 16:55:06 +01:00
5513b14587 Update 'documentation/restore.md' 2022-10-01 16:52:16 +01:00
0e7c34489c Update 'documentation/restore.md' 2022-10-01 16:51:17 +01:00
10f7cf88d2 Update 'documentation/restore.md' 2022-10-01 16:37:11 +01:00
8628a12ec5 Add 'documentation/restore.md' 2022-10-01 16:31:22 +01:00
dbe6acbf0e under development 2022-10-01 15:40:00 +01:00
12 changed files with 237 additions and 91 deletions

7
.gitignore vendored
View File

@@ -1,4 +1,3 @@
**.env
_volumes
_volumes
.vscode
*.local/*
*.env
*.env.d/*

View File

@@ -1,10 +1,11 @@
# git.limbosolutions.com
* Arquitectura : armv7
* docker
[compose file](docker/docker-compose.armv7.yaml)
## Setup
## Backup and Restore Strategy
Duplicati
(more info required)
for more information check /documentation/setup.md
## Backup Strategy
Duplicati running on docker.

View File

@@ -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"

View File

@@ -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:

View 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
View 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
View 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

View File

@@ -0,0 +1,29 @@
# 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 - "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 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 "
```

39
documentation/setup.md Normal file
View 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
View 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
View File

@@ -0,0 +1,3 @@
#!/bin/bash
chmod +x ./setup-lxc.sh
./setup-lxc.sh

4
scripts/web-setup.sh Normal file
View 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