Skip to content

AgoraCloud/kube-bot

Repository files navigation

Logo Cropped

GitHub issues GitHub license GitHub release (latest by date) GitHub Release Date Docker Pulls GitHub Workflow Status GitHub contributors GitHub commit activity

AgoraCloud is an open source and self hosted cloud development platform that runs in Kubernetes.

This repository contains a bot that is connected to Discord and deployed in a Kubernetes cluster. The main purpose of the bot is to automate the container update process when a new container is published for any of the main, develop, said, marc or waleed branches in the server and ui repositories.

The kube-bot listens for DockerHub webhook notifications and extracts useful information, such as the repository name, container name and tag name. The bot then notifies the team on Discord that a webhook has been received. Subsequently, the bot updates the container in a pre-configured Kubernetes namespace and notifies the team or team member if the deployment was successful or not. If successful, team members can view their changes live, without lifting a finger, in a production-like environment (Kubernetes cluster), on a pre-configured subdomain.

Installation

The AgoraCloud kube-bot is installed on a Kubernetes cluster using a Helm chart. For more details, refer to the instructions in the helm-chart directory.

Development

Set Up

  1. Clone this repository
git clone https://github.com/AgoraCloud/kube-bot.git
  1. Change directory
cd kube-bot
  1. Install required packages
npm i
  1. Create a .env file in the root of the project with the following environment variables

Make sure that all the environment variables below are populated. For a detailed description of all environment variables, check out the documentation.

# Node Environment
NODE_ENV=development
# Log Level
LOG_LEVEL=log,warn,error
# Domain
DOMAIN=
# Discord
DISCORD_BOT_TOKEN=
DISCORD_BOT_CHANNEL_ID=
DISCORD_BOT_ROLES_SERVER_ID=
DISCORD_BOT_ROLES_UI_ID=
DISCORD_BOT_USERS_SAID_ID=
DISCORD_BOT_USERS_WALEED_ID=
DISCORD_BOT_USERS_MARC_ID=
# DockerHub
DOCKER_HUB_TOKEN=

Running the app

# Development
npm run start

# Watch mode
npm run start:dev

# Production mode
npm run start:prod

Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Test coverage
npm run test:cov