-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
156 lines (151 loc) · 6.81 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
version: '3.7'
#================================================================================================
# NETWORK SETUP
#================================================================================================
networks:
devopscorner_net:
name: devopscorner_net
driver: bridge
ipam:
config:
- subnet: 172.148.0.0/16
#================================================================================================
# VOLUME SETUP
#================================================================================================
volumes:
vol_portainer:
driver: ${VOLUMES_DRIVER:-local}
driver_opts:
o: bind
type: none
device: ${DATA_PORTAINER:-/opt/data/docker/portainer2.9}
vol_go_bookstore_adot:
driver: ${VOLUMES_DRIVER:-local}
driver_opts:
o: bind
type: none
device: ${DATA_GO_BOOKSTORE_ADOT:-/opt/data/docker/go-bookstore-adot}
services:
#================================================================================================
# PORTAINER
#================================================================================================
portainer:
image: dockerframework/portainer:${PORTAINER_VERSION:-2.9}
container_name: ${CONTAINER_PORTAINER:-devopscorner_portainer}
restart: unless-stopped
ports:
- "${PORT_PORTAINER:-5212}:9000"
volumes:
# - /etc/localtime:/etc/localtime:ro ## Do not use it in mac
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s
- vol_portainer:/data
environment:
- PORTAINER_TEMPLATE=generic
- PORTAINER_VERSION=${PORTAINER_VERSION:-2.9}
privileged: true
networks:
devopscorner_net:
ipv4_address: ${CONTAINER_IP_PORTAINER:-172.148.148.5}
#================================================================================================
# OTEL
#================================================================================================
otel:
image: amazon/aws-otel-collector:latest
container_name: ${CONTAINER_OTEL:-devopscorner_otel}
restart: unless-stopped
ports:
- "1777:1777" # pprof extension
- "55679:55679" # zpages extension
- "4317:4317" # OTLP receiver
- "13133" # health_check
volumes:
- ./docker/config/otel/config.yaml:/etc/otel-agent-config.yaml
- ~/.aws:/root/.aws
command: ["--config=/etc/otel-agent-config.yaml"]
environment:
- AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
- AWS_REGION=us-west-2
privileged: true
networks:
devopscorner_net:
ipv4_address: ${CONTAINER_IP_PORTAINER:-172.148.148.12}
#================================================================================================
# GOLANG-BOOKSTORE-ADOT
#================================================================================================
go-bookstore-adot:
build:
context: .
dockerfile: Dockerfile
container_name: ${CONTAINER_GO_BOOKSTORE_ADOT:-devopscorner_go_bookstore_adot}
restart: unless-stopped
ports:
- "${PORT_GO_BOOKSTORE_ADOT:-8080}:8080"
volumes:
# - /etc/localtime:/etc/localtime:ro ## Do not use it in mac
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s
environment:
- TZ="Asia/Jakarta"
- ALPINE_VERSION=${ALPINE_VERSION:-3.17}
- CODEBUILD_VERSION=${CODEBUILD_VERSION:-4.0}
- GIN_MODE=release
- APP_URL=${APP_URL:-http://localhost}
- APP_PORT=${APP_PORT:-8080}
- DB_CONNECTION=${DB_CONNECTION:-sqlite}
- DB_HOST=${DB_HOST:-localhost}
- DB_PORT=${DB_PORT}
- DB_DATABASE=${DB_DATABASE:-go-bookstore.db}
- DB_USERNAME=${DB_USERNAME:-root}
- DB_PASSWORD=${DB_PASSWORD}
- JWT_AUTH_USERNAME=${JWT_AUTH_USERNAME:-devopscorner}
- JWT_AUTH_PASSWORD=${JWT_AUTH_PASSWORD:-DevOpsCorner2023}
- JWT_SECRET=${JWT_SECRET:-s3cr3t}
# Logger
- LOG_LEVEL=${LOG_LEVEL:-INFO}
# AWS Credentials
- AWS_REGION=${AWS_REGION:-us-west-2}
- AWS_ACCESS_KEY=${AWS_ACCESS_KEY:-YOUR_AWS_ACCESS_KEY}
- AWS_SECRET_KEY_ID=${AWS_SECRET_KEY_ID:-YOUR_AWS_SECRET_KEY_ID}
# OpenSearch
- OPENSEARCH_ENDPOINT=${OPENSEARCH_ENDPOINT:-https://opensearch.us-west-2.es.amazonaws.com}
- OPENSEARCH_USERNAME=${OPENSEARCH_USERNAME:-devopscorner}
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD:-DevOpsCorner2023}
# Prometheus
- PROMETHEUS_ENDPOINT=${PROMETHEUS_ENDPOINT:-http://localhost:9090}
# Grafana
- GRAFANA_ENDPOINT=${GRAFANA_ENDPOINT:-http://localhost:3000}
- GRAFANA_API_KEY=${GRAFANA_API_KEY:-YOUR_GRAFANA_API_KEY}
# OpenTelemetry
- OTEL_INSTRUMENTATION_METRIC_ENABLED=${OTEL_INSTRUMENTATION_METRIC_ENABLED:-true}
- OTEL_INSTRUMENTATION_TRACE_ENABLED=${OTEL_INSTRUMENTATION_TRACE_ENABLED:-true}
- OTEL_INSTRUMENTATION_LOG_ENABLED=${OTEL_INSTRUMENTATION_LOG_ENABLED:-true}
- OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-bookstore-adot}
- OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4317}
- OTEL_EXPORTER_OTLP_INSECURE=${OTEL_EXPORTER_OTLP_INSECURE:-true}
- OTEL_EXPORTER_OTLP_HEADERS=${OTEL_EXPORTER_OTLP_HEADERS}
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES}
- OTEL_TIME_INTERVAL=${OTEL_TIME_INTERVAL:-1}
- OTEL_RANDOM_TIME_ALIVE_INCREMENTER=${OTEL_RANDOM_TIME_ALIVE_INCREMENTER:-1}
- OTEL_RANDOM_TOTAL_HEAP_SIZE_UPPER_BOUND=${OTEL_RANDOM_TOTAL_HEAP_SIZE_UPPER_BOUND:-100}
- OTEL_RANDOM_THREAD_ACTIVE_UPPOR_BOUND=${OTEL_RANDOM_THREAD_ACTIVE_UPPOR_BOUND:-10}
- OTEL_RANDOM_CPU_USAGE_UPPER_BOUND=${OTEL_RANDOM_CPU_USAGE_UPPER_BOUND:-100}
# Jaeger
- JAEGER_AGENT_PORT=${JAEGER_AGENT_PORT:-6831}
- JAEGER_SAMPLER_TYPE=${JAEGER_SAMPLER_TYPE:-const}
- JAEGER_SAMPLER_PARAM=${JAEGER_SAMPLER_PARAM:-1}
- JAEGER_SAMPLER_MANAGER_HOST_PORT=${JAEGER_SAMPLER_MANAGER_HOST_PORT}
- JAEGER_REPORTER_LOG_SPANS=${JAEGER_REPORTER_LOG_SPANS:-true}
- JAEGER_REPORTER_BUFFER_FLUSH_INTERVAL=${JAEGER_REPORTER_BUFFER_FLUSH_INTERVAL:-5}
- JAEGER_REPORTER_MAX_QUEUE_SIZE=${JAEGER_REPORTER_MAX_QUEUE_SIZE:-100}
- JAEGER_REPORTER_LOCAL_AGENT_HOST_PORT=${JAEGER_REPORTER_LOCAL_AGENT_HOST_PORT}
- JAEGER_REPORTER_COLLECTOR_ENDPOINT=${JAEGER_REPORTER_COLLECTOR_ENDPOINT:-http://localhost:14268/api/traces}
- JAEGER_REPORTER_COLLECTOR_USER=${JAEGER_REPORTER_COLLECTOR_USER:-devopscorner}
- JAEGER_REPORTER_COLLECTOR_PASSWORD=${JAEGER_REPORTER_COLLECTOR_PASSWORD:-DevOpsCorner2023}
- JAEGER_TAGS=${JAEGER_TAGS:-golang,otel,restful,api,bookstore}
# X-Ray
- XRAY_VERSION=${XRAY_VERSION:-latest}
privileged: true
tty: true
networks:
devopscorner_net:
ipv4_address: ${CONTAINER_IP_GO_BOOKSTORE_ADOT:-172.148.148.225}