Modified docker definitions to use internal caddy_net

Exposing ports on docker-compose bypasses UFW definitions, which is a
high risk, so we use internal networks only to connect between
containers
This commit is contained in:
2025-01-26 00:55:05 -03:00
parent 9b88311406
commit f352126e56
3 changed files with 4 additions and 6 deletions

View File

@@ -16,4 +16,4 @@ services:
networks: networks:
caddy_net: # Crete VPN internal - Need to bind running containers to this network as well caddy_net: # Crete VPN internal - Need to bind running containers to this network as well
driver: bridge external: true # caddy_net must be created before spinning up containers

View File

@@ -3,8 +3,6 @@ services:
image: prom/prometheus:latest image: prom/prometheus:latest
container_name: prometheus container_name: prometheus
restart: always restart: always
ports:
- "9090:9090"
volumes: volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml - ./prometheus.yml:/etc/prometheus/prometheus.yml
networks: networks:
@@ -15,12 +13,12 @@ services:
image: prom/node-exporter:latest image: prom/node-exporter:latest
container_name: node-exporter container_name: node-exporter
restart: always restart: always
ports:
- "9100:9100"
networks: networks:
- monitoring_net - monitoring_net
networks: networks:
monitoring_net: monitoring_net:
driver: bridge driver: bridge
caddy_net:
external: true

View File

@@ -5,7 +5,7 @@ scrape_configs:
- job_name: 'prometheus' - job_name: 'prometheus'
static_configs: static_configs:
- targets: ['localhost:9090'] - targets: ['prometheus:9090']
- job_name: 'node' - job_name: 'node'
static_configs: static_configs: