GithubHelp home page GithubHelp logo

jstet / deploy_base Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 103 KB

Ansible Role for setting up a docker swarm that can serve as a foundation for deploying web apps.

Jinja 100.00%
ansible ansible-role cadvisor docker docker-swarm-mode grafana prometheus traefik

deploy_base's Introduction

deploy_base

This role creates a foundation for the deployment of dockerized web apps by setting up a linux server (including security) and deploying a docker swarm containing monitoring services, an alert manager and a reverse proxy.

Also find it on Ansible Galaxy

One use of this setup is to allow you to deploy multiple apps on one server. This can help you save hosting costs. Traefik will redirect incoming requests to the right docker container. Find an instruction on how to deploy an app to this setup and how to add an automatic deploy function with Github Workflows in this repo.

This docker swarm contains:

  • Traefik
  • Prometheus
  • CAdvisor
  • Node Exporter
  • Alertmanager
  • Grafana

Requirements

A user with posswordless sudo privileges should be set up on the server. Personally I take care of that with a cloud config file. You need to "become" and gather facts for this role to work.

Role Variables

ansible-galaxy install jstet.deploy_base

Role Variables

A user with passwordless sudo privileges that will execute all docker tasks.

user: user

Extra packages you want to install on the server.

packages:
  - htop
  - vim
  - net-tools

Vars needed for setting up Grafana. The password for the user "admin" and the domain on which you want to reach Grafana.

GRAFANA_PW: 1234
MONITORING_DOMAIN: monitoring.localhost

The email used for administering a certificate with letsencrypt.

LETSENCRYPT_EMAIL: [email protected]
SLACK_WEBHOOK: "{{  SLACK_WEBHOOK_VAULT }}"

Dependencies

This role uses jstet.initial_server_setup and geerlingguy.docker. Will be installed automatically with the needed parameters.

Example Playbook


- hosts: all
  gather_facts: yes
  become: no
  vars_files:
    - vars/vault.yml
  roles:
    - role: deploy_base
      vars:
          packages: 
              - htop
              - vim
              - net-tools
          user: user
          GRAFANA_PW: "{{ GRAFANA_PW_VAULT }}"
          LETSENCRYPT_EMAIL: example@mail,de
          MONITORING_DOMAIN: data.example.net
          TRAEFIK_USER: admin
  tasks:

License

MIT

Author Information

jstet.net

Sources

iptables and docker

Prometheus

Node exporter

Docker and Prometheus

Grafana

nginx-exporter

promtail and loki

Traefik

Docker Swarm

Alertmanager

Plausible

Misc

Testing alertmanager

docker service create --replicas 1 --name test --network=monitoring alpine/curl:3.14
docker exec -it .... sh
curl -H 'Content-Type: application/json' -d '[{"labels":{"alertname":"hallo hallo"}}]' http://alertmanager:9093/api/v1/alerts

deploy_base's People

Contributors

jstet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.