MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. ember1205
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    E
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 13
    • Posts 181
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Third-Party Module - how to get help?

      Also - I caught this error with your debug output:

      Failed to load resource: the server responded with a status of 404 (Not Found) :8080/MMM-ImagesPhotos/photos:1 
      

      That’s at the beginning of the console output along with another error I have seen later in the console:

      MMM-ImagesPhotos Could not load photos
      photosrequest.onreadystatechange @ :8080/modules/MMM-ImagesPhotos/MMM-ImagesPhotos.js:65
      

      Any thoughts on those?

      posted in Troubleshooting
      E
      ember1205
    • RE: Third-Party Module - how to get help?

      I know this is marked ‘solved’, but I wanted to mention that A ) the module does still crash with “out of memory” errors and B ) a little bit of investigative tinkering makes me think that this all ties back to a garbage collection issue with Java.

      If I change the timing of how often the images change, I can effectively ‘force’ or almost eliminate a crash. The shorter the duration between photos, the more likely a crash will occur. I changed the timing to 45 seconds and saw the setup run reliably from power on at 7AM until power off at 11PM for multiple days in a row.

      Shortening the window down to 5 seconds between images will cause the system to crash typically within about 10-15 minutes at a maximum.

      At no time do I actively witness memory levels dropping down to zero, but that could just be “bad luck” in not seeing the issue arise when it errors out. Is there an easy way on the Pi to track a process and watch for a specific, correlating event when something crashes?

      posted in Troubleshooting
      E
      ember1205
    • RE: Auto restart

      There’s a REALLY simple way to do this using a script and a cron job.

      From the pi user, execute:

      sudo nano /bin/mmreload.sh
      

      Paste the following contents into that file:

      #!/bin/sh
      
      if [ /home/pi/MagicMirror/config/config.js -nt /home/pi/.pm2/pids/mm-0.pid ]; then
      /usr/bin/pm2 restart mm
      fi
      

      Save it (CTRL-X) and then give it execute permissions like this:

      sudo chmod +x /bin/mmreload.sh
      

      From the pi user, execute the following:

      crontab -e
      

      In the crontab file, add the following line:

      0,30 * * * * /bin/mmreload.sh  > /dev/null 2>&1
      

      Save the file (CTRL-X if you’re using nano).

      This will check the MM ‘pid’ file against the config.js file to see if the configuration file has been edited since the mirror was last started (it will check at the top and bottom of every hour). If the config file has been edited, it will restart MM and use the new configuration file.

      posted in Troubleshooting
      E
      ember1205
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @fbr1969 said in MagicMirror behind a NGinx Reverse Proxy:

      @ember1205

      Hi,
      With my shortcut “mmirror”, I can access directly to the default Magic Mirror page (define in my MM config.js file), at home (LAN) or at work (by Internet).
      And effectively, I had needed to handle the /socket.io path independently of the of /mmirror path to correct the error I found I my NGinx error log. And that worked like that.
      I’ sorry, but I don’t know how it works exactly…

      Thanks for the extra detail - your description increases my suspicion/concern that there is likely a lot of JS content being delivered directly to the browser that is not being otherwise rewritten, hence the need for the additional path for socket.io

      On my mirror, with a total of five modules (all default except one), there are twenty-six JS scripts that are delivered to the browser for “local” execution. Fortunately, of them, ONLY the socket.io call has a hard path to the root of the server:

      < script type="text/javascript" src="/socket.io/socket.io.js"></script>
      

      Nothing else uses the leading “/” in the path which means they are all relative paths and will properly pass through a reverse proxy for access. Even though the other twenty-five scripts can be downloaded, there’s nothing to say that the content WITHIN them can execute if they make any subsequent calls using hard-coded information that isn’t being rewritten.

      Reverse proxy servers are awesome tools, but the configuration has to be ‘perfect’ to ensure everything will work properly now and in the future. And rewriting JS is not always trivial.

      posted in Troubleshooting
      E
      ember1205
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @fbr1969

      A couple of questions about your configuration…

      • It seems that you configured ONLY for access to the mirror with a /mmirror path as well - is this accurate? I can’t tell where the ‘default’ VIP might be pointing to.

      • It appears that you have to handle the /socket.io path independently of the of /mmirror path, and that leads me to wonder if there is javascript code being returned to the browser that ALSO needs to be rewritten inline?

      posted in Troubleshooting
      E
      ember1205
    • RE: MagicMirror behind a NGinx Reverse Proxy

      When using a proxy server like this, it functions mostly like a content switch. In other words, you can redirect specific paths to different back-end hosts - this is commonly done when you have different servers holding different kinds of content.

      When you have a VIP acting as a Content Switch, anything not explicitly defined for a particular path will be handled by the default VIP. In this case, he has not actually defined the /mmirror path, so appending that to his domain will result in the DEFAULT server getting the traffic as opposed to the mirror. That’s why the 404.

      I believe that the directive I mentioned earlier is all that needs to be defined in order to get the nginx proxy handling that path accordingly…

      posted in Troubleshooting
      E
      ember1205
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @sdetweil said in MagicMirror behind a NGinx Reverse Proxy:

      @ember1205 its pretty clear tho

      curl -iL http://192.168.10.10/mmirror
      HTTP/1.1 301 Moved Permanently
      Server: nginx/1.14.2
      Date: Mon, 23 Dec 2019 18:14:36 GMT
      Content-Type: text/html
      Content-Length: 185
      Connection: keep-alive
      Location: https://[MyDomain]/mmirror
      
      HTTP/1.1 404 Not Found
      Server: nginx/1.14.2
      Date: Mon, 23 Dec 2019 18:14:36 GMT
      Content-Type: text/html; charset=utf-8
      Content-Length: 146
      Connection: keep-alive
      X-DNS-Prefetch-Control: off
      X-Frame-Options: SAMEORIGIN
      Strict-Transport-Security: max-age=15552000; includeSubDomains
      X-Download-Options: noopen
      X-Content-Type-Options: nosniff
      X-XSS-Protection: 1; mode=block
      Content-Security-Policy: default-src 'self'
      
      Error
      <pre>Cannot GET /mmirror</pre>
      
      Cannot GET /mmirror

      because that is on the client issuing the curl command, url with no ip address is same as localhost

      what is this??
      Location: https://[MyDomain]/mmirror

      again this should be server.mydomain

      if u go to client and do an nslookup domain.com
      u will get an error
      ping domain.com will fail

      He stated that he is masking details of what he’s posting, so it’s definitely something to check.

      However…

      The error is delivered from nginx

      Server: nginx/1.14.2
      

      Which means that it isn’t attempting to retrieve the URL from localhost.

      The missing directive that I mentioned prior is where I believe the issue is… The client IS connecting and requesting /mmirror, but that is not defined on the nginx host. As a result, it’s being processed by the default host configured there which will be on a different back-end server and that server does not have a /mmirror path available to serve. So, 404.

      posted in Troubleshooting
      E
      ember1205
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @fbr1969 said in MagicMirror behind a NGinx Reverse Proxy:

      @sdetweil @ember1205 Thank for your help.

      I forgot to say :

      • My nginx server is fully fonctional with some other locations I’ve masqued in my exemple of configuration files… Like that :
      location /mmirror {
          proxy_bind              $server_addr;
          proxy_pass              http://192.168.10.60:8080;
          proxy_set_header        Host            $http_host;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        X-Scheme        $scheme;
          proxy_set_header        X-Script-Name   /;  # IMPORTANT: path has NO trailing slash
      }
      

      I think I have some problems with some "proxy_set_header " rules.

      It appears that your X-Script-Name IS setting a trailing slash and isn’t inserting / removing mmirror. Shouldn’t that last line be

           proxy_set_header        X-Script-Name   /mmirror;  # IMPORTANT: path has NO trailing slash
      

      ??

      posted in Troubleshooting
      E
      ember1205
    • RE: How to disable auto update from MMM-GooglePhotos

      @JohnDelta said in How to disable auto update from MMM-GooglePhotos:

      @sdetweil can you help me out what a cron tool is? Haven’t heard about it yet.

      Cron is a scheduling tool that’s available in various linux, BSD, Mac, Unix, etc. operating systems. It allows you to schedule “jobs” (scripts, typically) to run on certain days, at certain times, with certain privileges to get things done.

      On my mirror, I have a script that I’ve written to rsync images from a server on my network over to the Pi. Cron allows me to schedule the execution of that script at times that I want it to run (every 30 minutes, in this case) and copy over changes from the server. You could do something similar with a tool that could connect to a Google photo album, Google Drive, or wherever and copy the most current image to a local directory. After that, whatever module you’re using to display that image would be able to update what’s on the screen either by itself, or you could integrate a “notification” within your script to tell the module to reload the image once the copy is done.

      posted in Utilities
      E
      ember1205
    • RE: MagicMirror behind a NGinx Reverse Proxy

      Firstly, do you really want to put your mirror behind a piece of software developed by the Russians, released into Open Source, then claimed by another Russian Company as “theirs” after it was purchased out by a commercial entity (F5)? If you need a reverse proxy, you’re likely to have all that you need from a simply Apache setup.

      Second - you will need to ensure that all of your rewrite rules take into account the back-end port along with the front-end port information as well as specific host name rules.

      For example:

      If your MM is 192.168.1.10 and you have a system running reverse proxy with a VIP on 192.168.1.50, you will need to decide if you’re going to continue using port 8080 on the front-end or if you want to fall back to standard port 80 (or even tie it up with a certificate on 443 with HTTPS/SSL).

      In other words, you could be doing client to proxy as 192.168.1.100 -> http://192.168.1.50 or 192.168.1.100 -> http://192.168.1.50:8080 or 192.168.1.100 -> https://192.168.1.50 or something else entirely.

      After you have decided how you’re handling the front end, you then need to ensure that you’re rewriting ALL of that as it passes through the proxy to/from http://192.168.1.10:8080

      You ALSO need to ensure that you have updated the configuration on MM to allow connections from off-box IP’s. Specifically, unless you are forcing the use of the original source IP, connections to the mirror should be coming from the system running your proxy and THAT address needs to have access to the web server on the mirror.

      posted in Troubleshooting
      E
      ember1205
    • 1
    • 2
    • 10
    • 11
    • 12
    • 13
    • 14
    • 18
    • 19
    • 12 / 19