Panels
In BUG, each panel represents an instance of a module. Panels are run in their own Docker containers, which are built and managed using Dockerode, a Node.js library for interacting with the Docker API.
Adding a Panel
When a new panel is added:
- Build the module’s container if it hasn’t been built yet.
- Each module type has a container folder used to generate the Docker image.
- Create the container using Dockerode.
- Container configuration includes environment variables, network settings, and volume mounts.
- Start the container so it begins running the module’s service.
- Enable the panel through the enable/disable route.
- This registers the panel with the UI and makes it available for users.
Enabling a Panel
When a panel is enabled:
- Start the container if it is not already running.
- Show the panel in the UI, making it accessible to users.
- All of this is handled in the enable/disable API route.
Disabling a Panel
When a panel is disabled:
- Stop the container to free up system resources.
- Remove it from the UI, so users no longer see or interact with it.
- This is also handled in the enable/disable API route.
Notes on Panel Management
- Each panel runs in a separate Docker container, isolating it from other panels and the main BUG server.
- Dockerode is used for all container operations (build, create, start, stop, remove).
- Panel enable/disable logic ensures that containers are only running when needed, improving scalability and performance.
- The UI does not communicate directly with containers for startup — all interactions happen through the main server API.