Skip to content

Commit

Permalink
.github: Configure Gihub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
XxRoloxX committed Oct 11, 2024
1 parent cbf986e commit 6ecb6c9
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 81 deletions.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ KAFKA_EXTERNAL_HOSTNAME=kafka
KAFKA_CLIENT_USERNAME=username
KAFKA_CLIENT_PASSWORD=password
KAFKA_CLIENT_BATCH_SIZE=5

MONGOEXPRESS_USERNAME=admin
MONGOEXPRESS_PASSWORD=password
35 changes: 35 additions & 0 deletions .github/workflows/docker-compose-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Push Docker Images

on:
push:
branches:
- adam-lamers/configure-cicd

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker Compose Build
run: |
docker compose build
env:
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
VITE_BACKEND_URL: ${{ secrets.VITE_BACKEND_URL }}

- name: Docker Compose Push
run: |
docker compose push
1 change: 0 additions & 1 deletion client/src/components/Navbar/Navbar.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import '@/variables';

.navbar {
background-image: url('@/assets/login-banner.png');
width: 100%;
display: flex;
flex-direction: row;
Expand Down
103 changes: 102 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,105 @@ services:
path: ./client/src
target: /app/src
- action: rebuild
path: ./client/package.json
path: ./client/package.json
pod-agent:
user: "0" # Elevated permission needed for bind mount
container_name: magpie-monitor-pod-agent
build:
context: ./agent/app
dockerfile: Dockerfile
restart: always
depends_on:
- kafka
command:
- "--scrape"
- "pods"
- "--scrapeIntervalSeconds"
- "30"
- "--remoteWriteBrokerUrl"
- ${KAFKA_BROKER_URL}
- "--remoteWriteBrokerUsername"
- ${KAFKA_CLIENT_USERNAME}
- "--remoteWriteBrokerPassword"
- ${KAFKA_CLIENT_PASSWORD}
- "--remoteWriteBatchSize"
- ${KAFKA_CLIENT_BATCH_SIZE}
develop:
watch:
- action: rebuild
path: ./agent/app
target: /src
volumes:
- ${POD_AGENT_HOST_KUBECONFIG_PATH}:/root/.kube
node-agent:
user: "0" # Elevated permission needed for bind mount
container_name: magpie-monitor-node-agent
depends_on:
- kafka
- redis
build:
context: ./agent/app
dockerfile: Dockerfile
restart: always
command:
- "--scrape"
- "nodes"
- "--redisUrl"
- "redis:6379"
- "--redisPassword"
- ${REDIS_PASSWORD}
- "--file"
- "/var/log/file"
- "--remoteWriteBrokerUrl"
- ${KAFKA_BROKER_URL}
- "--remoteWriteBrokerUsername"
- ${KAFKA_CLIENT_USERNAME}
- "--remoteWriteBrokerPassword"
- ${KAFKA_CLIENT_PASSWORD}
- "--remoteWriteBatchSize"
- ${KAFKA_CLIENT_BATCH_SIZE}
environment:
NODE_NAME: "mock-node-name"
develop:
watch:
- action: rebuild
path: ./agent/app
target: /src
volumes:
- ${NODE_AGENT_HOST_WATCHED_FILE_PATH}:/var/log/file
redis:
image: redis:7.4-alpine
restart: always
command:
- "--requirepass"
- ${REDIS_PASSWORD}
ports:
- "6379:6379"
volumes:
- redisdata:/data
logs-generation-service:
user: "0"
container_name: magpie-monitor-logs-generation-service
restart: on-failure
image: magpiemonitor/logs-generation-service
build:
context: ./go
dockerfile: ./docker/logs_generation/Dockerfile
environment:
- LOGS_INGESTION_QUEUE_HOST=${LOGS_INGESTION_QUEUE_HOST}
- LOGS_INGESTION_QUEUE_PORT=${LOGS_INGESTION_QUEUE_PORT}
- LOGS_INGESTION_QUEUE_USERNAME=${KAFKA_CLIENT_USERNAME}
- LOGS_INGESTION_QUEUE_PASSWORD=${KAFKA_CLIENT_PASSWORD}
develop:
watch:
- action: rebuild
path: ./go/services/logs_generation
target: /src
- action: rebuild
path: ./go/pkg
target: /src
depends_on:
- kafka

volumes:
redisdata:
85 changes: 6 additions & 79 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
client:
container_name: magpie-monitor-client
image: magpiemonitor/client
build:
context: ./client
dockerfile: Dockerfile
Expand All @@ -15,11 +16,12 @@ services:
user: "0"
container_name: magpie-monitor-reports-service
restart: on-failure
image: magpiemonitor/reports-service
build:
context: ./go
dockerfile: ./docker/reports/Dockerfile
ports:
- ${REPORTS_SERVICE_PORT}:${REPORTS_SERVICE_PORT}
- ${REPORTS_SERVICE_PORT:-8090}:${REPORTS_SERVICE_PORT:-8090}
develop:
watch:
- action: rebuild
Expand Down Expand Up @@ -54,11 +56,10 @@ services:
user: "0"
container_name: magpie-monitor-logs-ingestion-service
restart: on-failure
image: magpiemonitor/logs-ingestion-service
build:
context: ./go
dockerfile: ./docker/logs_ingestion/Dockerfile
ports:
- ${LOGS_INGESTION_SERVICE_HTTP_PORT}:${LOGS_INGESTION_SERVICE_HTTP_PORT}
environment:
- LOGS_INGESTION_SERVICE_HTTP_PORT=${LOGS_INGESTION_SERVICE_HTTP_PORT}
- LOGSDB_PORT=${LOGSDB_PORT}
Expand Down Expand Up @@ -92,6 +93,7 @@ services:
user: "0"
container_name: magpie-monitor-logs-generation-service
restart: on-failure
image: magpiemonitor/logs-generation-service
build:
context: ./go
dockerfile: ./docker/logs_generation/Dockerfile
Expand Down Expand Up @@ -149,85 +151,10 @@ services:
ME_CONFIG_MONGODB_ADMINPASSWORD: ${REPORTSDB_PASSWORD}
depends_on:
- mongodb
pod-agent:
user: "0" # Elevated permission needed for bind mount
container_name: magpie-monitor-pod-agent
build:
context: ./agent/app
dockerfile: Dockerfile
restart: always
depends_on:
- kafka
command:
- "--scrape"
- "pods"
- "--scrapeIntervalSeconds"
- "30"
- "--remoteWriteBrokerUrl"
- ${KAFKA_BROKER_URL}
- "--remoteWriteBrokerUsername"
- ${KAFKA_CLIENT_USERNAME}
- "--remoteWriteBrokerPassword"
- ${KAFKA_CLIENT_PASSWORD}
- "--remoteWriteBatchSize"
- ${KAFKA_CLIENT_BATCH_SIZE}
develop:
watch:
- action: rebuild
path: ./agent/app
target: /src
volumes:
- ${POD_AGENT_HOST_KUBECONFIG_PATH}:/root/.kube
node-agent:
user: "0" # Elevated permission needed for bind mount
container_name: magpie-monitor-node-agent
depends_on:
- kafka
- redis
build:
context: ./agent/app
dockerfile: Dockerfile
restart: always
command:
- "--scrape"
- "nodes"
- "--redisUrl"
- "redis:6379"
- "--redisPassword"
- ${REDIS_PASSWORD}
- "--file"
- "/var/log/file"
- "--remoteWriteBrokerUrl"
- ${KAFKA_BROKER_URL}
- "--remoteWriteBrokerUsername"
- ${KAFKA_CLIENT_USERNAME}
- "--remoteWriteBrokerPassword"
- ${KAFKA_CLIENT_PASSWORD}
- "--remoteWriteBatchSize"
- ${KAFKA_CLIENT_BATCH_SIZE}
environment:
NODE_NAME: "mock-node-name"
develop:
watch:
- action: rebuild
path: ./agent/app
target: /src
volumes:
- ${NODE_AGENT_HOST_WATCHED_FILE_PATH}:/var/log/file
# Please ignore warning about vm.overcommit_memory, it requires host changes that aren't justified in a dev environment.
redis:
image: redis:7.4-alpine
restart: always
command:
- "--requirepass"
- ${REDIS_PASSWORD}
ports:
- "6379:6379"
volumes:
- redisdata:/data

management-service:
container_name: magpie-monitor-management-service
image: magpiemonitor/management-service
build:
context: ./management-service
dockerfile: Dockerfile
Expand Down

0 comments on commit 6ecb6c9

Please sign in to comment.