docker-compose.reference.yml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. version: "3.4"
  2. services:
  3. netmaker: # The Primary Server for running Netmaker
  4. container_name: netmaker
  5. image: gravitl/netmaker:v0.14.6
  6. cap_add:
  7. - NET_ADMIN
  8. - NET_RAW
  9. - SYS_MODULE
  10. sysctls:
  11. - net.ipv4.ip_forward=1
  12. - net.ipv4.conf.all.src_valid_mark=1
  13. - net.ipv6.conf.all.disable_ipv6=0
  14. - net.ipv6.conf.all.forwarding=1
  15. restart: always
  16. volumes: # Volume mounts necessary for sql, coredns, and mqtt
  17. - dnsconfig:/root/config/dnsconfig
  18. - sqldata:/root/data
  19. - shared_certs:/etc/netmaker
  20. environment: # Necessary capabilities to set iptables when running in container
  21. SERVER_NAME: "broker.NETMAKER_BASE_DOMAIN" # The domain/host IP indicating the mq broker address
  22. SERVER_HOST: "SERVER_PUBLIC_IP" # Set to public IP of machine.
  23. SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN" # Overrides SERVER_HOST if set. Useful for making HTTP available via different interfaces/networks.
  24. SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
  25. COREDNS_ADDR: "SERVER_PUBLIC_IP" # Address of the CoreDNS server. Defaults to SERVER_HOST
  26. DNS_MODE: "on" # Enables DNS Mode, meaning all nodes will set hosts file for private dns settings.
  27. API_PORT: "8081" # The HTTP API port for Netmaker. Used for API calls / communication from front end. If changed, need to change port of BACKEND_URL for netmaker-ui.
  28. CLIENT_MODE: "on" # Depricated. CLIENT_MODE should always be ON
  29. REST_BACKEND: "on" # Enables the REST backend (API running on API_PORT at SERVER_HTTP_HOST). Change to "off" to turn off.
  30. DISABLE_REMOTE_IP_CHECK: "off" # If turned "on", Server will not set Host based on remote IP check. This is already overridden if SERVER_HOST is set. Turned "off" by default.
  31. TELEMETRY: "on" # Whether or not to send telemetry data to help improve Netmaker. Switch to "off" to opt out of sending telemetry.
  32. RCE: "off" # Enables setting PostUp and PostDown (arbitrary commands) on nodes from the server. Off by default.
  33. MASTER_KEY: "REPLACE_MASTER_KEY" # The admin master key for accessing the API. Change this in any production installation.
  34. CORS_ALLOWED_ORIGIN: "*" # The "allowed origin" for API requests. Change to restrict where API requests can come from.
  35. DISPLAY_KEYS: "on" # Show keys permanently in UI (until deleted) as opposed to 1-time display.
  36. DATABASE: "sqlite" # Database to use - sqlite, postgres, or rqlite
  37. NODE_ID: "netmaker-server-1" # used for HA - identifies this server vs other servers
  38. MQ_HOST: "mq" # the address of the mq server. If running from docker compose it will be "mq". Otherwise, need to input address. If using "host networking", it will find and detect the IP of the mq container.
  39. MQ_SERVER_PORT: "1883" # the reachable port of MQ by the server - change if internal MQ port changes (or use external port if MQ is not on the same machine)
  40. MQ_PORT: "443" # the reachable port of MQ - change if external MQ port changes (port on proxy, not necessarily the one exposed in docker-compose)
  41. HOST_NETWORK: "off" # whether or not host networking is turned on. Only turn on if configured for host networking (see docker-compose.hostnetwork.yml). Will set host-level settings like iptables.
  42. VERBOSITY: "1" # logging verbosity level - 1, 2, or 3
  43. MANAGE_IPTABLES: "on" # deprecated
  44. PORT_FORWARD_SERVICES: "dns" # decide which services to port forward ("dns","ssh", or "mq")
  45. # this section is for OAuth
  46. AUTH_PROVIDER: "" # "<azure-ad|github|google|oidc>"
  47. CLIENT_ID: "" # "<client id of your oauth provider>"
  48. CLIENT_SECRET: "" # "<client secret of your oauth provider>"
  49. FRONTEND_URL: "" # "https://dashboard.<netmaker base domain>"
  50. AZURE_TENANT: "" # "<only for azure, you may optionally specify the tenant for the OAuth>"
  51. OIDC_ISSUER: "" # https://oidc.yourprovider.com - URL of oidc provider
  52. ports:
  53. - "51821-51830:51821-51830/udp" # wireguard ports
  54. expose:
  55. - "8081" # api port
  56. labels: # only for use with traefik proxy (default)
  57. - traefik.enable=true
  58. - traefik.http.routers.netmaker-api.entrypoints=websecure
  59. - traefik.http.routers.netmaker-api.rule=Host(`api.NETMAKER_BASE_DOMAIN`)
  60. - traefik.http.routers.netmaker-api.service=netmaker-api
  61. - traefik.http.services.netmaker-api.loadbalancer.server.port=8081
  62. netmaker-ui: # The Netmaker UI Component
  63. container_name: netmaker-ui
  64. image: gravitl/netmaker-ui:v0.14.6
  65. depends_on:
  66. - netmaker
  67. links:
  68. - "netmaker:api"
  69. restart: always
  70. environment:
  71. BACKEND_URL: "https://api.NETMAKER_BASE_DOMAIN" # URL where UI will send API requests. Change based on SERVER_HOST, SERVER_HTTP_HOST, and API_PORT
  72. expose:
  73. - "80"
  74. labels:
  75. - traefik.enable=true
  76. - traefik.http.middlewares.nmui-security.headers.accessControlAllowOriginList=*.NETMAKER_BASE_DOMAIN
  77. - traefik.http.middlewares.nmui-security.headers.stsSeconds=31536000
  78. - traefik.http.middlewares.nmui-security.headers.browserXssFilter=true
  79. - traefik.http.middlewares.nmui-security.headers.customFrameOptionsValue=SAMEORIGIN
  80. - traefik.http.middlewares.nmui-security.headers.customResponseHeaders.X-Robots-Tag=none
  81. - traefik.http.middlewares.nmui-security.headers.customResponseHeaders.Server= # Remove the server name
  82. - traefik.http.routers.netmaker-ui.entrypoints=websecure
  83. - traefik.http.routers.netmaker-ui.middlewares=nmui-security@docker
  84. - traefik.http.routers.netmaker-ui.rule=Host(`dashboard.NETMAKER_BASE_DOMAIN`)
  85. - traefik.http.routers.netmaker-ui.service=netmaker-ui
  86. - traefik.http.services.netmaker-ui.loadbalancer.server.port=80
  87. coredns: # The DNS Server. CoreDNS can be removed unless doing special advanced use cases
  88. container_name: coredns
  89. image: coredns/coredns
  90. command: -conf /root/dnsconfig/Corefile
  91. depends_on:
  92. - netmaker
  93. restart: always
  94. volumes:
  95. - dnsconfig:/root/dnsconfig
  96. traefik: # the default proxy - can be replaced with caddy or nginx, but requires careful configuration
  97. image: traefik:v2.6
  98. container_name: traefik
  99. command:
  100. - "--certificatesresolvers.http.acme.email=YOUR_EMAIL"
  101. - "--certificatesresolvers.http.acme.storage=/letsencrypt/acme.json"
  102. - "--certificatesresolvers.http.acme.tlschallenge=true"
  103. - "--entrypoints.websecure.address=:443"
  104. - "--entrypoints.websecure.http.tls=true"
  105. - "--entrypoints.websecure.http.tls.certResolver=http"
  106. - "--log.level=INFO"
  107. - "--providers.docker=true"
  108. - "--providers.docker.exposedByDefault=false"
  109. - "--serverstransport.insecureskipverify=true"
  110. restart: always
  111. volumes:
  112. - /var/run/docker.sock:/var/run/docker.sock:ro
  113. - traefik_certs:/letsencrypt
  114. ports:
  115. - "443:443"
  116. mq: # the MQTT broker for netmaker
  117. container_name: mq
  118. image: eclipse-mosquitto:2.0.11-openssl
  119. depends_on:
  120. - netmaker
  121. restart: unless-stopped
  122. volumes:
  123. - /root/mosquitto.conf:/mosquitto/config/mosquitto.conf # need to pull conf file from github before running (under docker/mosquitto.conf)
  124. - mosquitto_data:/mosquitto/data
  125. - mosquitto_logs:/mosquitto/log
  126. - shared_certs:/mosquitto/certs
  127. expose:
  128. - "8883"
  129. labels:
  130. - traefik.enable=true
  131. - traefik.tcp.routers.mqtts.rule=HostSNI(`broker.NETMAKER_BASE_DOMAIN`)
  132. - traefik.tcp.routers.mqtts.tls.passthrough=true
  133. - traefik.tcp.services.mqtts-svc.loadbalancer.server.port=8883
  134. - traefik.tcp.routers.mqtts.service=mqtts-svc
  135. - traefik.tcp.routers.mqtts.entrypoints=websecure
  136. volumes:
  137. traefik_certs: {} # ssl certificates - auto generated
  138. shared_certs: {} # netmaker certs generated for MQ comms - used by nodes/servers
  139. sqldata: {} # storage for embedded sqlite
  140. dnsconfig: {} # storage for coredns
  141. mosquitto_data: {} # storage for mqtt data
  142. mosquitto_logs: {} # storage for mqtt logs