This commit is contained in:
Aaron Reisman 2024-10-22 09:54:15 -05:00
parent 9825e2b552
commit 9ed6c1fd0d
2 changed files with 5 additions and 12 deletions

View File

@ -49,7 +49,7 @@ update_settings() {
is_mounted() { is_mounted() {
DIR=$1 DIR=$1
if mount | grep -q "${DIR}"; if grep -qs "${DIR} " /proc/mounts;
then then
return 0 return 0
else else
@ -80,13 +80,6 @@ run() {
} }
main() { main() {
# TERM isn't set by default in docker images
if [[ -z ${TERM} || ${TERM} = "dumb" ]]; then
TERM=xterm-256color
fi
info ${TERM}
info "initializing libation" info "initializing libation"
init_config_file AccountsSettings.json init_config_file AccountsSettings.json
init_config_file Settings.json init_config_file Settings.json
@ -98,7 +91,7 @@ main() {
info "loading database" info "loading database"
FILE=LibationContext.db FILE=LibationContext.db
# If user provides a separate database mount, use that # If user provides a separate database mount, use that
if is_mounted ${LIBATION_DB_DIR}; if is_mounted "${LIBATION_DB_DIR}";
then then
debug "using database directory ${LIBATION_DB_DIR}" debug "using database directory ${LIBATION_DB_DIR}"
if [ -f "${LIBATION_DB_DIR}/${FILE}" ]; then if [ -f "${LIBATION_DB_DIR}/${FILE}" ]; then
@ -119,7 +112,7 @@ main() {
fi fi
# Try to warn if books dir wasn't mounted in # Try to warn if books dir wasn't mounted in
if ! is_mounted ${LIBATION_BOOKS_DIR}; if ! is_mounted "${LIBATION_BOOKS_DIR}";
then then
warn "${LIBATION_BOOKS_DIR} does not appear to be mounted, books will not be saved" warn "${LIBATION_BOOKS_DIR} does not appear to be mounted, books will not be saved"
fi fi

View File

@ -44,7 +44,7 @@ sudo docker run -d \
| SLEEP_TIME | -1 | Length of time to sleep before doing another scan/download. Set to -1 to run one. | | SLEEP_TIME | -1 | Length of time to sleep before doing another scan/download. Set to -1 to run one. |
| LIBATION_BOOKS_DIR | /data | Folder where books will be saved | | LIBATION_BOOKS_DIR | /data | Folder where books will be saved |
| LIBATION_CONFIG_DIR | /config | Folder to read configuration from. | | LIBATION_CONFIG_DIR | /config | Folder to read configuration from. |
| LIBATION_DB_DIR | /db | Optional folder to load database from. If not present, will load database from `LIBATION_CONFIG_DIR`. | | LIBATION_DB_DIR | /db | Optional folder to load database from. If not mounted, will load database from `LIBATION_CONFIG_DIR`. |
### User ### User
This docker image runs as user `1001`. In order for the image to function properly, user `1001` must be able to read and write the volumes that are mounted in. If they are not, you will see errors This docker image runs as user `1001`. In order for the image to function properly, user `1001` must be able to read and write the volumes that are mounted in. If they are not, you will see errors
@ -62,4 +62,4 @@ sudo docker run -d \
``` ```
### Advanced Database Options ### Advanced Database Options
The docker image supports an optional database mount location defined by `LIBATION_DB_DIR`. This allows the database to be mounted as read/write, while allowing the rest of the configuration files to be mounted as read only. This is specifically useful if running in Kubernetes where you can use Configmaps and Secrets to define the configuration. The image will attempt to load the database first from `LIBATION_DB_DIR`, then from `LIBATION_CONFIG_DIR`, and finally it will try to create a new database in `LIBATION_CONFIG_DIR`. The docker image supports an optional database mount location defined by `LIBATION_DB_DIR`. This allows the database to be mounted as read/write, while allowing the rest of the configuration files to be mounted as read only. This is specifically useful if running in Kubernetes where you can use Configmaps and Secrets to define the configuration. If the `LIBATION_DB_DIR` is mounted, it will be used, otherwise it will look for the database in `LIBATION_CONFIG_DIR`. If it does not find the database in the expected location, it will attempt to make an empty database there.