Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 10-26-2010, 03:03 PM   #1
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,630
Karma: 857074
Join Date: Jan 2010
Location: France
Device: Many android devices
PHP+Apache web server for calibre ...

EDIT: 2012/02/15: V0.2.8 has been released. See this post.


My personal web + email server is a VPS, living in a data center somewhere. I want to have my calibre library available on that web server. I am running Debian Lenny, which means installing calibre is a right bother. The server is also headless, and I don't want to deal with the framebuffer stuff.

For quite some time I have been using calibre2opds + dropbox. These work quite adequately, but there are three things that are mildly irksome. The first is that calibre2opds doesn't support custom fields. The second (more serious for me) is that I must remember to regenerate the library (and I forget). The third is that calibre2opds creates a mess of files in my library (yes, I know I can copy it, but that means duplicating my library). Couple these with the question 'how hard would it be ...' and I started playing.

I now have a PHP-based Apache plugin implementing a calibre content server. It uses the calibre database and library directly, generating html as needed. The pages are template-driven (smarty, overkill but I wanted to learn it). It supports calibre custom columns, searches, sorting, and per-user restrictions, amongst other things. Either web server and internal authentication can be used.

Requirements: the implementation requires a web server (Apache and IIS should both work), PHP 5.2 or 5.3 with some modules such as SQLite and GD, and Smarty. I am using both PHP 5.2 and PHP5.3, smarty 2.6 and Apache 2.2. See the README and INSTALL files included in the distribution for more information.

Last edited by chaley; 02-15-2012 at 03:51 AM.
chaley is offline   Reply With Quote
Old 10-26-2010, 03:15 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Slightly tangential, but as far as I know, the calibre content server no longer requires X to function, so no need for framebuffer, and if you do a binary calibre install, then it should be trivial to install calibre on debian (the only thing you may have to do is compile a modern glibc by hand and put it into the /opt/calibre directory).
kovidgoyal is offline   Reply With Quote
Old 10-26-2010, 04:07 PM   #3
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,630
Karma: 857074
Join Date: Jan 2010
Location: France
Device: Many android devices
Actually, not tangential at all. Using the standard content server is certainly preferable to what I have done.

I am running Lenny, which has old everything. I tried the binary install, but the installer fails to run because of glibc. I checked backports, but would have more-or-less forced a full upgrade.

It never occurred to me to compile a full glibc and provide that when running the installer, thinking that the prerequisites would be too much trouble. I am still having some trouble figuring out exactly how it will work when running the installer, because /opt/calibre doesn't exist yet. I will take a look at that tomorrow. Suggestions are welcome.
chaley is offline   Reply With Quote
Old 10-26-2010, 04:45 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
I am running Lenny, which has old everything.
Ha! I run Woody on my server. (If it ain't broke ...)
Starson17 is offline   Reply With Quote
Old 10-26-2010, 04:57 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Don't run the installer. Just download the binary tarball, extract it into /opt/calibre and put glibc into /opt/calibre. You should then be able to run

/opt/calibre/calibre-server


All the installer does is install symlinks in /usr/bin, manpages, bash completion and other guff.
kovidgoyal is offline   Reply With Quote
Old 10-26-2010, 08:56 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Specially for you

http://calibre-ebook.com/user_manual...n-linux-server
kovidgoyal is offline   Reply With Quote
Old 10-26-2010, 09:16 PM   #7
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,861
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by kovidgoyal View Post
Specially for you
Quote:
Originally Posted by calibre FAQ
Note
If you bought into the notion that a real server must run a decade old version of Debian, then you will have to jump through a few hoops.

Last edited by DoctorOhh; 10-26-2010 at 09:22 PM.
DoctorOhh is online now   Reply With Quote
Old 10-27-2010, 08:48 AM   #8
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,630
Karma: 857074
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by kovidgoyal View Post
Snarky comments aside about running servers *that never change* so users keep off my back (I get complaints about spamassassin upgrades, for &% sake) ...

After several hours of work and once nuking my system (fortunately I had made a backup onto a spare partition), I got it to work on Debian Lenny.

I was never successful with using a compiled glibc. First problem: compiling glibc 10 and above requires a newer version of binutils because of some multi-arch stuff. It was while working around that when I nuked my system; at one point dpkg nicely removed /sbin/ldconfig, breaking everything. OK, I put that back, then successfully compiled glibc. Second problem: putting the resulting .so into /opt/calibre/libc.so.6 led to immediate segfaults during loading. After the 'export LDD_LIBRARY_PATH ...', no program would run, even 'ls'.

To make a very long story short, the only way I could make this work without upgrading most of my server was to grab the 'testing' version of the libc6 package (libc6_2.11.2), extract the contents to a temp directory, then copy everything from temp/lib to /opt/calibre. I am sure that a subset of the 43 copied libraries would work, but I don't have the patience to delete things one by one until it breaks.

Related notes (really off-topic, but as I am here):
-- getting calibre-server to run in reverse-proxy mode with SSL wasn't fun. The major problem is the non-relative URLs, making URL remapping impossible. Working around that (creating another SSL host) causes SSL certificate mismatches, but I can live with that.

-- The reference src="http://calibre-ebook.com/site_media//img/button-donate.png" in the donate form causes mixed-security mode errors in IE when running under SSL. It would be better if the button image came from calibre-server instead of the external site.

-- Regarding upgrading the server: I will do it when debian stops doing security upgrades to lenny. Life is too short to spend a week on essentially useless work (it really did take me a week to upgrade from sarge to lenny). For example, simply changing from PHP5.2 to PHP5.3 breaks every web application that uses MySQL. PHP5.3 no longer permits old-style password encryption, which means that the applications cannot log in. I don't need passwords at all, really, because of how the server runs, so the change simply breaks things without adding any security. Backing out PHP5.3 was a major reason I went through the bother of making calibre-server work.
chaley is offline   Reply With Quote
Old 10-27-2010, 09:40 AM   #9
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,630
Karma: 857074
Join Date: Jan 2010
Location: France
Device: Many android devices
In fact, I didn't get it to work. Once I finished cleaning up the dregs from the experiments and restoring my system to clean 'lenny', the segfaults came back.

I give up. I will take my PHP implementation to the point where I have what I want.
chaley is offline   Reply With Quote
Old 10-27-2010, 09:49 AM   #10
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Glad you got it to work I've fixed the server to use a local copy of the image.

Are you using the Apache reverse proxy for finer grained authentication?

On your server troubles, these all or nothing upgrades were the primary reason I switched from binary to source linux distros on all my computers (including the servers).

For example, with gentoo you have this nifty feature called slots which allow you to have two (or more) major versions of software installed side by side. So for example you could have PHP 5.2 and 5.3 installed side by side. And you can do more frequent (but less intensive) upgrades.
kovidgoyal is offline   Reply With Quote
Old 10-27-2010, 10:05 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by chaley View Post
In fact, I didn't get it to work. Once I finished cleaning up the dregs from the experiments and restoring my system to clean 'lenny', the segfaults came back.

I give up. I will take my PHP implementation to the point where I have what I want.
Here's another idea:

Create a chroot and install the binutils and libc, tar, gzip debs in the chroot. Then install calibre in the chroot and run the server from the chroot.
kovidgoyal is offline   Reply With Quote
Old 10-27-2010, 11:23 AM   #12
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,630
Karma: 857074
Join Date: Jan 2010
Location: France
Device: Many android devices
Did that.

Now I get
Code:
Traceback (most recent call last):
  File "/tmp/init.py", line 46, in <module>
  File "/home/kovid/build/calibre/src/calibre/library/server/main.py", line 12, in <module>
  File "/home/kovid/build/calibre/src/calibre/library/server/base.py", line 20, in <module>
  File "/home/kovid/build/calibre/src/calibre/library/server/content.py", line 14, in <module>
  File "/home/kovid/build/calibre/src/calibre/library/caches.py", line 15, in <module>
ImportError: cannot import name QImage
which is, I admit, better than a segfault. However, I have no idea how to fix it. The QT libs are clearly in the /opt/calibre directory.

I have not installed python. My understanding is that I should not need to.

Edit: Have tried chroots of both squeeze and sid. In both cases I had to install libglib2. In both cases I get the above error.

Last edited by chaley; 10-27-2010 at 11:37 AM.
chaley is offline   Reply With Quote
Old 10-27-2010, 11:32 AM   #13
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This is when running

/opt/calibre/calibre-server

(in the chroot?)
kovidgoyal is offline   Reply With Quote
Old 10-27-2010, 11:34 AM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
An import error usually means that a python module could not be found probably because the directory tree it is in is not in sys.path

It may be that the code in calibre that sets up sys.path in the binary install does not play nice with chrooting. Try this

calibre-debug -c "import sys; print sys.path"
kovidgoyal is offline   Reply With Quote
Old 10-27-2010, 11:40 AM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,121
Karma: 5101571
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
And can we move this to email.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Command Line usage with PHP artoros Related Tools 13 07-01-2010 09:57 AM
Web Content Server mezme Calibre 7 01-08-2010 09:59 PM
Calibre web server on MAC I cant get to work.. any help appreciated. stustaff Calibre 5 01-06-2010 06:05 PM
Calibre - web server problems eclpmb Calibre 9 11-28-2008 02:04 PM


All times are GMT -4. The time now is 07:19 AM.


MobileRead.com is a privately owned, operated and funded community.