/deploy-hook-bot

Telegram bot for sending notification when something is deployed on Heroku.

Primary LanguageGoMIT LicenseMIT

๐Ÿค– deploy-hook-bot

Go

Telegram bot for sending notification when something is deployed on Heroku.

๐Ÿง‘โ€๐Ÿ’ป Run locally

Register new bot at https://t.me/BotFather or use previously created one.

Take bot access token.

Before running copy sample file and replace env vars with your credentials

cp .env.sample .env
source .env

Run application locally:

make run

Also you can run bot with redis in docker compose:

docker-compose up

๐Ÿ‘ท Build

Build binary

make build

๐Ÿงช Testing

Run unit tests

make test

Run integration tests

make test_integration

๐Ÿ– Lint

Run linters

make lint

๐Ÿ›ฅ Deployment

Automatic CI/CD pipelines are building and testing the bot on each PR.

Demo bot is deployed to production on Heroku on merge to master.

To deploy your app on Heroku read documentation.

brew install heroku/brew/heroku

heroku login
heroku create deploy-hook-bot
heroku config:set TOKEN=<token>
heroku config:set AUTH_TOKEN=<auth_token>
heroku config:set TELEGRAM_CHAT_ID=<chat_id>
heroku webhooks:add -i api:build -l notify -u https://deploy-hook-bot.herokuapp.com/hooks -t <auth_token># To add deploy hook

git push heroku main

If application is already setup just run:

make deploy

๐Ÿ›  Environment variables

Env var Type Description Default
PORT String Port for server 9998
TOKEN String Telegram bot access token
AUTH_TOKEN String Authorization token
TELEGRAM_CHAT_ID Integer Telegram chat id
DEBUG Boolean Enable debug mode false