Introduction

Skedler Alerts is now available in the Docker Compose. It is a tool for defining and running multi-container (Skedler Alerts) Docker applications. With Compose, you use a YAML file to configure your application services. Then with a single command, you create and start all the services from your configuration. 

  • Install Docker Compose (Note: docker-compose is not pre-installed with Docker on Linux)   

  • Install docker-compose following the installation instructions that can be found here  

Step-by-Step Instruction

Step 1: Define service in a Compose file:

Create a file called docker-compose.yml in your project directory and paste the following 

  • docker-compose.yml:  

    version: '2.2'
    services:
      alerts:
        image: skedler/alerts:latest
        container_name: alerts
        privileged: true
        cap_add:
          - SYS_ADMIN
        volumes:
          - /sys/fs/cgroup:/sys/fs/cgroup:ro
          - alertdata:/data
          - ./alertconfig.yml:/opt/alert/config/alertconfig.yml
        command: opt/alert/bin/alert
        ports:
          - 3001:3001
        networks:
          - skedlernet
    
    volumes:
      alertdata:
        driver: local
    networks:
      skedlernet:   
        

This Compose file defines the service of Skedler Alerts.

Step 2: Basic Skedler configurations using alertconfig.yml  

Create a files called alertconfig.yml in your project directory .

  • Getting the alertconfig.yml file found here  

a) Configure Skedler Alerts Configuration like port, Elasticsearch URL and alert_index in alertconfig.yml

  • port - The port in which Skedler Alerts runs. The default port is 3001
  • elasticsearch_url - Elasticsearch URL with the port (even if the port is 80) in the following format <protocol>://<server>:<port> 
  • alert_index - Skedler Alerts index which will be created in Elasticsearch. It will create a new index if it doesn't already exist. Default alert_index is .alert  

Note: For more configuration options kindly refer the article alertConfig.yml in Skedler Alerts Install Guide 

Note: The following folders are persisted in the mapped volume (ie alertdata)

  • Log files -  log_dir: Persist log information in /data/log folder.
  • Custom images, images and custom CSS - ui_files_location: Persist UI information in /data/uifiles folder
  • alerts-  alerts_dir: Persist generated alerts information in /data/alerts folder.

Step 3: Build and run your app with compose

From your project directory, start up your application by running 

sudo docker-compose up

Compose pulls a Skedler Alerts image, builds an image for your code, and starts the services you defined

Enter http://<hostIP>:3001 in a browser to see the skedler alerts application running


If you want to run your services in the background, you can pass the -d flag (for "detached" mode) to docker-compose up and docker-compose ps to see what is currently running

sudo docker-compose up -d

To stop the service use the following command:

sudo docker-compose down

You can bring everything down, removing the containers entirely, with the down command. Pass --volumes to also remove the data volume just type:

sudo docker-compose down -v


How to generate debug logs for Skedler Alerts in Docker Compose

Note: If you are face an issue in running Skedler Alerts in Docker Compose, the support team will request you to run skedler in debug mode and upload the log files .  

For Skedler Alerts change the "command" keyword in the docker-compose.yml as shown 

command: opt/alert/bin/alert debug