Calibre in the plugin jail

blairjj

Cadet
Joined
Oct 14, 2013
Messages
8
MarchHare,

You need to populate the calibre database with your books before there is anything to see:

calibredb add -r /media/ebooks/ --library-path=/media/ebooks

once that is done you can test with:

calibre-server --library-path=/media/ebooks

in my case /mnt/media/ebooks is mounted on my calibre jail as /media/ebooks

blairjj
 

MarchHare

Dabbler
Joined
Oct 14, 2013
Messages
12
blairjj

That did it! Thank you!

I'm assuming one would just create a cron job to run this every so often?
 

blairjj

Cadet
Joined
Oct 14, 2013
Messages
8
MarchHare,

I think the cron is a reasonable approach depending on the frequency of the changes in your data set.

blairjj
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Managed to get Calibre running in a jail with the help of this thread, but still not sure how I get it to start with the jail

I've got calibre_enable="YES" in /etc/rc.conf which starts fine but not sure how to add the server command as it doesn't seem to like the combinations I've tried.

Did anyone get this starting automatically with the jail?

Also, where can I add a username and password to restrict access?

Thanks
 

meatservo80

Cadet
Joined
Feb 21, 2016
Messages
9
So I had this working with rc.conf settings for like 2 years now and I just migrated to a fresh server. They updated the calibre package where it doesnt work with a cron or rc so far. I currently have to run this manually each jail bootup with the following command. Which works with out issue from CLI. but put it in a cron and it doesnt work.

`calibre-server --with-library /media/calibreLibrary --port 12456 --daemonize`
 

meatservo80

Cadet
Joined
Feb 21, 2016
Messages
9
For anyone else starting out trying to get this working on a new build here is the way I did it as of 20Feb2016 on the latest 9.3 Stable. (Outside of autostart) *I wrote it in markdown thus ignore some of the syntax

#### Calibre **(Works but has to be manually started right now, cron and rc dont work)**
- Add Jail
- Name: calibre_1
- Template: --
- IP to 10.1.10.22 and Gateway to 10.1.10.254 #Yours will be different, I have a gateway because I port forward it to access outside
- **VIMAGE** and **Autostart**
- Add storage - Source /mnt/zpool0/media/Books/Calibre Library to /media/calibreLibrary , **create directory**, **mounted**

SSH to hyrule #my freenas server

```
sudo jexec calibre_1 csh
pkg update
pkg upgrade
pkg install calibre
vi /etc/rc.conf
```
Add the following lines (tried calibre like original and now this and both dont work)
```
calibre-server_enable="YES"
calibre-server_port="12456"
calibre-server_user="root"
calibre-server_library="/media/calibreLibrary/"
```
**ESC**, `:wq`

**Manually start right now on each reboot of jail**
SSH to hyrule
`sudo jexec calibre_1 csh`
`calibre-server --with-library /media/calibreLibrary --port 12456 --daemonize`


To update
```
pkg upgrade
```
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Managed to get Calibre running in a jail with the help of this thread, but still not sure how I get it to start with the jail

I've got calibre_enable="YES" in /etc/rc.conf which starts fine but not sure how to add the server command as it doesn't seem to like the combinations I've tried.

Did anyone get this starting automatically with the jail?

Also, where can I add a username and password to restrict access?

Thanks

After playing around with this for several hours and not getting anywhere, I thought I'd start from scratch with the little I'd learnt and hey presto, I've now got Calibre running in a jail with authentication in about 6 simple steps :D

For anyone interested:

1. Create FreeNAS jail (default settings - I called it calibre-server)
2. Enter shell of new jail
3. Run 'pkg upgrade' and then 'pkg install calibre'
4. Add storage to jail (i.e. mount the location of your Calibre library to the jail - I just used /mnt)
5. In the WUI create a Cron Job with the appropriate flags (mine looks like jexec calibre-server calibre-server --with-library="/mnt" --port="8282" --username="username" --password="password") nb: the first calibre-server is the name of your jail!
6. Run the Cron Job

Browse to the IP (with appropriate ":" port number) and after entering your username and password your books will appear!

:D
 
Last edited:

RoadHazard

Explorer
Joined
Nov 29, 2015
Messages
83
once that is done you can test with:

calibre-server --library-path=/media/ebooks

blairjj

Possible typo: I believe the correct switch is '--with-library' not '--library-path'. The latter is not a valid option with the caliber-server command.
 

RoadHazard

Explorer
Joined
Nov 29, 2015
Messages
83
calibredb add -r /media/ebooks/ --library-path=/media/ebooks

Presumably this command needs to be rerun every time new books are added? It appears so; Calibre doesn't show me any new books when I drop them into the library directory. Sounds like another good use for a cron job, unless I'm not doing it right.
 
Last edited:

meatservo80

Cadet
Joined
Feb 21, 2016
Messages
9
Presumably this command needs to be rerun every time new books are added? It appears so; Calibre doesn't show me any new books when I drop them into the library directory. Sounds like another good use for a cron job, unless I'm not doing it right.

The way I do is I only use it as a server for web access to your books. When I need to add books, I just open my windows calibre install that points to same location for metadata, so it updates the database, add my books and close. Then your books will showup. Then I can edit the meta data as I add them and such.
 

meatservo80

Cadet
Joined
Feb 21, 2016
Messages
9
For anyone else starting out trying to get this working on a new build here is the way I did it as of 20Feb2016 on the latest 9.3 Stable. (Outside of autostart) *I wrote it in markdown thus ignore some of the syntax

#### Calibre **(Works but has to be manually started right now, cron and rc dont work)**
- Add Jail
- Name: calibre_1
- Template: --
- IP to 10.1.10.22 and Gateway to 10.1.10.254 #Yours will be different, I have a gateway because I port forward it to access outside
- **VIMAGE** and **Autostart**
- Add storage - Source /mnt/zpool0/media/Books/Calibre Library to /media/calibreLibrary , **create directory**, **mounted**

SSH to hyrule #my freenas server

```
sudo jexec calibre_1 csh
pkg update
pkg upgrade
pkg install calibre
vi /etc/rc.conf
```
Add the following lines (tried calibre like original and now this and both dont work)
```
calibre-server_enable="YES"
calibre-server_port="12456"
calibre-server_user="root"
calibre-server_library="/media/calibreLibrary/"
```
**ESC**, `:wq`

**Manually start right now on each reboot of jail**
SSH to hyrule
`sudo jexec calibre_1 csh`
`calibre-server --with-library /media/calibreLibrary --port 12456 --daemonize`


To update
```
pkg upgrade
```

I found my issue now that I finally got back to fixing this, my rc.conf above was incorrect, also a crontab internal to jail at reboot wont work for some reason but rc does now

vi /etc/rc.conf
```
Add the following lines
```
calibre_enable="YES"
calibre_port="12456"
calibre_user="root"
calibre_library="/media/calibreLibrary/"
 

Lucio

Cadet
Joined
May 9, 2016
Messages
2
I found my issue now that I finally got back to fixing this, my rc.conf above was incorrect, also a crontab internal to jail at reboot wont work for some reason but rc does now

vi /etc/rc.conf
```
Add the following lines
```
calibre_enable="YES"
calibre_port="12456"
calibre_user="root"
calibre_library="/media/calibreLibrary/"
is possible to use port 80? in this way we do not need to put the port after the ip in the address bar (eg to have not 10.1.10.22:12456 but only 10.1.10.22)
Thanks :)
 

meatservo80

Cadet
Joined
Feb 21, 2016
Messages
9
is possible to use port 80? in this way we do not need to put the port after the ip in the address bar (eg to have not 10.1.10.22:12456 but only 10.1.10.22)
Thanks :)
Shouldn't be an issue to configure it that way. Just remember if trying to access outside of your internal network, you need to forward that port to calibre jail and since its 80 you have a very large security hole for people to get in.
 

Lucio

Cadet
Joined
May 9, 2016
Messages
2
Shouldn't be an issue to configure it that way. Just remember if trying to access outside of your internal network, you need to forward that port to calibre jail and since its 80 you have a very large security hole for people to get in.
good point, i didn't think before about that. thanks
 

fontes31

Explorer
Joined
Apr 6, 2012
Messages
96
After playing around with this for several hours and not getting anywhere, I thought I'd start from scratch with the little I'd learnt and hey presto, I've now got Calibre running in a jail with authentication in about 6 simple steps :D

For anyone interested:

1. Create FreeNAS jail (default settings - I called it calibre-server)
2. Enter shell of new jail
3. Run 'pkg upgrade' and then 'pkg install calibre'
4. Add storage to jail (i.e. mount the location of your Calibre library to the jail - I just used /mnt)
5. In the WUI create a Cron Job with the appropriate flags (mine looks like jexec calibre-server calibre-server --with-library="/mnt" --port="8282" --username="username" --password="password") nb: the first calibre-server is the name of your jail!
6. Run the Cron Job

Browse to the IP (with appropriate ":" port number) and after entering your username and password your books will appear!

:D


after entering 'pkg upgrade' i have this:
pkg: Skipping unknown key 'messages'

is normal?
 

fontes31

Explorer
Joined
Apr 6, 2012
Messages
96
After playing around with this for several hours and not getting anywhere, I thought I'd start from scratch with the little I'd learnt and hey presto, I've now got Calibre running in a jail with authentication in about 6 simple steps :D

For anyone interested:

1. Create FreeNAS jail (default settings - I called it calibre-server)
2. Enter shell of new jail
3. Run 'pkg upgrade' and then 'pkg install calibre'
4. Add storage to jail (i.e. mount the location of your Calibre library to the jail - I just used /mnt)
5. In the WUI create a Cron Job with the appropriate flags (mine looks like jexec calibre-server calibre-server --with-library="/mnt" --port="8282" --username="username" --password="password") nb: the first calibre-server is the name of your jail!
6. Run the Cron Job

Browse to the IP (with appropriate ":" port number) and after entering your username and password your books will appear!

:D
I did this mini tutorial but nothing. Is this cron job ok?

jexec calibre-server calibre-server with library="/mnt/tank/media/calibreLibrary" port="8282" username="username" password="password"

my folder of calibreLibrary: mnt/tank/media

my jails: /mnt/tank/media /mnt/media

The jail i created is: calibre-server
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
You're running the cron job within the jail, so the library="path" needs to be the name of whatever you mounted in the jail storage.
 

fontes31

Explorer
Joined
Apr 6, 2012
Messages
96
my jail storage: /mnt/tank/jails

add storage of the jail: source - mnt/tank/media destination - mnt/media
 

fontes31

Explorer
Joined
Apr 6, 2012
Messages
96
this is my cron job
 

Attachments

  • Captura de ecrã 2016-06-25, às 20.59.42.png
    Captura de ecrã 2016-06-25, às 20.59.42.png
    973 KB · Views: 522
Top