Netmaker will require elevated privileges to perform network operations. Netmaker has similar limitations to :doc:`netclient <./client-installation>` (client networking agent).
Typically, Netmaker is run inside of containers (Docker). To run a non-docker installation, you must run the Netmaker binary, CoreDNS binary, rqlite, and a web server directly on the host. Each of these components have their own individual requirements.
If you plan on running the server in DNS Mode, know that a `CoreDNS Server <https://coredns.io/manual/toc/>`_ will be installed. CoreDNS is a light-weight, fast, and easy-to-configure DNS server. It is recommended to bind CoreDNS to port 53 of the host system, and it will do so by default. The clients will expect the nameserver to be on port 53, and many systems have issues resolving a different port.
However, on your host system (for Netmaker), this may conflict with an existing process. On linux systems running systemd-resolved, there is likely a service consuming port 53. The below steps will disable systemd-resolved, and replace it with a generic (e.g. Google) nameserver. Be warned that this may have consequences for any existing private DNS configuration. The following was tested on Ubuntu 20.04 and should be run prior to deploying the docker containers.
The most simple (and recommended) way of installing Netmaker is to use one of the provided `Docker Compose files <https://github.com/gravitl/netmaker/tree/master/compose>`_. Below are instructions for several different options to install Netmaker via Docker Compose, followed by an annotated reference Docker Compose in case your use case requires additional customization.
* You can change the port mappings in the Docker Compose if the listed ports are already in use.
Assuming you have Docker and Docker Compose installed, you can just run the following, replacing **< Insert your-host IP Address Here >** with your host IP (or domain):
DNS Mode is currently limited to clients that can run resolvectl (systemd-resolved, see :doc:`Architecture docs <./architecture>` for more info). You may wish to disable DNS mode for various reasons. This installation option gives you the full feature set minus CoreDNS.
To run without DNS, follow the Quick Install guide, omitting the steps for DNS setup. In addition, when the guide has you pull (wget) the Netmaker docker-compose template, use the following link instead:
All environment variables and options are enabled in this file. It is the equivalent to running the "full install" from the above section. However, all environment variables are included, and are set to the default values provided by Netmaker (if the environment variable was left unset, it would not change the installation). Comments are added to each option to show how you might use it to modify your installation.
Most systems support Docker, but some, such as LXC, do not. In such environments, there are many options for installing Netmaker. Netmaker is available as a binary file, and there is a zip file of the Netmaker UI static HTML on GitHub. Beyond the UI and Server, you need to install MongoDB and CoreDNS (optional).
Below is a guided set of instructions for installing without Docker on Ubuntu 20.04. Depending on your system, the steps may vary.
1. **Run the install script:** ``sudo curl -sfL https://raw.githubusercontent.com/gravitl/netmaker/v0.3.5/scripts/netmaker-server.sh | sh -``
2. Check status: ``sudo journalctl -u netmaker``
3. If any settings are incorrect such as host or mongo credentials, change them under /etc/netmaker/config/environments/< your env >.yaml and then run ``sudo systemctl restart netmaker``
UI Setup
-----------
The following uses NGinx as an http server. You may alternatively use Apache or any other web server that serves static web files.
**This configuration is coming soon.** It will allow you to deploy Netmaker on a Kubernetes cluster.
Configuration Reference
=========================
The "Reference Compose File" (above) explains many of these options. However, it is important to understand fundamentally how Netmaker sets its configuration:
1. Defaults
2. Config File
3. Environment Variables
Variable Description
----------------------
SERVER_HOST:
**Default:** Server will perform an IP check and set automatically unless explicitly set, or DISABLE_REMOTE_IP_CHECK is set to true, in which case it defaults to 127.0.0.1
**Description:** Sets the SERVER_HTTP_HOST and SERVER_GRPC_HOST variables if they are unset. The address where traffic comes in.
SERVER_HTTP_HOST:
**Default:** Equals SERVER_HOST if set, "127.0.0.1" if SERVER_HOST is unset.
**Description:** Set to make the HTTP and GRPC functions available via different interfaces/networks.
SERVER_GRPC_HOST:
**Default:** Equals SERVER_HOST if set, "127.0.0.1" if SERVER_HOST is unset.
**Description:** Set to make the HTTP and GRPC functions available via different interfaces/networks.
API_PORT:
**Default:** 8081
**Description:** The HTTP API port for Netmaker. Used for API calls / communication from front end.
GRPC_PORT:
**Default:** 50051
**Description:** The GRPC port for Netmaker. Used for communications from nodes.
MASTER_KEY:
**Default:** "secretkey"
**Description:** The admin master key for accessing the API. Change this in any production installation.
CORS_ALLOWED_ORIGIN:
**Default:** "*"
**Description:** The "allowed origin" for API requests. Change to restrict where API requests can come from.
REST_BACKEND:
**Default:** "on"
**Description:** Enables the REST backend (API running on API_PORT at SERVER_HTTP_HOST). Change to "off" to turn off.
AGENT_BACKEND:
**Default:** "on"
**Description:** Enables the AGENT backend (GRPC running on GRPC_PORT at SERVER_GRPC_HOST). Change to "off" to turn off.
CLIENT_MODE:
**Default:** "on"
**Description:** Enables Client Mode, meaning netclient will be deployed on server and will be manageable from UI. Change to "off" to turn off.
DNS_MODE:
**Default:** "on"
**Description:** Enables DNS Mode, meaning config files will be generated for CoreDNS.
DISABLE_REMOTE_IP_CHECK:
**Default:** "off"
**Description:** 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.
MONGO_ADMIN:
**Default:** "mongoadmin"
**Description:** Admin user for MongoDB.
MONGO_PASS:
**Default:** "mongopass"
**Description:** Admin password for MongoDB.
MONGO_HOST:
**Default:** "127.0.0.1"
**Description:** Address of MongoDB.
MONGO_PORT:
**Default:** "27017"
**Description:** Port of MongoDB.
MONGO_OPTS:
**Default:** "/?authSource=admin"
**Description:** Opts to enable admin login for Mongo.
**Description:** Whether to run GRPC over a WireGuard network. On by default. Secures the server comms. Switch to "off" to turn off. If off and running in production, make sure to have certificates installed to secure GRPC communications.
SERVER_GRPC_WG_INTERFACE:
**Default:** "nm-grpc-wg"
**Description:** Interface to use for GRPC WireGuard network if enabled
SERVER_GRPC_WG_ADDRESS:
**Default:** "10.101.0.1"
**Description:** Private Address to use for GRPC WireGuard network if enabled
SERVER_GRPC_WG_ADDRESS_RANGE:
**Default:** "10.101.0.0/16"
**Description:** Private Address range to use for GRPC WireGard clients if enabled. Gives 65,534 total addresses for all of netmaker. If running a larger network, will need to configure addresses differently, for instance using ipv6, or use certificates instead.
SERVER_GRPC_WG_PORT:
**Default:** 50555
**Description:** Port to use for GRPC WireGuard if enabled
SERVER_GRPC_WG_PUBKEY:
**Default:** < generated at startup >
**Description:** PublicKey for GRPC WireGuard interface. Generated if left blank.
SERVER_GRPC_WG_PRIVKEY:
**Default:** < generated at startup >
**Description:** PrivateKey for GRPC WireGuard interface. Generated if left blank.
SERVER_GRPC_WG_KEYREQUIRED
**Default:** ""
**Description:** Determines if an Access Key is required to join the Comms network. Blank (meaning 'no') by default. Set to "yes" to turn on.
**Description:** Specifies if GRPC is going over secure GRPC or SSL. This is a setting for the clients and is passed through the access token. Can be set to "on" and "off". Set to on if SSL is configured for GRPC.
SERVER_API_CONN_STRING
**Default:** ""
**Description:** Allows specification of the string used to connect to the server api. Format: IP:PORT or DOMAIN:PORT. Defaults to SERVER_HOST if not specified.
SERVER_GRPC_CONN_STRING
**Default:** ""
**Description:** Allows specification of the string used to connect to grpc. Format: IP:PORT or DOMAIN:PORT. Defaults to SERVER_HOST if not specified.
A config file may be placed under config/environments/<env-name>.yml. To read this file at runtime, provide the environment variable ENV at runtime. For instance, dev.yml paired with ENV=dev. Netmaker will load the specified Config file. This allows you to store and manage configurations for different environments. Below is a reference Config File you may use.
The `Swag Proxy <https://github.com/linuxserver/docker-swag>`_ makes it easy to generate a valid ssl certificate for the config bellow. Here is the `documentation <https://docs.linuxserver.io/general/swag>`_ for the installation.
The following file configures Netmaker as a subdomain. This config is an adaption from the swag proxy project.