How semaphoreui/semaphore works
Main Components
• Frontend: Located in the “web” directory, this is a Vue.js–based web application with its source files (App.vue, components, views, assets, etc.), configurations, and tests.
• Backend/API: Found in the “api” directory, this is the core server-side functionality (routing, authentication, tasks, projects, integrations, etc.) written in Go.
• CLI: The “cli” directory shows command-line functionalities for management tasks (migrations, runner setup, server start, user management, etc.).
• Database Layer: The “db” and “db_lib” directories illustrate two approaches (Bolt and SQL) for database/storage integration including migrations and data access for tokens, tasks, projects, users, etc.
• Services: The “services” directory contains subdirectories for projects, runners, schedules, and tasks, indicating additional business logic and orchestration layers (e.g., job pools, scheduler, task runners).
• Supporting Utilities and Libraries: Under “pkg”, “util”, and hook stubs (as seen in .dredd and hook_helpers) there are reusable libraries for SSH, randomness, error logging, and mailing.
• Deployment & Containerization: The “deployment” directory (with Docker compose, Dockerfiles, systemd service files, etc.) sets up how the application is packaged and deployed in different environments.
• Testing and CI/CD: Multiple files and directories (like tests in “web/tests”, .github/workflows configurations, Codacy, and goreleaser files) reveal support for automated testing/delivery.
Relationships & Interactions
• The Frontend interacts with the Backend via HTTP/REST APIs (and potentially websockets as indicated in “api/sockets” and “web/src/socket.js”).
• The Backend communicates with the Database layer abstracted by “db” (both Bolt and SQL implementations) for data persistence.
• The CLI provides alternative access to the same core functionalities as the API, likely interacting with the database or invoking API endpoints.
• The “services” layer encapsulates logic for project management, runner jobs, scheduling, and task execution – interactions that the API relies upon.
• Deployment orchestration is achieved via Docker, Docker Compose, and potentially systemd, setting up independent containers or processes for the backend server, runner components, and storage.
• External integrations or hooks (see “.dredd/hooks” and “hook_helpers”) enable custom capabilities and event handling within the system.
Architectural Patterns & Design Principles
• The project appears to follow a separation-of-concerns model by splitting the UI from backend logic.
• Microservice or modular patterns are used, with directories for “cli”, “services”, and “api” suggesting loosely coupled components.
• There is a clear domain-driven design around key concepts (Projects, Tasks, Schedules, Inventory, etc.) representing user workflows.
• The use of multiple deployment configurations (Docker Compose, systemd, etc.) indicates an emphasis on adaptability to different environments.
Relevant Technologies
• Programming Language: Go (back end) and Vue.js (front end).
• Database: Options for Bolt and SQL.
• Containerization & Deployment: Docker, Docker Compose, systemd.
• Additional Tools: Dredd for API testing, various CI/CD configurations from GitHub Actions, and code quality settings (Codacy).