Skip to content

Commit 929b897

Browse files
committed
Merge branch 'datadog-integration'
2 parents e081f82 + 1b659f0 commit 929b897

File tree

5 files changed

+53
-9
lines changed

5 files changed

+53
-9
lines changed

.env.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ DB_NAME=<POSTGRES DATABASE NAME>
33
DB_USER=<POSTGRES DATABASE USERNAME>
44
DB_PASS=<POSTGRES DATABASE PASSWORD>
55
DB_SERVICE=<HOST>
6-
DB_PORT=<PORT (DEFAULT=5432)>
6+
DB_PORT=<PORT (DEFAULT=5432)>
7+
DATADOG_USER=<POSTGRES DATADOG USERNAME>
8+
DATADOG_PASSWORD=<POSTGRES DATADOG PASSWORD>

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ venv/
33
*.pyc
44
*/__pycache__/*
55
config/postgres/.env
6+
config/datadog/.env

config/datadog/.env.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DD_API_KEY=<DATADOG API KEY>
2+
DD_HOSTNAME=<HOSTNAME>
3+
DD_SITE=<DATADOG SITE (US OR EU)>
4+
DD_LOGS_ENABLED=<ENABLE LOGS (DISABLED BY DEFAULT)>

config/nginx/conf.d/status.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
server {
2+
listen 81;
3+
server_name localhost;
4+
5+
access_log off;
6+
# allow 127.0.0.1;
7+
# deny all;
8+
9+
location /nginx_status {
10+
# Choose your status module
11+
12+
# freely available with open source NGINX
13+
stub_status;
14+
15+
# for open source NGINX < version 1.7.5
16+
# stub_status on;
17+
18+
# available only with NGINX Plus
19+
# status;
20+
}
21+
}

docker-compose.yaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ services:
88
env_file:
99
- .env
1010
networks:
11-
- nginx_network
12-
- postgres_network
11+
- datadog_network
1312
depends_on:
1413
- postgres
1514

@@ -20,9 +19,13 @@ services:
2019
depends_on:
2120
- django
2221
networks:
23-
- nginx_network
22+
- datadog_network
2423
ports:
2524
- 8000:80
25+
labels:
26+
com.datadoghq.ad.check_names: '["nginx"]'
27+
com.datadoghq.ad.init_configs: '[{}]'
28+
com.datadoghq.ad.instances: '[{"nginx_status_url": "http://%%host%%:81/nginx_status"}]'
2629

2730
postgres:
2831
image: postgres:12.3
@@ -31,15 +34,28 @@ services:
3134
env_file:
3235
- config/postgres/.env
3336
networks:
34-
- postgres_network
37+
- datadog_network
3538
ports:
3639
- '5432:5432'
40+
labels:
41+
com.datadoghq.ad.check_names: '["postgres"]'
42+
com.datadoghq.ad.init_configs: '[{}]'
43+
com.datadoghq.ad.instances: '[{"host":"%%host%%", "port":5432,"username":"${DATADOG_USER}","password":"${DATADOG_PASSWORD}"}]'
44+
45+
datadog:
46+
image: datadog/agent:7.19.2
47+
env_file:
48+
- config/datadog/.env
49+
networks:
50+
- datadog_network
51+
volumes:
52+
- /var/run/docker.sock:/var/run/docker.sock
53+
- /proc/:/host/proc/:ro
54+
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
3755

3856
networks:
39-
nginx_network:
40-
driver: bridge
41-
postgres_network:
42-
driver: bridge
57+
datadog_network:
58+
driver: bridge
4359

4460
volumes:
4561
postgres_volume:

0 commit comments

Comments
 (0)