Introducing a new way to review your PRs.

Read the announcement

semaphoreui / semaphore

Modern UI and powerful API for Ansible, Terraform/OpenTofu/Terragrunt, PowerShell and other DevOps tools.

View on GitHub

21 documents · Updated Nov 23, 2026

docs / installation-and-operations

Installation and operations

Semaphore UI runs as a server or as a runner. Installation supplies a binary or container with a configuration source, durable data, and a database; operations then connect the HTTP service to users, runners, logs, metrics, and optional high-availability services.

Service roles

The server is the central web and task service. It loads configuration, connects to the database, runs migrations, starts schedulers and task workers, exposes the HTTP and WebSocket interfaces, and can coordinate several nodes through Redis when high availability is enabled. The runner is a separate process that polls the server for work and executes tasks on its host or in its selected executor. cli/…/root.go• L167-211, cli/…/root.go• L253-365

The main binary selects these roles through the command tree. It also provides shared controls for log level and debug output so operators can change runtime diagnostics without changing the service role. cli/…/root.go• L45-115

RoleCommandOperational purpose
Serversemaphore serverServe the UI and API and run local coordination services.
Runnersemaphore runner startConnect to a server and process assigned tasks.
Setupsemaphore setupCreate initial server configuration, migrate the database, and create an administrator.
Runner setupsemaphore runner setupCreate runner configuration and optionally register the runner.

References: cli/main.go• L1-9 cli/…/root.go• L45-127 cli/…/server.go• L10-20 cli/…/runner.go• L20-31 cli/…/setup.go• L20-80 cli/…/runner_setup.go• L11-44

Server startup

The server startup path turns configuration into a ready service. It loads the selected configuration, opens the store, applies database migrations, restores database-backed configuration, then starts the task, schedule, audit, WebSocket, and optional HA services before binding the HTTP listener. cli/…/root.go• L480-510, cli/…/root.go• L167-225, cli/…/root.go• L253-365

The startup sequence is:

  1. Resolve the configuration file and environment overrides.
  2. Connect to the selected database and apply migrations.
  3. Initialize encryption keys, JWT signing, audit handling, and optional HA Redis.
  4. Start task and schedule processing plus WebSocket delivery.
  5. Build the HTTP routes and bind the configured interface and port.

The server binds plain HTTP when TLS is disabled. When TLS is enabled it serves HTTPS with the configured certificate and key. An optional redirect listener accepts only safe read methods and sends clients to the HTTPS URL. cli/…/root.go• L405-477

Initial setup

The interactive setup command creates secrets, gathers the database and instance settings, saves a configuration file, runs migrations, and creates the first administrator. It prints the command used to launch the server with that file. cli/…/setup.go• L28-80

Container startup uses the same setup flow without a terminal. The server wrapper waits for an external database when needed, builds a temporary setup input from environment values, runs semaphore setup, and then replaces the wrapper with semaphore server. This gives a first-run container a repeatable bootstrap path while keeping later starts focused on service startup. deployment/docker/server/server-wrapper#L70-L151, deployment/docker/server/server-wrapper#L154-L249, deployment/docker/server/server-wrapper#L305-L313

Runner registration

Runner setup and startup support either a registration token or an existing runner token. Registration exchanges the bootstrap token for a durable runner token, which the runner then uses for later connections. A runner can also run once when its one-off setting is enabled. cli/…/runner_setup.go• L24-44, cli/…/runner_start.go• L20-48, util/config.go• L157-186

The registration relationship is:

sequenceDiagram
    participant Operator
    participant Runner
    participant Server
    Operator->>Runner: Start with registration token
    Runner->>Server: Register
    Server-->>Runner: Durable runner token
    Runner->>Server: Poll and report task progress
    Server-->>Runner: Assigned task

The server-side runners settings control how long missed heartbeats keep a runner offline or allow a running task to continue. These values must match the expected runner poll and network behavior. util/config.go• L278-305, config.schema.yaml• L904-931

References: cli/…/runner_setup.go• L24-44 cli/…/runner_start.go• L20-48 deployment/…/runner-wrapper• L16-28 util/config.go• L157-186 util/config.go• L933-991

Configuration model

Configuration is a JSON or YAML document represented by util.ConfigType. The loader combines a file, environment variables, defaults, and validation into one runtime configuration. SEMAPHORE_CONFIG_PATH or the global --config flag selects a file; without either, the loader checks the current directory and standard system configuration paths. --no-config skips the file. util/config.go• L649-864, util/config.go• L1060-1178

The command line also accepts --log-level and --debug-filter. Their environment forms are SEMAPHORE_LOG_LEVEL and SEMAPHORE_DEBUG_FILTER. The debug filter narrows only debug-level output, so it has no effect unless debug logging is active. cli/…/root.go• L56-106

The configuration schema groups settings by operational concern:

AreaMain settings
Service and storageDatabase dialect, database connection, bind interface, port, temporary paths, and Git behavior.
SecurityTLS, cookies, authentication, MFA, encryption keys, SSH trust, and JWT issuance.
ExecutionLocal runner settings, server runner-fleet policy, concurrency, task limits, and task environment.
IntegrationLDAP, OIDC, email and chat alerts, syslog, metrics, audit export, and subscriptions.
ResilienceHA mode, Redis or Redis Sentinel, node identity, and key reload behavior.

The schema is the reference for accepted names and shapes. Sensitive values can be supplied through environment variables or files where the configuration supports them. The loader rejects invalid values before the service starts, and it keeps compatibility paths for older settings such as the legacy secrets and runner registration fields. config.schema.yaml• L1-35, config.schema.yaml• L249-263, util/config.go• L1060-1129

Configuration precedence is operationally important: an explicit command flag selects the file, the selected file supplies structured values, environment variables override matching fields, and defaults fill unset fields. A configuration file is therefore not the only source of runtime behavior. util/config.go• L1060-1085, util/config.go• L1133-1178

References: util/config.go• L649-864 util/config.go• L1060-1178 util/config.go• L1254-1267 config.schema.yaml• L1-35 config.schema.yaml• L249-263 cli/…/root.go• L56-115

Client administration CLI

The semaphore client command is the operator interface for managing server and project resources through the API. It supports read and write actions for projects, task resources, users, runners, schedules, and the data that tasks need, so setup and repeatable operations do not require the web UI. cli/…/resources.go• L47-60, cli/…/resources.go• L665-729

The client resolves each target by numeric ID or by a case-insensitive name. Project resources use the selected project, global resources use the server, and runners can target either scope when --project is set. A name that matches more than one object stops the command and requires an ID. cli/…/resources.go• L63-117, cli/…/resources.go• L192-225, cli/…/resources.go• L472-518

Create and update actions can take flags or JSON/YAML input files. The client preserves fields that are not changed during an update, while secret values are read from files or standard input and are hidden from normal output. This keeps resource automation useful without making credentials part of shell history or command output. cli/…/mutate_resources.go• L26-37, cli/…/mutate_resources.go• L279-365, cli/…/mutate_resources.go• L388-461, cli/…/resources.go• L325-410

Task commands also provide an operational path from task launch to task outcome. Operators can start or rerun a task, wait for its final state, watch status changes, follow new log output, and stop or answer a task through the API. Wait and follow commands retry short network or server failures, but a timeout does not stop the server-side task unless the operator requests stop-on-interrupt behavior. cli/…/waiter.go• L18-45, cli/…/waiter.go• L66-122, cli/…/waiter.go• L269-301

Tasks that pause for confirmation can be approved or rejected from an interactive terminal. An unattended command can use --auto-reject; without a terminal or an answer, the client gives the operator a separate confirmation command instead of silently approving the task. The client sends each decision once while it waits for the server to move the task forward. cli/…/waiter.go• L125-228, cli/…/tasks_test.go• L271-448

The client request path connects operator input to the running server and returns either resource data or an operation result. This diagram shows the main relationship.

flowchart LR
    Operator[Operator or automation] --> Client[semaphore client]
    Client -->|authenticated API request| Server[Semaphore server]
    Server --> State[(Database and task state)]
    Server -->|resource or action result| Client

References: cli/…/resources.go• L15-37 cli/…/resources.go• L192-225 cli/…/mutate_resources.go• L739-833 cli/…/waiter.go• L41-122 cli/…/waiter.go• L142-228 cli/…/tasks_test.go• L202-269 cli/…/tasks_test.go• L271-448 cli/…/mutate_test.go• L158-204 cli/…/resources_test.go• L103-232

Operational integrations

The service exposes integration points for traffic, identity, task execution, observability, and cluster coordination. Each integration is enabled through configuration and participates in startup before the HTTP listener accepts requests.

IntegrationRole in operations
DatabaseStores persistent application state and receives startup migrations.
TLS and public URLProtects HTTP traffic and defines redirect and external callback behavior.
Redis or Redis SentinelShares HA state and coordinates nodes when HA is enabled.
Syslog and file logsSends service, event, and task records to external or rotating log sinks.
MetricsExposes the metrics endpoint with optional basic authentication.
Audit exportersSends audit records to configured external destinations.
WebSocket clientsReceives live task and system events from the running service.

Encryption keys are a live operational resource. The server can reload the configured key file on SIGHUP and can poll it for changes, so key rotation does not require a process restart. cli/…/root.go• L130-165, util/config.go• L579-587, config.schema.yaml• L266-283

In an HA deployment, every node must reach the shared Redis backend before it starts. The nodes use that backend for shared task state, schedule coordination, cluster membership, and cross-node event delivery. cli/…/root.go• L186-212, cli/…/root.go• L287-325

References: cli/…/root.go• L130-165 cli/…/root.go• L178-225 cli/…/root.go• L287-325 config.schema.yaml• L547-679 config.schema.yaml• L681-739

Deployment packaging

Deployment packaging provides three main artifact forms: container images for the server and runner, a job image for task execution, and a Linux package shape that installs the binary, setup helper, configuration directory, and systemd unit. The build task creates the server binary and frontend assets, while the runtime images provide the tools needed to run automation tasks. Taskfile.yml• L58-124, deployment/packaging/semaphore.spec#L26-L80

The server and runner images separate the service roles. Both use a small runtime image with a non-root semaphore user, bundled automation tools, and tini as the process entry point. The server image exposes port 3000 and starts through its wrapper; the runner image starts through its own wrapper. deployment/docker/server/Dockerfile#L53-L109, deployment/docker/runner/Dockerfile#L53-L109

The job image supplies a separate runtime for task jobs. It includes the Ansible, SSH, Git, and infrastructure tools that jobs may need, runs with a non-root user, and uses tini as its entry point. Its workspace is the handoff point for job files and task output. deployment/docker/job/Dockerfile#L1-L64

See the child page Deployment packaging for release artifacts, image construction, and packaging-specific workflows.

References: Taskfile.yml• L58-124 Taskfile.yml• L217-315 deployment/…/Dockerfile• L53-109 deployment/…/Dockerfile• L53-109 deployment/…/Dockerfile• L1-64 deployment/…/semaphore.spec• L42-80

Docker Compose

Docker Compose assembles a server, an optional runner, and one supported database from small override files. The base server definition selects a released image, publishes port 3000, creates durable server storage, and supplies first-run administrator settings. Build and config overlays replace the image source or mount a local configuration file. deployment/…/base.yml• L3-20, deployment/…/build.yml• L1-7, deployment/…/config.yml• L1-6

The database overlay determines whether the server uses a named SQLite volume or an external database container. The runner overlay connects the runner to the server and passes the registration token to both sides. deployment/…/sqlite.yml• L3-12, deployment/…/postgres.yml• L3-26, deployment/…/base.yml• L3-14

The Compose assembly model is:

flowchart LR
    Base[Server base] --> Server[Semaphore server]
    Build[Build overlay] --> Server
    Config[Config overlay] --> Server
    Store[Database overlay] --> Server
    Runner[Runner overlay] --> RemoteRunner[Semaphore runner]
    RemoteRunner --> Server

Use the server base with one image choice, then add at most the needed config, runner, and database overlays. The Compose README documents the combinations and uses down to remove the assembled stack. deployment/…/README.md• L10-149

References: deployment/…/README.md• L10-149 deployment/…/base.yml• L3-20 deployment/…/build.yml• L1-7 deployment/…/config.yml• L1-6 deployment/…/base.yml• L3-14 deployment/…/sqlite.yml• L3-12 deployment/…/postgres.yml• L3-26

Systemd operations

The systemd deployment runs the server as the semaphore user and restarts it after failure. The unit reads /etc/semaphore/env, starts the binary in server mode, maps reload to SIGHUP, and sends logs to the journal. A companion runner unit uses the same environment-file pattern and starts the runner with the configured path. deployment/systemd/semaphore.service#L1-L19, deployment/systemd/runner.service#L1-L15

The sample installer places the unit and environment file under /etc, reloads systemd, and starts the server. It expects the binary and configuration file to be installed separately. deployment/…/install.sh• L1-10, deployment/…/README.md• L9-12

For operations, the environment file is the systemd boundary for configuration path and small runtime overrides such as log level, debug filtering, and database dialect. After changing it, reload the unit definitions and restart the service. Read service output with journalctl -u semaphore.service. deployment/…/README.md• L14-38

See the child page Administration and observability for logs, metrics, audit output, health checks, and runtime diagnosis.

References: deployment/…/README.md• L1-41 deployment/…/semaphore.service• L1-19 deployment/…/runner.service• L1-15 deployment/…/env• L1 deployment/…/install.sh• L1-10

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep util.ConfigType, config.schema.yaml, environment names, and generated configuration reference pages aligned.
  • Keep server, runner, and job container images aligned with the tools and paths expected by task execution and their Compose overlays.
  • Keep server and runner container wrappers aligned with the paths, database defaults, registration modes, and secret-file rules used by their Compose overlays.
  • Keep systemd ExecStart, environment-file paths, and the documented configuration path consistent.
  • Keep database overlay values aligned with the database fields consumed during server startup and migration.
  • Keep TLS redirect settings aligned with the public URL used by proxies and external identity providers.
  • Keep runner heartbeat timeouts comfortably above the runner poll and connection timeout values.
  • Treat encryption key-file path, active key pointers, and reload signaling as one rotation contract.
  • Keep debug flag names and their environment forms aligned when changing the CLI's diagnostic controls.
  • Keep client resource scope, name resolution, secret redaction, and API actions aligned when changing the semaphore client command tree.
  • Keep task wait exit codes, timeout behavior, approval commands, transient-error retries, and --auto-reject behavior aligned across task commands and their API actions.

Important failure modes

TriggerConsequenceGuard
The selected database is unreachable during startupThe server does not become ready.Make the database dependency and network path available before starting the service.
TLS is enabled without a usable certificate or keyHTTPS startup fails.Provide both files and keep HTTP redirect address and port mutually exclusive.
HA is enabled but Redis cannot be reachedThe node refuses to start to avoid unsound task and schedule coordination.Test the shared Redis or Sentinel connection from every node.
A runner token is missing or the registration token is expiredThe runner cannot receive work.Persist the durable runner token or register again with a valid bootstrap token.
A config file and its *_FILE secret variable are both setThe container wrapper exits before startup.Set exactly one secret source.
A systemd environment change is not followed by a restartThe old process keeps the old settings.Run systemctl daemon-reload and restart the service.
The database overlay does not match the selected dialectThe server connects to the wrong backend or cannot connect.Select one database overlay and verify its dialect, host, port, and credentials together.
The job image lacks a tool required by a taskThe task fails inside its execution environment.Build and validate the job image with the tool set required by supported task types.
A debug filter is set without debug log levelThe expected filtered debug entries do not appear.Enable debug logging before relying on --debug-filter or SEMAPHORE_DEBUG_FILTER.
A client command uses an ambiguous resource nameThe command stops without changing the resource.Use the numeric ID or choose a unique name.
A client secret is passed as a command argumentThe secret can appear in shell history or process listings.Read it from a protected file or standard input.
A runner registration token is lost after creation or re-issueThe runner cannot register with that token.Store the token when it is printed and re-issue it when needed.
A project delete is run without the exact project-name confirmationThe destructive request is rejected.Pass --confirm with the exact name or confirm at the prompt.
A task wait sees repeated transport or 5xx errorsThe client gives up after its retry budget even though the task may still run on the server.Restore the server path and run the wait or log follow command again.
An unattended wait reaches a confirmation gate without --auto-rejectThe client remains waiting and the task does not continue.Use --auto-reject or approve or reject the task from another client.
A wait times outThe client exits without stopping the server-side task.Use an explicit stop action or configure stop-on-interrupt for an interrupted wait.

Key files

FileWhy to read it
cli/…/root.goShows server assembly, startup order, HTTP binding, HA setup, key reload behavior, and shared CLI diagnostics.
cli/…/setup.goShows interactive first-run setup and administrator creation.
cli/…/runner_setup.go and cli/…/runner_start.goShow runner configuration and registration lifecycle.
util/config.goDefines the runtime configuration model and load precedence.
config.schema.yamlDefines the supported JSON/YAML configuration shape.
deployment/docker/server/server-wrapperShows container first-run bootstrap and server startup.
deployment/docker/runner/runner-wrapperShows container runner registration and startup.
deployment/docker/job/DockerfileDefines the task execution image and its available tool environment.
deployment/…/README.mdExplains how Compose overlays form server, runner, and database stacks.
deployment/systemd/semaphore.service and deployment/systemd/runner.serviceDefine the systemd service boundaries and signals.
deployment/packaging/semaphore.specShows the Linux package contents and installed service entry points.
cli/…/resources.goDefines client resource scope, lookup, output, and read commands.
cli/…/mutate_resources.goDefines client resource changes, guarded actions, and secret input rules.
cli/…/waiter.goDefines task polling, log following, approval handling, retries, timeouts, and interruption behavior.
cli/…/tasks_test.goShows the task client contract for outcomes, logs, approvals, retries, and unattended waits.