Giter Site home page Giter Site logo

meshcentral-docker's Introduction

Meshcentral Docker

Repository for building meshcentral images in docker

docker run -p 80:80 -p 443:443 ghcr.io/gurucomputing/meshcentral-docker

readme-gif

Meshcentral Summary

Meshcentral is a remote management and monitoring (RMM) system designed to run in a web browser. Meshcentral supports Linux, Windows, MacOS, and (to a certain extent) Android.

Meshcentral is developed by a separate team: their repository can be found at https://github.com/Ylianst/MeshCentral. This repository is unaffiliated and meant for a docker deployment of the platform.

Meshcentral Documentation

For advanced configurations, you can modify the config.json that will be generated at /meshcentral/meshcentral-data. You can use the following resources for more information:

Docker Container Features

  • Nightly automated builds thanks to github actions
  • Environment Variables for different starting configurations
  • Non-Root container by default
  • Volumes will automatically adjust file permissions to the docker user

Docker Container Changelog

These mark changes to how the docker container operates. The version description defines where the change in question took place. Versions before the change will not be affected.

Version Change
0.9.52 initialization script will now perform additional checks regarding file permissions before resorting to overwriting file ownership

Docker Tags

If you want to stay on the bleeding edge, the latest tag will follow all version updates from the upstream Meshcentral (checked daily). Meshcentral is highly maintained and sees nearly daily updates.

If you are looking for a production or stable experience, the stable tag will follow any versions marked stable within the node repository for Meshcentral.

Container Defaults

  • Ports are 80/443
  • Certificates are self signed and generated on first boot
    • Signed certificates can be provided by a reverse proxy (example given in documentation) or by editing config.json
  • Database is an embedded database by default (NeDB)
    • Database can be changed to mongodb using environment variables or editing config.json in meshcentral-data. Recommended for production.
  • Container will run as the node user, with a UID of 1000 and GID of 1000

Environment Variables

The docker image can take multiple environment variables as arguments. All environment variables are optional.

Environment variables will only apply on first run, when no config.json file is present. If the config.json file already exists, environment variables will have no effect.

Variable Description Example
MONGODB_URL url to mongo database mongodb://meshcentral-db:27017
MONGODB_NAME database name meshcentral
DB_ENCRYPT_KEY secret/key to encrypt the mongodb database ${DB_ENCRYPT_KEY}
AGENT_PORT optional port for agents to connect on 8800
CERT dns name for your server, needed for trusted TLS connections mesh.mydomain.com

Volumes

There are three volumes in question for persistent data:

Volume Description
/meshcentral/meshcentral-data Main configuration folder, holds config.json, all certs, and the embedded db (if in use)
/meshcentral/meshcentral-files folder that holds files uploaded to the meshcentral server
/meshcentral/meshcentral-backup automated database backs will reside in this folder

Examples

Example docker-compose files can be found in the repository. For your convenience, the three most common examples are here:

Example 1: Simple Configuration

Most basic meshcentral configuration

version: '2'
services:
  meshcentral:
    container_name: meshcentral
    image: ghcr.io/gurucomputing/meshcentral-docker:latest
    restart: "always"
    volumes:
      - ./container-data/meshcentral-data:/meshcentral/meshcentral-data
      - ./container-data/meshcentral-files:/meshcentral/meshcentral-files
      - ./container-data/meshcentral-backup:/meshcentral/meshcentral-backup
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 80:80
      - 443:443

Example 2: using MongoDB for Backend

initialize a meshcentral container with mongodb

version: '2'
# This is example 2 from the documentation
services:
  meshcentral:
    container_name: meshcentral
    image: ghcr.io/gurucomputing/meshcentral-docker:latest
    restart: "always"
    volumes:
      - ./container-data/meshcentral-data:/meshcentral/meshcentral-data
      - ./container-data/meshcentral-files:/meshcentral/meshcentral-files
      - ./container-data/meshcentral-backup:/meshcentral/meshcentral-backup
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MONGODB_URL=mongodb://meshcentral-db:27017
      - MONGODB_NAME=meshcentral
      - DB_ENCRYPT_KEY=${DB_ENCRYPT_KEY}
    ports:
      - 80:80
      - 443:443
    networks:
      - meshcentral-nw
  meshcentral-db:
    container_name: meshcentral-db
    image: mongo:latest
    restart: "always"
    volumes:
      - ./container-data/db:/data/db
      - /etc/localtime:/etc/localtime:ro
    # ports:
    #   - 27017:27017
    networks:
      - meshcentral-nw

networks:
  meshcentral-nw:

Also create a .env file for your secrets:

DB_ENCRYPT_KEY=mysecretpassword

Example 3: Advanced Config with MongoDB, Agent Port, and Caddy Reverse Proxy

A full solution including an separate port for agent connections and caddy for reverse proxying and let's encrypt. This assumes port 80, 443, and 8800 are all forwarded from the docker host to the web (otherwise let's encrypt will fail)

version: '2'
# This is example 3 from the documentation
services:
  meshcentral:
    container_name: meshcentral
    image: ghcr.io/gurucomputing/meshcentral-docker:latest
    restart: "always"
    volumes:
      - ./container-data/meshcentral-data:/meshcentral/meshcentral-data
      - ./container-data/meshcentral-files:/meshcentral/meshcentral-files
      - ./container-data/meshcentral-backup:/meshcentral/meshcentral-backup
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MONGODB_URL=mongodb://meshcentral-db:27017
      - MONGODB_NAME=meshcentral
      - DB_ENCRYPT_KEY=${DB_ENCRYPT_KEY}
      - AGENT_PORT=8800
      - CERT=mesh.mydomain.com
    ports:
      - 8800:8800
      # - 80:80
      # - 443:443
    networks:
      - meshcentral-nw
      - reverseproxy-nw
  meshcentral-db:
    container_name: meshcentral-db
    image: mongo:latest
    restart: "always"
    volumes:
      - ./container-data/db:/data/db
      - /etc/localtime:/etc/localtime:ro
    # ports:
    #   - 27017:27017
    networks:
      - meshcentral-nw
  meshcentral-proxy:
    container_name: meshcentral-proxy
    image: caddy:latest
    restart: "always"
    volumes:
      - ./caddy/Caddyfile:/usr/share/caddy/Caddyfile
    ports:
      - 80:80
      - 443:443
    networks:
      - reverseproxy-nw

networks:
  meshcentral-nw:
  reverseproxy-nw:

Include your .env file of course:

DB_ENCRYPT_KEY=mysecretpassword

And include your Caddyfile under caddy/Caddyfile

https://mesh.mydomain.com {
  reverse_proxy https://meshcentral:443 {
    transport http {
      tls_insecure_skip_verify
    }
  }
}

Additional Notes

SE-Linux Based Environments

If you are using an SE-Linux based environment (such as Fedora, CentOS, or equivalent), docker will deny file permissions in bind mounts. You must relabel or explicitly tell docker to ignore file labelling. You can ignore file labelling by adding the following to your service:

services:
  meshcentral:
    security_opt:
      - label:disable

meshcentral-docker's People

Contributors

routerino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meshcentral-docker's Issues

issue on installing with config

Hi @routerino currently trying to copy a config i had on a previous vm with meshcentral but im getting this error

ERROR: Unable to parse /meshcentral/meshcentral-data/config.json

i was also trying to publish the port 8085 to use http only has im going to use my SWAG docker which has reverse proxy but cant seem to get it use http

this is the config


{
  "__comment__" : "This is a sample configuration file, edit a section and remove the _ in front of the name. Refer to the user's guide for details.",
  "settings": {
    "Cert": "remoto.domain.com",
    "mongoDb": "mongodb://meshcentral-db:27017",
    "mongoDbName": "meshcentral",
    "dbEncryptKey": "MyReallySecretPassword2"
    "WANonly": true,
    "Port": 8085,
    "AliasPort": 8085,
    "RedirPort": 8085,
    "AgentPing": 60,
    "AgentPong": 60,
    "NpmPath": "/usr/bin/node /usr/bin/npm",
    "TlsOffload": "127.0.0.1",
    "BrowserPong": 20,
    "ignoreagenthashcheck": false,
    },
 
    "domains": {
    "": {
      "Title": "Remoto",
      "Title2": "Remoto",
      "CertUrl": "https://remoto.domain.com:443/",
    },
  },
}

This is the docker-compose

version: '2'
# This is example 2 from the documentation
services:
  meshcentral:
    container_name: meshcentral
    image: ghcr.io/gurucomputing/meshcentral-docker:latest
    restart: "always"
    volumes:
      - meshcentral-data:/meshcentral/meshcentral-data
      - meshcentral-files:/meshcentral/meshcentral-files
      - meshcentral-backup:/meshcentral/meshcentral-backup
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MONGODB_URL=mongodb://meshcentral-db:27017
      - MONGODB_NAME=meshcentral
      - DB_ENCRYPT_KEY=${DB_ENCRYPT_KEY}
    ports:
      - 8085:80
      - 8086:443
    networks:
      - meshcentral-nw
  meshcentral-db:
    container_name: meshcentral-db
    image: mongo:3.6.3
    restart: "always"
    volumes:
      - mongo-data:/data/db
      - /etc/localtime:/etc/localtime:ro
    networks:
      - meshcentral-nw

networks:
  meshcentral-nw:

volumes:
  mongo-data:
    driver: local-persist
    driver_opts:
      mountpoint: /scsi2/remote/meshcentral/_data/mongo-data
  meshcentral-data:
    driver: local-persist
    driver_opts:
      mountpoint: /scsi2/remote/meshcentral/_data/meshcentral-data
  meshcentral-files:
    driver: local-persist
    driver_opts:
      mountpoint: /scsi2/remote/meshcentral/_data/meshcentral-files
  meshcentral-backup:
    driver: local-persist
    driver_opts:
      mountpoint: /scsi2/remote/meshcentral/_data/meshcentral-backup

Thank you

Default password?

Hi
I was wondering what is the default password?
Im trying to configure so it runs on another port would it work if i put a reverse proxy in front of it?

Thank you

odd issue to update?

Hi @routerino
i was wondering if you had seen this issue before ,
Currently on the webGUI i try to update but im getting this

image

i was reading a bit might be an issue because meshcentral cant find the NPM
but not sure if its a docker image issue or config issue?
Thank you

Question about migrating?

Hi
I was wondering if someone could shed somelight, im currently have the meshcentral on a vm and want to migrate to docker

i have a copy of the server meshcentral-autobackup-2022-07-12-20-45.zip
which has the meshcentral data and the mongodump

would copy the files of the meshcentral data to my other hosts which has the docker of meshcentral? and how would i restore the mongodb?

i know i would need to change my config.json maybe something like this?

{
  "__comment__" : "This is a sample configuration file, edit a section and remove the _ in front of the name. Refer to the user's guide for details.",
  "settings": {
  "Cert": "remote.domain.com",
  "trustedproxy": "CloudFlare",
    "mongoDb": "mongodb://meshcentral-db:27017",
    "mongoDbName": "meshcentral",
    "dbEncryptKey": "mysecretpassword"
    "WANonly": true,
    "Port": 4430,
    "RedirPort": 800,
    "AliasPort": 443,
    "MeshErrorLogPath": "/var/log/mesh.log",
    "NpmPath": "/usr/bin/node /usr/bin/npm",
    "TlsOffload": "127.0.0.1",
    "BrowserPong": 20,
    "AgentPong": 20,
    "AutoBackup": {
      "backupIntervalHours": 24,
      "keepLastDaysBackup": 10,
      "backupPath": "/root/meshcentral-backup"
    },
  },
  "domains": {
    "": {
      "Title": "Mesh central ",
      "Title2": "Remote",
      "TitlePicture": "pic.png",
      "WelcomePicture": "pic2.png",
      "WelcomePictureFullScreen": true,
      "CertUrl": "https://remote.domain.com:443/",
      "agentCustomization": {
          "displayName": "meshcentral",
          "description": "Remote",
          "companyName": "remote",
          "serviceName": "agent",
          "filenameName": "agent",
          "image": "agent.png",
          "installText": "Remote"
          },
    },

  },
}

docker compose


version: '2'
# This is example 2 from the documentation
services:
  meshcentral:
    container_name: meshcentral
    image: ghcr.io/gurucomputing/meshcentral-docker:latest
    restart: "always"
    volumes:
      - ./container-data/meshcentral-data:/meshcentral/meshcentral-data
      - ./container-data/meshcentral-files:/meshcentral/meshcentral-files
      - ./container-data/meshcentral-backup:/meshcentral/meshcentral-backup
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MONGODB_URL=mongodb://meshcentral-db:27017
      - MONGODB_NAME=meshcentral
      - DB_ENCRYPT_KEY=mysecretpassword
    ports:
      - 800:80
      - 4430:443
    networks:
      - meshcentral-nw
  meshcentral-db:
    container_name: meshcentral-db
    image: mongo:4.4.6
    restart: "always"
    volumes:
      - ./container-data/db:/data/db
      - /etc/localtime:/etc/localtime:ro
    # ports:
    #   - 27017:27017
    networks:
      - meshcentral-nw

networks:
  meshcentral-nw:

Thank you

Is it possible to change the user/group under which it will run ?

Hello,
is it possible to change the user/group ID under which it will run?
I read that it will run as the user node(1000,1000) but this is undesirable in my Docker environment. I would like to use a _meshcentral(1047, 65535) user. Can I define it in the docker-compose.yml file , or as environment variables ?
Thanks for your support !

Migrate to mongo

Hi,

Is it possible to activate bash in to the container? I want to migrate from dafault DB to mongo.
Or an other way to import a database..

edit:
When i try to export the DB:

docker exec -it meshcentral-mongo "node meshcentral --dbexport"
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "node meshcentral --dbexport": executable file not found in $PATH: unknown

Usage with Traefik

Do you have a docker-compose for usage with Traefik?
When I use port 80 for binding, I get 'ERR_TOO_MANY_REDIRECTS'.
And with port 443 I get a 'Bad Gateway error'.

When I deploy the container without traefik, I can connect to 443 without any issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.