Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jpradoar committed Jun 7, 2023
0 parents commit 41b364b
Show file tree
Hide file tree
Showing 60 changed files with 3,368 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/consumer-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Consumer-CI
on:
push:
branches:
- main
paths:
- '04-consumer/**' # Any change in this path, make trigger build action.
- '.github/workflows/consumer-ci.yaml'

env:
REPO_APP: 'mqtt-consumer'
SLACK_CHANNEL: 'builds-and-ci'
SLACK_MSG_COLOR: '#0092ff'
BUILD_CONTEXT: './04-consumer'

jobs:
Consumer-CI_build-docker-image:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate tag ID
id: tag_id
run: echo "::set-output name=IMAGE_TAG::$(date +%Y.%m)"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ env.BUILD_CONTEXT }}
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}'
format: 'table'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
#exit-code: '1'

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}
SLACK_COLOR: ${{ env.SLACK_MSG_COLOR }}
SLACK_MESSAGE: 'URL: https://hub.docker.com/repository/docker/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}'
SLACK_TITLE: ':rocket: GithubAction Build docker image: [ ${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }} ]'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
63 changes: 63 additions & 0 deletions .github/workflows/dbwriter-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: DBWriter-CI
on:
push:
branches:
- main
paths:
- '05-dbwriter/**' # Any change in this path, make trigger build action.
- '.github/workflows/dbwriter-ci.yaml'

env:
REPO_APP: 'mqtt-dbwriter'
SLACK_CHANNEL: 'builds-and-ci'
SLACK_MSG_COLOR: '#0092ff'
BUILD_CONTEXT: './05-dbwriter'

jobs:
DBWriter-CI_build-docker-image:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate tag ID
id: tag_id
run: echo "::set-output name=IMAGE_TAG::$(date +%Y.%m)"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ env.BUILD_CONTEXT }}
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}'
format: 'table'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
#exit-code: '1'

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}
SLACK_COLOR: ${{ env.SLACK_MSG_COLOR }}
SLACK_MESSAGE: 'URL: https://hub.docker.com/repository/docker/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}'
SLACK_TITLE: ':rocket: GithubAction Build docker image: [ ${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }} ]'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

62 changes: 62 additions & 0 deletions .github/workflows/k8s-event-exporter-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: k8s-event-exporter-CI
on:
push:
branches:
- main
paths:
- '12-k8s-event-exporter/**' # Any change in this path, make trigger build action.
- '.github/workflows/k8s-event-exporter-ci.yaml'

env:
REPO_APP: 'k8s-event-exporter'
SLACK_CHANNEL: 'builds-and-ci'
SLACK_MSG_COLOR: '#0092ff'
BUILD_CONTEXT: './12-k8s-event-exporter'

jobs:
Build-Docker-image:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate tag ID
id: tag_id
run: echo "::set-output name=IMAGE_TAG::$(date +%Y.%m)"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ env.BUILD_CONTEXT }}
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}'
format: 'table'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
#exit-code: '1'

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}
SLACK_COLOR: ${{ env.SLACK_MSG_COLOR }}
SLACK_MESSAGE: 'URL: https://hub.docker.com/repository/docker/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}'
SLACK_TITLE: ':rocket: GithubAction Build docker image: [ ${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }} ]'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
63 changes: 63 additions & 0 deletions .github/workflows/producer-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Producer-CI
on:
push:
branches:
- main
paths:
- '03-producer/**' # Any change in this path, make trigger build action.
- '.github/workflows/producer-ci.yaml'

env:
REPO_APP: 'mqtt-producer'
SLACK_CHANNEL: 'builds-and-ci'
SLACK_MSG_COLOR: '#0092ff'
BUILD_CONTEXT: './03-producer'

jobs:
Producer-CI_build-docker-image:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate tag ID
id: tag_id
run: echo "::set-output name=IMAGE_TAG::$(date +%Y.%m)"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ env.BUILD_CONTEXT }}
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}'
format: 'table'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
#exit-code: '1'

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}
SLACK_COLOR: ${{ env.SLACK_MSG_COLOR }}
SLACK_MESSAGE: 'URL: https://hub.docker.com/repository/docker/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}'
SLACK_TITLE: ':rocket: GithubAction Build docker image: [ ${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }} ]'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

63 changes: 63 additions & 0 deletions .github/workflows/webserver-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: webserver-CI
on:
push:
branches:
- main
paths:
- '06-webserver/**' # Any change in this path, make trigger build action.
- '.github/workflows/webserver-ci.yaml'

env:
REPO_APP: 'mqtt-webserver'
SLACK_CHANNEL: 'builds-and-ci'
SLACK_MSG_COLOR: '#0092ff'
BUILD_CONTEXT: './06-webserver'

jobs:
webserver-CI_build-docker-image:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate tag ID
id: tag_id
run: echo "::set-output name=IMAGE_TAG::$(date +%Y.%m)"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ env.BUILD_CONTEXT }}
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }}'
format: 'table'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
#exit-code: '1'

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ env.SLACK_CHANNEL }}
SLACK_COLOR: ${{ env.SLACK_MSG_COLOR }}
SLACK_MESSAGE: 'URL: https://hub.docker.com/repository/docker/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_APP }}'
SLACK_TITLE: ':rocket: GithubAction Build docker image: [ ${{ env.REPO_APP }}:${{ steps.tag_id.outputs.IMAGE_TAG }} ]'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/*.log
**/*_bkp
**/*_tmp
**/*.ignore
**/*.key
**/*.pem
**/*.secure
temp/
tmp/
5 changes: 5 additions & 0 deletions 01-generic-pub_sub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:latest
WORKDIR /app
ADD ./pubsub.py /app/api.py
RUN apk add python3 py3-pip bind-tools && pip3 install flask pika prometheus_client
CMD [ "python3", "-u", "./api.py" ]
Loading

0 comments on commit 41b364b

Please sign in to comment.