Giter Site home page Giter Site logo

append-text-webhook's Introduction

append-text-webhook

Creates a webhook docker container and appends text to a file using POST requests

usage: append-text.sh   build
                        run [webhook_url] [file]

arguments:
  build                 build and start the webhook container
  run                   appends text to file

Tested on Docker version 20.10.12

Getting Started

Installation

Ensure docker and docker-compose is installed in your machine.

Configuration

  1. In hooks.yml, replace ENTER_SECRET_TOKEN_HERE with your secret token. This secret token acts as a password to the webhook container. You will need this secret token later.
trigger-rule:
  match:
    type: value
    value: ENTER_SECRET_TOKEN_HERE
    parameter:
      source: payload
      name: secret
  1. Run ./append-text.sh build to create your secret token, build and start the webhook container. Make sure you enter the exact same secret token that was used in hooks.yml.

The webhook URL will be http://localhost:9000/hooks/append-text. To access the container outside of localhost, replace localhost with the IP of the machine with the container.

An output folder will be created to store the appended files that is mounted to the container.

How to Run

  1. Run ./append-text.sh run [webhook_url] [file] from the machine running the container. Replace [webhook_url] with the webhook URL and [file] with the file path. Specific position of arguments are required.
  2. Enter the text to append to the file in the input prompt.
  3. Outputs will be placed in the output folder.

How to Stop

Run ./append-text.sh destroy to destroy the webhook container and delete the secret token.

NOTE: The secret token in the hooks.yml will need to be manually changed.

Moving to Production on AWS

  1. Create an EC2 instance with minimal specs depending on how frequently the webhook will be used.
  2. Expose port 9000 on the EC2 instance.
  3. Clone this repo on the EC2 instance and follow the setup above.
  • To backup the appended files, mount a S3 bucket to the output folder in the EC2 instance.
  • Will need to change to HTTPS requests for security, which requires SSL and proper certificates.
  • Can modify the webhook's match rule to use whitelisting known IPs if needed.

append-text-webhook's People

Contributors

kn-lim 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.