Looking at Octoprint plugin for Raspberry Pi

It is my understanding that an Octoprint plugin is custom python script that calls Octoprint to call custom java scripts to create the web interface. Is this correct?

I would like to add much functionality to the octoprint interface I was hoping to use my book on html5 canvas and WebGL, but i am afraid many users would be excluded because web interfaces have to go through firewall and certain web browsers turn off functionality. Is this true?

I have a putzy environment set up on a linux machine. I do hope to upload the code to git hub.

https://docs.octoprint.org/en/master/plugins/gettingstarted.html.
Also, you will need to have your own Raspberry Pi and test with your own printers.

Yes i am going through that tutorial. I am able to run in on Linux mint in an environment.

https://docs.octoprint.org/en/master/development/environment.html#linux.

Linux can run multiple servers from your computer, but that tends to put a computer at risk some times. So we tend to use raspberry pi as it reduces the risk of getting a server hacked.

I believe there are native python function that can create guis but that Octoprint uses python to store data and java scripts to displace that data. Does that seem correct from the tutorial?

ok… lets break down Octoprint.

UI:

  • Bootstrap/jquery (e.g. html5, CSS, javascript) web application that uses socket api and rest apis to communicate to a backend

Backend:

  • Python based websocket+restapi that communicates to the 3d printer for managing print queues, head locations, etc.

  • Firewalls are not something of concern here given this would not sit in the DMZ or public facing zone of a network being its an internal network service and even then it runs on standard 80/443 tcp. Put a WAF / Load Balancer in front of it and your good.

Sidebar on development setup

Also, need to break the myth here that one needs a “beefy” computer to develop on, exepecially with python and web apps. One can build some serious web based applications on a 2Gb netbook like the one I had for about six years, hp mini 110. Plus my tech firm where we built full production grade sits like silkfair and meterbase (an IoT management system for Realtors and Rental property management firms). These were developed on less, a Pentium 4 with 2Gb ram for the linux server and development+graphic work was done with a Dell laptop.

Just pointing out there, any computer with a text editor, decent standards compliant browser, and a good bit of knowledge can build some amazing stuff.

Now back to the octoprint stuff.

The python api (SocksJS, flask) doesn’t really have anything to do with the frontend UI other than parsing a bunch of jinja2 applications (ie server side rendered html) as one can see in https://github.com/foosel/OctoPrint/blob/master/src/octoprint/templates/index.jinja2.

So in summary, Octoprint is a restapi server built on top of python flask which is extended with web sockets via sock.js and manages print queues to a 3d printer. There’s no magic here just standard web programs (http/rest, websockets, and server side python for serial device control + html rendering).

Octoprint’s RestAPI is well documented at http://docs.octoprint.org/en/master/api/. One could anything that talks HTTP/1.1 to talk to an octoprint powered printer.

2 Likes

Thank you i am not prone toward building web applications. I hope to get the application to compile and if i have any interesting pictures as i am messing around i will post them here. Would it be good to post the UML and use cases, on this page? So that i explain what i am looking to do?

1 Like

Is Eric useful as a ide for this project?


Might be easier to post the use cases, UML, etc… on a wiki page then link it back here but either way works.

Personally I’d use a real editor like vim (gvim/neovim) but visual studio code is good or even anything that can write out utf-8 files.

1 Like