mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-12 21:52:57 +00:00
dind: add logs action, move all container management code into Makefile
This commit is contained in:
parent
1aca595eb2
commit
21003ba467
2
Makefile
2
Makefile
@ -90,7 +90,7 @@ stop-supervisor:
|
||||
-docker stop resin_supervisor_1 > /dev/null || true
|
||||
-docker rm -f --volumes resin_supervisor_1 > /dev/null || true
|
||||
|
||||
refresh-supervisor:
|
||||
refresh-supervisor-src:
|
||||
echo " * Compiling CoffeeScript.." \
|
||||
&& coffee -c ./src \
|
||||
&& echo " * Restarting supervisor container.." \
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
# set -o xtrace
|
||||
|
||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
SUPERVISOR_BASE_DIR="${DIR}/../.."
|
||||
@ -12,6 +11,12 @@ SUPERVISOR_IMAGE=${SUPERVISOR_IMAGE:-"registry.resindev.io/resin/${ARCH}-supervi
|
||||
PASSWORDLESS_DROPBEAR=${PASSWORDLESS_DROPBEAR:-"false"}
|
||||
SUPERVISOR_EXTRA_MOUNTS=
|
||||
|
||||
SUPERVISOR_LOGS=(
|
||||
'/var/log/supervisor-log/go_supervisor_stdout.log'
|
||||
'/var/log/supervisor-log/resin_supervisor_stdout.log'
|
||||
'/var/log/supervisor-log/supervisor/supervisord.log'
|
||||
)
|
||||
|
||||
function showHelp {
|
||||
echo
|
||||
echo " This script can be used to facilitate supervisor development. Its core feature is allowing"
|
||||
@ -30,9 +35,10 @@ function showHelp {
|
||||
echo " PASSWORDLESS_DROPBEAR [=false]"
|
||||
echo " Actions:"
|
||||
echo " deploy build and deploy local supervisor image - you can override registry/image name with 'SUPERVISOR_IMAGE'"
|
||||
echo " run [options] build dind supervisor host container, run it, then pull the configured 'SUPERVISOR_IMAGE' and run it"
|
||||
echo " run [options] build dind host container, run it, then pull the configured 'SUPERVISOR_IMAGE' into the dind host and run it"
|
||||
echo " deployrun [options] run 'deploy' and then immediately 'run' the deployed container"
|
||||
echo " refresh recompile sources in './src' with 'coffee -c' and restart supervisor container on dind host"
|
||||
echo " logs [-f] print out supervisor log files - use '-f' to follow instead"
|
||||
echo " stop stop dind supervisor host container"
|
||||
echo " Options:"
|
||||
echo " --mount-src bind-mount './src/' from local development environment into supervisor container"
|
||||
@ -62,6 +68,7 @@ function runDind {
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Warning: unknown argument: $arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@ -74,20 +81,35 @@ function runDind {
|
||||
run-supervisor
|
||||
}
|
||||
|
||||
case $1 in
|
||||
function logs {
|
||||
if [ "$1" = "-f" ]; then
|
||||
docker exec -ti resin_supervisor_1 tail -f ${SUPERVISOR_LOGS[@]}
|
||||
else
|
||||
for log in "${SUPERVISOR_LOGS[@]}"; do
|
||||
echo " == ${log} =="
|
||||
docker exec -ti resin_supervisor_1 cat "$log"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
action="$1"
|
||||
shift || true
|
||||
|
||||
case $action in
|
||||
deploy)
|
||||
deploySupervisor
|
||||
;;
|
||||
run)
|
||||
shift
|
||||
runDind "$@"
|
||||
;;
|
||||
deployrun)
|
||||
shift
|
||||
deploySupervisor && runDind "$@"
|
||||
;;
|
||||
refresh)
|
||||
make -C "$SUPERVISOR_BASE_DIR" refresh-supervisor
|
||||
make -C "$SUPERVISOR_BASE_DIR" refresh-supervisor-src
|
||||
;;
|
||||
logs)
|
||||
logs "$@"
|
||||
;;
|
||||
stop)
|
||||
make -C "$SUPERVISOR_BASE_DIR" stop-supervisor
|
||||
|
Loading…
x
Reference in New Issue
Block a user