MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MM in Container config lost after Container Stop/Start

    Scheduled Pinned Locked Moved Solved Troubleshooting
    15 Posts 3 Posters 4.7k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      asdf303 @karsten13
      last edited by

      @karsten13 Thank you for asking.
      Please find all my stuff below

      As mentioned above, it loads correctly and runs the configuration correctly on the first start.
      Everything is fine.
      But if the container is started/stopped in Portainer, it seems to not be able to find a correct config.js, as you can see in the log.

      The only way to get it running is, i stop the container, remove the stack in Portainer, then navigate to /data/compose in the host system, manually delete all the data there (i use Winscp). Then i re-install everything (including e.g. the mmm-localtransport addon) acc. to the book, modify the config.js to what you can see below.

      let config = {
      	address: "0.0.0.0", 	// Address to listen on, can be:
      	port: 8080,
      	basePath: "/", 	// The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
      					// you must set the sub path here. basePath must end with a /
      	//ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "192.168.178.1/24"], 	// Set [] to allow all IP addresses
      	ipWhitelist: [], 	// Set [] to allow all IP addresses
      
      	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
      	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
      	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
      
      	language: "de",
      	locale: "en-US",
      	logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
      	timeFormat: 24,
      	units: "metric",
      	// serverOnly:  true/false/"local" ,
      	// local for armv6l processors, default
      	//   starts serveronly and then starts chrome browser
      	// false, default for all NON-armv6l devices
      	// true, force serveronly mode, because you want to.. no UI on this device
      
      	modules: [
      		{
      			module: "alert",
      		},
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_left",
      				config: {
      					displaySeconds: false,
      					displayType: "digital",
      					clockBold: false,
      					// The config property is optional.
      					// See 'Configuration options' for more information.
      					}
      		},
      {
      			module: "calendar",
      			header: "Was passiert heute?",
      			position: "top_left",
      			config: {
      				fade: false,
      				timeFormat: 'absolute',
      				dateFormat: '24',
      				getRelative: 24,
      				fetchInterval: 3600000,
      				calendars: [
                                      	{
      					// der Abfallkalender
                                                    	symbol: "trash",
                                             		url: "webcal://XXX"
                                              },
      					{
      					//private calendar
      						symbol: "home",
            					 	url: "XXX",
              					auth: {
      							user: "XXX",
      							pass: "XXX",
      							method: "basic"
      						}
      					}
      				]
      			}
      		},
      
      /*		{
      			module: "compliments",
      			position: "lower_third"
      		},*/
      	
      		{
      			module: "weather", //aktuelles Wetter
      			position: "top_right",
      			//header: "aktuelles Wetter",
      			config: {
      				fade: false,
      				type: "current",
      				weatherProvider: "openweathermap",
      				location: "XXX",
      				locationID: "XXX",  //ID from http://www.openweathermap.org/help/city_list.txt
      				apiKey: "XXX",
      				roundTemp: true,
      				maxNumberOfDays: 2,
      			}
      
      		},{
      			module: "weather", //Vorhersage
      			position: "top_right",
      			header: "Vorhersage",
      			config: {
      				fade: false,
      				type: "forecast",
      				weatherProvider: "openweathermap",
      				location: "XXX",
      				locationID: "XXX",  //ID from http://www.openweathermap.org/help/city_list.txt
      				apiKey: "xxx",
      				roundTemp: true,
      				maxNumberOfDays: 4,
      			}
      
      		},
      		{
      			module: "newsfeed",
      			position: "bottom_bar",
      			config: {
      				feeds: [
      					{
      						title: "Tagesschau",
      						url: "https://www.tagesschau.de/xml/rss2"
      					}
      				],
      				showSourceTitle: false,
      				showPublishDate: false,
      				wrapTitle: false,
      			}
      		},,{
      		module: 'MMM-LocalTransport',
      		header: 'Bus nach XXX',
      		position: 'bottom_right',
      		config: {
      			api_key: 'xxxx',
      			origin: 'xxxx',
      			destination: 'xxxx',
      			maximumEntries: 3,
      			displayArrival: false,
      			displayWalkType: 'none',
      			updateInterval: 60,
      			displayStationLength: -1,
      		}
      	},
      	]
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      
      

      Here is the docker-compose.yml, copied from your project, unchanged:

      version: '3'
      
      services:
        magicmirror:
          container_name: mm
          image: karsten13/magicmirror:latest
          ports:
            - "8080:8080"
          volumes:
            - ../mounts/config:/opt/magic_mirror/config
            - ../mounts/modules:/opt/magic_mirror/modules
            - ../mounts/css:/opt/magic_mirror/css
          restart: unless-stopped
          command: 
            - npm
            - run
            - server
      

      and finally, the log after RE-starting the container.

      > magicmirror@2.22.0 server
      
      > node ./serveronly
      
      [17.02.2023 13:35.40.960] [LOG]   Starting MagicMirror: v2.22.0
      
      [17.02.2023 13:35.40.962] [LOG]   Loading config ...
      
      [17.02.2023 13:35.40.964] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: TypeError: Cannot read properties of undefined (reading 'module')
      
      [17.02.2023 13:35.40.965] [ERROR] Whoops! There was an uncaught exception...
      
      [17.02.2023 13:35.40.967] [ERROR] TypeError: Cannot read properties of undefined (reading 'module')
      
          at /opt/magic_mirror/js/app.js:220:34
      
          at loadConfig (/opt/magic_mirror/js/app.js:81:4)
      
          at App.start (/opt/magic_mirror/js/app.js:212:3)
      
          at Object.<anonymous> (/opt/magic_mirror/serveronly/index.js:4:5)
      
          at Module._compile (node:internal/modules/cjs/loader:1226:14)
      
          at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
      
          at Module.load (node:internal/modules/cjs/loader:1089:32)
      
          at Module._load (node:internal/modules/cjs/loader:930:12)
      
          at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
      
          at node:internal/main/run_main_module:23:47
      
      [17.02.2023 13:35.40.967] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      
      [17.02.2023 13:35.40.967] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      
      copy default modules to host ...
      
      copy css files to host ...
      
      chown modules and config folder ...
      
      timezone is Europe/Berlin
      
      start magicmirror
      
      karsten13K 1 Reply Last reply Reply Quote 0
      • karsten13K Offline
        karsten13 @asdf303
        last edited by

        @asdf303

        must be something with the portainer setup.

        What is strange is the order in the log file, I would expect the last lines beginning with copy default modules to host ... at the top.

        One thing you can try is to change restart: unless-stopped to restart: never in the docker-compose.yml, may 2 containers are started when portainer stops the one running.

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          asdf303 @karsten13
          last edited by

          @karsten13 thank you, i will try next time, will take 2…3 days, maybe

          A 1 Reply Last reply Reply Quote 0
          • A Offline
            asdf303 @asdf303
            last edited by asdf303

            update: if the module: ‘MMM-LocalTransport’, module is disabled, it works.
            Strange thing:

            • the module works on my raspi electron installation.
            • it does not in the container.
              I will keep you updated.
            karsten13K 1 Reply Last reply Reply Quote 0
            • karsten13K Offline
              karsten13 @asdf303
              last edited by

              @asdf303

              this module is not really maintained, it relies on an outdated dependency (request) which was removed from mm core a long time ago.

              If it runs on your pi the mm installation there is very old or you installed request manually. See this topic for more info.

              A 1 Reply Last reply Reply Quote 0
              • A Offline
                asdf303 @karsten13
                last edited by

                @karsten13 indeed, the installation has been running for ~5 years now.

                I know this is none of your business, but do you might have a recommendation for a up-to-date module where i can run the same features? (naming a start and destination bus stop in google maps and getting the next connections displayed?)

                i scrolled through all of the 3rd party modules and there are many many of them, but none of them seems to be customizable to my home town. I live within VGN area in Germany, but there is no plugin really supporting this and i am definetly lacking the skills to create such a plugin by myself.

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @asdf303
                  last edited by

                  @asdf303 just install the missing library

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  karsten13K 1 Reply Last reply Reply Quote 0
                  • karsten13K Offline
                    karsten13 @sdetweil
                    last edited by

                    as sam already said you can fix this, for more info see https://khassel.gitlab.io/magicmirror/faq/#error-cannot-find-module-request

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @karsten13
                      last edited by

                      @karsten13 and note there are other libs as well

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      A 1 Reply Last reply Reply Quote 0
                      • A Offline
                        asdf303 @sdetweil
                        last edited by

                        @sdetweil @karsten13 thanks a lot for your advice!
                        finally, there was only one package missing

                        npm install request
                        

                        did the job for me.

                        :folded_hands_medium-light_skin_tone:

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy