-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kerem/metrics discovery without volumes (#382)
- This PR removes persistent volume requirements in order to simplify the metrics aggregator deployment. This way we won't need to maintain additional cloud components like EFS or EBS. - We're also setting up docker builds in this same PR.
- Loading branch information
1 parent
ad6a912
commit b241aaf
Showing
8 changed files
with
100 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: 'Build River Metrics Discovery Docker Image' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'packages/**' | ||
workflow_dispatch: | ||
|
||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CD_WORKFLOW_WEBHOOK_URL }} | ||
|
||
jobs: | ||
build: | ||
name: Build docker image | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-aws-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
with: | ||
registry-type: 'public' | ||
|
||
- name: Build and push docker image to Amazon ECR | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-aws-ecr.outputs.registry }} | ||
#This can be custom alias once requested to aws and approved for public repo | ||
REGISTRY_ALIAS: h5v6m2x1 | ||
ECR_REPOSITORY: river-metrics-discovery | ||
run: | | ||
docker build -t $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:latest . -f ./packages/metrics-discovery/Dockerfile | ||
docker push $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:latest | ||
# If action failed, we send a slack notification | ||
- name: Slack notification | ||
if: failure() | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"step": "Build Metrics Discovery Docker Image", | ||
"environment": "N/", | ||
"branch": "${{ github.ref }}", | ||
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
"commit": "${{ github.sha }}", | ||
"actor": "${{ github.actor }}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
prometheus/etc/config/targets.json | ||
prometheus/etc/config | ||
.env |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
packages/metrics-discovery/src/create-prometheus-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import fs from 'fs' | ||
|
||
const PROMETHEUS_CONFIG_FILE_SOURCE = './prometheus-config.yml' | ||
const PROMETHEUS_CONFIG_FILE_DESTINATION = './prometheus/etc/config/prometheus-config.yml' | ||
|
||
export const createPrometheusConfig = async () => { | ||
console.info('Creating prometheus config...') | ||
const prometheusConfig = await fs.promises.readFile(PROMETHEUS_CONFIG_FILE_SOURCE, { | ||
encoding: 'utf8', | ||
}) | ||
await fs.promises.writeFile(PROMETHEUS_CONFIG_FILE_DESTINATION, prometheusConfig, { | ||
encoding: 'utf8', | ||
}) | ||
console.info(`Prometheus config written to: ${PROMETHEUS_CONFIG_FILE_DESTINATION}`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,3 @@ | ||
import fs, { WriteFileOptions } from 'fs' | ||
|
||
export function sleep(ms: number) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)) | ||
} | ||
|
||
export function writeFile( | ||
file: string, | ||
data: string | NodeJS.ArrayBufferView, | ||
options: WriteFileOptions, | ||
) { | ||
return new Promise<void>((resolve, reject) => { | ||
fs.writeFile(file, data, options, (err) => { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve() | ||
} | ||
}) | ||
}) | ||
} |