pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

nginx configuration for redirection on 404 #183

Closed Praneet9 closed 4 years ago

Praneet9 commented 4 years ago

Added configuration to nginx configuration file for redirecting to localhost on 404 error code.

ethanjli commented 4 years ago

Test results:

I first ran the setup for PR #179, so I had already executed nginx_setup.sh. This time I ran it again from this branch; I got an error ln: failed to create symbolic link '/var/log/nginx/tmp': File exists, but the script seemed to complete successfully. It might be worth adding error handling for that case.

After restarting, I ended up in an infinite loop where the Chromium kiosk browser starts and then closes itself as soon as the default frontend page loads. I'm not sure why this is happening, but it needs to be fixed.

If I just manually start a regular Chromium browser and go to a page like localhost/dashboard, I can successfully reload that page instead of getting a 404. So I think this PR is fine to merge in. Can you answer the following questions for records-keeping:

  1. This project is licensed under Apache License v2.0 for any software, and Solderpad Hardware License v2.1 for any hardware - do you agree that your contributions to this project will be under these licenses, too?
  2. Were any of these contributions also part of work you did for an employer or a client?
  3. Does this work include, or is it based on, any third-party work which you did not create?
ethanjli commented 4 years ago

I have just tried to replicate this issue from a clean image (flashing your default image from Google Drive); here are my actions & results:

  1. I flashed pufferfish.img onto the SD card.
  2. I started and closed the Chromium browser.
  3. I did a git checkout of PR #179, and then I ran setup.sh and allowed it to restart the RPi.
  4. I ran backend_service.sh and kiosk.sh and restarted the RPi. The kiosk browser launched fine. I then pressed "Ctrl+W" to close it, and then I restarted the RPi again. The kiosk browser still launched fine.
  5. I ran usb_logging.sh and restarted the RPi. The kiosk browser still launched fine. I then pressed "Ctrl+W" to close it, and then I restarted the RPi again. The kiosk browser still launched fine. After I pressed "Ctrl+W" again, eventually the kiosk browser would restart on its own.
  6. Then I ran configure_kiosk.sh and restarted the RPi. The kiosk browser still launched fine. I then pressed "Ctrl+W" to close it, and then I restarted the RPi again. The kiosk browser still launched fine. After I pressed "Ctrl+W" again, eventually the kiosk browser would restart on its own.
  7. Then I did a git checkout of #183 and ran nginx_setup.sh and restarted the RPi. The kiosk browser entered the restart loop.
  8. Then I did a git checkout of PR #179 again and ran nginx_setup.sh and restarted the RPi. The kiosk browser then launched fine.

This suggests that running nginx_setup.sh from this PR, after I've already done the setup from PR #179, causes the problem somehow.

Praneet9 commented 4 years ago

I was actually supposed to remove the line with symbolic link, as it is not required anymore. We are writing logs to a custom directory which is not read-only. This was done to fix the bug of writing logs in read-only mode. I'll remove this line in a new commit in #179

I tried to reproduce the problem and was successful in doing that. Weirdly the looping stopped whenever I switched branch from #183 to #179 Turns out the problem was in the backend due to ModuleNotFoundError: No module named 'RPi' error. This restarted the backend service and in turn, the kiosk service restarted as well as it requires backend service to be active. I can confirm there's no problem with nginx_setup in this branch.

ethanjli commented 4 years ago

Ok, so that's a separate issue; we can merge in this PR in the meantime. For records-keeping:

  1. This project is licensed under Apache License v2.0 for any software, and Solderpad Hardware License v2.1 for any hardware - do you agree that your contributions to this project will be under these licenses, too?
  2. Were any of these contributions also part of work you did for an employer or a client?
  3. Does this work include, or is it based on, any third-party work which you did not create?
Praneet9 commented 4 years ago
  1. This project is licensed under Apache License v2.0 for any software, and Solderpad Hardware License v2.1 for any hardware - do you agree that your contributions to this project will be under these licenses, too? Yes
  2. Were any of these contributions also part of work you did for an employer or a client? No
  3. Does this work include, or is it based on, any third-party work which you did not create? No