[PHP-FPM] Filter containers by compose project name
parent
27b192d5c3
commit
ed3c58134b
|
@ -23,7 +23,7 @@ done
|
||||||
# Check mysql_upgrade (master and slave)
|
# Check mysql_upgrade (master and slave)
|
||||||
CONTAINER_ID=
|
CONTAINER_ID=
|
||||||
until [[ ! -z "${CONTAINER_ID}" ]] && [[ "${CONTAINER_ID}" =~ ^[[:alnum:]]*$ ]]; do
|
until [[ ! -z "${CONTAINER_ID}" ]] && [[ "${CONTAINER_ID}" =~ ^[[:alnum:]]*$ ]]; do
|
||||||
CONTAINER_ID=$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], id: .Id}" 2> /dev/null | jq -rc "select( .name | tostring | contains(\"mysql-mailcow\")) | .id" 2> /dev/null)
|
CONTAINER_ID=$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], project: .Config.Labels[\"com.docker.compose.project\"], id: .Id}" 2> /dev/null | jq -rc "select( .name | tostring | contains(\"mysql-mailcow\")) | select( .project | tostring | contains(\"${COMPOSE_PROJECT_NAME}\")) | .id" 2> /dev/null)
|
||||||
done
|
done
|
||||||
echo "MySQL @ ${CONTAINER_ID}"
|
echo "MySQL @ ${CONTAINER_ID}"
|
||||||
SQL_LOOP_C=0
|
SQL_LOOP_C=0
|
||||||
|
@ -58,7 +58,7 @@ done
|
||||||
|
|
||||||
# doing post-installation stuff, if SQL was upgraded (master and slave)
|
# doing post-installation stuff, if SQL was upgraded (master and slave)
|
||||||
if [ ${SQL_CHANGED} -eq 1 ]; then
|
if [ ${SQL_CHANGED} -eq 1 ]; then
|
||||||
POSTFIX=($(curl --silent --insecure https://dockerapi/containers/json | jq -r '.[] | {name: .Config.Labels["com.docker.compose.service"], id: .Id}' | jq -rc 'select( .name | tostring | contains("postfix-mailcow")) | .id' | tr "\n" " "))
|
POSTFIX=($(curl --silent --insecure https://dockerapi/containers/json | jq -r '.[] | {name: .Config.Labels["com.docker.compose.service"], project: .Config.Labels[\"com.docker.compose.project\"], id: .Id}' | jq -rc 'select( .name | tostring | contains("postfix-mailcow")) | select( .project | tostring | contains(\"${COMPOSE_PROJECT_NAME}\")) | .id' | tr "\n" " "))
|
||||||
if [[ -z ${POSTFIX} ]]; then
|
if [[ -z ${POSTFIX} ]]; then
|
||||||
echo "Could not determine Postfix container ID, skipping Postfix restart."
|
echo "Could not determine Postfix container ID, skipping Postfix restart."
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue