File Management - Multiple OctoPis / Instances

I have a cataloged of gcode files I print on demand on one of many OctoPrint instances (Same server, I would probably design the solution to work on multiple OctoPis). They are updated on occasion, usually when I need to change the slicing strategy. I want to have central storage for the gcodes and easily send the correct version to a printer.

I have some thoughts on how to achieve this. I could use some direction on where to start.

Some thoughts I've considered :
A]

  • Git repo the gcodes
  • Keep central on server with linux Inotify -> copy to each Watched folder - > delete file on print to keep old versions
  • Alternately some system to compare hashes

B] write a new plugin to use a central file source like File Manager with remote (I tried a symlink in the .octoprint/uploads folder without success)

  • The OctoPi image already has git loaded by default
  • In theory, you could enter the following commands in the ~/.octoprint/uploads folder:

(archive out the original files in this folder first)

git init
git remote add origin master https://github.com/YourGithubID/YourRepository.git
git pull

I've confirmed that there's no .git folder in ~/.octoprint (which would have caused problems).

Then your workflow would look like:

  1. Re-slice something into your workstation's local repository
  2. In that local repository: git add file, git commit -m "Updated file x", git push
  3. In the Raspberry's ~/.octoprint/uploads folder: git pull
  4. In OctoPrint, hit the refresh button in the Files side panel widget

Your project could have subfolders if you needed to maintain rafted-versus-unrafted versions, say, or any other distinction like material type.

I'll test that out. When I tried copying the files directly into the folder, [ cp ~/sliced ~/.octoprint/uploads] the files would show but I could not recognized as machine files. I'll try on a fresh install.

I think I'd go with cp ~/sliced/* ~/.octoprint/uploads/. in a scenario like that. I'd guess that the version you did would bring in the folder itself.

@Adam_Kickham I created a plugin and I've described it here, btw. It appears to behave nicely (on a Raspberry Pi 3B as server) and uses the symlink approach.

I have a 3TB network drive attached to a pi3b that I named "Samba-Pi" (I'm so original) that I have no problem transferring files into and out of using the octoprint interface without having to edit anything

It's nothing but a shared network drive that I keep movies, music, and stl's and gcode on, and I haven't had a problem

I may have broken something in testing. I'm going to start again from a fresh install.