Skip to content

Commit

Permalink
comments and container names added while debugging prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
dmdequin committed Oct 18, 2023
1 parent 985dfbe commit 6f1a837
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docker-compose-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
- main

db:
container_name: db
image: postgres:13-alpine
restart: always
volumes:
Expand All @@ -39,6 +40,7 @@ services:
- main

prometheus:
container_name: prometheus
image: prom/prometheus
volumes:
- ./prometheus:/etc/prometheus
Expand All @@ -48,6 +50,7 @@ services:
- main

proxy:
container_name: proxy
build:
context: ./proxy
restart: always
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- main

db:
container_name: db
image: postgres:13-alpine
volumes:
- dev-db-data:/var/lib/postgresql/data
Expand All @@ -48,6 +49,7 @@ services:
- main

prometheus:
container_name: prometheus
image: prom/prometheus
volumes:
- ./prometheus:/etc/prometheus
Expand Down
14 changes: 10 additions & 4 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ scrape_configs:
- job_name: 'monitoring'
metrics_path: /metrics
static_configs:
- targets: [
'prometheus:9090',
'app:8000', # can specify an IP
]
- targets: ['app:8000'] # can specify an IP
# 127.0.0.1:8000 is http://cded26fdc423:8000/metrics
# app:8000 is http://app:8000/metrics
# for local deployment 'app:8000 works correctly'
# 172.27.0.1:8000 times out
# host.docker.internal:8000 400 bad request

- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090']
6 changes: 6 additions & 0 deletions proxy/default.conf.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{* pass in environment variables to nginx at runtime *}

server {
{* port server will listen on *}
listen ${LISTEN_PORT};

{* map /static url to /vol/static in system *}
location /static {
alias /vol/static;
}

{* map the rest of the urls *}
location / {
uwsgi_pass ${APP_HOST}:${APP_PORT};
include /etc/nginx/uwsgi_params;
client_max_body_size 10M;
{* proxy_pass http://app:8000; *}
}
}
2 changes: 1 addition & 1 deletion proxy/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e

envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'
nginx -g 'daemon off;' # run nginx in the foreground with daemon off to ensure logs are output to screen
1 change: 1 addition & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ python manage.py collectstatic --noinput
python manage.py migrate
python manage.py load_msisdn_data

# run uwsgi service, on tcp socket, port 9000
uwsgi --socket :9000 --workers 4 --master --enable-threads --module app.wsgi

0 comments on commit 6f1a837

Please sign in to comment.