Skip to content

Commit

Permalink
- exposed additional directories (see ticket #24)
Browse files Browse the repository at this point in the history
- added support for setting the Calibre Web application folder (see ticket #27)
- updated python `requirements` and `optional requirements`at dockerfile
- added Container Directory Structure information at README.md (see ticket #24)
- kindlegen archive will be downloaded on container startup into `/calibre-web/kindlegen` and is not directly included in the image anymore
- ownership of symlink of `app.db`, `gdrive.db` and `kindlegen` is changed from _root_ to the _calibre_ user & group
  • Loading branch information
Technosoft2000 committed Apr 14, 2018
1 parent dc20c00 commit a298378
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 19 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
**2018-04-14 - v1.1.11**

* exposed additional directories (see ticket #24)
`-v /calibre-web/app` - local path for Calibre Web application files
`-v /calibre-web/kindlegen` - local path for Calibre Web kindlegen application
* added support for setting the Calibre Web application folder (see ticket #27);
map volume `-v /calibre-web/app` if you want to use Google Drive
* updated python `requirements` and `optional requirements`at dockerfile according to
- https://github.com/janeczku/calibre-web/blob/master/requirements.txt
- https://github.com/janeczku/calibre-web/blob/master/optional-requirements.txt
* added __Container Directory Structure__ information at README.md (see ticket #24)
* kindlegen archive will be downloaded on container startup into `/calibre-web/kindlegen`
and is not directly included in the image anymore
* ownership of symlink of `app.db`, `gdrive.db` and `kindlegen` is changed from _root_ to the _calibre_ user & group

__Example:__
```
docker create --name=calibre-web --restart=always \
-v /volume1/books/calibre:/books \
-v /volume1/docker/apps/calibre-web/app:/calibre-web/app \
-v /volume1/docker/apps/calibre-web/config:/calibre-web/config \
-v /volume1/docker/apps/calibre-web/kindlegen:/calibre-web/kindlegen \
-e PGID=65539 -e PUID=1029 \
-p 8083:8083 \
technosoft2000/calibre-web
```

**2017-11-04 - v1.1.10**

* added support for a configuration directory (as asked in ticket #13),
Expand Down
26 changes: 13 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM technosoft2000/alpine-base:3.6-3
MAINTAINER Technosoft2000 <technosoft2000@gmx.net>
LABEL image.version="1.1.10" \
LABEL image.version="1.1.11" \
image.description="Docker image for Calibre Web, based on docker image of Alpine" \
image.date="2017-11-04" \
image.date="2018-04-14" \
url.docker="https://hub.docker.com/r/technosoft2000/calibre-web" \
url.github="https://github.com/Technosoft2000/docker-calibre-web" \
url.support="https://cytec.us/forum"

# Set basic environment settings
ENV \
# - VERSION: the docker image version (corresponds to the above LABEL image.version)
VERSION="1.1.10" \
VERSION="1.1.11" \

# - PUSER, PGROUP: the APP user and group name
PUSER="calibre" \
Expand Down Expand Up @@ -65,17 +65,19 @@ RUN \

# install additional python packages:
### REQUIRED ###
### see https://github.com/janeczku/calibre-web/blob/master/requirements.txt
pip --no-cache-dir install --upgrade \
pip setuptools \
pyopenssl babel \
flask flask-babel flask-login flask-principal \
iso-639 pypdf2 pytz requests \
sqlalchemy tornado wand unidecode \
pyopenssl Babel \
Flask Flask-Babel Flask-Login Flask-Principal \
iso-639 PyPDF2 pytz requests \
SQLAlchemy tornado Wand unidecode \
### OPTIONAL ###
### https://github.com/janeczku/calibre-web/blob/master/optional-requirements.txt
gevent google-api-python-client greenlet \
httplib2 lxml oauth2client \
pyasn1-modules pyasn1 pydrive pyyaml \
rsa six uritemplate \
rsa six uritemplate goodreads python-Levenshtein\
&& \

# get actual ImageMagic 6 version info
Expand Down Expand Up @@ -126,11 +128,6 @@ RUN \
# create Calibre Web folder structure
mkdir -p $APP_HOME/app && \

# download and install kindlegen (Amazon Kindle Generator)
mkdir -p $APP_HOME/kindlegen && \
wget $AMAZON_KG_URL -P /tmp && \
tar -xzf /tmp/$AMAZON_KG_TAR -C $APP_HOME/kindlegen && \

# cleanup temporary files
rm -rf /tmp && \
rm -rf /var/cache/apk/*
Expand All @@ -147,6 +144,9 @@ COPY calibre-init /init/calibre-init

# Set volumes for the Calibre Web folder structure
VOLUME /books
VOLUME $APP_HOME/app
VOLUME $APP_HOME/config
VOLUME $APP_HOME/kindlegen

# Expose ports
EXPOSE 8083
65 changes: 59 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,32 @@ And if you are interested in the original __Calibre__ ebook management tool then

## Updates ##

**2017-11-04 - v1.1.10**

* added support for a configuration directory (as asked in ticket #13),
where the configuration related files like `app.db` and `gdrive.db` will be stored;
be aware that `metadata.db` will be still stored at the books directory which is required by the original Calibre application
* new options `-v <your Calibre Web config folder>:/calibre-web/config` and `-e USE_CONFIG_DIR=true` to setup the configuration directory
**2018-04-14 - v1.1.11**

* exposed additional directories (see ticket #24)
`-v /calibre-web/app` - local path for Calibre Web application files
`-v /calibre-web/kindlegen` - local path for Calibre Web kindlegen application
* added support for setting the Calibre Web application folder (see ticket #27);
map volume `-v /calibre-web/app` if you want to use Google Drive
* updated python `requirements` and `optional requirements`at dockerfile according to
- https://github.com/janeczku/calibre-web/blob/master/requirements.txt
- https://github.com/janeczku/calibre-web/blob/master/optional-requirements.txt
* added __Container Directory Structure__ information at README.md (see ticket #24)
* kindlegen archive will be downloaded on container startup into `/calibre-web/kindlegen`
and is not directly included in the image anymore
* ownership of symlink of `app.db`, `gdrive.db` and `kindlegen` is changed from _root_ to the _calibre_ user & group

__Example:__
```
docker create --name=calibre-web --restart=always \
-v /volume1/books/calibre:/books \
-v /volume1/docker/apps/calibre-web/app:/calibre-web/app \
-v /volume1/docker/apps/calibre-web/config:/calibre-web/config \
-v /volume1/docker/apps/calibre-web/kindlegen:/calibre-web/kindlegen \
-e PGID=65539 -e PUID=1029 \
-p 8083:8083 \
technosoft2000/calibre-web
```

For previous changes see at [full changelog](CHANGELOG.md).

Expand Down Expand Up @@ -84,6 +104,8 @@ __Create the container:__
```
docker create --name=calibre-web --restart=always \
-v <your Calibre books folder>:/books \
[-v <your Calibre Web application folder>:/calibre-web/app] \
[-v <your Calibre Web kindlegen folder>:/calibre-web/kindlegen`]
[-v <your Calibre Web config folder>:/calibre-web/config \]
[-e USE_CONFIG_DIR=true \]
[-e APP_REPO=https://github.com/janeczku/calibre-web.git \]
Expand Down Expand Up @@ -137,6 +159,8 @@ Accessing http://'host':8080 (e.g. http://192.168.0.10:8080) would then show you
### Details ###
* `-p 8083` - http port for the web user interface
* `-v /books` - local path which contains the Calibre books and the necessary `metadata.db` which holds all collected meta-information of the books
* `-v /calibre-web/app` - local path for Calibre Web application files; set this volume if you want to use Google Drive
* `-v /calibre-web/kindlegen` - local path for Calibre Web kindlegen application
* `-v /etc/localhost` - for timesync - __optional__
* `-v /calibre-web/config` - local path for Calibre Web config files, like `app.db` and `gdrive.db`; **IMPORTANT**: the environment variable `USE_CONFIG_DIR` must be set to `true` - __optional__
* `-e USE_CONFIG_DIR=true` - activate the usage of a dedicated configuration directory, otherwise the `books` directory will be used (default) - __optional__
Expand Down Expand Up @@ -177,6 +201,35 @@ In this instance PUID=1001 and PGID=1001. To find yours use id user as below:
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
```

## Container Directory Structure ##
```
/
|- books
|- calibre-web
|- app
| |- "all Calibre Web Application files"
| |- app.db -> /calibre-web/config/app.db
| |- gdrive.db -> /calibre-web/config/gdrive.db
| |- calibre-web.log
| |- cps
| | |- *.py
| | |- *.pyc
| |
| |- vendor
| |- kindlegen -> /calibre-web/kindlegen/kindlegen
|
|- config
| |- app.db
| |- gdrive.db
|
|- kindlegen
|- EULA*.txt
|- KindleGen Legal Notices*.txt
|- docs
|- kindlegen
|- manual.html
```

## Additional ##
Shell access whilst the container is running: `docker exec -it calibre-web /bin/bash`

Expand Down
28 changes: 28 additions & 0 deletions get_or_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ if [[ $ACCESS == "yes" ]]; then
else
echo "> create 'app.db' link $APPDB_LINK assigned to source $APPDB_SRC"
ln -s $APPDB_SRC $APPDB_LINK
echo "> change the ownership of $APPDB_LINK to $PUSER:$PGROUP"
chown -h $PUSER:$PGROUP $APPDB_LINK
fi

GDRIVEDB_SRC="$CONFIG_DIR/gdrive.db"
Expand All @@ -103,6 +105,8 @@ if [[ $ACCESS == "yes" ]]; then
else
echo "> create 'gdrive.db' link $GDRIVEDB_LINK assigned to source $GDRIVEDB_SRC"
ln -s $GDRIVEDB_SRC $GDRIVEDB_LINK
echo "> change the ownership of $GDRIVEDB_LINK to $PUSER:$PGROUP"
chown -h $PUSER:$PGROUP $GDRIVEDB_LINK
fi

else
Expand Down Expand Up @@ -184,6 +188,28 @@ else
echo "> Please check and modify the permissions of the directory"
fi

# create the kindlegen directory if it doesn't exist
if [[ ! -d $APP_HOME/kindlegen ]]; then
echo "[INFO] Creating the kindlegen directory: $APP_HOME/kindlegen"
mkdir -p $APP_HOME/kindlegen
echo "[INFO] Change the ownership of $APP_HOME/kindlegen (including subfolders) to $PUSER:$PGROUP"
chown -R $PUSER:$PGROUP $APP_HOME/kindlegen
else
echo "[INFO] The kindlegen directory exist already and will be used: $APP_HOME/kindlegen"
fi

# download and install kindlegen (Amazon Kindle Generator)
if [[ ! -f $APP_HOME/kindlegen/kindlegen ]]; then
echo "[INFO] Downloading kindlegen from $AMAZON_KG_URL into directory: $APP_HOME/kindlegen/$AMAZON_KG_TAR"
wget $AMAZON_KG_URL -P $APP_HOME/kindlegen
echo "[INFO] Extracting $AMAZON_KG_TAR into directory: $APP_HOME/kindlegen"
tar -xzf $APP_HOME/kindlegen/$AMAZON_KG_TAR -C $APP_HOME/kindlegen
echo "[INFO] Change the ownership of $APP_HOME/kindlegen (including subfolders) to $PUSER:$PGROUP"
chown -R $PUSER:$PGROUP $APP_HOME/kindlegen
else
echo "[INFO] Kindlegen application exists already in directory: $APP_HOME/kindlegen"
fi

# create symlink for kindlegen (Amazon Kindle Generator)
KINDLEGEN_DIR="$APP_HOME/kindlegen"
VENDOR_DIR="$APP_HOME/app/vendor"
Expand All @@ -202,6 +228,8 @@ else
fi
echo "> create kindlegen link $KINDLEGEN_LINK assigned to source $KINDLEGEN_SRC"
ln -s $KINDLEGEN_SRC $KINDLEGEN_LINK
echo "> change the ownership of $KINDLEGEN_LINK to $PUSER:$PGROUP"
chown -h $PUSER:$PGROUP $KINDLEGEN_LINK
fi

# check if a /tmp directory is available, if not create one
Expand Down

0 comments on commit a298378

Please sign in to comment.