mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 06:25:38 +00:00
move calibre books to zfs directory
This commit is contained in:
parent
366a7f6157
commit
7ab78767d4
23
docs/restore-calibre.md
Normal file
23
docs/restore-calibre.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Restoring Calibre From Backup
|
||||
|
||||
The `metadata.db` holds the library and `app.db` and `gdrive.db` contain the
|
||||
web/account information.
|
||||
|
||||
Place books directories in `/data/books/`.
|
||||
|
||||
Place `metadata.db` in `/var/lib/calibre-web-db/`.
|
||||
|
||||
Symlink `metadata.db` to the library:
|
||||
|
||||
```
|
||||
sudo ln -s /var/lib/calibre-web-db/metadata.db /data/books/metadata.db
|
||||
```
|
||||
|
||||
Place `app.db` and `gdrive.db` in `/var/lib/calibre-web/`.
|
||||
|
||||
Restart Calibre:
|
||||
|
||||
```
|
||||
sudo systemctl restart calibre-web.service
|
||||
```
|
||||
|
@ -22,10 +22,10 @@ litestream restore -o nextcloud.db s3://noahmasur-backup.s3.us-west-002.backblaz
|
||||
Install Nextcloud. Then copy DB:
|
||||
|
||||
```
|
||||
sudo rm /var/lib/nextcloud/data/nextcloud.db*
|
||||
sudo mv nextcloud.db /var/lib/nextcloud/data/
|
||||
sudo chown nextcloud:nextcloud /var/lib/nextcloud/data/nextcloud.db
|
||||
sudo chmod 770 /var/lib/nextcloud/data/nextcloud.db
|
||||
sudo rm /data/nextcloud/data/nextcloud.db*
|
||||
sudo mv nextcloud.db /data/nextcloud/data/
|
||||
sudo chown nextcloud:nextcloud /data/nextcloud/data/nextcloud.db
|
||||
sudo chmod 770 /data/nextcloud/data/nextcloud.db
|
||||
```
|
||||
|
||||
Restart Nextcloud:
|
||||
@ -37,7 +37,7 @@ sudo systemctl restart phpfpm-nextcloud.service
|
||||
Adjust Permissions and Directories:
|
||||
|
||||
```
|
||||
sudo mkdir /var/lib/nextcloud/data/noah/files
|
||||
sudo chown nextcloud:nextcloud /var/lib/nextcloud/data/noah/files
|
||||
sudo mkdir /data/nextcloud/data/noah/files
|
||||
sudo chown nextcloud:nextcloud /data/nextcloud/data/noah/files
|
||||
```
|
||||
|
||||
|
@ -41,6 +41,7 @@ nixpkgs.lib.nixosSystem {
|
||||
caddy.enable = true;
|
||||
streamServer = "stream.masu.rs";
|
||||
nextcloudServer = "cloud.masu.rs";
|
||||
bookServer = "books.masu.rs";
|
||||
samba.enable = true;
|
||||
|
||||
backup.s3 = {
|
||||
|
@ -1,4 +1,10 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
libraryPath = "/data/books";
|
||||
|
||||
in {
|
||||
|
||||
options = {
|
||||
bookServer = lib.mkOption {
|
||||
@ -6,6 +12,11 @@
|
||||
description = "Hostname for Calibre library";
|
||||
default = null;
|
||||
};
|
||||
backups.calibre = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Whether to backup Calibre library";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.bookServer != null) {
|
||||
@ -17,6 +28,7 @@
|
||||
reverseProxyAuth.enable = false;
|
||||
enableBookConversion = true;
|
||||
enableBookUploading = true;
|
||||
calibreLibrary = libraryPath;
|
||||
};
|
||||
};
|
||||
|
||||
@ -30,7 +42,7 @@
|
||||
}];
|
||||
|
||||
# Run a backup on a schedule
|
||||
systemd.timers.calibre-backup = {
|
||||
systemd.timers.calibre-backup = lib.mkIf config.backups.calibre {
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 00:00:00"; # Once per day
|
||||
Unit = "calibre-backup.service";
|
||||
@ -39,9 +51,7 @@
|
||||
};
|
||||
|
||||
# Backup Calibre data to object storage
|
||||
systemd.services.calibre-backup =
|
||||
let libraryPath = "/var/lib/calibre-web"; # Default location
|
||||
in {
|
||||
systemd.services.calibre-backup = lib.mkIf config.backups.calibre {
|
||||
description = "Backup Calibre data";
|
||||
environment.AWS_ACCESS_KEY_ID = config.backup.s3.accessKeyId;
|
||||
serviceConfig = {
|
||||
|
Loading…
Reference in New Issue
Block a user