Compare commits

...

2 Commits

Author SHA1 Message Date
17b4417a0a . 2022-10-09 18:12:20 +01:00
5edf0b7cb2 . 2022-10-09 18:11:35 +01:00
4 changed files with 49 additions and 23 deletions

View File

@@ -1,13 +1,13 @@
version: "3" version: "3"
services: services:
duplicati: duplicati:
image: duplicati-sqlclient # requirement https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/sqlclient.dockerfile image: duplicati-mysqlclient
environment: environment:
- DB_HOST=db - MYSQL_HOST=db
- DB_NAME=${DB_NAME} - MYSQL_DATABASE=${DB_NAME}
- DB_USER=${DB_USER} - MYSQL_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD} - MYSQL_PASSWORD=${DB_PASSWORD}
- DB_TARGETFOLDER=/git/db-dumps - DESTINATION=/git/db-dumps
volumes: volumes:
- duplicati-data:/data - duplicati-data:/data
- duplicati-data:/git/duplicati-data:ro - duplicati-data:/git/duplicati-data:ro
@@ -15,16 +15,16 @@ services:
- db:/git/db:ro - db:/git/db:ro
- db-dumps:/git/db-dumps - db-dumps:/git/db-dumps
ports: ports:
- 8200:8200 - ${DUPLICATI_PORT}:8200
restart: unless-stopped restart: unless-stopped
volumes: volumes:
duplicati-data: duplicati-data:
data: data:
name: ${GITEA_APP_VOLUMES_DATA_NAME} name: ${GITEA_APP_DATA_VOLUME_NAME}
db: db:
name: ${GITEA_DB_VOLUMES_DATA_NAME} name: ${GITEA_DB_DATA_VOLUME_NAME}
db-dumps: db-dumps:
name: ${GITEA_DB_VOLUMES_DB-DUMPS_NAME} name: ${GITEA_DB_DUMPS_VOLUME_NAME}
networks: networks:
gitea: gitea:
name: ${DEFAULT_NETWORK_NAME} name: ${DEFAULT_NETWORK_NAME}

View File

@@ -15,7 +15,7 @@ services:
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
ports: ports:
- ${APP_PORT}:80 - ${GITEA_PORT}:80
networks: networks:
- gitea - gitea
db: db:
@@ -35,11 +35,11 @@ services:
- gitea - gitea
volumes: volumes:
data: data:
name: ${GITEA_APP_DATA-VOLUME_NAME} name: ${GITEA_APP_DATA_VOLUME_NAME}
db: db:
name: ${GITEA_DB_DATA_VOLUME_NAME} name: ${GITEA_DB_DATA_VOLUME_NAME}
db-dumps: db-dumps:
name: ${GITEA_DB-DUMPS_VOLUME_NAME} name: ${GITEA_DB_DUMPS_VOLUME_NAME}
networks: networks:
gitea: gitea:
name: ${DEFAULT_NETWORK_NAME} name: ${DEFAULT_NETWORK_NAME}

View File

@@ -35,12 +35,14 @@ lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.co
## Check docker for fusefs ## Check docker for fusefs
lxc exec $LXC_CONTAINER_NAME -- bash -c "docker info" lxc exec $LXC_CONTAINER_NAME -- bash -c "docker info"
#install Portainer #Setup 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"
#confirm container ip address #confirm container ip address
lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a" lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a"
lxc restart $LXC_CONTAINER_NAME
``` ```
### Check instalation ### Check instalation
@@ -48,10 +50,10 @@ lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a"
From other computer From other computer
```bash ```bash
ping http://$LXC_CONTAINER_NAME:9000 ping $LXC_CONTAINER_NAME
``` ```
Access portainer (http://$LXC_CONTAINER_NAME:9000_) for inicial setup: Access portainer (https://$LXC_CONTAINER_NAME:9443/) for inicial setup:
- Setup administration username and password - Setup administration username and password
@@ -60,3 +62,26 @@ Access portainer (http://$LXC_CONTAINER_NAME:9000_) for inicial setup:
```bash ```bash
lxc rm $LXC_CONTAINER_NAME --force lxc rm $LXC_CONTAINER_NAME --force
``` ```
## set a static ip
On lxc container
``` bash
Example:
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
addresses:
- 192.168.121.221/24
gateway4: 192.168.121.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
``` bash

View File

@@ -14,7 +14,7 @@ _Currently hosted on an ubuntu lxc container with docker and portainer [+ inform
### Services (Stacks) ### Services (Stacks)
If portainer installed use portainer (http://githost:9000) to setup/manage services If portainer installed use portainer (https://githost:9443) to setup/manage services
Required environment variables (.env): Required environment variables (.env):
@@ -45,7 +45,7 @@ DUPLICATI_PORT=8200
Requirements: Requirements:
- [Duplicati Image with mySql client](https://git.limbosolutions.com/kb/duplicati/docker/sqlclient/README.md) - [Duplicati Image with mySql client](https://git.limbosolutions.com/kb/duplicati/src/branch/main/docker/mysqlclient/README.md)
_[Docker Compose File](../docker/dupliticati-docker-compose.yaml)_ _[Docker Compose File](../docker/dupliticati-docker-compose.yaml)_
@@ -67,15 +67,13 @@ After starting stack:
1) Check every Container is ok and running 1) Check every Container is ok and running
1) Stop every Container except duplicati and portainer 1) Stop every Container except duplicati and portainer
_note: restore of portainer/duplicati not tested_ _note: restore of portainer/duplicati not tested_
1) Enter Duplicati (http://githost:8200) 1) Enter Duplicati (http://hostip:8200)
1) Import Backup job (if not possible next steps must be adapted) 1) Import Backup job (if not possible next steps must be adapted)
- Restore with permissions checked - Restore with permissions checked
- 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)
- (step not required after this migration) Remove references to scripts (example:run-script-before-required, /data/myScripts/backupdb.sh)
1) Recreate duplicati local database (home-> backup-> advanced-> database-> Recreate (delete and repair)) 1) Recreate duplicati local database (home-> backup-> advanced-> database-> Recreate (delete and repair))
1) Restore all files to original location 1) Restore all files (except portainer and duplicati data) 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**with this processs because duplicati is running!
- From duplicati only restore custom scripts (duplicati-data/myScripts), dot not restore full duplicati with this processs because duplicati is running!
1) Recreate stack gitea _[Docker Compose](../docker/docker-compose.yaml)_ with original read only restrictions on duplicati volumes 1) Recreate stack gitea _[Docker Compose](../docker/docker-compose.yaml)_ with original read only restrictions on duplicati volumes
1) Confirm everything is ok and running 1) Confirm everything is ok and running
1) Return to duplicati on schedule job add script to run-script-before-required /data/myScripts/backupdb.sh 1) Return to duplicati on schedule job add script to run-script-before-required /data/myScripts/backupdb.sh
@@ -101,3 +99,6 @@ mysql --host db -uroot -p ${MYSQL_DATABASE} < /db-dumps/$DB_FILE
#enter root password (root password is in enviromnent variable ${MYSQL_ROOT_PASSWORD}) #enter root password (root password is in enviromnent variable ${MYSQL_ROOT_PASSWORD})
``` ```