From 5c1a416b6091f274cb16cadfdecdd05c9cb7ff08 Mon Sep 17 00:00:00 2001 From: Daniel Legt Date: Thu, 18 Jan 2024 15:15:36 +0100 Subject: [PATCH] Readme and License + MIT License + Project README.md + Bitwarden Backup Script README --- LICENSE | 21 +++++++++++++++++ README.md | 21 +++++++++++++++++ bitwarden/README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b92fe48 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Daniel Legt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ea6ba1d --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +## About + +This repository is more or less a repository I mainly use in my own development environment and usually use it as a point of reference for future use, there's a couple services I run and backup constantly simply using cronjobs and shell scripts. + +## Why + +Mainly because most services don't actually have a backup script or if they do it's specifically for one method of running that service ( bare metal ), I usually run my services in a docker-compose environment, I love doing it like this and it just makes sense for me especially with self hosting multiple services, I know kubernetes is a thing but I am not a company, I am just a guy hosting some stuff :) + +## How to run + +Most if not all scripts have a "Requirements" script which runs to check if you have the required programs to run the script, if you don't have them then you can simply check the readme for a list providing links to any github project I depend on, you of course only need the binary, although most programs I require are super common such as `curl`, `ssh`, etc... + +But if there's a program such as `gdrive` that I depend on, I will link the github repository where you can yoink the binary from. + +## Contributing + +If you feel like you can make my scripts better, please feel free to open a pull request, I will review it asap and merge it in if I feel like it's an improvement. I know I'm not perfect and that there are many mistakes in my scripts so I'm more than happy to have PRs! + +## License + +The whole project is under a [MIT LICENSE](./LICENSE), so, feel free to do whatever you want with what you find in here. \ No newline at end of file diff --git a/bitwarden/README.md b/bitwarden/README.md index e69de29..e700c7c 100644 --- a/bitwarden/README.md +++ b/bitwarden/README.md @@ -0,0 +1,57 @@ +## About + +This script has been written to backup a `vaultwarden` docker-compose instance, this is how I run my own service on my own server, this backup script will target the `data` folder and of course will also use `sqlite` to create a `.backup` of the `db.sqlite3` file, to ensure safety. + +## Requirements + +### [gdrive](https://github.com/glotlabs/gdrive) +gdrive is a command line application for interacting with Google Drive. + +## Overview +Environment: Docker Compose + +Docker Compose File: +```yml +version: '3' + +services: + bitwarden: + image: vaultwarden/server:latest + ports: + - 127.0.0.1:90:80 + - 127.0.0.1:91:3012 + user: "${UID}:${GID}" + volumes: + - ./data:/data + restart: unless-stopped + environment: + WEBSOCKET_ENABLED: 'true' + SMTP_HOST: "smtp.gmail.com" + SMTP_FROM: "xxx@local.lan" + SMTP_PORT: 587 + SMTP_SECURITY: "starttls" + SMTP_USERNAME: "xxx@local.lan" + SMTP_PASSWORD: "xxx" + DOMAIN: "https://pass.yourdomain.lan" +``` + +Directory Structure +```bash +/path/to/your/service +├── data +│ ├── attachments +│ ├── db.sqlite3 # Your important database +│ ├── db.sqlite3-shm +│ ├── db.sqlite3-wal +│ ├── icon_cache +│ ├── rsa_key.pem +│ ├── rsa_key.pub.pem +│ ├── sends +│ └── tmp +└── docker-compose.yaml +``` + +## Restoration Procedure +Simply unzip the backup file, plop the docker-compose with the correct parameters into the same folder and run it, it should pick right back where it was, but in case the database did get corrupt or broken because the backup was running during an operation, simply remote the `db.sqlite3-sh` and `db.sqlite3-wa` files, and replace the `db.sqplite3` with the one from the zip's top-level, this should work just fine. + +Worst case scenario, restore the database from a different point and it will definitely work. \ No newline at end of file