2018-02-20 09:20:12 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2018-12-17 18:36:59 +00:00
|
|
|
source "${BASH_SOURCE%/*}/_realpath"
|
|
|
|
|
2018-02-20 09:20:12 +00:00
|
|
|
CMD="$(realpath "$0")"
|
|
|
|
DIR="$(dirname "${CMD}")"
|
|
|
|
BASE_DIR="$(dirname "${DIR}")"
|
|
|
|
CONFIG_DIR="${BASE_DIR}/config"
|
|
|
|
|
|
|
|
echo_bold() {
|
|
|
|
printf "\\033[1m%s\\033[0m\\n" "$@"
|
|
|
|
}
|
|
|
|
|
2019-03-15 15:14:57 +00:00
|
|
|
VERSIONS_FILE="${BASE_DIR}/compose/versions"
|
|
|
|
if [ ! -f "$VERSIONS_FILE" ]; then
|
|
|
|
echo_bold "No service versions defined in ${VERSIONS_FILE}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-02-20 09:20:12 +00:00
|
|
|
ENV_FILE="${CONFIG_DIR}/activate"
|
|
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
|
|
echo_bold 'No configuration found; please create one first with: ./scripts/quickstart'
|
|
|
|
echo_bold 'See README.md for help.'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-07-30 09:59:30 +00:00
|
|
|
source "${ENV_FILE}"
|
|
|
|
|
|
|
|
# only include the MDNS publisher IF the domain is valid...
|
|
|
|
if [ ${OPENBALENA_HOST_NAME: -6} == ".local" ]; then
|
|
|
|
INCLUDE_MDNS="-f ${BASE_DIR}/compose/mdns.yml"
|
|
|
|
fi
|
|
|
|
|
2018-02-20 09:20:12 +00:00
|
|
|
# shellcheck source=/dev/null
|
2019-07-30 09:59:30 +00:00
|
|
|
source "${VERSIONS_FILE}"; docker-compose \
|
2018-02-20 09:20:12 +00:00
|
|
|
--project-name 'openbalena' \
|
|
|
|
-f "${BASE_DIR}/compose/services.yml" \
|
2019-07-30 09:59:30 +00:00
|
|
|
${INCLUDE_MDNS} \
|
2018-02-20 09:20:12 +00:00
|
|
|
-f "${CONFIG_DIR}/docker-compose.yml" \
|
|
|
|
"$@"
|