diff --git a/bitwarden_rs/readme.md b/bitwarden_rs/readme.md index 8a96568..3be1cfd 100644 --- a/bitwarden_rs/readme.md +++ b/bitwarden_rs/readme.md @@ -99,7 +99,7 @@ SMTP_FROM=admin@blabla.org ``` **All containers must be on the same network**.
-If one does not exists yet: `docker network create caddy_net` +If one does not exist yet: `docker network create caddy_net` # Reverse proxy @@ -162,32 +162,36 @@ So you better manually sync before making changes. # Update - * [watchtower](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/watchtower) updates the image automaticly +* [watchtower](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/watchtower) updates the image automaticly - * manual image update
- `docker-compose pull`
- `docker-compose up -d`
- `docker image prune` +* manual image update
+ `docker-compose pull`
+ `docker-compose up -d`
+ `docker image prune` # Backup and restore - * **backup** using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) - that makes daily snapshot of the entire directory - - * **restore**
- down the bitwarden container `docker-compose down`
- delete the entire bitwarden directory
- from the backup copy back the bitwarden directortory
- start the container `docker-compose up -d` +#### Backup + +Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) +that makes daily snapshot of the entire directory. + +#### Restore + +* down the bitwarden container `docker-compose down`
+* delete the entire bitwarden directory
+* from the backup copy back the bitwarden directory
+* start the container `docker-compose up -d` # Backup of just user data -Users data daily export using the [official procedure.](https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault)
+Users data daily export using the +[official procedure.](https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault)
For bitwarden_rs it means sqlite database dump and backing up `attachments` directory.
Daily [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) run takes care of backing up the directory. -So only database dump is needed. +So only database dump is needed.
The created backup sqlite3 file is overwritten on every run of the script, but that's ok since borg is making daily snapshots. @@ -196,7 +200,7 @@ but that's ok since borg is making daily snapshots. Placed inside `bitwarden` directory on the host. `bitwarden-backup-script.sh` -``` +```bash #!/bin/bash # CREATE SQLITE BACKUP @@ -224,6 +228,8 @@ Assuming clean start. * down the container `docker-compose down` * in `bitwarden/bitwarden-data/`
replace `db.sqlite3` with the backup one `BACKUP.bitwarden.db.sqlite3`
- replace `attachments` directory with the one from the BorgBackup repository + replace `attachments` directory with the one from the borg repository * start the container `docker-compose up -d` +Again, the above steps are based on the +[official procedure.](https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault) diff --git a/bookstack/readme.md b/bookstack/readme.md index df62c66..f14da6b 100644 --- a/bookstack/readme.md +++ b/bookstack/readme.md @@ -13,10 +13,10 @@ Documentation and notes. * [DockerHub](https://hub.docker.com/r/linuxserver/bookstack) BookStack is a modern, open source, good looking wiki platform -for storing and organising information and documentation. +for storing and organizing information and documentation. -Writen in PHP, with MySQL storing the user data.
-There is no official Dockerhub image so the one mainted by +Written in PHP, with MySQL database for the user data.
+There is no official Dockerhub image so the one maintained by [linuxserver.io](https://www.linuxserver.io/) is used, which uses nginx as a web server. @@ -34,6 +34,15 @@ which uses nginx as a web server. └── bookstack-backup-script.sh ``` +* `bookstack-data/` - a directory where bookstack will store its web app data +* `bookstack-db-data/` - a directory where bookstack will store its MySQL database data +* `.env` - a file containing environmental variables for docker compose +* `docker-compose.yml` - a docker compose file, telling docker how to build bookstack container +* `bookstack-backup-script.sh` - a backup script if you want it + +You only need to provide the files.
+The directories are created by docker compose on the first run. + # docker-compose Dockerhub linuxserver/bookstack @@ -134,61 +143,74 @@ book.{$MY_DOMAIN} { # Backup and restore - * **backup** using [BorgBackup setup](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) - that makes daily snapshot of the entire directory - - * **restore**
- down the bookstack containers `docker-compose down`
- delete the entire bookstack directory
- from the backup copy back the bookstack directortory
- start the container `docker-compose up -d` +#### Backup + +Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) +that makes daily snapshot of the entire directory. + +#### Restore + +* down the bookstack containers `docker-compose down`
+* delete the entire bookstack directory
+* from the backup copy back the bookstack directory
+* start the containers `docker-compose up -d` # Backup of just user data -Users data daily export using the [official procedure.](https://www.bookstackapp.com/docs/admin/backup-restore/)
+Users data daily export using the +[official procedure.](https://www.bookstackapp.com/docs/admin/backup-restore/)
For bookstack it means database dump and backing up several directories containing user uploaded files. -Daily run of [BorgBackup](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) +Daily [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) run takes care of backing up the directories. -So only database dump is needed. -The created database backup sql file is overwriten on every run of the script, -but that's ok since BorgBackup is making daily snapshots. +So only database dump is needed.
+The created backup sqlite3 file is overwritten on every run of the script, +but that's ok since borg is making daily snapshots. + +#### Create a backup script -* **create a backup script**
- placed inside `bookstack` directory on the host +Placed inside `bookstack` directory on the host + +`bookstack-backup-script.sh` +```bash +#!/bin/bash + +# CREATE DATABASE DUMP, bash -c '...' IS USED OTHERWISE OUTPUT > WOULD TRY TO GO TO THE HOST +docker container exec bookstack-db bash -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > $MYSQL_DIR/BACKUP.bookstack.database.sql' +``` - `bookstack-backup-script.sh` - ```bash - #!/bin/bash +the script must be **executable** - `chmod +x bookstack-backup-script.sh` - # CREATE DATABASE DUMP, bash -c '...' IS USED OTHERWISE OUTPUT > WOULD TRY TO GO TO THE HOST - docker container exec bookstack-db bash -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > $MYSQL_DIR/BACKUP.bookstack.database.sql' - ``` +#### Cronjob - the script must be **executabe** - `chmod +x bookstack-backup-script.sh` +Running on the host, so that the script will be periodically run. -* **cronjob** on the host
- `crontab -e` - add new cron job
- `0 2 * * * /home/bastard/docker/bookstack/bookstack-backup-script.sh` - run it [at 02:00](https://crontab.guru/#0_2_*_*_*)
- `crontab -l` - list cronjobs +* `su` - switch to root +* `crontab -e` - add new cron job
+* `0 22 * * * /home/bastard/docker/bookstack/bookstack-backup-script.sh`
+ runs it every day [at 22:00](https://crontab.guru/#0_22_*_*_*) +* `crontab -l` - list cronjobs to check # Restore the user data - Assuming clean start, first restore the database before running the app container. - - * start only the database container: `docker-compose up -d bookstack-db` - * copy `BACKUP.bookstack.database.sql` in `bookstack/bookstack-db-data/` - * restore the database inside the container
- `docker container exec --workdir /config bookstack-db bash -c 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < BACKUP.bookstack.database.sql'` - * now start the app container: `docker-compose up -d` - * let it run so it creates its file structure - * down the containers `docker-compose down` - * in `bookstack/bookstack-data/www/`
- replace directories `files`,`images`,`uploads` and the file `.env`
- with the ones from the BorgBackup repository - * start the containers: `docker-compose up -d` - * if there was a major version jump, exec in to the app container and run `php artisan migrate`
- `docker container exec -it bookstack /bin/bash`
- `cd /var/www/html/`
- `php artisan migrate` +Assuming clean start, first restore the database before running the app container. + +* start only the database container: `docker-compose up -d bookstack-db` +* copy `BACKUP.bookstack.database.sql` in `bookstack/bookstack-db-data/` +* restore the database inside the container
+ `docker container exec --workdir /config bookstack-db bash -c 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < BACKUP.bookstack.database.sql'` +* now start the app container: `docker-compose up -d` +* let it run so it creates its file structure +* down the containers `docker-compose down` +* in `bookstack/bookstack-data/www/`
+ replace directories `files`,`images`,`uploads` and the file `.env`
+ with the ones from the BorgBackup repository +* start the containers: `docker-compose up -d` +* if there was a major version jump, exec in to the app container and run `php artisan migrate`
+ `docker container exec -it bookstack /bin/bash`
+ `cd /var/www/html/`
+ `php artisan migrate` + +Again, the above steps are based on the +[official procedure.](https://www.bookstackapp.com/docs/admin/backup-restore/)