Coder Social home page Coder Social logo

blazeyo / mattermost-openresty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cgenie/mattermost-openresty

0.0 1.0 0.0 39 KB

Bridge between Mattermost and various services using the Openresty platform

License: GNU General Public License v3.0

Nginx 9.82% Lua 90.18%

mattermost-openresty's Introduction

Table of Contents

Mattermost Openresty bridge

This is a bridge between Mattermost and various other services, scripted in Lua using the Openresty platform.

Installation

This is a Docker container with an up-to-date docker-compose file so basically you just need to

docker-compose up

and you're done.

If you want bots to send custom username to Mattermost, you need to check the Enable integrations to override usernames setting in Mattermost System Console.

If you want to add custom config, best is to use the docker-compose.override.yml file (see https://docs.docker.com/compose/extends/ on how this works).

Bitbucket webhooks support

In Bitbucket, go to project Settings -> Webhooks -> Add webhook. As the webhook URL enter

<openresty-host>/mattermost/bitbucket

Then go to Mattermost, add an Incoming hook and paste its URL into docker-compose.yml under the BITBUCKET_MATTERMOST_URL setting (this is where the notifications about Bitbucket events will come). Start the containers and you're done!

Username is bitbucket by default, change it via the BITBUCKET_MATTERMOST_USER env variable.

Multiple rooms for multiple Bitbucket configurations

You can have multiple Bitbucket notifications being proxied to multiple rooms. Just specify BITBUCKET_MATTERMOST_URL_ROOM1 env variable and set the bitbucket URL to <openresty-host>/mattermost/bitbucket?room=room1 (uppercase env is handled automatically).

Same goes for BITBUCKET_MATTERMOST_USER_USER1 being mapped to <openresty-host>/mattermost/bitbucket?user=user1.

Don't forget to add your custom variables to the nginx.conf file!

If you don't want to provide multiple variables and alter the nginx.conf file, there is another way to introduce multiple rooms. You can define a simple key-value mapping (in JSON format) into the BITBUCKET_MATTERMOST_URL and BITBUCKET_MATTERMOST_USER variables. Also, "default" key has the special property of returning the value whenever it is not found in JSON.

For example:

BITBUCKET_MATTERMOST_URL='{"default": "<other-rooms>", "room1": "<room1-url>", "room2": "<room2-url>"}'
BITBUCKET_MATTERMOST_USER='{"room1": "<room1-user>", "room2": "<room2-user>"}'

The default user is bitbucket but there is no default URL so if room is undefined, nginx will throw an exception.

Bitbucket Pipelines support

We also support update notifications from Bitbucket Pipelines. To add the Webhook, go to your repository settings on Bitbucket, select Webhooks -> Add Webhook and then make sure to pick Choose from a full list of triggers -> Build status updated.

Environment variables are PIPELINES_MATTERMOST_URL and PIPELINES_MATTERMOST_USER and they behave in exactly the same way as variables for the Bitbucket integration.

Sentry integration

In a Sentry project settings, enable webhooks, then put this as the address:

<openresty-host>/sentry/mattermost

Again, create an Incoming webhook in Mattermost and save in docker-compose.yml under the SENTRY_MATTERMOST_URL variable.

Username is sentry by default, change it via the SENTRY_MATTERMOST_USER env variable.

Same logic applies for the SENTRY_MATTERMOST_URL and SENTRY_MATTERMOST_USER variables for multi-room configuration as above.

mattermost-openresty's People

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.