docker-compose.reference.yml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. version: "3.4"
  2. services:
  3. netmaker: # The Primary Server for running Netmaker
  4. container_name: netmaker
  5. image: gravitl/netmaker:v0.14.5
  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_PORT: "443" # the reachable port of MQ - change if external MQ port changes (port on proxy, not necessarily the one exposed in docker-compose)
  40. 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.
  41. VERBOSITY: "1" # logging verbosity level - 1, 2, or 3
  42. MANAGE_IPTABLES: "on" # deprecated
  43. PORT_FORWARD_SERVICES: "dns" # decide which services to port forward ("dns","ssh", or "mq")
  44. # this section is for OAuth
  45. AUTH_PROVIDER: "" # "<azure-ad|github|google|oidc>"
  46. CLIENT_ID: "" # "<client id of your oauth provider>"
  47. CLIENT_SECRET: "" # "<client secret of your oauth provider>"
  48. FRONTEND_URL: "" # "https://dashboard.<netmaker base domain>"
  49. AZURE_TENANT: "" # "<only for azure, you may optionally specify the tenant for the OAuth>"
  50. OIDC_ISSUER: "" # https://oidc.yourprovider.com - URL of oidc provider
  51. ports:
  52. - "51821-51830:51821-51830/udp" # wireguard ports
  53. expose:
  54. - "8081" # api port
  55. labels: # only for use with traefik proxy (default)
  56. - traefik.enable=true
  57. - traefik.http.routers.netmaker-api.entrypoints=websecure
  58. - traefik.http.routers.netmaker-api.rule=Host(`api.NETMAKER_BASE_DOMAIN`)
  59. - traefik.http.routers.netmaker-api.service=netmaker-api
  60. - traefik.http.services.netmaker-api.loadbalancer.server.port=8081
  61. netmaker-ui: # The Netmaker UI Component
  62. container_name: netmaker-ui
  63. image: gravitl/netmaker-ui:v0.14.5
  64. depends_on:
  65. - netmaker
  66. links:
  67. - "netmaker:api"
  68. restart: always
  69. environment:
  70. 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
  71. expose:
  72. - "80"
  73. labels:
  74. - traefik.enable=true
  75. - traefik.http.middlewares.nmui-security.headers.accessControlAllowOriginList=*.NETMAKER_BASE_DOMAIN
  76. - traefik.http.middlewares.nmui-security.headers.stsSeconds=31536000
  77. - traefik.http.middlewares.nmui-security.headers.browserXssFilter=true
  78. - traefik.http.middlewares.nmui-security.headers.customFrameOptionsValue=SAMEORIGIN
  79. - traefik.http.middlewares.nmui-security.headers.customResponseHeaders.X-Robots-Tag=none
  80. - traefik.http.middlewares.nmui-security.headers.customResponseHeaders.Server= # Remove the server name
  81. - traefik.http.routers.netmaker-ui.entrypoints=websecure
  82. - traefik.http.routers.netmaker-ui.middlewares=nmui-security@docker
  83. - traefik.http.routers.netmaker-ui.rule=Host(`dashboard.NETMAKER_BASE_DOMAIN`)
  84. - traefik.http.routers.netmaker-ui.service=netmaker-ui
  85. - traefik.http.services.netmaker-ui.loadbalancer.server.port=80
  86. coredns: # The DNS Server. CoreDNS can be removed unless doing special advanced use cases
  87. container_name: coredns
  88. image: coredns/coredns
  89. command: -conf /root/dnsconfig/Corefile
  90. depends_on:
  91. - netmaker
  92. restart: always
  93. volumes:
  94. - dnsconfig:/root/dnsconfig
  95. traefik: # the default proxy - can be replaced with caddy or nginx, but requires careful configuration
  96. image: traefik:v2.6
  97. container_name: traefik
  98. command:
  99. - "--certificatesresolvers.http.acme.email=YOUR_EMAIL"
  100. - "--certificatesresolvers.http.acme.storage=/letsencrypt/acme.json"
  101. - "--certificatesresolvers.http.acme.tlschallenge=true"
  102. - "--entrypoints.websecure.address=:443"
  103. - "--entrypoints.websecure.http.tls=true"
  104. - "--entrypoints.websecure.http.tls.certResolver=http"
  105. - "--log.level=INFO"
  106. - "--providers.docker=true"
  107. - "--providers.docker.exposedByDefault=false"
  108. - "--serverstransport.insecureskipverify=true"
  109. restart: always
  110. volumes:
  111. - /var/run/docker.sock:/var/run/docker.sock:ro
  112. - traefik_certs:/letsencrypt
  113. ports:
  114. - "443:443"
  115. mq: # the MQTT broker for netmaker
  116. container_name: mq
  117. image: eclipse-mosquitto:2.0.11-openssl
  118. depends_on:
  119. - netmaker
  120. restart: unless-stopped
  121. volumes:
  122. - /root/mosquitto.conf:/mosquitto/config/mosquitto.conf # need to pull conf file from github before running (under docker/mosquitto.conf)
  123. - mosquitto_data:/mosquitto/data
  124. - mosquitto_logs:/mosquitto/log
  125. - shared_certs:/mosquitto/certs
  126. expose:
  127. - "8883"
  128. labels:
  129. - traefik.enable=true
  130. - traefik.tcp.routers.mqtts.rule=HostSNI(`broker.NETMAKER_BASE_DOMAIN`)
  131. - traefik.tcp.routers.mqtts.tls.passthrough=true
  132. - traefik.tcp.services.mqtts-svc.loadbalancer.server.port=8883
  133. - traefik.tcp.routers.mqtts.service=mqtts-svc
  134. - traefik.tcp.routers.mqtts.entrypoints=websecure
  135. volumes:
  136. traefik_certs: {} # ssl certificates - auto generated
  137. shared_certs: {} # netmaker certs generated for MQ comms - used by nodes/servers
  138. sqldata: {} # storage for embedded sqlite
  139. dnsconfig: {} # storage for coredns
  140. mosquitto_data: {} # storage for mqtt data
  141. mosquitto_logs: {} # storage for mqtt logs