Docker Watchdog¶
- File location:
Bundled implementation:
source/server/python/compose.py
Cluster implementation:
cluster/daemon/python/compose.py
This module provides a handy way to always keep the underlying BroAPT system in Docker containers running.
- compose.docker_compose()¶
A context to manager Docker containers. This function will start
watch_container()
as a background process.Note
When start, the function will start the Docker containers through
start_container()
.Before exit, the function will toggle the value of
UP_FLAG
toFalse
and wait for the process to exit. And gracefully stop the Docker containers throughstop_container()
.
- compose.watch_container()¶
Supervise the status of Docker containers while the system is running, i.e.
UP_FLAG
isTrue
.- Raises:
ComposeWarning – If fail to poll status of Docker containers.
- compose.start_container()¶
Start Docker container using Docker Compose in detached mode.
- compose.stop_container()¶
Stop Docker container gracefully using Docker Compose, and clean up Docker caches.
- compose.flask_exit(signum: signal.Signals | None = None, frame: types.FrameType | None = None)¶
Flask exit signal handler. This function is registered as handler for
const.KILL_SIGNAL
throughregister()
.
- compose.register()¶
Register
flask_exit()
as signal handler ofconst.KILL_SIGNAL
.
- compose.UP_FLAG = multiprocessing.Value('B', True)¶
If the BroAPT system is actively running.
- exception compose.ComposeWarning¶
- Bases:
Warning
Warn if fail to poll status of Docker containers.