quick-start.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. ===============
  2. Quick Install
  3. ===============
  4. This quick start guide is an **opinionated** guide for getting up and running with Netmaker as quickly as possible.
  5. 0. Introduction
  6. ==================
  7. We assume for this installation that you want all of the Netmaker features enabled, want your server to be secure, and want it to be accessible from anywhere.
  8. This instance will not be HA. However, it should comfortably handle around one hundred concurrent clients and support most use cases.
  9. If you are deploying for an enterprise use case, please contact [email protected] for support.
  10. By the end of this guide, you will have Netmaker installed on a public VM linked to your custom domain, secured behind an Nginx reverse proxy.
  11. If this configuration does not fit your use case, see the :doc:`Advanced Installation <./server-installation>` docs.
  12. 1. Prerequisites
  13. ==================
  14. - **Virtual Machine**
  15. - Preferably from a cloud provider (e.x: DigitalOcean, Linode, AWS, GCP, etc.)
  16. - Public, static IP
  17. - Min 2GB RAM, 1 CPU (4GB RAM, 2CPU preferred)
  18. - 5GB+ of storage
  19. - Ubuntu 20.04 Installed
  20. - **Domain**
  21. - A publicly owned domain (e.x. example.com, mysite.biz)
  22. - Permission and access to modify DNS records via DNS service (e.x: Route53)
  23. 2. Install Dependencies
  24. ========================
  25. ``ssh root@your-host``
  26. Install Docker
  27. ---------------
  28. Begin by installing the community version of Docker and docker-compose (there are issues with the snap version). You can follow the official `Docker instructions here <https://docs.docker.com/engine/install/>`_. Or, you can use the below series of commands which should work on Ubuntu 20.04.
  29. .. code-block::
  30. sudo apt-get remove docker docker-engine docker.io containerd runc
  31. sudo apt-get update
  32. sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
  33. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  34. echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  35. sudo apt-get update
  36. sudo apt-get install docker-ce docker-ce-cli containerd.io
  37. sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  38. sudo chmod +x /usr/local/bin/docker-compose
  39. docker --version
  40. docker-compose --version
  41. At this point Docker should be installed.
  42. Install Dependencies
  43. -----------------------------
  44. In addition to Docker, this installation requires WireGuard, Nginx, and Certbot.
  45. ``sudo apt install wireguard wireguard-tools nginx certbot python3-certbot-nginx net-tools``
  46. 3. Prepare VM
  47. ===============================
  48. Prepare Domain
  49. ----------------------------
  50. 1. Choose a base domain or subdomain for Netmaker. If you own **example.com**, this should be something like **netmaker.example.com**
  51. - You must point your wildcard domain to the public IP of your VM, e.x: *.example.com --> <your public ip>
  52. 2. Add an A record pointing to your VM using your DNS service provider for *.netmaker.example.com (inserting your own subdomain of course).
  53. 3. Netmaker will create three subdomains on top of this. For the example above those subdomains would be:
  54. - dashboard.netmaker.example.com
  55. - api.netmaker.example.com
  56. - grpc.netmaker.example.com
  57. Moving forward we will refer to your base domain using **<your base domain>**. Replace these references with your domain (e.g. netmaker.example.com).
  58. 4. ``nslookup host.<your base domain>`` (inserting your domain) should now return the IP of your VM.
  59. 5. Generate SSL Certificates using certbot:
  60. ``sudo certbot certonly --manual --preferred-challenges=dns --email [email protected] --server https://acme-v02.api.letsencrypt.org/directory --agree-tos --manual-public-ip-logging-ok -d "*.<your base domain>"``
  61. The above command (using your domain instead of <your base domain>), will prompt you to enter a TXT record in your DNS service provider. Do this, and **wait one minute** before clicking enter, or it may fail and you will have to run the command again.
  62. Prepare Firewall
  63. -----------------
  64. Make sure firewall settings are appropriate for Netmaker. You need ports 53 and 443. On the server you can run:
  65. .. code-block::
  66. sudo ufw allow proto tcp from any to any port 443 && sudo ufw allow dns
  67. **Based on your cloud provider, you may also need to set inbound security rules for your server. This will be dependent on your cloud provider. Be sure to check before moving on:**
  68. - allow 443/tcp from all
  69. - allow 53/udp from all
  70. Prepare for DNS
  71. ----------------------------------------------------------------
  72. On Ubuntu 20.04, by default there is a service consuming port 53 related to DNS resolution. We need port 53 open in order to run our own DNS server. The below steps will disable systemd-resolved, and insert a generic DNS nameserver for local resolution.
  73. .. code-block::
  74. systemctl stop systemd-resolved
  75. systemctl disable systemd-resolved
  76. vim /etc/systemd/resolved.conf
  77. * uncomment DNS and add 8.8.8.8 or whatever reachable nameserver is your preference *
  78. * uncomment DNSStubListener and set to "no" *
  79. ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
  80. Prepare Nginx
  81. -----------------
  82. Nginx will serve the SSL certificate with your chosen domain and forward traffic to netmaker.
  83. Get the nginx configuration file:
  84. ``wget https://raw.githubusercontent.com/gravitl/netmaker/develop/nginx/netmaker-nginx-template.conf``
  85. Insert your domain in the configuration file and add to nginx:
  86. .. code-block::
  87. sed -i 's/NETMAKER_BASE_DOMAIN/<your base domain>/g' netmaker-nginx-template.conf
  88. sudo cp netmaker-nginx-template.conf /etc/nginx/conf.d/<your base domain>.conf
  89. nginx -t && nginx -s reload
  90. systemctl restart nginx
  91. 4. Install Netmaker
  92. ====================
  93. Prepare Templates
  94. ------------------
  95. .. code-block::
  96. wget https://raw.githubusercontent.com/gravitl/netmaker/develop/compose/docker-compose.quickstart.yml
  97. sed -i 's/NETMAKER_BASE_DOMAIN/<your base domain>/g' docker-compose.quickstart.yml
  98. sed -i 's/SERVER_PUBLIC_IP/<your server ip>/g' docker-compose.quickstart.yml
  99. Generate a unique master key and insert it:
  100. .. code-block::
  101. tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo ''
  102. sed -i 's/REPLACE_MASTER_KEY/<your generated key>/g' docker-compose.quickstart.yml
  103. Start Netmaker
  104. ----------------
  105. ``sudo docker-compose -f docker-compose.quickstart.yml up -d``
  106. navigate to dashboard.<your base domain> to see your nginx instance.
  107. To troubleshoot issues, start with:
  108. ``docker logs netmaker``
  109. Or check out the :doc:`troubleshoooting docs <./troubleshoot>`.