Skip to content

Latest commit

 

History

History
executable file
·
93 lines (65 loc) · 3.83 KB

README.md

File metadata and controls

executable file
·
93 lines (65 loc) · 3.83 KB

Docker Swarm - Containers Health Monitor Production Deployment

License Commit Releases Contributors

Repository with configuration files required for Containers Health Monitor Production Deployment using Docker Swarm.

Main Features:

  • Simplified and automated startup through scripts.

Prerequisites

  1. Linux (Ubuntu 16.04+ recommended)
  2. Docker Engine 18.06.0+
  3. Docker Compose 1.22.0+
  4. Make sure that Swarm is enabled by typing docker system info, and looking for a message Swarm: active (you might have to scroll up a little).
    • If Swarm isn’t running, simply type docker swarm init at a shell prompt to set it up.

1. Health monitor services stack

1.1 Set the environment variables

To ensure flexibility, the health monitor services receive some parameters through environment variables, e.g. SMTP configurations, credentials (username and password), etc.

First, create the configuration file based on the .env.monitor.example file:

$ cp .env.monitor.example .env.monitor

After making the settings, execute the command to assign the values defined in the environment variables that are in the settings file:

$ set -a && source .env.monitor && set +a

1.1.1 Authorization/Authentication Setup

Variables to define the administrator user's credentials the first time the Grafana is instantiated.

Variable Description Example
ADMIN_USERNAME Username of the default admin user created automatically at the first time the Grafana is instantiated. admin
ADMIN_PASSWORD Password of the default admin user created automatically at the first time the Grafana is instantiated. admin

1.1.2 External Services Ports

Variable Description Example
GF_PORT Port used by the Grafana service to listen for HTTP request. 3000

1.1.3 SMTP Setup

Variable Description Example
GF_SMTP_ENABLED Enable SMTP server settings. false
GF_SMTP_HOST Host where the SMTP server is allocated. smtp.gmail.com:465
GF_SMTP_USER Registered email on the SMTP server. It will be used to send emals when an alarm is detected. grafana@test.com
GF_SMTP_PASSWORD Password for the email registered on the SMTP server. secret

1.1.4 Storage Data

Variable Description Example
DATA_RETENTION Time the data remained stored in database. 15d - corresponds to 15 days

1.2 Building and Deploying the containers

Start services stack

$ docker stack deploy -c docker-monitor-stack.yml <stack_name>

Stop services stack

$ docker stack rm <stack_name>