Ubuntu 24.04 LTS conformance mods
* docker-compose-v2 compatibility * MySQL/MariaDB dual comaptibility ACME client minor upgrade
This commit is contained in:
@ -8,6 +8,10 @@
|
||||
#
|
||||
# Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
|
||||
# License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
# 2024-08-24 v1.1
|
||||
# new: docker-compose v2 compatibility - tested with Ubuntu 24.04 LTS.
|
||||
# 2023-06-18 v1.0
|
||||
# new: forked from the "Smartfront's DOCKER_skeleton" repository.
|
||||
# 2021-09-02 v0.1 Initial release
|
||||
|
||||
# Accepted environment variables and their defaults.
|
||||
@ -27,12 +31,27 @@ MSG_MISSINGYML="Fatal: didn't find the docker-compose.yml file"
|
||||
# Checks the dependencies.
|
||||
TR=$(which tr 2>/dev/null)
|
||||
if [ -z "$TR" ]; then echo "$MSG_MISSINGDEP tr."; exit 1 ; fi
|
||||
for item in dirname docker-compose readlink
|
||||
for item in dirname docker readlink
|
||||
do
|
||||
if [ -n "$(which $item)" ]
|
||||
then export $(echo $item | "$TR" '[:lower:]' '[:upper:]' | "$TR" '-' '_')=$(which $item)
|
||||
else echo "$MSG_MISSINGDEP $item." >&2; exit 1; fi
|
||||
done
|
||||
# All dependencies are available via "$THECOMMAND" (upper case) call.
|
||||
#
|
||||
# Let's find which version of docker-compose is installed.
|
||||
if [ $($DOCKER compose version 2>&1 >/dev/null; echo $?) -eq 0 ]; then
|
||||
# We'll use v2 if it is available.
|
||||
DOCKER_COMPOSE="$DOCKER"
|
||||
commandstring="compose"
|
||||
else
|
||||
# Otherwise falling back to v1.
|
||||
DOCKER_COMPOSE="$(which docker-compose)"
|
||||
commandstring=""
|
||||
fi
|
||||
# One of the two is mandatory.
|
||||
if [ -z "$DOCKER_COMPOSE" ];then echo "$MSG_MISSINGDEP docker-compose" >&2; exit 1; fi
|
||||
# Below docker-compose should be called as "$DOCKER_COMPOSE" $commandstring sequence.
|
||||
|
||||
# Where I'm?
|
||||
# https://gist.github.com/TheMengzor/968e5ea87e99d9c41782
|
||||
@ -63,24 +82,24 @@ if [ -z "$BASE_DIR" -o ! -r "$BASE_DIR/$YMLFILE" ]; then
|
||||
fi
|
||||
|
||||
# Doesn't start if it is already running.
|
||||
if [ -n "$(cd "$BASE_DIR"; "$DOCKER_COMPOSE" ps --services --filter "status=running")" ]; then
|
||||
if [ -n "$(cd "$BASE_DIR"; "$DOCKER_COMPOSE" $commandstring ps --services --filter "status=running")" ]; then
|
||||
echo "$MSG_ALREADYRUN" >&2; exit 1
|
||||
fi
|
||||
# Starts the service.
|
||||
(cd "$BASE_DIR"; "$DOCKER_COMPOSE" up -d)
|
||||
(cd "$BASE_DIR"; "$DOCKER_COMPOSE" $commandstring up -d)
|
||||
|
||||
|
||||
# Starts the logger - this/these process(es) will automatically terminate
|
||||
# when the docker-compose stops.
|
||||
if [ -n "$PAR_AGGLOGS" ]; then
|
||||
# Aggregated logs
|
||||
(cd "$BASE_DIR"; "$DOCKER_COMPOSE" logs --no-color -t -f >> "$BASE_DIR/$LOGFILE" &)
|
||||
(cd "$BASE_DIR"; "$DOCKER_COMPOSE" $commandstring logs --no-color -t -f >> "$BASE_DIR/$LOGFILE" &)
|
||||
else
|
||||
# Separate logs, each for every running service.
|
||||
for service in $(cd "$BASE_DIR"; "$DOCKER_COMPOSE" ps --services) ""
|
||||
for service in $(cd "$BASE_DIR"; "$DOCKER_COMPOSE" $commandstring ps --services) ""
|
||||
do
|
||||
if [ -n "$service" ]; then
|
||||
(cd "$BASE_DIR"; "$DOCKER_COMPOSE" logs --no-color -t -f $service >> "$BASE_DIR/$LOGDIR/$service.log" &)
|
||||
(cd "$BASE_DIR"; "$DOCKER_COMPOSE" $commandstring logs --no-color -t -f $service >> "$BASE_DIR/$LOGDIR/$service.log" &)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
Reference in New Issue
Block a user