diff --git a/bitwarden_rs/readme.md b/bitwarden_rs/readme.md index a97ed07..e05707e 100644 --- a/bitwarden_rs/readme.md +++ b/bitwarden_rs/readme.md @@ -10,7 +10,7 @@ Password manager. RS version is simpler and lighter than the official bitwarden. * [Official site](https://bitwarden.com/) * [Github](https://github.com/dani-garcia/bitwarden_rs) -* [DockerHub image used](https://hub.docker.com/r/bitwardenrs/server) +* [DockerHub](https://hub.docker.com/r/bitwardenrs/server) ### Files and directory structure @@ -19,7 +19,6 @@ Password manager. RS version is simpler and lighter than the official bitwarden. └── ~ └── docker └── bitwarden - ├── 🗁 bitwarden-backup ├── 🗁 bitwarden-data ├── 🗋 .env ├── 🗋 docker-compose.yml @@ -72,10 +71,10 @@ Password manager. RS version is simpler and lighter than the official bitwarden. # BITWARDEN ADMIN_TOKEN=YdLo1TM4MYEQ948GOVZ29IF4fABSrZMpk9 - DOMAIN=https://passwd.blabla.org SIGNUPS_ALLOWED=true # USING SENDGRID FOR SENDING EMAILS + DOMAIN=https://passwd.blabla.org SMTP_SSL=true SMTP_EXPLICIT_TLS=true SMTP_HOST=smtp.sendgrid.net @@ -110,13 +109,13 @@ Password manager. RS version is simpler and lighter than the official bitwarden. ### Extra info - * **bitwarden can be managed** at `passwd.blabla.org/admin` and entering `ADMIN_TOKEN` set in the `.env` file + * **bitwarden can be managed** at `/admin` and entering `ADMIN_TOKEN` set in the `.env` file ![interface-pic](https://i.imgur.com/5LxEUsA.png) ### Update - * [watchtower](https://github.com/DoTheEvo/docker-selfhosted-projects/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`
@@ -125,8 +124,8 @@ Password manager. RS version is simpler and lighter than the official bitwarden. ### Backup and restore - * **backup** using [borgbackup setup](https://github.com/DoTheEvo/docker-selfhosted-projects/tree/master/borg_backup) - that makes daily backup of the entire directory + * **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 bitwarden container `docker-compose down`
@@ -136,35 +135,27 @@ Password manager. RS version is simpler and lighter than the official bitwarden. ### Backup of just user data -For additional peace of mind. -Having user-data daily exported 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 the content of the `attachments` folder. -The backup files are overwriten on every run of the script, -but borg backup is backing the entire directory in to snapshots daily, so no need for some keeping-last-X consideration. +For additional peace of mind, +user-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. +The created backup files are overwriten on every run of the script, +but borg backup is daily making snapshot of the entire directory. -* **install sqlite on the host system** - -* **create backup script**
+* **create a backup script**
placed inside `bitwarden` directory on the host - `make_bitwarden_backup.sh` + `bitwarden-backup-script.sh` ``` - #!/bin/sh - - # GO IN TO THE DIRECTORY WHERE THIS SCRIPT RESIDES - cd "${0%/*}" - - # CREATE BACKUP DIRECTORY IF IT DOES NOT EXIST - mkdir -p ./bitwarden-backup + #!/bin/bash # CREATE SQLITE BACKUP - sqlite3 ./bitwarden-data/db.sqlite3 ".backup './bitwarden-BACKUP.db.sqlite3'" + docker container exec bitwarden sqlite3 /data/db.sqlite3 ".backup '/data/BACKUP.bitwarden.db.sqlite3'" # BACKUP ATTACHMENTS - tar -czvf ./bitwarden-backup/attachments.tar.gz ./bitwarden-data/attachments + docker container exec bitwarden tar -czPf /data/BACKUP.attachments.tar.gz /data/attachments ``` - the script must be executabe - `chmod +x make_bitwarden_backup.sh` + the script must be executabe - `chmod +x bitwarden-backup-script.sh` * **cronjob** on the host
`crontab -e` - add new cron job
@@ -173,8 +164,13 @@ but borg backup is backing the entire directory in to snapshots daily, so no nee ### Restore the user data - - down the container `docker-compose down`
- - replace `db.sqlite3` with the one from the backup - - replace attachments folder with the one from the backup - - start the container `docker-compose up -d` + Assuming clean start. + + * start the bitwarden container: `docker-compose up -d` + * let it run so it creates its file structure + * down the container `docker-compose down` + * in `bitwarden/bitwarden-data/`
+ replace `db.sqlite3` with the one from the backup `BACKUP.bitwarden.db.sqlite3`
+ replace `attachments` directory with the one from the archive `BACKUP.attachments.tar.gz` + * start the container `docker-compose up -d` diff --git a/bookstack/readme.md b/bookstack/readme.md index 8d940ef..62b1a51 100644 --- a/bookstack/readme.md +++ b/bookstack/readme.md @@ -36,11 +36,28 @@ Documentation and notes. version: "2" services: + bookstack_db: + image: linuxserver/mariadb + container_name: bookstack_db + hostname: bookstack_db + environment: + - TZ + - PUID + - PGID + - MYSQL_ROOT_PASSWORD + - MYSQL_DATABASE + - MYSQL_USER + - MYSQL_PASSWORD + volumes: + - ./bookstack-data-db:/config + restart: unless-stopped + bookstack: image: linuxserver/bookstack container_name: bookstack hostname: bookstack environment: + - TZ - PUID - PGID - DB_HOST @@ -48,28 +65,19 @@ Documentation and notes. - DB_PASS - DB_DATABASE - APP_URL + - MAIL_DRIVER + - MAIL_HOST + - MAIL_PORT + - MAIL_FROM + - MAIL_USERNAME + - MAIL_PASSWORD + - MAIL_ENCRYPTION volumes: - ./bookstack-data:/config restart: unless-stopped depends_on: - bookstack_db - bookstack_db: - image: linuxserver/mariadb - container_name: bookstack_db - hostname: bookstack_db - environment: - - PUID - - PGID - - MYSQL_ROOT_PASSWORD - - TZ - - MYSQL_DATABASE - - MYSQL_USER - - MYSQL_PASSWORD - volumes: - - ./bookstack-data-db:/config - restart: unless-stopped - networks: default: external: @@ -84,22 +92,31 @@ Documentation and notes. DEFAULT_NETWORK=caddy_net TZ=Europe/Prague + # BOOKSTACK-MARIADB + PUID=1000 + PGID=1000 + MYSQL_ROOT_PASSWORD=bookstack + MYSQL_DATABASE=bookstack + MYSQL_USER=bookstack + MYSQL_PASSWORD=bookstack + # BOOKSTACK PUID=1000 PGID=1000 DB_HOST=bookstack_db DB_USER=bookstack DB_PASS=bookstack - DB_DATABASE=bookstackapp - APP_URL=https://book.blabla.org + DB_DATABASE=bookstack - # BOOKSTACK-MARIADB - PUID=1000 - PGID=1000 - MYSQL_ROOT_PASSWORD=bookstack - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=bookstack + # USING SENDGRID FOR SENDING EMAILS + APP_URL=https://book.blabla.org + MAIL_DRIVER=smtp + MAIL_HOST=smtp.sendgrid.net + MAIL_PORT=465 + MAIL_FROM=book@blabla.org + MAIL_USERNAME=apikey + MAIL_PASSWORD=SG.2FA24asaddasdasdasdsadasdasdassadDEMBzuh9e43 + MAIL_ENCRYPTION=SSL ``` ### Reverse proxy @@ -134,7 +151,7 @@ Documentation and notes. ### Backup and restore * **backup** using [borgbackup setup](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup) - that makes daily backup of the entire directory + that makes daily snapshot of the entire directory * **restore**
down the bookstack containers `docker-compose down`
@@ -144,8 +161,7 @@ Documentation and notes. ### Backup of just user data -For additional peace of mind, -user-data daily exported using the [official procedure.](https://www.bookstackapp.com/docs/admin/backup-restore/)
+user-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. The created backup files are overwriten on every run of the script, but borg backup is daily making snapshot of the entire directory. @@ -155,10 +171,10 @@ but borg backup is daily making snapshot of the entire directory. `bookstack-backup-script.sh` ``` - #!/bin/sh + #!/bin/bash - # CREATE DATABASE DUMP, sh -c '...' IS USED OTHERWISE OUTPUT > WOULD TRY TO GO TO THE HOST - docker container exec bookstack_db sh -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > $MYSQL_DIR/BACKUP.bookstack.database.sql' + # 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' # ARCHIVE UPLOADED FILES docker container exec bookstack tar -czPf /config/BACKUP.bookstack.uploaded-files.tar.gz /config/www/ @@ -181,13 +197,13 @@ but borg backup is daily making snapshot of the entire directory. `docker container exec -it bookstack_db /bin/bash`
`cd /config`
`mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < BACKUP.bookstack.database.sql` - * now start both containers: `docker-compose up -d` - * let it run so it creates folder structure + * now start the app container: `docker-compose up -d` + * let it run so it creates its file structure * down the containers `docker-compose down` - * extract `BACKUP.bookstack.uploaded-files.tar.gz` and place directories `files` and `uploads` where they belong in the mounted volume + * in `bookstack/bookstack-data/www/` replace directories `files`,`images` and `uploads` and the file `.env` + with the ones from the archive `BACKUP.bookstack.uploaded-files.tar.gz` * start the containers: `docker-compose up -d` - * if there was a major version jump, exec in to the container and run `php artisan migrate`
+ * 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` -