poma / docker

My scripts to quickly bring up common docker infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker infrastructure scripts

My scripts to quickly bring up common docker infrastructure. All compose files don't bind any custom config files so it is usable on remote docker instances without copying any files. This is intended for smaller scale deployments on few machines using docker-compose. For larger scale infrastructure you should use Kubernetes anyway.

Frontend

Consists of nginx-dockergen-letsencrypt stack to proxy http requests to multiple containers. Advanced version is a bit more complex, but is more secure and monitoring friendly.

Usage:

docker-compose up -d on any host, then run any container on the same network with appropriate env variables:

version: '2'
services:
  app:
    image: app
    environment:
      VIRTUAL_HOST: example.com
      LETSENCRYPT_HOST: example.com
networks:
  default:
    external:
      name: frontend_default

Frontend will automatically generate nginx conf and a valid https certificate (if the domain has a valid DNS record) and will route all requests for specified host to this container. After https certificate is generated http endpoint will contain a redirect to https.

For more info see nginx proxy docs

Elastic

This will run ELK stack to storing data for monitoring

  • consider running it in dedicated server apart from main services.
cd elastic
cp .env.example .env

# Set credentials:
vi .env

# Set your `VIRTUAL_HOST` in docker-compose.yml 
vi docker-compose.yml

# Run  docker:
docker-compose up -d

Monitoring agent

Configured filebeat and metricbeat agents for ELK stack for log and metric ingestion. Collects all container logs, syslog, and auth log, and various container and host metrics. Indexes for advanced nginx stack above are already configured.

To run the agent configure .env variables:

cd monitoring
cp .env.example .env
# set ELASTICSEARCH_HOST same as VIRTUAL_HOST in Elastic (see above)
vi .env

#Run docker:
docker-compose up -d

Note that for monitoring we build the containers so if you change yaml configs in filebeat and metricbeat dir don't forget --build flag when updating containers.

  • go to Kibana at the host, that you specify in KIBANA_HOST, enter login and password (from .env file)
  • Enjoy!

Notifier

It will notify you in Telegram about changes status of running services

cd notifier
cp .env.example .env
vi .env

About

My scripts to quickly bring up common docker infrastructure


Languages

Language:Shell 73.9%Language:Dockerfile 26.1%