How can I set up OctoPi/OctoPrint with NFS or WebDAV exposed storage?

In trying to address some issues with making it easier to combine Simplify3D with OctoPi/OctoPrint instances in front of multiple printers, one of which uses older Sailfish firmware (which I'm finding has really poor SD card support) and is difficult to upgrade, I'm coming to the conclusion that I may be better off using local storage and USB printing instead of SD card printing with file transfers over WiFi (FlashAir card). To do this, I need to export a filesystem from my OctoPi, to mount on the machine(s) running Simplify3D, so I can simply save my exported gcode to the network drive, instead of relying on extra steps to upload it.

I'm not sure if anyone has exported an NFS filesystem or exposed a WebDAV share on OctoPi, but I'd love to get some insight from anyone who has. My obvious concerns are the impact that the extra network traffic and CPU load have during prints (since the RPi uses a single USB2 channel for all I/O) and any impact adding a reverse proxy in front of OctoPrint would have, to allow for the WebDAV connection.

This is all on OctoPi 0.15, and I'm not afraid to experiment, especially as NFS should be completely independent of OctoPrint (but still consumes network, CPU, and memory resources), but I'm not completely sure of the web server architecture that OctoPrint uses. I know @foosel mentioned something about some changes to that architecture in her recent stream, so I will check that out again, but I'd love a pointer to documentation or even just some basic info on the architecture so I can do some reading up to translate my nginx/haproxy habits to something more appropriate.

I'm not very bright, so, see if you can break down for me exactly what it is yer trying to accomplish.

(If anybody has a correction to my drawing, please feel free to correct me)

My admittedly limited understanding of how OctoPrint works is like this...

(Remember, this is simplified, so id10t's like me can understand it)

You have a Raspberry Pi.

On this RPi you are running a version of Linux. The version is irrelevant, but, if you download the full package (pre-installed image) it's Stretch-Lite with Octopi server software running Octoprint Web server printer interface.

You can run Octoprint on pretty much anything, but, I don't want to complicate matters just yet

Octoprint has a built-in slicer program called Cura. You can slice right in Octoprint.

The RPi has an SD Card which contains the server itself (Octopi) and the web server printer interface (Octoprint)

The SD card in the RPi has some extra space on it which you can store sliced and unsliced 3D files.

You have a computer on which you create, or download from the internet, your 3D creations in unsliced format

Your computer has a slicing program running on it

You have a Local Area Network in your house/workplace. It could be wired or wireless

Your Printer also has SD Card storage

You have a number of options on how to use this particular setup...

You create your 3D file on your computer.

You slice your file on your computer

You send your file over LAN to the RPi via the web interface

When you send your file, you can send it into RPi storage, or you can choose to send it to the SD Card in your printer, which is connected to the RPi via USB cable

You can now print your file

My understanding of what you're trying to say, is that, instead of sending your files either to your printer, or to the RPi, you want to send it to the WEBDAV, and somehow have the RPi take the file to be printed from a share on the WEBDAV

Have I got it right ?

Just some food for thought. There are articles on the raspberrypi.org forums (and other places, Google is your friend) for both NFS server and NFS client on the RPi. I think I'd go with client as it probably uses less resources.

OctoPrint Settings, Folders has an entry for a Watched Folder. If this was an NFS mount point, would that work? In fact, doing a Google search for "octoprint watched folder" has numerous hits.

There was a mod for the flash air that gave it samba/windows file sharing support native. I forget where I found it. I've been busy with a lot of stuff but I will try to dig up information after work today.

Also on an octopi install, all paths that octoprint use are under /home/pi/octoprint I believe. You could in theory mount the remote share on top of the directory for local storage. You just don't want it to update the file being printed. If you want to reduce cpu load, use Ethernet instead of wifi. Though I personally would not mount the flash air this way. I would suggest you set up windows file sharing/samba on it and just save directly to that. You would end up only using traffic you need to the flash air and have control over what file you save to or touch.

I have not taken the NFS route on this project but what I have done is to install/config Samba on the Raspberry Pi 3 to share an SMB mount point which is rather convenient. You may then map drives using Windows/OSX/Linux using the native Microsoft "net use" sort of behavior.

You don't have to do it exactly as I've done. I created a folder under OctoPrint's default upload location to separate my files from the original ones on there.

Thanks for the time and thoughts. All of them are appreciated :smile:

@Spyder, sort of. I am currently sending gcode (x3g) files over WiFi to a FlashAir SD card in one of my printers. The printer has lousy firmware compatibility with OctoPrint's needs for working with a printer's SD card and for monitoring SD card prints. I'd like to improve my experience, which means either a) changing my firmware and possibly the board running the printer, or b) finding an effective way to save files directly to the OctoPi install via WebDAV or NFS and taking the performance hit to print via USB while both network and webcam I/O are also on the same USB bus (which could be a major hit, since my print speeds often get up around 100mm/s, depending on materials and the model).

@b-morgan, I did dig up the RPi NFS info last night, and I think that's most likely what I'll end up with for now, though NFS server would be better than NFS client, unless I were to set up a NAS mount point for each OctoPi/printer combo and push my gcode from S3D to the NAS and then have OctoPrint watch that combo's share. It seems like a bit of overkill to me, though, to add a middle man, except for the potential advantage of not worrying about SD card corruption on the RPi. Since the RPis are all on a UPS, though, I'm not super concerned about corruption due to power failures. Either way, yes, the watched folder as a mount point should be the "right" way to do it.

@loclhst, If you have a FlashAir W-03 or W-04 with firmware 3.x or above installed, you can set WEBDAV=2 in your CONFIG file to turn on WebDAV, which I've done. The FlashAir isn't SMB compatible, IIRC, so you'd either have to get a MicroSD<->SD card adapter and put a FlashAir on the RPi instead of the printer, or you'd have to use a printer that is SMB enabled (basically using MachineKit on a BBB, which I'm not sure OctoPrint supports). If you just want to avoid WebDAV on the FlashAir, you could use a post-processing script to POST the file to the card, though I'm not sure how that'd be better. I do already have my RPis set up via ethernet, with wifi disabled, since it is about 2 feet to the nearest gigabit switch :wink: You're right, though, it does reduce CPU load because you don't have to worry about all of the WPA and wifi link management stuff that eats CPU in the background.

@OutsourcedGuru, it's more a question of overhead with SMB vs NFS on both the RPi side and the OS X side. Because NFS natively uses POSIX file permissions, as do both Linux and OS X, it seems to me that NFS should be a lot more resource efficient, as it isn't doing a bunch of remapping of users, groups, and permissions. NFS also far predates SMB, so, while both are considered mature, my thought is that resource bottlenecks have likely been ironed out a bit better over time (I remember times in the past where both NFS and SMB were resource hogs, but it's worth looking at some data if we're trying to be REALLY efficient). AFS, on the other hand, is a NIGHTMARE to use on anything that isn't OS X, due to a wide variety of bugs, quirks, and oddities in implementations not done by Apple.

I just bought another printer of the same model as my primary and plan to experiment with different firmware and possibly a different board in it, to see if I can get better data to OctoPrint. If I succeed, I'll then upgrade my primary printer similarly and may actually abandon this whole exercise.

In an ideal world, OctoPrint would be getting much better and more robust information from the firmware on my printer, and thus would have progress data, full file listings, and could really be focused on features like monitoring, manual control, cam/timelapse, and statistics. USB is really not the most efficient way to drive a printer, so I really want to get the best of both worlds: WiFi push of gcode to the printer, OctoPrint launching and monitoring SD card prints, webcams, and stats, and my desktop free for part design and slicing at all times.

Taz,

I used this tutorial to connect a 1 TB USB external drive to a RPi running the latest nightly build of Octopi, installed Samba, shared a few folders, dropped some gcode into them, and successfully loaded the gcode from the share directly to my printer...

Then I reread your comments, and realized that you wanted NFS instead of SMB, not the other way around, so I followed this tutorial instead

Now, the NFS instructions are older, so, you'll have to modify a bit, and you'll probably have to use an adapter to mount the sd card if you wanna use a raspberry, but, both options work