Create a docker-compose.yml file with following content:
services:# uncomment this section and comment out the mysql section to use postgres instead of mysql#postgres:#restart: unless-stopped#image: postgres:14#hostname: postgres#volumes: # - semaphore-postgres:/var/lib/postgresql/data#environment:# POSTGRES_USER: semaphore# POSTGRES_PASSWORD: semaphore# POSTGRES_DB: semaphore# if you wish to use postgres, comment the mysql service section below mysql:restart:unless-stoppedimage:mysql:8.0hostname:mysqlvolumes: - semaphore-mysql:/var/lib/mysqlenvironment:MYSQL_RANDOM_ROOT_PASSWORD:'yes'MYSQL_DATABASE:semaphoreMYSQL_USER:semaphoreMYSQL_PASSWORD:semaphoresemaphore:restart:unless-stoppedports: - 3000:3000image:semaphoreui/semaphore:latestenvironment:SEMAPHORE_DB_USER:semaphoreSEMAPHORE_DB_PASS:semaphoreSEMAPHORE_DB_HOST:mysql# for postgres, change to: postgresSEMAPHORE_DB_PORT:3306# change to 5432 for postgresSEMAPHORE_DB_DIALECT:mysql# for postgres, change to: postgresSEMAPHORE_DB:semaphoreSEMAPHORE_PLAYBOOK_PATH:/tmp/semaphore/SEMAPHORE_ADMIN_PASSWORD:changemeSEMAPHORE_ADMIN_NAME:adminSEMAPHORE_ADMIN_EMAIL:admin@localhostSEMAPHORE_ADMIN:adminSEMAPHORE_ACCESS_KEY_ENCRYPTION:gs72mPntFATGJs9qK0pQ0rKtfidlexiMjYCH9gWKhTU=SEMAPHORE_LDAP_ACTIVATED:'no'# if you wish to use ldap, set to: 'yes' SEMAPHORE_LDAP_HOST:dc01.local.example.comSEMAPHORE_LDAP_PORT:'636'SEMAPHORE_LDAP_NEEDTLS:'yes'SEMAPHORE_LDAP_DN_BIND:'uid=bind_user,cn=users,cn=accounts,dc=local,dc=shiftsystems,dc=net'SEMAPHORE_LDAP_PASSWORD:'ldap_bind_account_password'SEMAPHORE_LDAP_DN_SEARCH:'dc=local,dc=example,dc=com' SEMAPHORE_LDAP_SEARCH_FILTER: "(\u0026(uid=%s)(memberOf=cn=ipausers,cn=groups,cn=accounts,dc=local,dc=example,dc=com))"
depends_on: - mysql# for postgres, change to: postgresvolumes:semaphore-mysql:# to use postgres, switch to: semaphore-postgres
You must specify following confidential variables:
MYSQL_PASSWORD and SEMAPHORE_DB_PASS — password for the MySQL user.
SEMAPHORE_ADMIN_PASSWORD — password for the Semaphore's admin user.
SEMAPHORE_ACCESS_KEY_ENCRYPTION — key for encrypting access keys in database. It must be generated by using the following command: head -c32 /dev/urandom | base64.
Run the following command to start Semaphore with configured database (MySQL or Postgres):
Some Ansible modules and roles require additional python packages to run. To install additional python packages, create a requirements.txt file and mount it in the /etc/semaphore directory on the container. For example, you could add the following lines to your docker-compose.yml file: