.
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
server:
|
app:
|
||||||
image: gitea/gitea:1.17
|
image: gitea/gitea:1.17
|
||||||
container_name: gitea
|
|
||||||
environment:
|
environment:
|
||||||
- GITEA__database__DB_TYPE=mysql
|
- GITEA__database__DB_TYPE=mysql
|
||||||
- GITEA__database__HOST=db:3306
|
- GITEA__database__HOST=db:3306
|
||||||
@@ -19,7 +18,6 @@ services:
|
|||||||
- ${HTTP_PORT}:3000
|
- ${HTTP_PORT}:3000
|
||||||
db:
|
db:
|
||||||
image: mysql:8
|
image: mysql:8
|
||||||
container_name: gitea_db
|
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
|
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
|
||||||
@@ -31,7 +29,6 @@ services:
|
|||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
duplicati:
|
duplicati:
|
||||||
container_name: gitea_duplicati
|
|
||||||
image: duplicati-sqlclient # requirement https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/sqlclient.dockerfile
|
image: duplicati-sqlclient # requirement https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/sqlclient.dockerfile
|
||||||
environment:
|
environment:
|
||||||
- DB_HOST=db
|
- DB_HOST=db
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
# Feature - lxc migration
|
# Feature - Migrate to LXC container
|
||||||
https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com/issues/8
|
|
||||||
|
_[Issue 8](https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com/issues/8)_
|
||||||
|
|
||||||
## Development & Testing
|
## Development & Testing
|
||||||
|
|
||||||
- [x] Create LXC Container
|
- [x] Create LXC Container
|
||||||
|
- [x] Documentation Scripts for Setup
|
||||||
|
- [x] Scripts for Setup
|
||||||
- [ ] Restore Backup
|
- [ ] Restore Backup
|
||||||
|
- [ ] Documentation for backup and restore
|
||||||
- [ ] Validate Backup
|
- [ ] Validate Backup
|
||||||
- [ ] Recreate System from scripts
|
- [x] Recreate System from scripts
|
||||||
|
|
||||||
## Day 1
|
## Day 1
|
||||||
|
|
||||||
- [ ] Backup Current Production
|
- [ ] Backup Current Production
|
||||||
- [ ] Stop Current Production
|
- [ ] Stop Current Production
|
||||||
- [ ] Restore to new Production
|
- [ ] Restore to new Production
|
||||||
@@ -19,5 +24,6 @@ https://git.limbosolutions.com/limbosolutions.com/git.limbosolutions.com/issues/
|
|||||||
- [ ] Production - Check Backup
|
- [ ] Production - Check Backup
|
||||||
|
|
||||||
## Day 2
|
## Day 2
|
||||||
|
|
||||||
- [ ] Production - Check Daily Backup
|
- [ ] Production - Check Daily Backup
|
||||||
- [ ] Delete Old Production
|
- [ ] Delete Old Production
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,18 +1,26 @@
|
|||||||
# LXD
|
# LXC Setup
|
||||||
|
|
||||||
## Setup
|
## Install
|
||||||
|
|
||||||
set variables required for setup
|
### Requirements
|
||||||
|
|
||||||
|
- Currently hosted using macvlan network
|
||||||
|
- Instructions are provided for $LXC_PROFILE defined as macvlan
|
||||||
|
_For more information how to setup a lxc profile with macvlan network https://git.limbosolutions.com/kb/lxc_
|
||||||
|
|
||||||
|
|
||||||
|
Replace and execute on bash
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
LXC_CONTAINER_NAME=samplename
|
LXC_CONTAINER_NAME=gitsrv01
|
||||||
|
LXC_PROFILE=default
|
||||||
```
|
```
|
||||||
|
|
||||||
then execute
|
then execute
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## Create ubuntu container
|
## Create ubuntu container
|
||||||
lxc launch ubuntu $LXC_CONTAINER_NAME
|
lxc launch ubuntu $LXC_CONTAINER_NAME -p $LXC_PROFILE
|
||||||
|
|
||||||
## Setup container for docker
|
## 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
|
curl -s "https://git.limbosolutions.com/kb/lxc/raw/branch/main/scripts/lxc-config-docker-requirements.sh" | bash -s $LXC_CONTAINER_NAME
|
||||||
@@ -24,6 +32,9 @@ lxc exec $LXC_CONTAINER_NAME -- bash -c "apt update -y && apt upgrade -y"
|
|||||||
## Install fuse and docker on lxc container
|
## 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"
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/docker/raw/branch/main/scripts/ubuntu-fuse-setup.sh\" | bash"
|
||||||
|
|
||||||
|
## Check docker for fusefs
|
||||||
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "docker info"
|
||||||
|
|
||||||
#install Portainer
|
#install Portainer
|
||||||
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash"
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash"
|
||||||
|
|
||||||
@@ -31,3 +42,21 @@ lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.co
|
|||||||
lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a"
|
lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Check instalation
|
||||||
|
|
||||||
|
From other computer
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ping http://$LXC_CONTAINER_NAME:9000
|
||||||
|
```
|
||||||
|
|
||||||
|
Access portainer (http://$LXC_CONTAINER_NAME:9000_) for inicial setup:
|
||||||
|
|
||||||
|
- Setup administration username and password
|
||||||
|
|
||||||
|
## Remove
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc rm $LXC_CONTAINER_NAME --force
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,35 +1,40 @@
|
|||||||
# Setup
|
# Setup
|
||||||
|
|
||||||
## Requirements
|
## Install
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
- Docker
|
- Docker
|
||||||
|
|
||||||
_Currently hosted on an ubuntu lxc container with docker and portainer [+ information](setup-lxc.md)._
|
_Currently hosted on an ubuntu lxc container with docker and portainer [+ information](setup-lxc.md)._
|
||||||
|
|
||||||
## /Services (Stacks)
|
### Services (Stacks)
|
||||||
|
|
||||||
### Gitea
|
If portainer installed use portainer (default https//host:9000) to setup/manage services
|
||||||
|
|
||||||
[Docker Compose](../docker/docker-compose.yaml)
|
#### Gitea
|
||||||
|
|
||||||
### Duplicati
|
- Stack Name: gitea
|
||||||
|
_[Docker Compose](../docker/docker-compose.yaml)_
|
||||||
|
|
||||||
- [Docker File](https://git.limbosolutions.com/kb/duplicati/docker/sqlclient.dockerfile)
|
|
||||||
- [Docker Compose](../docker/docker-compose.yaml)
|
|
||||||
|
|
||||||
### Restore
|
## Restore
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
- Host setup with docker and portainer ./setup.md
|
||||||
|
|
||||||
|
|
||||||
1) Execute Setup process
|
|
||||||
1) Check Every Container is ok and running
|
1) Check Every Container is ok and running
|
||||||
1) Stop Every Container (including portainer, if restoring portainer is a requirement) except duplicati
|
2) Stop Every Container except duplicati (including portainer, if restoring portainer is a requirement)
|
||||||
1) Enter Duplicati
|
_note: restore portainer not tested_
|
||||||
1) Import Backjob (if possible, if not possible next steps must be adapted)
|
3) Enter Duplicati
|
||||||
|
4) Import Backup job (if not possible next steps must be adapted)
|
||||||
- All Imported jobs schedules must be disabled (or disable write permissions on backup host)
|
- All Imported jobs schedules must be disabled (or disable write permissions on backup host)
|
||||||
1) Restore all files to original location
|
5) Restore all files to original location
|
||||||
- If database engine is diferent do not restore db_data and check restore database before next steps
|
- 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
|
6) Start Containers and check if everything is ok
|
||||||
|
|
||||||
#### Database
|
### Database
|
||||||
|
|
||||||
Only required of database data files not recovarable (example: diferent database engine from backup)
|
Only required of database data files not recovarable (example: diferent database engine from backup)
|
||||||
|
|
||||||
@@ -37,3 +42,29 @@ Only required of database data files not recovarable (example: diferent database
|
|||||||
2) Start Database container (if stopped in restore process)
|
2) Start Database container (if stopped in restore process)
|
||||||
3) Enter duplicati bash (by using portainer)
|
3) Enter duplicati bash (by using portainer)
|
||||||
4) Execute Command
|
4) Execute Command
|
||||||
|
|
||||||
|
````bash
|
||||||
|
|
||||||
|
```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
|
||||||
Reference in New Issue
Block a user