Jump to content
hernandito

My New Dockers - Apache-PHP and Enhanced Calibre Server

181 posts in this topic Last Reply

Recommended Posts

Hi Guys,

 

Thanks to all the help from you guys, I have managed to make a couple of Dockers. They are basically modifications of the work by smdion, CHBMB, and Aptalca. PLease note that I am NOT an expert at any of this... including Github.

 

Apache-PHP

This includes PHP and Apache to server some simple web pages..  I added Midnight Commander to the install (and created a quick logo).

 

Calibre Server

I took Aptalcas, and made some changes.

 

First I am storing the location of the server files (which would ordinarily remain in the container) and put them in one of my unRAID shares /mnt/users/appdata/calibre. The reason for this is that I have edited the look and feel of the Calibre web page. I do not want to loose those edits every time I reinstall the container.

 

Question:

ANSWERED by Sparklyballs Password login feature is implemented!!

A feature I would like is to password protect the Web site interface if I open the port on my router. Via script (in Ubuntu in /etc/init/calibre-server.conf) one can start the Calibre Server via this command:

 

env USER='myusername'
env PASSWORD='mypassword'
env LIBRARY_PATH='/home/hernando/Dropbox/Calibre'
env MAX_COVER='400x500'
env PORT='8080'

script
    exec /usr/bin/calibre-server --with-library $LIBRARY_PATH --auto-reload \
                                 --max-cover $MAX_COVER --port $PORT \
                                 --username $USER --password $PASSWORD
end script

 

As you can see you can pass a a username and password variables that it uses to password protect the site. How can I make this happen so I do not have to hard code the unername/password in the Dockerfile? Can something be done within the template where you enter these variables as part of the configuration?

 

Another feature I added, was to add my unRAID downloads folder to the container. When I download books, I have them automatically be copied from either rTorrent or Sab into /mnt/user/downloads/complete/books. I want to create a cron job that has the following code:

 

*/10 * * * * xvfb-run /opt/calibre/calibredb add /downloads/complete/Books/ -r --with-library /config && rm -rf /mnt/user/downloads/complete/Books/*

 

This will execute an update of the library and any new books will automatically land in the Calibre library without any intervention.

 

Question

Automatic Cron feature is implemented!! Watch out for the paths.

Can someone please guide me how I can automatically add this cron to the container?.

 

Feature should be added and working.

 

Any help is greatly appreciated as always.

 

Thanks,

 

Here is the repo:

https://github.com/hernandito/docker-templates

 

 

 

 

 

 

 

 

Share this post


Link to post

Hi Guys,

 

Thanks to all the help from you guys, I have managed to make a couple of Dockers. They are basically modifications of the work by smdion, CHBMB, and Aptalca. PLease note that I am NOT an expert at any of this... including Github.

 

Apache-PHP

This includes PHP and Apache to server some simple web pages..  I added Midnight Commander to the install (and created a quick logo).

 

Calibre Server

I took Aptalcas, and made some changes.

 

First I am storing the location of the server files (which would ordinarily remain in the container) and put them in one of my unRAID shares /mnt/users/appdata/calibre. The reason for this is that I have edited the look and feel of the Calibre web page. I do not want to loose those edits every time I reinstall the container.

 

Question:

A feature I would like is to password protect the Web site interface if I open the port on my router. Via script (in Ubuntu in /etc/init/calibre-server.conf) one can start the Calibre Server via this command:

 

env USER='myusername'
env PASSWORD='mypassword'
env LIBRARY_PATH='/home/hernando/Dropbox/Calibre'
env MAX_COVER='400x500'
env PORT='8080'

script
    exec /usr/bin/calibre-server --with-library $LIBRARY_PATH --auto-reload \
                                 --max-cover $MAX_COVER --port $PORT \
                                 --username $USER --password $PASSWORD
end script

 

As you can see you can pass a a username and password variables that it uses to password protect the site. How can I make this happen so I do not have to hard code the unername/password in the Dockerfile? Can something be done within the template where you enter these variables as part of the configuration?

 

Another feature I added, was to add my unRAID downloads folder to the container. When I download books, I have them automatically be copied from either rTorrent or Sab into /mnt/user/downloads/complete/books. I want to create a cron job that has the following code:

 

*/10 * * * * xvfb-run /opt/calibre/calibredb add /downloads/complete/Books/ -r --with-library /config && rm -rf /mnt/user/downloads/complete/Books/*

 

This will execute an update of the library and any new books will automatically land in the Callibre library without any intervention.

 

Question:

Can someone please guide me how I can automatically add this cron to the container?.

 

Feature should be added and working.

 

Any help is greatly appreciated as always.

 

Thanks,

 

Here is the repo:

https://github.com/hernandito/docker-templates

 

you can pass in variables by either adding them to the template.xml

 

or manually by hitting advanced when adding/editing the docker in the unraid webui.

 

if this is your container, i'm not sure if it will let you get away with using USER as a variable or not though, because user is a docker command in build stage, so you may want to edit the script.

Share this post


Link to post

 

you can pass in variables by either adding them to the template.xml

 

or manually by hitting advanced when adding/editing the docker in the unraid webui.

 

if this is your container, i'm not sure if it will let you get away with using USER as a variable or not though, because user is a docker command in build stage, so you may want to edit the script.

 

I assume I can change to...

env CALUSER='myusername'
env CALPASSWORD='mypassword'

script
    exec /usr/bin/calibre-server --with-library $LIBRARY_PATH --auto-reload \
                                 --username $CALUSER --password $CALPASSWORD
end script

 

How do I go about setting the variable in the template.xml? Or an example you can point me to... Ideally it would be great if one could enter both values like we enter the port and Host Paths when creating a new container in the unRAID webui.

 

For your second suggestion, the variable(s) I set in Advanced View, are these the same variables used by the string --username $CALUSER --password $CALPASSWORD? This is the fist time I ever ever heard of environment variables.

 

Thank you Sparkly!

 

Share this post


Link to post

take a look at my kodi container template.xml in my main repo for a look at defining variables there.

 

and as for inputting them in the advanced view manually, and in fact putting them in the template xml you can use the variables in the script, removing the leading $.

 

 

Share this post


Link to post

Thanks again Sparkly... seem very straight forward. It is taking a long time to Autobuild. I will let you know how it works out.

Share this post


Link to post

It worked... Thank you all.... I am psyched to exercise my brain and come up with ideas what to do. I will edit OP to mark questions done.

 

Thanks again,

 

;D  ;D  ;D

 

H.

Share this post


Link to post

I installed the apachephp docker and it is working for me, but the banner and icon files appear to be corrupted or non existent.

Share this post


Link to post

I installed the apachephp docker and it is working for me, but the banner and icon files appear to be corrupted or non existent.

 

Same here.  But great work mate.

Share this post


Link to post

I will fix the template in Github... Gotta come up w/ a better logo though...

 

How about this one.

hernandito-hernando-apachephp-docker-latest-icon.png.b90434e2ff02a0acf3192c5d151f3d99.png

Share this post


Link to post

I will fix the template in Github... Gotta come up w/ a better logo though...

 

This one is better.  It has a transparent background.

hernandito-hernando-apachephp-docker-latest-icon.png.04a606e0130b34b465cda5b757529839.png

Share this post


Link to post

I just upped a logo and changed the xml.... I want something that shows php, apache and database..

 

A1AQVll.png

 

Not great... but not sure what else to try. Apache feather is a little too boring for my taste.

 

EDIT -  fixed earlier problem.

Share this post


Link to post

Experimenting with you Apache-PHP container,

 

Couple of questions..

 

Firstly, I'm just curious, what would you use cron for in the Apache-PHP container?  I've never really used cron for much other than some of the scripts people have posted on here, so I'm genuinely interested.

 

Secondly, and on the same topic, when I start the container, my log gets filled with

 

/usr/sbin/cron: can't lock /var/run/cron.pid, otherpid may be 11: Resource temporarily unavailable

 

Any ideas?

 

By the way, I've forked your container back and renabled some of the SSL stuff,  ;D

Share this post


Link to post

I have created my own "portal" page which is like a Maraschino on super steroids. One of the things it does, it goes to the various NZB indexing sites I am a member of, and it parses the RSS feed to show me the latest releases. It then presents them on my portal.

 

Because you only get a limited amount of API hits on those sites, I have a script that reads the rss feed, stores the info in a mySQL database table. Then when load the portal page, it reads the stored value in the database and not directly from the indexer websites.

 

The script runs every 30 minutes, so that is 48 API hits per day. The info then is at worse, 29 minutes or less behind. This is totally fine for my perusal purpose. It do not need real time like that.

 

Thus the cron... it runs the script that loads the data in the db. I also scrape the NY Times bestseller book list and stores it. I have a page that lists the weeks list.

 

I was getting the cron job  error you listed... and someway, somehow they went away. Unfortunately I cannot figure out what causes it. My guess is that it was a conflict with another docker. As you know, I am far from an expert.

 

 

 

 

Share this post


Link to post

is the nzedb docker container not available anymore - just tried to install it and its not found.....

 

Thanks

Myk

 

Share this post


Link to post

I could never get it to work properly.... sorry.

 

Try again, but no promises on how it works. YOu will need to go to the nZEDb forum for help configuring nZEDb... not that I dont want to elp; its that its been a while since I set nZEDb up... I use it in a VM, not the docker.

Share this post


Link to post

Any way to fix this? I have myrianDB installed and the folder is inside the docker's appdata. I'm still trying to wrap my head around how the data flows within multiple virtualized environments on top of a host.

 

http://puu.sh/jyWnk/e9fc22a79b.png

 

What Docker are you referring to... I dont know anything about MyrianDB... you need to get a grasp on how folders are mapped and shared. Lots of posts here on how this works.

 

 

Share this post


Link to post

Just installed this and it works great on 6.0.1 as well. Maybe I'm not understanding how this all works yet, but can someone tell me where all of the the .conf files exist, such as the httpd.conf, mod_php.conf, httpd-vhosts.conf?

 

Do I just manually create these and place them in my "config" folder?

Share this post


Link to post

I'm also having connection rejected problems when apache is on port 80. It was listening on 80 earlier yesterday and all of a sudden it stopped. The WebGUI for unraid is on 8080 and nothing else on the network should be on 80.

 

Any ideas on what it could be?

Share this post


Link to post

I am trying to get your Calibre docker running but am not having any luck. I just get a "This webpage is not available" error when browsing to the WebUI.

 

Here's my mappings. The strange thing is that there are no files created in the /appdata/calibre folder and I would have expected to have something there. Any help you can provide would be appreciated.

 

 

Edit: I restarted the Docker and here's the log:

 

Installing Clean - Apply any Custom Edits
Installing to /opt/calibre
Downloading tarball signature securely...
Using previously downloaded calibre-2.38.0-x86_64.txz
Defining Cron job from crons.conf 
Launching Cron
Cron Done

image001.png.897a7b6bfeace257d54fcd76bddf6856.png

Share this post


Link to post

Here are my settings. I use it with Dropbox so I can access my library from anywhere.

 

Did you get it to work?

 

nLpn5AB.png

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.