meshcentral-docker icon indicating copy to clipboard operation
meshcentral-docker copied to clipboard

Container doesn't build config.json correctly ("latest" tag)

Open natechoiniere opened this issue 11 months ago • 5 comments

So I ran into this issue (bug?) earlier and fixed it. I was just able to recreate it. Went straight to this page https://hub.docker.com/r/typhonragewind/meshcentral and copied/pasted the "docker-compose.yml example" and spun it up after changing the hostname to be my IP address. Looks like it is using the "latest" tag. It gives me the error "ERROR: Unable to parse /opt/meshcentral/meshcentral-data/config.json." The culprit is a mangled sessionKey in config.json:

{
  "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json",
  "settings": {
    "cert": "2x.xx.xx.x8",
    "_WANonly": true,
    "_LANonly": true,
    "sessionKey": "%-$GEdm[(@IzzGg}MV"_sessionKey": "MyReallySecretPassword1"7-sqi7bz-@CZ3",
    "port": 443,
    "_aliasPort": 443,
    "redirPort": 80,
    "_redirAliasPort": 80,
    "AgentPong": 300,
    "TLSOffload": false,
    "SelfUpdate": false,
    "AllowFraming": "false",
    "WebRTC": "false",
    "AutoBackup": {
      "backupPath": "/opt/meshcentral/meshcentral-backups",
      "backupInvervalHours": "24",
      "keepLastDaysBackup": "10",
      "zippassword": "MyAwesomePasswordPleaseChangeMe"
    }
  },
  "domains": {
        "": {
        "_title": "MyServer",
    "_title2": "Servername",
    "_minify": true,
    "NewAccounts": "true",
        "_userNameIsEmail": true,
    "_certUrl": "my.reverse.proxy"
        }
  },
  "_letsencrypt": {
    "__comment__": "Requires NodeJS 8.x or better, Go to https://letsdebug.net/ first before>",
    "_email": "[email protected]",
    "_names": "myserver.mydomain.com",
        "production": false
  }
}

For some reason the container doesn't correctly set the sessionKey. Looks like it's trying to set both a commented out & an uncommented sessionKey, and forgetting a comma between them. The fix is to simply make the sessionKey of format "sessionKey":"sessionKeyHere";

natechoiniere avatar Sep 07 '23 15:09 natechoiniere

Thanks

grahamIT avatar Jan 24 '24 16:01 grahamIT

Uhh, weird. Thanks for letting me know, I'll fix this as soon as i can

Typhonragewind avatar Jan 24 '24 17:01 Typhonragewind

It also seems to copy and add some lines to the end of the file, when I fix the above mistake and recreate the container. Which again makes the JSON broken. The end of my file looks like this: image

svenwanzenried avatar Jan 29 '24 12:01 svenwanzenried

Something changed on the master config file from meshcentral and now my SED lines are broken. Thanks for all the troubleshooting! Things should get calmer for me in a few days and i'll be able to take a look at this properly

Typhonragewind avatar Jan 29 '24 15:01 Typhonragewind

I had a look at the startup script and it seems to be all in order. I did remove one source for a potential bug i didn't think off and that may solve this issue

Typhonragewind avatar Feb 11 '24 19:02 Typhonragewind