docker-compose.reference.yml 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. version: "3.4"
  2. services:
  3. mongodb: # The MongoDB Instance that backs up Netmaker
  4. image: mongo:4.2
  5. ports:
  6. - "27017:27017" # Port Mapping for MongoDB. Can be modified, but be sure to change the MONGO_PORT env var in netmaker
  7. container_name: mongodb
  8. volumes:
  9. - mongovol:/data/db
  10. restart: always
  11. environment:
  12. MONGO_INITDB_ROOT_USERNAME: mongoadmin # Default username. Recommend changing for production installs. You will need to set MONGO_ADMIN netmaker env var.
  13. MONGO_INITDB_ROOT_PASSWORD: mongopass # Default password. Recommend changing for production installs. You will need to set MONGO_PASS netmaker env var.
  14. netmaker: # The Primary Server for running Netmaker
  15. privileged: true # Necessary to run sudo/root level commands on host system. Take out if not running with CLIENT_MODE=on
  16. container_name: netmaker
  17. depends_on:
  18. - mongodb
  19. image: gravitl/netmaker:v0.3
  20. volumes: # Volume mounts necessary for CLIENT_MODE to control netclient, wireguard, and networking on host (except dnsconfig, which is where dns config files are stored for use by CoreDNS)
  21. - ./:/local
  22. - /etc/netclient:/etc/netclient
  23. - dnsconfig:/root/config/dnsconfig # Netmaker writes Corefile to this location, which gets mounted by CoreDNS for DNS configuration.
  24. - /usr/bin/wg:/usr/bin/wg
  25. - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
  26. - /run/systemd/system:/run/systemd/system
  27. - /etc/systemd/system:/etc/systemd/system
  28. - /sys/fs/cgroup:/sys/fs/cgroup
  29. cap_add: # Necessary for CLIENT_MODE. Should be removed if turned off.
  30. - NET_ADMIN
  31. - SYS_MODULE
  32. restart: always
  33. network_mode: host # Necessary for CLIENT_MODE. Should be removed if turned off, but then need to add port mappings
  34. environment:
  35. SERVER_HOST: "" # All the Docker Compose files pre-populate this with HOST_IP, which you replace as part of the install instructions. This will set both HTTP and GRPC host.
  36. SERVER_HTTP_HOST: "127.0.0.1" # Overrides SERVER_HOST if set. Useful for making HTTP and GRPC available via different interfaces/networks.
  37. SERVER_GRPC_HOST: "127.0.0.1" # Overrides SERVER_HOST if set. Useful for making HTTP and GRPC available via different interfaces/networks.
  38. 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.
  39. GRPC_PORT: 50051 # The GRPC port for Netmaker. Used for communications from nodes.
  40. MASTER_KEY: "secretkey" # The admin master key for accessing the API. Change this in any production installation.
  41. CORS_ALLOWED_ORIGIN: "*" # The "allowed origin" for API requests. Change to restrict where API requests can come from.
  42. REST_BACKEND: "on" # Enables the REST backend (API running on API_PORT at SERVER_HTTP_HOST). Change to "off" to turn off.
  43. AGENT_BACKEND: "on" # Enables the AGENT backend (GRPC running on GRPC_PORT at SERVER_GRPC_HOST). Change to "off" to turn off.
  44. CLIENT_MODE: "on" # Enables Client Mode, meaning netclient will be deployed on server and will be manageable from UI. Change to "off" to turn off.
  45. DNS_MODE: "on" # Enables DNS Mode, meaning config files will be generated for CoreDNS. Note, turning "off" does not remove CoreDNS. You still need to remove CoreDNS from compose file.
  46. 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.
  47. MONGO_ADMIN: "mongoadmin" # Admin user for MongoDB. Change to match above MongoDB instance
  48. MONGO_PASS: "mongopass" # Admin password for MongoDB. Change to match above MongoDB instance
  49. MONGO_HOST: "127.0.0.1" # Address of MongoDB. Change if necessary.
  50. MONGO_PORT: "27017" # Port of MongoDB. Change if necessary.
  51. MONGO_OPTS: "/?authSource=admin" # Opts to enable admin login for Mongo.
  52. SERVER_GRPC_WIREGUARD: "on" # Whether to run GRPC over a WireGuard network. On by default. Secures server comms. Switch to "off" to turn off.
  53. SERVER_GRPC_WG_INTERFACE: "nm-grpc-wg" # Interface to use for GRPC WireGuard network if enabled
  54. SERVER_GRPC_WG_ADDRESS: "10.101.0.1" # Private Address to use for GRPC WireGuard network if enabled
  55. SERVER_GRPC_WG_ADDRESS_RANGE: "10.101.0.0/16" # Private Address range to use for GRPC WireGard clients if enabled
  56. SERVER_GRPC_WG_PORT: "50555" # Port to use for GRPC WireGuard if enabled
  57. SERVER_GRPC_WG_PUBKEY: "SERVER_GRPC_WG_PUBKEY" # PublicKey for GRPC WireGuard interface. Generated if blank.
  58. SERVER_GRPC_WG_PRIVKEY: "SERVER_GRPC_WG_PRIVKEY" # PrivateKey for GRPC WireGuard interface. Generated if blank.
  59. netmaker-ui: # The Netmaker UI Component
  60. container_name: netmaker-ui
  61. depends_on:
  62. - netmaker
  63. image: gravitl/netmaker-ui:v0.3
  64. links:
  65. - "netmaker:api"
  66. ports:
  67. - "80:80"
  68. environment:
  69. BACKEND_URL: "http://HOST_IP:8081" # URL where UI will send API requests. Change based on SERVER_HOST, SERVER_HTTP_HOST, and API_PORT
  70. MASTER_KEY: "secretkey" # Master Key for API calls. Will be removed in v0.3.5
  71. coredns: # The DNS Server. Remove this section if DNS_MODE="off"
  72. depends_on:
  73. - netmaker
  74. image: coredns/coredns
  75. command: -conf /root/dnsconfig/Corefile # Config location for Corefile. This is the path of file which is also mounted to Netmaker for modification.
  76. container_name: coredns
  77. restart: always
  78. ports:
  79. - "53:53/udp" # Likely needs to run at port 53 for adequate nameserver usage.
  80. volumes:
  81. - dnsconfig:/root/dnsconfig
  82. volumes:
  83. mongovol: {}
  84. dnsconfig: {}