Coder Social home page Coder Social logo

codingkoopa / gitlab-discord-bridge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from avluis/gitlab-discord-bridge

1.0 1.0 0.0 13 KB

Mirror of https://gitlab.com/CodingKoopa/gitlab-discord-bridge.

Python 73.85% Dockerfile 26.15%
python gitlab discord

gitlab-discord-bridge's Introduction

gitlab-discord-bridge

This is a super simple GitLab>Discord bridge. It started out as a basic standalone Python program, and then had Docker support added in a fork. This is a fork of the latter, with modifications made to make it build and run on the arm64v8 architecture.

Usage

After setup (see below), the webhook URL is "http://<ip>:25431/<discord channel id>" to support posting in any channel. The bot user will need to be added to the server by an administrator before attempting to post.

Instructions

Tested on Ubuntu 16.10 and OS X El Capitan (with Homebrew)

  1. Install Python 3.5/3.6 (and Pip if not installed automatically): https://www.python.org/downloads/ or brew install python3
  2. Clone or download the repository using the green button above.
  3. Rename config.example.json to config.json and edit the file.
  • "secret" should be an arbitrary secret token that you'll be giving to Gitlab to make sure incoming requests to this bridge aren't from an attacker.
  • "token" should be a bot login token acquired after creating an application at https://discordapp.com/developers/applications/ and giving it a bot user.
  1. Install the required libraries (Flask and requests): sudo pip3 install -r requirements.txt
  2. Run the application with python3 app.py.
  • If you want to run it in the background with more worker threads, I use gunicorn: sudo pip3 install gunicorn gunicorn -w 4 -b 0.0.0.0:25431 app:app
  • You may need to forward port 25431 (TCP) if the server is behind a router. If the bridge and Gitlab are on the same machine or LAN disregard this.
  1. In Gitlab, go into the desired repository's Webhooks settings and add "http://<ip>:25431/<discord channel ID>" as the webhook address. Set "Secret Token" to the same token as you set in config.json.
  • You can get the channel ID in the desktop client by opening User Settings > Appearance > Enable Developer Mode, then right clicking on the channel you want the bot to interact with and pressing "Copy ID". If using the browser client, the channel ID is the second string of numbers in the URL separated by forward slashes.
  • The bridge can currently handle these event types: push, tag push, issue, note, merge request and wiki page. The author doesn't use pipelines but would like to add support for them to the bot; if you use pipelines, enable that checkbox in Webhook settings and, after triggering a pipeline event, send the author the log from the server. All responses are treated as confidential and will be used to add pipeline support to future releases.
  1. Test the webhook. You should see a message corresponding to the last event on the repository!

If you need assistance please create an issue.

Docker Instructions

The Docker image follows a similar approach to a local install. Assuming you know how to use Docker, here is how to get started:

  1. Create a directory to hold the application's config.json file.
  2. Rename config.example.json to config.json and edit the file -- reference step 3 above.
  3. Create the container with the following command:
docker create --name=gitlab-bridge \
-v <path to config file>:/usr/src/app/config.json \
-p 25431:25431 \
avluis/gitlab-discord-bridge
  • Note: The application will not work without mounting the config file! If you encounter an error when running the container, verify your volume mount!

gitlab-discord-bridge's People

Contributors

avluis avatar blha303 avatar carlodepieri avatar codingkoopa avatar

Stargazers

 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.