MichaIng / DietPi-Docs

Source repository for the DietPi OS documentation
https://dietpi.com/docs/
Creative Commons Attribution Share Alike 4.0 International
153 stars 53 forks source link

Readarr | Add info about how to run a second instance #845

Open MichaIng opened 1 year ago

MichaIng commented 1 year ago

This is required if one wants to download the eboot and audiobook of the same book: https://github.com/MichaIng/DietPi/discussions/5004#discussioncomment-4899829

Alternative we can implement it as install option. But we should first check whether there is any aim to allow it with a single Readarr instance. I mean, if Readarr can download both, it cannot be so hard to allow downloading both with the same instance, giving download a related prefix/suffix or so.

roni-estein commented 1 year ago

I think the issue is the whole core organizational unit is the author which lives in one root library. I haven't tested trying to use the same author in two different directories but I have done it for lecturers in Sonarr for example and it will combine them if you have permission to see both.

However, in the cases I do that I normally am taking my own lectures or course lectures and organizing them, They are not part of a public pre-existing group. Also they are in a different interface.

Readarr seems to take 1 author and then let you choose one modality spoken or written for the whole author. You can force it book by book but it won't allow you in the UI to have both. It will treat it as an upgrade. Or at the very least it will make it very difficult to use. For now, it would be convenient until someone comes up with a better solution to allow a quick double install hosted on two separate web interfaces. Readarr:8787 ReadarrAudio:8788 is what I've selected (Speakarr) I actually still haven't got it to work. So if there progress on this at least one person would find it helpful.

Lastly if there is anything about my configuration that I can post that would help debug, the situationI'd be happy to provide it.

MichaIng commented 1 year ago

Yeah, at some point, either individual ebook/audiobook, author or data directory, there would need to be some Identifier in the directory name to differentiate between ebooks and audiobooks. I'm not sure whether the downloads themselves have some reliable way for Readarr to know whether it's ebook or audiobook, but otherwise e.g. a dropdown selector for the user would need to be required.

I actually still haven't got it to work.

You mean the two instances? Have you tried/compared the steps I posted at the other repo?

roni-estein commented 1 year ago

You mean the two instances? Have you tried/compared the steps I posted at the other repo?

Yes, I changed the names around for preferences but here are the exact steps. I also tried looking at the dietpi-services but with no luck. In the end the goal is to replicate how i had it running with docker basically just two different ports 8787 and 8788 one would control epubs, the other audiobooks until there is a better solution.

# Create new data directory
mkdir /mnt/dietpi_userdata/speakarr
chown -R readarr:root /mnt/dietpi_userdata/speakarr
# Setup logging to /var/log (optional)
rm -Rf /mnt/dietpi_userdata/speakarr/logs*
ln -s /var/log/speakarr /mnt/dietpi_userdata/speakarr/logs
ln -s /var/log/speakarr/logs.db /mnt/dietpi_userdata/speakarr/logs.db
ln -s /var/log/speakarr/logs.db-shm /mnt/dietpi_userdata/speakarr/logs.db-shm
ln -s /var/log/speakarr/logs.db-wal /mnt/dietpi_userdata/speakarr/logs.db-wal
# Copy service
cp /etc/systemd/system/readarr.service /etc/systemd/system/speakarr.service
# Adjust new service to use new data directory
G_CONFIG_INJECT 'Description=' 'Description=Speakarr (Readarr Audio Books)' /etc/systemd/system/speakarr.service
G_CONFIG_INJECT 'SyslogIdentifier=' 'SyslogIdentifier=speakarr' /etc/systemd/system/speakarr.service
G_CONFIG_INJECT 'LogsDirectory=' 'LogsDirectory=speakarr' /etc/systemd/system/speakarr.service
sed -i 's|/mnt/dietpi_userdata/readarr$|/mnt/dietpi_userdata/speakarr|' /etc/systemd/system/speakarr.service
# Enable and start new service
systemctl daemon-reload
systemctl enable --now speakarr
MichaIng commented 1 year ago

We forgot to set the directory owner:

chown readarr:root /mnt/dietpi_userdata/speakarr
systemctl restart speakarr

Generally, when something is not working, check the service logs, otherwise you'll never find out the probably trivial issue:

journalctl -u speakarr
roni-estein commented 1 year ago

I have been trying to dig into this configuration, but it appears that tying it too closely to readarr seems to be causing a ton of issues or perhaps I'm seeing errors in the journalling that don't exist, but even though this non-dockerized version seems much smoother, this is where it all falls apart for me.

So I'm not sure but it looks like there were issues with sqlite where there were so any locking errors because there are two readarr instances manipulating the same database, or something is making it seem like that.

It's implied here that the database will be installed in the user directory. I wasn't sure but there were so many errors and locks in the journal so i tried making a speakarr user to further isolate the processes.

https://wiki.servarr.com/en/readarr/installation#debian-ubuntu

I gave speakarr access to the dietpi and readarr groups. I added this to the service to help it

G_CONFIG_INJECT 'User=' 'User=speakarr' /etc/systemd/system/speakarr.service

I've tied a few other things, deleting the database and restarting, but it seems that even though i have a fairly large import other people have such massive ones it takes a week, yet sqlite is not locking up all the time.

For now, I might have to live with throwing it into docker on another machine. Not ideal, but it seems like i can't get this working no matter what i try. In the end the imports just don't seem to show up. It would be great if this was configured properly by someone who knows the small details of whats causing so many failures.

The rest is so solid. If anyone gets this working, I'd be thankful.

Cheers.

here is a sample of what im seeing in journal


" = @Expiry, "Value" = @Value, "StatusCode" = @StatusCode WHERE "Id" = @Id] attempt to write a readonly dat
Feb 14 04:42:38 DietPi Readarr[4051]: SQLite error (5): database is locked in "PRAGMA cache_size=-10000"
Feb 14 04:42:55 DietPi Readarr[4051]: SQLite error (8): statement aborts at 37: [UPDATE "HttpResponse" SET "Url" = @Url, "LastRefresh" = @LastRefresh, "Expiry" = @Expiry, "Value" = @Value, "StatusCode" = @StatusCode WHERE "Id" = @Id] attempt to write a readonly dat
Feb 14 04:43:12 DietPi systemd[1]: speakarr.service: Main process exited, code=killed, status=9/KILL
Feb 14 04:43:12 DietPi systemd[1]: speakarr.service: Failed with result 'signal'.
Feb 14 04:43:12 DietPi systemd[1]: speakarr.service: Consumed 6min 34.942s CPU time.
Feb 14 04:43:12 DietPi systemd[1]: speakarr.service: Scheduled restart job, restart counter is at 1.
Feb 14 04:43:12 DietPi systemd[1]: Stopped Speakarr (Readarr Audio Books).
Feb 14 04:43:12 DietPi systemd[1]: speakarr.service: Consumed 6min 34.942s CPU time.
Feb 14 04:43:12 DietPi systemd[1]: Started Speakarr (Readarr Audio Books).
Feb 14 04:43:15 DietPi speakarr[4425]: [Info] Bootstrap: Starting Readarr - /opt/readarr/Readarr.dll - Version 0.1.3.1584
Feb 14 04:43:15 DietPi speakarr[4425]: [Debug] Bootstrap: Getting windows service status
Feb 14 04:43:15 DietPi speakarr[4425]: [Debug] Bootstrap: Console selected
Feb 14 04:43:15 DietPi speakarr[4425]: [Info] AppFolderInfo: Data directory is being overridden to [/mnt/dietpi_userdata/speakarr]
Feb 14 04:43:17 DietPi speakarr[4425]: [Trace] EventAggregator: Publishing ApplicationStartingEvent
Feb 14 04:43:18 DietPi speakarr[4425]: [Info] AppFolderInfo: Data directory is being overridden to [/mnt/dietpi_userdata/speakarr]
Feb 14 04:43:18 DietPi speakarr[4425]: [Info] MigrationController: *** Migrating data source=/mnt/dietpi_userdata/speakarr/readarr.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
Feb 14 04:43:19 DietPi speakarr[4425]: [Debug] MigrationController: Took: 00:00:00.7297974
Feb 14 04:43:19 DietPi speakarr[4425]: [Info] MigrationController: *** Migrating data source=/mnt/dietpi_userdata/speakarr/cache.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
Feb 14 04:43:19 DietPi speakarr[4425]: [Debug] MigrationController: Took: 00:00:00.0252336
Feb 14 04:43:20 DietPi speakarr[4425]: [Trace] EventAggregator: ApplicationStartingEvent -> InstallUpdateService
Feb 14 04:43:20 DietPi speakarr[4425]: [Trace] EventAggregator: ApplicationStartingEvent <- InstallUpdateService
Feb 14 04:43:20 DietPi speakarr[4425]: [Warn] SingleInstancePolicy: Failed to check for multiple instances of Readarr.
Feb 14 04:43:20 DietPi speakarr[4425]: [v0.1.3.1584] System.NullReferenceException: Object reference not set to an instance of an object.
Feb 14 04:43:20 DietPi speakarr[4425]:    at NzbDrone.Common.Processes.ProcessProvider.GetExeFileName(Process process) in D:\a\1\s\src\NzbDrone.Common\Processes\ProcessProvider.cs:line 340
Feb 14 04:43:20 DietPi speakarr[4425]:    at NzbDrone.Common.Processes.ProcessProvider.ConvertToProcessInfo(Process process) in D:\a\1\s\src\NzbDrone.Common\Processes\ProcessProvider.cs:line 323
Feb 14 04:43:20 DietPi speakarr[4425]:    at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
Feb 14 04:43:20 DietPi speakarr[4425]:    at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
Feb 14 04:43:20 DietPi speakarr[4425]:    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Feb 14 04:43:20 DietPi speakarr[4425]:    at NzbDrone.Common.Processes.ProcessProvider.FindProcessByName(String name) in D:\a\1\s\src\NzbDrone.Common\Processes\ProcessProvider.cs:line 90
Feb 14 04:43:20 DietPi speakarr[4425]:    at NzbDrone.Host.SingleInstancePolicy.GetOtherNzbDroneProcessIds() in D:\a\1\s\src\NzbDrone.Host\SingleInstancePolicy.cs:line 68
Feb 14 04:43:20 DietPi speakarr[4425]: [Info] MigrationController: *** Migrating data source=/mnt/dietpi_userdata/speakarr/logs.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
Feb 14 04:43:22 DietPi Readarr[4425]: SQLite error (1): near "SHOW": syntax error in "SHOW server_version"
Feb 14 04:43:23 DietPi speakarr[4425]: [Info] RootFolderWatchingService: Watching directory /mnt/tank/plex/media/audiobooks/kids/
Feb 14 04:46:53 DietPi Readarr[4425]: SQLite error (5): database is locked in "PRAGMA cache_size=-10000"
Feb 14 04:51:53 DietPi speakarr[4425]: [Info] RssSyncService: Starting RSS Sync
Feb 14 04:52:02 DietPi speakarr[4425]: [Warn] Torznab: Indexer EBookBay (Prowlarr) rss sync didn't cover the period between 02/14/2023 04:36:47 and 02/14/2023 04:51:54 UTC. Search may be required.
Feb 14 04:52:03 DietPi speakarr[4425]: [Info] DownloadDecisionMaker: Processing 200 releases
Feb 14 04:52:04 DietPi speakarr[4425]: [Info] RssSyncService: RSS Sync Completed. Reports found: 200, Reports grabbed: 0
Feb 14 04:52:53 DietPi Readarr[4425]: SQLite error (5): database is locked in "PRAGMA cache_size=-10000"
MichaIng commented 1 year ago

Since your Speakarr has an own data directory, it also has its own database, so that cannot be the issue.

I btw wouldn't use an own user but keep using the readarr user that already exists. That way you can push upgrades from both instances since only readarr has write access to its install directory.

If you want to use an own user, remember to grant it write access to its data and logs directory:

chown -R speakarr:root /mnt/dietpi_userdata/speakarr /var/log/speakarr
roni-estein commented 1 year ago

That did it! This is now running smoothly!!! I can't speak to what was happening before. But keeping the separate user, and adding the final command has it running completely! Importing large libraries is just working. Screenshot 2023-02-15 at 2 01 26 AM

And the logs look totally different, for the same events ...

Feb 15 07:54:44 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 86/320
Feb 15 07:54:47 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 87/320
Feb 15 07:54:47 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 88/320
Feb 15 07:54:51 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 89/320
Feb 15 07:54:54 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 90/320
Feb 15 07:54:57 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 91/320
Feb 15 07:54:58 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 92/320
Feb 15 07:54:58 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 93/320
Feb 15 07:54:59 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 94/320
Feb 15 07:55:06 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 95/320
Feb 15 07:55:06 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 96/320
Feb 15 07:55:07 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 97/320
Feb 15 07:55:08 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 98/320
Feb 15 07:55:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 99/320
Feb 15 07:55:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 100/320
Feb 15 07:55:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 101/320
Feb 15 07:55:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 102/320
Feb 15 07:55:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 103/320
Feb 15 07:55:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 104/320
Feb 15 07:55:10 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 105/320
Feb 15 07:55:10 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 106/320
Feb 15 07:55:24 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 107/320
Feb 15 07:55:35 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 108/320
Feb 15 07:55:47 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 109/320
Feb 15 07:55:58 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 110/320
Feb 15 07:56:09 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 111/320
Feb 15 07:56:17 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 112/320
Feb 15 07:56:18 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 113/320
Feb 15 07:56:18 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 114/320
Feb 15 07:56:18 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 115/320
Feb 15 07:56:19 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 116/320
Feb 15 07:56:50 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 117/320
Feb 15 07:57:16 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 118/320
Feb 15 07:57:42 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 119/320
Feb 15 07:57:43 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 120/320
Feb 15 07:57:43 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 121/320
Feb 15 07:57:47 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 122/320
Feb 15 07:57:48 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 123/320
Feb 15 07:57:50 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 124/320
Feb 15 07:57:51 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 125/320
Feb 15 07:57:52 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 126/320
Feb 15 07:57:53 DietPi Readarr[393]: SQLite error (5): database is locked in "PRAGMA cache_size=-10000"
Feb 15 07:57:57 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 127/320
Feb 15 07:57:59 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 128/320
Feb 15 07:58:00 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 129/320
Feb 15 07:58:01 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 130/320
Feb 15 07:58:02 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 131/320
Feb 15 07:58:04 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 132/320
Feb 15 07:58:05 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 133/320
Feb 15 07:58:06 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 134/320
Feb 15 07:58:07 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 135/320
Feb 15 07:58:07 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 136/320
Feb 15 07:58:08 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 137/320
Feb 15 07:58:11 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 138/320
Feb 15 07:58:12 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 139/320
Feb 15 07:58:14 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 140/320
Feb 15 07:58:16 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 141/320
Feb 15 07:58:18 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 142/320
Feb 15 07:58:21 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 143/320
Feb 15 07:58:22 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 144/320
Feb 15 07:58:24 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 145/320
Feb 15 07:58:25 DietPi speakarr[393]: [Info] IdentificationService: Identifying book 146/320

Thanks for everything. I'll post a log of my config steps in the morning. From there you can make a better version for other users. But in case there are more pressing things on the project at least people will have a reference that finally worked worked for me. And also a chance to improve on it. :)

MichaIng commented 1 year ago

Great, looks like the permissions of the data dir were still wrong, e.g. readarr user while you use speakarr user. /var/log/speakarr is created and handed to the correct user automatically as of LogsDirectory=speakarr in the systemd service.