Typhonragewind / meshcentral-docker

175 stars 46 forks source link

Meshcentral-Docker

Docker Pulls Docker Image Size (latest by date)

About

This is my implementation of the amazing MeshCentral software (https://github.com/Ylianst/MeshCentral) on a docker image, with some minor QOL settings to make it easier to setup.

While easier to setup and get up and running, you should still peer through the very informative official guides:

https://meshcentral.com/info/docs/MeshCentral2InstallGuide.pdf

https://meshcentral.com/info/docs/MeshCentral2UserGuide.pdf

Disclaimer

This image is targeted for self-hosting and small environments. The regular image does not make use of a specialized database solution (MongoDB) and as such, per official documentation is not recommended for environments for over 100 devices.

Installation

The preferred method to get this image up and running is through the use of docker-compose (examples below).

By filling out some of the options in the environment variables in the docker compose you can define some initial meshcentral settings and have it up and ready in no time. If you'd like to include settings not supported by the docker-compose file, you can also edit the config.json to your liking (you should really check the User's Guide for this) and place it in the meshcentral-data folder before initializing the container.

Updating settings is also easy after having the container initialized if you change your mind or want to tweak things. Just edit meshcentral-data/config.json and restart the container.

docker-compose.yml example:

version: '3'
services:
    meshcentral:
        restart: always
        container_name: meshcentral
        image: typhonragewind/meshcentral:latest
        ports:
            - 8086:443  #MeshCentral will moan and try everything not to use port 80, but you can also use it if you so desire, just change the config.json according to your needs
        environment:
            - HOSTNAME=my.domain.com     #your hostname
            - REVERSE_PROXY=false     #set to your reverse proxy IP if you want to put meshcentral behind a reverse proxy
            - REVERSE_PROXY_TLS_PORT=
            - IFRAME=false    #set to true if you wish to enable iframe support
            - ALLOW_NEW_ACCOUNTS=true    #set to false if you want disable self-service creation of new accounts besides the first (admin)
            - WEBRTC=false  #set to true to enable WebRTC - per documentation it is not officially released with meshcentral, but is solid enough to work with. Use with caution
            - BACKUPS_PW=MyAwesomePasswordPleaseChangeMe #password for the autobackup function
            - BACKUP_INTERVAL=24 # Interval in hours for the autobackup function
            - BACKUP_KEEP_DAYS=10 #number of days of backups the function keeps
        volumes:
            - ./meshcentral/data:/opt/meshcentral/meshcentral-data    #config.json and other important files live here. A must for data persistence
            - ./meshcentral/user_files:/opt/meshcentral/meshcentral-files    #where file uploads for users live
            - ./meshcentral/backups:/opt/meshcentral/meshcentral-backups     #Backups location

As per multiple requests and @mwllgr and @originaljay contributions, this image can be used with MongoDB using the following docker-compose.yml:

version: '3'
services:
    mongodb:
        container_name: meshcentral_db
        restart: always
        image: mongo:latest
        expose:
            - 27017
        volumes:
            - '/opt/meshcentral/database:/data/db'
    meshcentral:
        restart: always
        container_name: meshcentral
        depends_on:
            - 'mongodb'
        image: typhonragewind/meshcentral:mongodb-latest
        ports:
            - 8086:443 #MeshCentral will moan and try everything not to use port 80, but you can also use it if you so desire, just change the config.json according to your needs
        environment:
            - HOSTNAME=my.domain.com     #your hostname
            - REVERSE_PROXY=false     #set to your reverse proxy IP if you want to put meshcentral behind a reverse proxy
            - REVERSE_PROXY_TLS_PORT=443
            - IFRAME=false #set to true if you wish to enable iframe support
            - ALLOW_NEW_ACCOUNTS=true    #set to false if you want disable self-service creation of new accounts besides the first (admin)
            - WEBRTC=false  #set to true to enable WebRTC - per documentation it is not officially released with meshcentral, but is solid enough to work with. Use with caution
            - NODE_ENV=production
        volumes:
            - ./meshcentral/data:/opt/meshcentral/meshcentral-data
            - ./meshcentral/user_files:/opt/meshcentral/meshcentral-files

If you do not wish to use the prebuilt images, you can also easily build it yourself. Just make sure to include config.json.template and startup.sh in the same directory if you do not change the Dockerfile.

Tags

These tags are available both in Dockerhub or ghcr.io

Regular Images

typhonragewind/meshcentral:latest

typhonragewind/meshcentral:preloadlibs-latest

typhonragewind/meshcentral:\<specific version number>

typhonragewind/meshcentral:preloadlibs-\<specific version number>

MongoDB Images

typhonragewind/meshcentral:mongodb-latest

typhonragewind/meshcentral:preloadlibs-mongodb-latest

typhonragewind/meshcentral:mongodb-\

typhonragewind/meshcentral:preloadlibs-mongodb-\<specific version number>

Final words

Be sure to check out MeshCentral's github repo. The project is amazing and the developers too!

Troubleshooting/FAQ

Can't change settings to fix my instllation Currently, the environment variables you define when you first run your docker-compose are written to the config.conf and not replaced if you change the environment file (i plan on changing this behaviour soon:tm:). Either edit the config.conf directly or delete it before running the docker-compose again.

Unable to install required module "otplib@10.2.3" I haven't been able to find the source of this error and can't replicate it locally. Use one of the tags that contains "preloadlibs".

Changelog

2023-06-22 - Implemented multi-arch images (tags have changed). Images are now built using Github Actions and additionally uploaded to github Registry as well. Added images with preloaded libs. Implemented options for autobackup on the regular image (MongoDB version soon:tm:). Added backup options for regular image.

2022-06-22 - Specified Ubuntu base image version to fix problems in latest builds. Documentation cleaup.

2022-05-20 - Added Docker Hub image versioning for future automated builds.