quick-start.rst 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 a business or enterprise use case and this setup will not fit your needs, please contact [email protected], or check out the business subscription plans at gravitl.com/plans.
  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. - We do not recommend Oracle Cloud, as VM's here have been known to cause network interference.
  17. - Public, static IP
  18. - Min 1GB RAM, 1 CPU (4GB RAM, 2CPU preferred)
  19. - 2GB+ of storage
  20. - Ubuntu 20.04 Installed
  21. - **Domain**
  22. - A publicly owned domain (e.x. example.com, mysite.biz)
  23. - Permission and access to modify DNS records via DNS service (e.x: Route53)
  24. 2. Install Dependencies
  25. ========================
  26. ``ssh root@your-host``
  27. Install Docker
  28. ---------------
  29. 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.
  30. .. code-block::
  31. sudo apt-get remove docker docker-engine docker.io containerd runc
  32. sudo apt-get update
  33. sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
  34. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  35. 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
  36. sudo apt-get update
  37. sudo apt-get install docker-ce docker-ce-cli containerd.io
  38. 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
  39. sudo chmod +x /usr/local/bin/docker-compose
  40. docker --version
  41. docker-compose --version
  42. At this point Docker should be installed.
  43. Install Dependencies
  44. -----------------------------
  45. In addition to Docker, this installation requires WireGuard, Nginx, and Certbot.
  46. ``sudo apt install wireguard wireguard-tools nginx certbot python3-certbot-nginx net-tools``
  47. 3. Prepare VM
  48. ===============================
  49. Prepare Domain
  50. ----------------------------
  51. 1. Choose a base domain or subdomain for Netmaker. If you own **example.com**, this should be something like **netmaker.example.com**
  52. - You must point your wildcard domain to the public IP of your VM, e.x: *.example.com --> <your public ip>
  53. 2. Add an A record pointing to your VM using your DNS service provider for *.netmaker.example.com (inserting your own subdomain of course).
  54. 3. Netmaker will create three subdomains on top of this. For the example above those subdomains would be:
  55. - dashboard.netmaker.example.com
  56. - api.netmaker.example.com
  57. - grpc.netmaker.example.com
  58. Moving forward we will refer to your base domain using **<your base domain>**. Replace these references with your domain (e.g. netmaker.example.com).
  59. 4. ``nslookup host.<your base domain>`` (inserting your domain) should now return the IP of your VM.
  60. 5. Generate SSL Certificates using certbot:
  61. ``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>"``
  62. 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.
  63. Prepare Firewall
  64. -----------------
  65. Make sure firewall settings are appropriate for Netmaker. You need ports 53 and 443. On the server you can run:
  66. .. code-block::
  67. sudo ufw allow proto tcp from any to any port 443 && sudo ufw allow 53/udp && sudo ufw allow 53/tcp
  68. **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:**
  69. - allow 443/tcp from all
  70. - allow 53/udp and 53/tcp from all
  71. Prepare Nginx
  72. -----------------
  73. Nginx will serve the SSL certificate with your chosen domain and forward traffic to netmaker.
  74. Get the nginx configuration file:
  75. ``wget https://raw.githubusercontent.com/gravitl/netmaker/develop/nginx/netmaker-nginx-template.conf``
  76. Insert your domain in the configuration file and add to nginx:
  77. .. code-block::
  78. NETMAKER_BASE_DOMAIN=<your base domain>
  79. sed -i 's/NETMAKER_BASE_DOMAIN/$NETMAKER_BASE_DOMAIN/g' netmaker-nginx-template.conf
  80. sudo cp netmaker-nginx-template.conf /etc/nginx/sites-available/netmaker-nginx.conf
  81. sudo ln -s /etc/nginx/sites-available/netmaker-nginx.conf /etc/nginx/sites-enabled/netmaker.nginx.conf
  82. nginx -t && nginx -s reload
  83. systemctl restart nginx
  84. 4. Install Netmaker
  85. ====================
  86. Prepare Templates
  87. ------------------
  88. .. code-block::
  89. wget https://raw.githubusercontent.com/gravitl/netmaker/develop/compose/docker-compose.quickstart.yml
  90. sed -i 's/NETMAKER_BASE_DOMAIN/$NETMAKER_BASE_DOMAIN/g' docker-compose.quickstart.yml
  91. sed -i 's/SERVER_PUBLIC_IP/<your server ip>/g' docker-compose.quickstart.yml
  92. Generate a unique master key and insert it:
  93. .. code-block::
  94. tr -dc A-Za-z0-9 </dev/urandom | head -c 30 ; echo ''
  95. sed -i 's/REPLACE_MASTER_KEY/<your generated key>/g' docker-compose.quickstart.yml
  96. Start Netmaker
  97. ----------------
  98. ``sudo docker-compose -f docker-compose.quickstart.yml up -d``
  99. navigate to dashboard.<your base domain> to see your nginx instance.
  100. To troubleshoot issues, start with:
  101. ``docker logs netmaker``
  102. Or check out the :doc:`troubleshoooting docs <./troubleshoot>`.