forked from bsherman/netmaker-traefik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
168 lines (166 loc) · 6.08 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
157
158
159
160
161
162
163
164
165
166
167
168
version: "3.4"
services:
netmaker:
container_name: netmaker
image: gravitl/netmaker:v0.12.1
volumes:
- dnsconfig:/root/config/dnsconfig
- sqldata:/root/data
cap_add:
- NET_ADMIN
- NET_RAW
- SYS_MODULE
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
restart: always
environment:
SERVER_HOST: "${NM_PUBLIC_IP}"
SERVER_API_CONN_STRING: "api.${NM_BASE_DOMAIN}:443"
SERVER_GRPC_CONN_STRING: "grpc.${NM_BASE_DOMAIN}:443"
GRPC_SSL: "on"
DNS_MODE: "on"
SERVER_HTTP_HOST: "api.${NM_BASE_DOMAIN}"
SERVER_GRPC_HOST: "grpc.${NM_BASE_DOMAIN}"
API_PORT: "8081"
GRPC_PORT: "50051"
CLIENT_MODE: "on"
MASTER_KEY: "${NM_MASTER_KEY}"
CORS_ALLOWED_ORIGIN: "*"
DISPLAY_KEYS: "on"
DATABASE: "sqlite"
NODE_ID: "netmaker-server-1"
MQ_HOST: "mq"
HOST_NETWORK: "off"
MANAGE_IPTABLES: "on"
PORT_FORWARD_SERVICES: "mq,dns,ssh"
VERBOSITY: "1"
ports:
- "51821-51830:51821-51830/udp"
# - "8081:8081" # api endpoint exposed via traefik so not needed in ports
# - "50051:50051" # grpc endpoint exposed via traefik so not needed in ports
labels:
- traefik.enable=true
- traefik.http.routers.netmaker-api.entrypoints=websecure
- traefik.http.routers.netmaker-api.rule=Host(`api.${NM_BASE_DOMAIN}`)
- traefik.http.routers.netmaker-api.service=netmaker-api
- traefik.http.services.netmaker-api.loadbalancer.server.port=8081
- traefik.http.routers.netmaker-grpc.entrypoints=websecure
- traefik.http.routers.netmaker-grpc.rule=Host(`grpc.${NM_BASE_DOMAIN}`)
- traefik.http.routers.netmaker-grpc.service=netmaker-grpc
- traefik.http.services.netmaker-grpc.loadbalancer.server.port=50051
- traefik.http.services.netmaker-grpc.loadbalancer.server.scheme=h2c
netmaker-ui:
container_name: netmaker-ui
depends_on:
- netmaker
image: gravitl/netmaker-ui:v0.12.1
links:
- "netmaker:api"
# ports:
# - "8082:80" # UI endpoint exposed via traefik so not needed in ports
environment:
BACKEND_URL: "https://api.${NM_BASE_DOMAIN}"
restart: always
labels:
- traefik.enable=true
- traefik.http.routers.netmaker-ui-http.entrypoints=web
- traefik.http.routers.netmaker-ui-http.rule=Host(`dashboard.${NM_BASE_DOMAIN}`)
- traefik.http.middlewares.nmui-security.headers.accessControlAllowOriginList=*.$${NM.BASE_DOMAIN}
- traefik.http.middlewares.nmui-security.headers.stsSeconds=31536000
- traefik.http.middlewares.nmui-security.headers.browserXssFilter=true
- traefik.http.middlewares.nmui-security.headers.customFrameOptionsValue=SAMEORIGIN
- traefik.http.middlewares.nmui-security.headers.customResponseHeaders.X-Robots-Tag=none
- traefik.http.middlewares.nmui-security.headers.customResponseHeaders.Server= # Remove the server name
- traefik.http.routers.netmaker-ui.middlewares=nmui-security@docker
- traefik.http.routers.netmaker-ui.entrypoints=websecure
- traefik.http.routers.netmaker-ui.rule=Host(`dashboard.${NM_BASE_DOMAIN}`)
- traefik.http.routers.netmaker-ui.service=netmaker-ui
- traefik.http.services.netmaker-ui.loadbalancer.server.port=80
coredns:
depends_on:
- netmaker
image: coredns/coredns
command: -conf /root/dnsconfig/Corefile
container_name: coredns
restart: always
volumes:
- dnsconfig:/root/dnsconfig
traefik:
image: traefik:v2.5
container_name: traefik
command:
- "--log.level=INFO"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.websecure.http.tls=true"
- "--entrypoints.websecure.http.tls.certResolver=dns"
- "--certificatesresolvers.dns.acme.email=${ACME_EMAIL}"
- "--certificatesresolvers.dns.acme.storage=acme.json"
- "--certificatesresolvers.dns.acme.dnsChallenge.provider=cloudflare"
- "--providers.docker=true"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--providers.docker.exposedByDefault=false"
- "--serverstransport.insecureskipverify=true"
- "--api.insecure=true"
- "--api.dashboard=true"
environment:
- CF_DNS_API_TOKEN=${CF_API_TOKEN}
restart: always
security_opt:
- no-new-privileges:true
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /PATHTO/traefik_acme.json:/acme.json
ports:
- "80:80"
- "443:443"
labels:
- traefik.enable=true
- traefik.http.routers.traefik-http.entrypoints=web
- traefik.http.routers.traefik-http.rule=Host(`${TRAEFIK_DOMAIN}`)
- traefik.http.routers.traefik=api@internal
- traefik.http.middlewares.secure-ips.ipwhitelist.sourcerange=192.168.129.0/16,172.16.0.0/12,10.0.0.0/8
- traefik.http.routers.traefik.middlewares=secure-ips@docker
- traefik.http.routers.traefik.entrypoints=websecure
- traefik.http.routers.traefik.rule=Host(`${TRAEFIK_DOMAIN}`)
- traefik.http.routers.traefik.service=api@internal
- traefik.http.services.traefik-containers.loadbalancer.server.port=8080
mq:
image: eclipse-mosquitto:2.0.14
container_name: mq
restart: unless-stopped
ports:
- "1883:1883"
volumes:
- /PATHTO/mosquitto.conf:/mosquitto/config/mosquitto.conf
- mosquitto_data:/mosquitto/data
- mosquitto_logs:/mosquitto/log
volumes:
sqldata:
driver: local
driver_opts:
type: none
device: /PATHTO/netmaker_sqldata
o: bind
dnsconfig:
driver: local
driver_opts:
type: none
device: /PATHTO/netmaker_dnsconfig
o: bind
mosquitto_data:
driver: local
driver_opts:
type: none
device: /PATHTO/netmaker_mosquitto_data
o: bind
mosquitto_logs:
driver: local
driver_opts:
type: none
device: /PATHTO/netmaker_mosquitto_logs
o: bind