Add Prometheus monitoring integration and enhance application metrics
This commit is contained in:
@@ -16,9 +16,12 @@
|
||||
// "postCreateCommand": "bundle install && rake db:setup",
|
||||
"postCreateCommand": ".devcontainer/post-create.sh",
|
||||
"forwardPorts": [
|
||||
8080, // pgadmin
|
||||
3000, // rails development
|
||||
3001 // rails staging
|
||||
3001, // rails staging
|
||||
9394, // prometheus exporter
|
||||
"pgadmin:8080", // pgadmin
|
||||
"grafana:3100", // grafana
|
||||
"prometheus:9090" // prometheus
|
||||
]
|
||||
// Configure tool-specific properties.
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
|
||||
@@ -16,7 +16,6 @@ services:
|
||||
OTEL_SERVICE_NAME: redux-scraper-dev
|
||||
OTEL_RESOURCE_ATTRIBUTES: application=redux-scraper-dev
|
||||
command: sleep infinity
|
||||
network_mode: service:db
|
||||
|
||||
db:
|
||||
build:
|
||||
@@ -34,7 +33,6 @@ services:
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4:8.14.0
|
||||
restart: unless-stopped
|
||||
network_mode: service:db
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: admin@example.com
|
||||
PGADMIN_DEFAULT_PASSWORD: password
|
||||
@@ -42,7 +40,28 @@ services:
|
||||
PGADMIN_CONFIG_SERVER_MODE: 'False'
|
||||
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False'
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./prometheus:/etc/prometheus
|
||||
- devcontainer-redux-prometheus-data:/prometheus
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- GF_SERVER_HTTP_PORT=3100
|
||||
- GF_USERS_ALLOW_SIGN_UP=false
|
||||
- GF_LOG_LEVEL=debug
|
||||
volumes:
|
||||
- devcontainer-redux-grafana-data:/var/lib/grafana
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
devcontainer-redux-gem-cache:
|
||||
devcontainer-redux-blob-files:
|
||||
devcontainer-redux-grafana-data:
|
||||
devcontainer-redux-prometheus-data:
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
function mkdir_and_chmod {
|
||||
sudo mkdir -p $1
|
||||
sudo chmod 777 $1
|
||||
}
|
||||
|
||||
mkdir_and_chmod .devcontainer/data/prometheus
|
||||
mkdir_and_chmod .devcontainer/data/grafana
|
||||
echo "Path: $PATH"
|
||||
echo "Ruby: $(which ruby)"
|
||||
echo "Gem: $(which gem)"
|
||||
|
||||
12
.devcontainer/prometheus/prometheus.yml
Normal file
12
.devcontainer/prometheus/prometheus.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['prometheus:9090']
|
||||
|
||||
- job_name: 'rails'
|
||||
static_configs:
|
||||
- targets: ['app:9394']
|
||||
Reference in New Issue
Block a user