I’m in the process of setting up my first balena project which is the balena-cups print server. I’ve run into a problem at the point where I try to connect via the public URL which has been switched on.
This lan is also supporting a standard apache2 web server on another computer and the router is set to direct port 80 traffic there and as a result I get the error…
We encountered an error when reaching this balena.io device:
UUID ################### (removed)
tunneling socket could not be established: 500
One possible reason is because nothing is listening on port 80 on the device.
I suspect that balena tries to get to the device on port 80 but that’s not going to work because the router sends port 80 traffic to the web server and I’m unwilling to shift the web server in the other computer onto any port other than 80. Is it possible to reconfigure the public URL and any other parts of balena-cups so that they use a different port ie: something like 8080 and I can then set that up in the router to point to the balena-cups machine? Otherwise the balena-cups project will not be able to be used in this situation.
If I haven’t understood the problem correctly, then I’m ready to learn…
In this case your router is not interfering because our Public URL is being proxied over the balena VPN to your device. So multiple devices can run multiple webservices on port 80 behind your NAT/firewall without forwarding any ports.
Can you confirm that in your docker-compose file you have at least one service with port 80 or 443 exposed? This is what the Public URL is looking for when proxying traffic over the VPN to one of your services. Maybe sharing your project source code URL if it is public would be the most helpful.
so I have no actual code of my own, it’s just whatever code is part of this project. I’m assuming that the project sets up some sort of web server to respond to a port 80 request. The tutorial mentioned in the blog just assumes that the “public URL” step should work, but it doesn’t for me. I should probably have chosen to include balena-cli so that I can actually examine the running “machine”. I will try to create a new balena-cups project image, incorporating the CLI so that I can do this. That might help when debugging the problem.
Now regarding the application, if I understand correctly, you used the Deploy with balena button for your first deployment. Can you please share logs from your device? You should be able to find them in your balenaCloud account. Perhaps check if services are running? You can find that on the device summary page in your balenaCloud dashboard
Thanks for the reply, Rahul. I’m not sure which services should show up on the device summary page, I’m not seeing much except that the device is alive and well and the logs area is empty. I’ve been over to the diagnostics and run a full diagnosis (and downloaded it). I also checked out the willswire github repo and I can see that the balena-print was originally created for rpi3 and newer but in my case I was attempting to repurpose an antique rpi model 1B as a print server and it seemed from the tutorial description that this would be a possible use for this older pi. Once I know that the correct repo is being linked in I might just do a new SD image and start the tutorial over again.
Have you tried browsing directly to the device? Does it serve the page? You can see what happens using just curl for a quick test. Get the local ip address from the dashboard and then just curl to it.
When you try to open the remote url, you are just clicking on the little box/arrow icon in the dashboard, right?
When you say the logs area is blank, you mean totally blank? There message that it is listening on port 80?
If I try to use a browser to connect locally, I just get “Problem loading page” error. I used the terminal in the dashboard and ifconfig to see what the local lan ip address was and besides, I’ve already set my router up to deliver a fixed address to that rpi.
Curl to the address gives me “connection refused” (I don’t think that there’s any web server running in the image I originally created using the balena dashboard). And I didn’t opt for an image with CLI capability so I can’t really query it beyond using the “terminal” window in the dashboard
I’m not sure how to actually modify the existing image file to incorporate the github project in the link from Rahul via the balena dashboard, as noted above, I don’t have direct connection to the computer because I didn’t go for a development version when I created the image.
I’m really a noob with balena so I’m still learning my way around the dashboard.
Oh, seriously cool. I just clicked on Deploy button and it’s adding the balena-print repo to the image even without CLI access. OK. WIll report back once whirly logo indicates that it has actually deployed. I just got a bit more impessed with balena.
Further… now that the correct repo has finished installing I am now showing that CUPS service is running and my public URL now actually reaches the CUPS interface on the rpi. I’m hoping that my problem is resolved. Thanks to the responders.
Aha, yes, I suspect that if the URL was broken as Rahul suggested it was, then the original build never completed, and the containers never got built and and pushed to the device…thus your empty logs. Now the the build properly ran, it built the containers and they download to the device, and the application will start. The process of cloning a repo, and then doing a balena push to load containers onto a device (no matter where it is located!) is the normal process for loading applications, no need for a serial console or development version of the OS.
Well, I’m not out of the woods yet. My printer model requires HPLIP for its driver for linux (basically it wants the foomatic foo2xqx file) and I just get the “Unable to get list of printer drivers:” response from CUPS. I’m pretty sure I saw that HPLIP was part of the balena-print project but maybe not. CUPS does find the printer either when it is connected to my Airport Express or alternatively as a local printer when directly connected via USB but so far I can’t actually add the printer (an HP Laserjet P1505). Maybe this particular printer can’t be made to work with CUPS although I did get printing happening from another rpi by just adding the printer by using the pi’s gui desktop preferences.
balena-print does seem to reference HPLIP components. Does the printer have an IP? Can the CUPS container ping this IP? Can you establish some form of connectivity from the CUPS container/server to the printer IP via cURL for example?