4.3 KiB
Semaphore UI
Modern UI for Ansible, Terraform/OpenTofu and Bash.
TL;DR
Projects are independent environments where all activities occur.
Templates define how to run code.
What is run depends on their type.
Tasks are instances of template runs.
Create tasks from templates. Status and logs are available once tasks start running.
The key store stores credentials for accessing remote repositories and hosts, sudo credentials, and Ansible vault passwords.
Inventories are files containing lists of hosts Ansible will run plays against.
They are effectively just Ansible inventories.
Each inventory also must have at least one credential tied to it.
The user credential is required, and is what Ansible uses to log into hosts for that inventory.
Sudo credentials are used for escalating privileges on those hosts.
A user credential must be either a username with a login, or SSH keys configured in the Key Store.
Environments store additional variables for inventories and must be stored in JSON format.
All templates require an environment to be defined, even if empty.
Integrations allow establishing interaction between Semaphore and external services.
Supports MySQL, PostgreSQL and BoltDB (an embedded key/value database) for storing its data.
Setup
sudo snap install 'semaphore'
docker run -d --name 'semaphore' -p 3000:3000 \
-e SEMAPHORE_DB_DIALECT='bolt' \
-e SEMAPHORE_ADMIN='admin' -e SEMAPHORE_ADMIN_PASSWORD='changeme' \
-e SEMAPHORE_ADMIN_NAME='Admin' -e SEMAPHORE_ADMIN_EMAIL='admin@localhost' \
'semaphoreui/semaphore:v2.10.22'
wget 'https://github.com/semaphoreui/semaphore/releases/download/v2.9.58/semaphore_2.9.44_linux_amd64.deb' \
&& sudo dpkg -i 'semaphore_2.9.44_linux_amd64.deb'
Refer the Docker container configurator for all available environment variables.
Usage
sudo snap stop 'semaphore'
sudo semaphore user add --admin --login 'john' --name 'John' --email 'john1996@gmail.com' --password '12345'
sudo snap start 'semaphore'
sudo snap services 'semaphore'
sudo snap get 'semaphore'
sudo snap refresh 'semaphore'
semaphore setup
semaphore server --config='./config.json'
Real world use cases
docker compose run --rm --user 'root' 'semaphore' chown -Rv 'semaphore' '/etc/semaphore' '/var/lib/semaphore'
Runners
Can be used to run tasks on separate servers from the one hosting Semaphore.
They operate like GitLab or GitHub Actions runners would:
- One launches a runner on a separate host, specifying the Semaphore server's address and an authentication token.
- The runner connects to Semaphore and signals its readiness to accept tasks.
- When a new task appears, Semaphore provides all the necessary information to the runner.
- The runner clones the repository and runs the task.
- The runner sends the task execution results back to Semaphore.
The runner app comes as part of Semaphore.
It is launched with the following command:
semaphore runner --config './config.json'
The runner's configuration file must contain a runner section with the following parameters:
{
"runner": {
"registration_token": "***",
"config_file": "path/to/the/file/where/runner/saves/service/information",
"api_url": "http://<semaphore_host>:<semaphore_port>/api",
"max_parallel_tasks": 10
}
}
Allow the Semaphore server to work with runners by setting the following parameters in its configuration file:
{
"use_remote_runner": true,
"runner_registration_token": "***"
}