DuetWifi DWC Encryption using Rasberry Pi Zero W as Proxy Server
-
Hi @resam thank you for your contribution. I will try your recommendation as soon as my Pi up and running again (busy getting everything in their cases and mounting) positions.
The Basic Auth is also a good idea, though it is only between your browser and the Pi, so the RRF password is still the only protection for a direct connection to the Duet; that said any contributions are welcome.
For the proxy, I simply followed a tutorial on getting such a proxy setup, so there is some extras that are not needed; so for this to work, we only need the
proxy_pass
from the original one I had and then the 2 extras you mentioned? -
Fantastic!!!
Once you have this "really the way you like it", consider writing a WiKi page?
-
@jacotheron said in DuetWifi DWC Encryption using Rasberry Pi Zero W as Proxy Server:
For the proxy, I simply followed a tutorial on getting such a proxy setup, so there is some extras that are not needed; so for this to work, we only need the
proxy_pass
from the original one I had and then the 2 extras you mentioned?You could even get by with only
proxy_pass
andclient_max_body_size
but I would recommend to keep the other settings as this enables the browser and nginx to be more efficient in some tasks. -
@wilriker That makes sense.
@Danal I plan to make it a wiki page as a reference for other to also use.
While I have a few more knowledgeable people here, I plan to power the Pi from the Duet's expansion port. The idea is that since the Pi and a Pi Cam (v1.3) use very little power, it should be a nice integrated place to have it - as soon as the Duet power up, the Pi also power up and ready to work.
My current setup: I have a relay with a momentary bypass switch in parallel before the power supply. Relay is triggered on startup, as the PS_ON (active low). I have made a shutdown macro which I use to shut the printer off.
I have read that the Pi does not always like to simply loose power, so I have been thinking about a way to ensure the Pi can safely shut down, when I want to switch the printer off: I use 2 IO pins on the Duet, which runs to 2 GPIO pins on the Pi for a very basic type of communication (since both are 3.3V logic, it should not be an issue). Wire 1 is the return from the Pi (to signal it is almost shutdown) and Wire 2 is input to the Pi to start shutdown. On startup, the Duet pulls wire 1 HIGH (or can be LOW) it is set as an Input, and writes wire 2 to HIGH (Output); the Pi writes the opposite to wire 1, and creates an interrupt on wire 2 for a rise or fall. When the Pi's interrupt triggers, it should start shutting down, but the important part is that wire 1 should remain what it is for as long as possible until the Pi is as close to being shut down as possible, then it released and this should then be detected by the Duet which have a slight extra second delay before releasing the PS_ON relay and be off.
Is this a good idea or should I simply have a standard 10 second delay (with a single wire to signal shutdown); or am I just making it more complicated than it needs to be?
The camera will mainly be used to stream to DWC, but may from time to time be used for stills and time-lapse videos, and when they record I will complete the video before shutting down anyways (and usually download it to a computer, to clear the space).
-
Others may vary... I have never shut down a Pi in my life, other than by yanking power.
I have never had to re-build a Pi flash as a result of this practice. And, if I did, it wouldn't take long.
-
@danal said in DuetWifi DWC Encryption using Rasberry Pi Zero W as Proxy Server:
Fantastic!!!
Once you have this "really the way you like it", consider writing a WiKi page?
Yes my thoughts exactly - or a guide if you feel up to breaking down into detailed steps!
-
@jacotheron said in DuetWifi DWC Encryption using Rasberry Pi Zero W as Proxy Server:
I have read that the Pi does not always like to simply loose power, so I have been thinking about a way to ensure the Pi can safely shut down
In theory this is true. In practice i run some Pi which was so often hard power down and it still runs :D. Sometimes I wonder my self how it is possible. But they are some solutions which can improve hard power down reliability:
- use an industrial grade SD Card
- setups Pi file-system as read-only
-
I have now written a guide for the Proxy part, the camera section will come slightly later, but it is really simple to install (only real requirement is to run it on a different port than the proxy - I had issues when they were on the same port).
https://www.instructables.com/id/DuetWifi-HTTPS-Proxy-and-Camera-Using-RaspberryPi-/Any further advice, questions etc can be posted to the instructable or this thread. I will try to help anyone, but usually a Google Search can also help (in essence my guide is simply a compilation of information found on a whole lot of websites, added in a logical order for this specific task).
-
I just set mine up, and FYI if you don't have the WiFi password in double quotes it fails. I suggest including them everywhere anyone might copy/paste or they won't know what is going on without picking through the logs. I couldn't vi /etc/wpa_supplicant/wpa_supplicant.conf either because the Pi doesn't like the mappings on my keyboard. So there was no way to insert a double quote. I put the card back in my PC and added the double quotes and WiFi connects.
Of course so far I can't connect over SSH from my Mac or PC. I get as far as the password entry and Pi thinks I'm logged in, but I never get the prompt back. It's just hung there. So auth seems to be working according to the log but I never see the banner or a prompt that accepts typing. I have tried from Windows 10, Mac and Linux.
I'm very interested in the camera guide if you have a work in progress. My camera arrives tomorrow.
-
@jacotheron said in DuetWifi DWC Encryption using Rasberry Pi Zero W as Proxy Server:
I have now written a guide for the Proxy part, the camera section will come slightly later, but it is really simple to install (only real requirement is to run it on a different port than the proxy - I had issues when they were on the same port).
https://www.instructables.com/id/DuetWifi-HTTPS-Proxy-and-Camera-Using-RaspberryPi-/Would you be willing to put this in the Duet Dozuki Wiki?
If not, would you be offended if I did?
Thanks,
Danal
-
@3dmntbighker Ok, I will change it so that it have the double quotes.
@Danal You are more than welcome to add it to the wiki. As mentioned, my work was simply compiling it and ordering it. You can also, if you see a need for it, change grammar and spelling - English is not my native language.
-
@danal great if you did. can you link to @Jacotheron 's instructable if you do and focus the documentation on what to do, with the explanation of the background left in the instructable.
@Jacotheron thanks for writing this up, I plan on giving it a go as soon as possible. Do you think it is possible to put together a Pi zero image with everything configured (other than the obvious WIFI settings , printer name etc?
Torbjorn (of hang printer fame) has done his for the hangprinter development environment under Ubuntu
-
@T3P3Tony I am actually a beginner with regards to a Raspberry Pi, how would I go about creating that image?
-
@jacotheron I am not up to speed with it either. I will look into it once i get a version working.