Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .env.custom.sample
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ CALIBRE_CALIBRE_PASSWORD=changeme
# Flood Password for Deluge RPC daemon
FLOOD_FLOOD_PASSWORD=changeme

# Please ensure you encrypt your password first using this command:
# docker run -it --rm --entrypoint htpasswd ubuntu/apache2 -nbB admin your_password | cut -d ":" -f 2 | sed -e s/\\$/\\$\\$/g
PORTAINER_PORTAINER_ADMIN_PASSWORD=changeme

# Nextcloud
NEXTCLOUD_NEXTCLOUD_ADMIN_USER=admin # you can change it
NEXTCLOUD_NEXTCLOUD_ADMIN_PASSWORD=changeme
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# v2.2.1 (The little Flame 🔥)

> Bugfix release due to errors on some services after v2.2 release.

## Bugfixes and improvements ⚙️

* [**Portainer**] Remove ``admin`` password auto-configuration. Password is now set on first installation via GUI.
* [**Flood** | **MariaDB** | **Calibre**] Fix variables not taken into account (fix #61)
* Services which used a ``command`` with environment variables were broken since v2.2 release because app-specific env files are injected with env_file directive in Docker Compose, but some services cannot read from environment variables in their command.

# v2.2 (The Flame 🔥)

## What's new?

### New services 💫

* ``qBittorrent``: [Torrends downloader](https://github.com/qbittorrent/qBittorrent)
* ``qBittorrent``: [Torrents downloader](https://github.com/qbittorrent/qBittorrent)
* Use of ``hotio`` build ([documentation here](https://hotio.dev/containers/qbittorrent/)) with VueTorrent and native VPN support (for those who want to avoid gluetun configuration)
* Use of qBittorrent is recommended over Deluge as the project is more active and its alternative UI setup is easier (no separate container).
* ``Filebrowser``: [Lightweight filebrowser](https://github.com/filebrowser/filebrowser)
Expand Down
63 changes: 62 additions & 1 deletion run-seedbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ done

cleanup_on_exit() {
rm -f rules.props *-vpn.props *-envfile.props config.json
[[ -d env ]] && rm -f env/*.tmp
}
trap cleanup_on_exit EXIT

Expand Down Expand Up @@ -255,6 +256,8 @@ rm -f services/generated/*-vpn.yaml

ALL_SERVICES="-f docker-compose.yaml"

GLOBAL_ENV_FILE=".env"

# Parse the config.yaml master configuration file
for json in $(yq eval -o json config.yaml | jq -c ".services[]"); do
name=$(echo $json | jq -r .name)
Expand Down Expand Up @@ -304,6 +307,63 @@ for json in $(yq eval -o json config.yaml | jq -c ".services[]"); do
fi
fi

###### For services which have "command" field with environment variables ######
var_in_cmd_detected="0"
if [[ $(yq ".services.${name}.command[]" services/${file} | { grep "\\$.*\}" || true; } | wc -l) -gt 0 ]]; then
var_in_cmd_detected="1"
echo-debug "[$0] Service ${name} has a command with environment variables..."
# Extract variable names to test them
yq ".services.${name}.command[]" services/${file} | { grep "\\$.*\}" || true; } | sed -n -e 's/.*${\(\w\+\)}.*/\1/p' > env/${name}-cmd.env.1.tmp
(
# Check if these variables are defined in generated .env files (global or custom)
set -a
source ./env/${name}.env
source .env
set +a
while read p; do
# If the command references a variable which is not known, throw an error
if [[ -z ${!p+x} ]]; then
echo "ERROR. Variable \"$p\" is referenced in \"command\" for service ${name} (file $file) but this variable is not defined in .env (or in .env.custom with prefix \"${name^^}_\"). Please correct it or add a variable which will be used."
exit 1
fi
done < env/${name}-cmd.env.1.tmp

# Does not work for now because of how docker handles merges for arrays. Original values with variables stay.
# Disabled for now
if [[ "0" == "1" ]]; then
# Extract command block from original service yaml file
yq ".services.${name}.command[]" services/${file} > env/${name}-cmd.env.2.tmp
# Envsubst this file
envsubst < env/${name}-cmd.env.2.tmp > env/${name}-cmd.env.3.tmp
# Convert this file to a props file, used to source a new proper YAML file
i=0
while read line; do
echo "services.${name}.command.$i: $line" >> env/${name}-cmd.env.4.tmp
i=$((i+1))
done < env/${name}-cmd.env.3.tmp
# Generate a proper override file with substituted variables
yq -p=props env/${name}-cmd.env.4.tmp -o yaml > services/generated/${name}-command.yaml
fi
)
rm -f env/*.tmp
# echo-debug "[$0] Adding override file for service ${name} / command with subsituted environment variables..."
# ALL_SERVICES="${ALL_SERVICES} -f services/generated/${name}-command.yaml"
fi

# Handle case for command in a single line, not in array
if [[ $(yq ".services.${name}.command" services/${file} | { grep "\\$.*\}" || true; } | wc -l) -gt 0 ]]; then
var_in_cmd_detected="1"
fi

# Workaround for now
if [[ "${var_in_cmd_detected}" == "1" ]]; then
cat ${GLOBAL_ENV_FILE} ./env/${name}.env >> .env.concat.tmp
rm -f .env.concat
mv .env.concat.tmp .env.concat
export GLOBAL_ENV_FILE=".env.concat"
var_in_cmd_detected="0"
fi

###################################### TRAEFIK RULES ######################################

# Skip this part for services which have Traefik rules disabled in config
Expand Down Expand Up @@ -397,8 +457,9 @@ if [[ "${SKIP_PULL}" != "1" ]]; then
fi

echo "[$0] ***** Recreating containers if required... *****"
${DOCKER_COMPOSE_BINARY} ${ALL_SERVICES} up -d --remove-orphans
${DOCKER_COMPOSE_BINARY} --env-file ${GLOBAL_ENV_FILE} ${ALL_SERVICES} up -d --remove-orphans
echo "[$0] ***** Done updating containers *****"
rm -f .env.concat

echo "[$0] ***** Clean unused images and volumes... *****"
docker image prune -af
Expand Down
4 changes: 0 additions & 4 deletions services/mariadb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ services:
user: ${PUID}:${PGID}
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- TZ=${TZ}
volumes:
- nextclouddb:/var/lib/mysql
Expand Down
2 changes: 1 addition & 1 deletion services/portainer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ services:
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --admin-password ${PORTAINER_ADMIN_PASSWORD} --host=unix:///var/run/docker.sock
command: --host=unix:///var/run/docker.sock