Skip to content

Commit

Permalink
Merge pull request #92 from GrantBirki/cluster-updates
Browse files Browse the repository at this point in the history
Cluster updates
  • Loading branch information
GrantBirki authored Jan 9, 2022
2 parents 8bc5723 + e19b0d4 commit c695b87
Show file tree
Hide file tree
Showing 85 changed files with 421 additions and 20,607 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ jobs:
# Config
TF_VAR_IMAGE_TAG: ${{ github.sha }}
# Creds
TF_VAR_STATUS_PUSH_ENDPOINT: ${{ secrets.STATUS_PUSH_ENDPOINT }}
TF_VAR_CHAT_SERVICE_TOKEN: ${{ secrets.TF_VAR_CHAT_SERVICE_TOKEN }}
TF_VAR_CLIENT_ID: ${{ secrets.TF_VAR_CLIENT_ID }}
TF_VAR_CLIENT_SECRET: ${{ secrets.TF_VAR_CLIENT_SECRET }}
Expand Down Expand Up @@ -394,7 +393,6 @@ jobs:
# Config
TF_VAR_IMAGE_TAG: ${{ github.sha }}
# Creds
TF_VAR_STATUS_PUSH_ENDPOINT: ${{ secrets.STATUS_PUSH_ENDPOINT }}
TF_VAR_CHAT_SERVICE_TOKEN: ${{ secrets.TF_VAR_CHAT_SERVICE_TOKEN }}
TF_VAR_CLIENT_ID: ${{ secrets.TF_VAR_CLIENT_ID }}
TF_VAR_CLIENT_SECRET: ${{ secrets.TF_VAR_CLIENT_SECRET }}
Expand Down
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ To setup your bot, you will need to modify your `config.env` file. To make thing
There are three main components to errbot:

- The chatbot itself - This is `errbot`, the python app running in a docker container which processes requests - `src/errbot/`
- The status page - This is the uptime-kuma docker app which accepts push events from the chatbot to display its health - `src/status_page/` - *add on service to the core chatbot*
- The NGINX reverse proxy - This is a simple NGINX server which proxies HTTP requests to the status page - `src/nginx/` - *add on service to the core chatbot*

The **status_page** and **NGINX** server are mainly just additions to the observability of **errbot**. The do not affect the functionality of the chatbot in any meaningful way.

### Testing and Building Locally 🧪

Expand Down Expand Up @@ -260,8 +256,6 @@ What is in each folder?
- `src/errbot/backend/` - Folder containing extra backend modules (Discord)
- `src/errbot/` - Folder containing all the extra / custom plugins for our chatop commands
- `src/errbot/lib/` - Folder containing shared libraries for plugins
- `src/status_page/` - Folder containing the code for building the errbot status page (uptime-kuma)
- `src/nginx/` - Folder containing the docker components for building the NGINX reverse proxy to handle HTTP requests for the status page

What are these files?

Expand All @@ -288,16 +282,6 @@ Core:
- For any commands that require some form of "state" we use AWS DynamoDB to store information since containers are ephemeral by design
- We store any configuration as environment variables and secrets as k8s secrets which get injected into the container on boot

Status Page:

In addition to the core `errbot` container, we also deploy a **status page** to k8s which accepts HTTP requests that are interpreted as healthchecks from `errbot`. The project that is used is [uptime-kuma](https://github.com/louislam/uptime-kuma). The **status page** consists of two components: the "app" (kuma-uptime) and the NGINX reverse proxy.

- The status page source code is built via Docker in CI/CD (`src/status_page`)
- The NGINX reverse proxy source code is built via Docker in CI/CD (`src/nginx`)
- The status page and NGINX images are deployed with Terraform and GitHub actions to our k8s cluster
- `errbot` will make HTTP GET requests to the `src/status_page` app at a set interval which gets registered as a healthcheck if it is successful (configured via the `STATUS_PUSH_ENDPOINT` environment variable)
- End users can view the status page which is accessible from the NGINX reverse proxy (kong ingress gateway is configured to forward requets to it)

---

## Mkdocs Documentation 📚
Expand Down
4 changes: 2 additions & 2 deletions config.env
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ RIOT_REGION='na1'
RIOT_REGION_V5='AMERICAS'

# Status page push endpoint (for obserability - dev only)
STATUS_PUSH_ENDPOINT='http://status_page:3001/api/push/jQuCvxd6lC?msg=OK'
# STATUS_PUSH_ENDPOINT='http://status_page:3001/api/push/jQuCvxd6lC?msg=OK'

# Public URL for status page
STATUS_PAGE_URL='https://errbot-status.birki.io'
# STATUS_PAGE_URL='https://errbot-status.birki.io'

# Public URL for documentation
DOCS_URL='https://errbot-docs.birki.io'
26 changes: 0 additions & 26 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,3 @@ services:
env_file:
- ./config.env
- ./creds.env
depends_on:
- status_page
status_page:
container_name: status_page
restart: always
volumes:
- ./src/status_page/data:/app/data
ports:
- 3001:3001
build:
context: ./src/status_page
dockerfile: ./dockerfile

nginx_proxy:
container_name: nginx_proxy
build:
context: ./src/nginx
dockerfile: ./dockerfile
ports:
- "8080:8080"
environment:
- SERVER_NAME=localhost
- BACKEND_ADDR=status_page
- BACKEND_PORT=3001
depends_on:
- status_page
16 changes: 0 additions & 16 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ To setup your bot, you will need to modify your `config.env` file. To make thing
There are three main components to errbot:

- The chatbot itself - This is `errbot`, the python app running in a docker container which processes requests - `src/errbot/`
- The status page - This is the uptime-kuma docker app which accepts push events from the chatbot to display its health - `src/status_page/` - *add on service to the core chatbot*
- The NGINX reverse proxy - This is a simple NGINX server which proxies HTTP requests to the status page - `src/nginx/` - *add on service to the core chatbot*

The **status_page** and **NGINX** server are mainly just additions to the observability of **errbot**. The do not affect the functionality of the chatbot in any meaningful way.

### Testing and Building Locally

Expand Down Expand Up @@ -191,8 +187,6 @@ What is in each folder?
- `src/errbot/backend/` - Folder containing extra backend modules (Discord)
- `src/errbot/` - Folder containing all the extra / custom plugins for our chatop commands
- `src/errbot/lib/` - Folder containing shared libraries for plugins
- `src/status_page/` - Folder containing the code for building the errbot status page (uptime-kuma)
- `src/nginx/` - Folder containing the docker components for building the NGINX reverse proxy to handle HTTP requests for the status page

What are these files?

Expand All @@ -219,16 +213,6 @@ Core:
- For any commands that require some form of "state" we use AWS DynamoDB to store information since containers are ephemeral by design
- We store any configuration as environment variables and secrets as k8s secrets which get injected into the container on boot

Status Page:

In addition to the core `errbot` container, we also deploy a **status page** to k8s which accepts HTTP requests that are interpreted as healthchecks from `errbot`. The project that is used is [uptime-kuma](https://github.com/louislam/uptime-kuma). The **status page** consists of two components: the "app" (kuma-uptime) and the NGINX reverse proxy.

- The status page source code is built via Docker in CI/CD (`src/status_page`)
- The NGINX reverse proxy source code is built via Docker in CI/CD (`src/nginx`)
- The status page and NGINX images are deployed with Terraform and GitHub actions to our k8s cluster
- `errbot` will make HTTP GET requests to the `src/status_page` app at a set interval which gets registered as a healthcheck if it is successful (configured via the `STATUS_PUSH_ENDPOINT` environment variable)
- End users can view the status page which is accessible from the NGINX reverse proxy (kong ingress gateway is configured to forward requets to it)

---

## Mkdocs Documentation 📚
Expand Down
4 changes: 2 additions & 2 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ k8s_success () {
PROXY_IP=$(kubectl get -o jsonpath="{.status.loadBalancer.ingress[0].ip}" service -n kong kong-proxy)

echo -e "✅ All manifests applied successfully\n"
echo -e "🦍 Kong LoadBalancer IP: http://$PROXY_IP"
echo -e "📊 Run 'script/grafana' to connect to the Kong metrics dashboard"
# echo -e "🦍 Kong LoadBalancer IP: http://$PROXY_IP"
# echo -e "📊 Run 'script/grafana' to connect to the Kong metrics dashboard"
echo -e "✨ Done! ✨"
}

Expand Down
5 changes: 0 additions & 5 deletions script/build-and-push-azure
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@ echo "✅ Successfully logged into ACR"
docker build -t $ACR_NAME.azurecr.io/errbot:test $REPO_DIR/src/errbot
docker push $ACR_NAME.azurecr.io/errbot:test
echo "✅ Successfully pushed the errbot image"

cd $REPO_DIR
$REPO_DIR/script/status-page --build-and-tag-only --tag="$ACR_NAME.azurecr.io/status_page:test"
docker push $ACR_NAME.azurecr.io/status_page:test
echo "✅ Successfully pushed the status_page image"
8 changes: 7 additions & 1 deletion src/errbot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ FROM python:3.9-alpine
WORKDIR /app

# install alpine dependencies
RUN apk add gcc musl-dev libffi-dev make libffi-dev libsodium-dev opus-dev ffmpeg
RUN apk add gcc musl-dev libffi-dev make libffi-dev libsodium-dev opus-dev ffmpeg zlib-dev jpeg-dev

# setup selenium
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.14/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.14/community" >> /etc/apk/repositories
RUN apk update
RUN apk add chromium chromium-chromedriver xvfb

# install python dependencies
COPY requirements.txt .
Expand Down
Loading

0 comments on commit c695b87

Please sign in to comment.