Giter VIP home page Giter VIP logo

docker-notify's Introduction

Docker-Notify

Docker-Notify can send you a mail or call a webhook when a Docker image gets updated.

If you are trying to set docker-notify up on a Synology, here is a guide for that.

Variable Definitions

  • $CONFIG_DIR defines the directory where the config is stored

Setup

  1. Copy the config.json.example file to $CONFIG_DIR/config.json
  2. Fill out the config.json file:
    • Read the self describing schema in src/schema.json
    • If the tag is left out (example: user/repoName), you will receive a mail about any updates made (e.g. nightly builds)
    • If the repository is an official repository, you can leave out the user and just add repoName:tag as image.
  3. Build the Docker container for docker-notify.
  4. Set the variable $CONFIG_DIR in the docker-compose file.
  5. Run the container with docker-compose up -d
  6. If you edit settings in the config, you need to execute docker-compose up again.

Example

Consider the following scenario: You have a server with 2 software services. One is a dockerized webserver and the other one is a dockerized nextcloud image with some customizations, so your docker-compose.yml is looking like this:

version: '3'
services:
  webserver:
    image: apache2
    restart: always
  nextcloud:
    image: customUser/nextcloud:latest
    restart: always

Now you want to be notified if you may update your apache2-server and you want to be notified if you must call your ci-pipeline to rebuild your custom nextcloud-docker-image. So, now your docker-compose.yml file is looking like this:

version: '3'
services:
  webserver:
    image: apache2
    restart: always
  nextcloud:
    image: customUser/nextcloud:latest
    restart: always
  docker-notify:
    image: schlabbi/docker-notify
    restart: always
    volumes: 
      - /home/someUser/notify/cache:/usr/src/app/cache
      - /home/someUser/notify/config.json:/usr/src/app/config.json

The config.json looks like the following:

{
    "notifyServices":[
        {
            "image": "nextcloud:fpm",
            "actions": [
                {
                    "type": "mailHook",
                    "instance": "generalMail",
                    "recipient": "[email protected]"
                },
                {
                    "type": "webHook",
                    "instance": "gitlabHook"
                }
            ]
        },
        {
            "image": "httpd",
            "actions": [
                {
                    "type": "mailHook",
                    "instance": "generalMail",
                    "recipient": "[email protected]"
                }
            ]
        }
    ],
    "smtpServer": {
        "generalMail": {
            "host": "mail.example.org",
            "port": 25,
            "username": "[email protected]",
            "password": "PASSWORD",
            "sendername": "Docker-Notify",
            "senderadress": "[email protected]"
        }
    },
    "webHooks":{
        "gitlabHook": {
            "reqUrl": "https://ci.example.org",
            "httpMethod": "POST",
            // This one is optional and will default to null.
            "httpBody": {
                "foo": [1, 2, 3]
            }
        }
    }
}

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.