Public | Automated Build

Last pushed: 3 months ago
Short Description
Docker Image for Semaphore using the gcavalcante8808/ansible.
Full Description

Semaphore Container

This is a gcavalcante8808/sempahore docker image with Ansible Installed.

Usage

You need to provide the following information (through environment variables):

  • MYSQL_HOST: The MYSQL DB HOST;
  • MYSQL_PORT: Listen port of the host. If not provided, the value '3306' is assumed;
  • MYSQL_USER: The User that can access the mysql. If Not provided, the value 'semaphore' is assumed;
  • MYSQL_PASSWORD: The Password of the User. If not provided, the value 'semaphore' is assumed;
  • MYSQL_DATABASE: The Name of Schema created. If Not provided, the value 'semaphore' is assumed.

The following environment variables are optional (default values will be assumed if these arent defined):

  • SEMAPHORE_USER: user that have access to semaphore web ui. Default: semaphore;
  • SEMAPHORE_MAIL: email of the user. Default: semaphore;
  • SEMAPHORE_USER_NAME: Name of the user. Default: Semaphore User;
  • SEMAPHORE_PASS: password of the user. Default: semaphore.

These variables are OPTIONAL but when defined, you SHOULD provide the needed configuration or the application cannot use the resources correctly:

  • MAIL_ALERTS: If set to 1 you should define the following env variables:

    • MAIL_SERVER: If not defined, semaphore will use the value 'localhost';
    • MAIL_PORT: If not defined, semaphore will use the value '25';
    • MAIL_SENDER: If not defined, semaphore will use the value 'semaphore@localhost';
  • TELEGRAM_ALERTS: if set to 1 you should define the following env variables:

    • TELEGRAM_BOT_TOKEN: If not provided, semaphore will use the value '';
    • TELEGRAM_CHAT_ID: If not provided, semaphore will use the value '';
  • LDAP_AUTH: if set to 1 you should define the following env variables:

    • LDAP_SERVER: If not provided, semaphore will use the value 'localhost:389';
    • LDAP_TLS: If not provided, semaphore will use the value 'n';
    • LDAP_BINDDN: If not provided, semaphore will use the value 'cn=user,ou=users,dc=example';
    • LDAP_BINDPASS: If not provided, semaphore will use the value 'pa55w0rd';
    • LDAP_CONTEXT: If not provided, semaphore will use the value ' ou=users,dc=example';
    • LDAP_FILTER: If not provided, semaphore will use the value 'uid=%s';
    • LDAP_DN_MAPPING: If not provided, semaphore will use the value 'dn';
    • LDAP_USERNAME_MAPPING: If not provided, semaphore will use the value 'uid';
    • LDAP_FULLNAME_MAPPING: If not provided, semaphore will use the value 'cn';
    • LDAP_MAIL_MAPPING: If not provided, semaphore will use the value 'mail';

Questions about the image tag

Previously, the image was based in the gcavalcante8808/ansible (latest) image, but this behavious has changed; as such, all needed Dockerfile statements to install ansible are included in this image and the following statements are true for the tags of the images:

  • The semaphore_versions supported are listed in the file semaphore_versions;
  • The ansible_versions support are listed in the file ansible_versions;
  • The tags were defined using the just the semaphore_version before; now, it uses a the following format '{{ semaphore-version }}-ansible-{{ ansible-version}}" allowing to permute the versions declared in the 'semaphore_versions' and 'ansible_versions'. Eg:
    • 2.4.1-ansible-2.4.3.0: an semaphore 2.4.1 with an ansible 2.4.3.0 installed.

All previous tags are available in the hub.docker.com as well.

Simple

Create a MySQL container first, then create the Semaphore Container:

    docker run \
    -d \
    --name semaphore \
    -e MYSQL_HOST=myhost.mydomain \
    -e MYSQL_USER=semaphore \
    -e MYSQL_PASSWORD=semaphore \
    -p 8080:3000 \
    gcavalcante8808/semaphore

You can now access the interface on port 8080 using the user "semaphore" with the password "semaphore".

Using Docker Compose

Clone the repo into your machine and access the folder created. Then, use the following command:

    docker-compose up

Check your semaphore on localhost:8080 after some seconds (The MySQL takes some time to setUp for the first time). The default user and password is "semaphore".

Note About 2.2+ versions

The original docker-compose.yml of the project was using a local folder to provide a volume for mysql data. From Now on, a named volume caled dbdata (dockersemaphore_dbdata if the source folder is called docker-semaphore) is used instead.

Note About "Host key Verification Failed"

Due to the use of ssh client by ansible, you'll need to fingerprint the target SSH public before the use of the semaphore or you will incur in some 'Host key verification failed.' Errors. To do that, use the following command (for each host in the inventory):

    docker exec -it <CONTAINER> sh -c 'ssh-keyscan -H <SERVER> >> ~/.ssh/known_hosts'

Where container is the id or the name of the semaphore container created and server is the target of your ansible playbooks.

If you want to disable the SSh Strict Host Checking feature (Be Carefull with Man-In-The-Middle attacks), use the statement 'host_key_checking=False' as extra_var in your Template Task or set ANSIBLE_HOST_KEY_CHECKING=False in the container creation.

Build the image

    docker build -t gcavalcante8808/semaphore .

If you want to build an image with a specific version of semaphore (2.0.4 in the sample), you can do the following:

    docker build --build-arg SEMAPHORE_VERSION=2.0.4 -t gcavalcante8808/sempahore:2.0.4 . 

Author

Author: Gabriel Abdalla Cavalcante Silva (gabriel.cavalcante88@gmail.com)

Docker Pull Command
Owner
gcavalcante8808