Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | laptopwiki:guides:docker:meshcentral [08/03/2025 17:58] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Mesh Central in Docker behind NGINX Proxy Manager Reverse Proxy ====== | ||
+ | |||
+ | * What is Nginx Proxy Manager (also known as NPM): [[https:// | ||
+ | * What is Mesh Central: [[https:// | ||
+ | * Container we will be using, including base of my docker-compose.yml: | ||
+ | * [[https:// | ||
+ | |||
+ | ====== Prerequisites ====== | ||
+ | |||
+ | - Root Docker environment on Linux | ||
+ | - docker-compose installed | ||
+ | - Ports 80/443 port forwarded to your Docker host | ||
+ | - Reverse proxy being Nginx Proxy Manager, not Traefik as I don't use it | ||
+ | - Nginx Proxy Manager listening for ports 80/443 | ||
+ | - Proper DNS records for a LetsEncrypt DNS Challenge (for a certificate) | ||
+ | - Folder on your linux filesystem named meshcentral (This folder will only contain a docker-compose.yml file) | ||
+ | |||
+ | ===== Deploying container ===== | ||
+ | |||
+ | * We will be using the official Docker container | ||
+ | * Create a folder with the name meshcentral | ||
+ | * cd into the folder and create a docker-compose.yml file | ||
+ | * Paste the content of the following example into that file and edit whatever is necessary for you | ||
+ | * Run | ||
+ | < | ||
+ | |||
+ | sudo docker compose up -d | ||
+ | |||
+ | </ | ||
+ | |||
+ | * Here is an example of my docker-compose.yml file | ||
+ | |||
+ | < | ||
+ | networks: | ||
+ | reverse_proxy: | ||
+ | external: true | ||
+ | |||
+ | volumes: | ||
+ | files: | ||
+ | database: | ||
+ | |||
+ | services: | ||
+ | mongodb: | ||
+ | container_name: | ||
+ | restart: always | ||
+ | image: mongo: | ||
+ | expose: | ||
+ | - 27017 | ||
+ | volumes: | ||
+ | - database:/ | ||
+ | networks: | ||
+ | - reverse_proxy | ||
+ | environment: | ||
+ | - TZ=Europe/ | ||
+ | |||
+ | meshcentral: | ||
+ | restart: always | ||
+ | container_name: | ||
+ | image: ghcr.io/ | ||
+ | depends_on: | ||
+ | - mongodb | ||
+ | #ports: | ||
+ | # - 4433:4433 # This is used for Intel AMT, uncomment if you don't need it | ||
+ | # - 443:443 # You don't need to expose the port 443 directly if MeshCentral is behind a reverse proxy, this is just for debugging | ||
+ | environment: | ||
+ | - TZ=Europe/ | ||
+ | volumes: | ||
+ | - files:/ | ||
+ | - / | ||
+ | - / | ||
+ | - / | ||
+ | - / | ||
+ | networks: | ||
+ | - reverse_proxy | ||
+ | |||
+ | </ | ||
+ | |||
+ | * In this, Mesh Central will use a MongoDB instance to store everything, instead of SQLite | ||
+ | * You must change: | ||
+ | - Network name to match what your NPM is using, in my case that name is " | ||
+ | * You can change | ||
+ | * TZ - timezone, so your logs have proper timestamps, follows standardized naming | ||
+ | * For example, TZ=Europe/ | ||
+ | * Storage mounts (I had issues with MeshCentral Volume paths, so that is why I'm using volumes) | ||
+ | * ALLOW_NEW_ACCOUNTS=false, | ||
+ | |||
+ | ===== Config File ===== | ||
+ | |||
+ | * You will find the config file in the container' | ||
+ | * In the last VOLUME section we mounted the file from the container directly to a folder on our local filesystem, / | ||
+ | * This file will have default root permissions | ||
+ | * The config contains some basic settings for MongoDB, examples of custom text and branding for agents. | ||
+ | * The branding will affect logos and text in the administrator WebUI, the MeshCentral Agent (if installed in interactive mode), Service Name of the MeshCentral agent (perfect if you need to run multiple agents on one machine, for example because of migrations to a different server or multiple MSPs managing one server) as well the MeshAssistant and Android app. | ||
+ | * Logos will need to be uploaded onto the local filesystem (a URL might work, never tried it, sorry) | ||
+ | * Open the config.json file with | ||
+ | < | ||
+ | |||
+ | sudo nano / | ||
+ | |||
+ | </ | ||
+ | |||
+ | * This example is based on [[https:// | ||
+ | * Modify it according to this example, changing stuff like your FQDN | ||
+ | < | ||
+ | |||
+ | { | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | "": | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | * Note: I did not touch the letsencrypt section here at all, since we are handling our SSL certificate elsewhere | ||
+ | |||
+ | ==== So what are we changing and why? ==== | ||
+ | |||
+ | * TLDR: | ||
+ | * Mesh Central uses a self signed certificate to talk to clients. | ||
+ | * Since ours is behind NPM it can't communicate directly and hashes won't match. | ||
+ | * We need to tell it to instead use NPM's certificate | ||
+ | |||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | - " | ||
+ | |||
+ | |||
+ | ===== NGINX Proxy Manager ===== | ||
+ | - Add a new Proxy host as you would with any other Docker container \\ {{: | ||
+ | - Check Cache Assets, Block Common Exploits and Websockets Support - In SSL, select your certificate, | ||
+ | - In the **Advanced** | ||
+ | proxy_set_header X-Forwarded-Host $host: | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | proxy_set_header X-Forwarded-Proto $scheme; | ||
+ | proxy_read_timeout 200s; | ||
+ | proxy_connect_timeout 200s; | ||
+ | proxy_send_timeout 200s; </ | ||
+ | ==== If Cloudflare Proxy ===== | ||
+ | - As of August 2023, MeshCentral no longer works through Cloudflare Proxy, see [[https:// | ||
+ | - < | ||
+ | - < | ||
+ | - < | ||
+ | ===== Issues ===== | ||
+ | ==== Unable to connect web socket ==== | ||
+ | * If you get this error after logging into the Mesh Central WebUI do: | ||
+ | * Go to NPM - In Proxy Host → your Mesh Central Host → Check **Websockets Support** | ||
+ | * | ||
+ | |||
+ | —- [[: | ||
+ | |||