Go Back to handibot.com
sign up or log-in

Advanced

Running Fabmo in Docker

Posted by tagd 
Running Fabmo in Docker
August 10, 2020 12:38PM
Hi Everyone,

More than 2 years ago, I posted about how poorly my Handibot was performing on the network. It's an Intel Edison based Adventure Edition 2.0, and even with an external antenna, it could never stay connected to my Wifi. I have a limited amount of garage/workspace that I don't want to fill with sawdust, so I prefer to put the Handibot on the back patio during long cuts. I won't go back into those details here, suffice to say I shelved the tool while searching for a reliable solution, and this weekend I finally cracked the code and got the Fabmo build from the github repository running in a docker container on a Raspberry Pi.

Below are my notes on how I got it working. Leveraging the completely unorganized, outdated, gap-ridden, bizarrely formatted sprinkling of documentation about Handibot was nearly impossible - the G2 v30x boards never had published data sheets or any kind of pinout diagram, and in general the stack of 3 custom boards makes for a guess-fest when trying to determine which things are important. If these breadcrumbs help even one other person (or a future self that has lost my build notes) it will have been worth it:

- Make sure G2 has been upgraded to latest firmware. This was tested with 1.7.2.
- Firmware updates were not possible with docker build, reinstall edison and flash up using :81 interface first

Docker Problems to Overcome:

1. Docker Build must be done on a Pi with no NodeJS or NPM installed.
- The dependencies are ancient and its a rabbit hole of problems to upgrade. Just SerialPort is 16 major revisions behind
- Remove any NodeJS install before starting
- Overall I recommend just getting a dedicated SD card to do this with.

2. BOSSA is missing
- It's actually a sub-project on git, so download it and add it to the directory
- [github.com]
- The docker build will exit with a Make error if this is missing

3. Network manager has no code for linux generic
- Since we're not trying to replicate the Wireless AP mode, most of this is
irrelevant, however it will still try to run during startup and break
the process
- The generic network_manager can be copied from the root to:
/fabmo/network/linux/generic/index.js
- The online check should be edited to just return True:
GenericNetworkManager.prototype.isOnline=function(callback) {
setImmediate(callback, null, true);
}
- The dependency on log should be changed to require('../../../log')

4. Machine starts in "ALARM" state sometimes
- Not sure why this is the case
- While its in alarm, it refuses to do anything else which breaks the initial setup
- I resolved this by running clearAlarm from g2.js right after connect in the machine.js code but removed it later.

5. Docker must run privileged to access the serial port, must have 80 passed through for normal http access.
- Did not test with alternate external ports but it would probably work.

6. No apps are included by default.
- Apps are FMA files that are really Zip files with content in the root.
- Downloading a repository as a zip from github puts the content in a directory which won't work.
- If needed, download, extract, re-zip without the containing directory.
- Upload from inside Fabmo and be patient - it takes a while.
- Recommended minimum: Fire-Up, Macro Installer, Hole Cutter

Instructions:
1. Get a clean Pi and apt-get update/upgrade before proceeding. Tested on a Pi 2 and a Pi 3.
2. Clone [github.com] into /fabmo
3. Clone [github.com] into /fabmo/BOSSA
4. Fix the network manager stuff. (pre-req step 3)
5. Build the docker image: docker build -t fabmo /fabmo
6. Connect the G2 board with a USB2 A>B cable to a USB port on the Pi.
6. Make sure you can see /dev/ttyAMA0 from the Pi while the G2 is connected (this is the USB serial port used)
7. Start the container: docker run -it -v /dev:/dev -p 80:80 -p 81:81 --privileged fabmo /bin/bash
8. Inside the container start the app: npm run dev
9. Install apps in the instance using FMA files (pre-req step 6)
10. Commit the changes to a new image - docker commit <example 9a03c28c0a37> fabmo-apps

This was good enough to send the tool a few cuts and it stayed connected thanks to the better connectivity of the outboard Pi!

I'm looking for a good place on the tool to hijack some DC 5v for the Raspberry pi so that I don't need a separate power cable, so if anyone can point me to a place where I can pull that (it's up to 2.5a for a Pi 3) it would be a big help. If anyone wants to collaborate on this I think it would revitalize some of the older tools that might be hanging around out there.
Re: Running Fabmo in Docker
August 11, 2020 06:20PM
Hi,

I just wanted to take a moment and thank you for the note and instructions to help others out. Internally at shopbot some months ago we have come to the some of the same conclusions and in an effort to make FabMo more broadly available to makers and those interested we have Dockerized Fabmo with the intent to install on a Pi. The latest image can be found on Docker Hub. While we we are very close to switching all outgoing FabMos to this docker image, we have not felt comfortable enough with this version to guide everyone towards it in the Read Me and having people ruin a system that was working for them. Since you have already brought it up I thought I would post the abbreviated instructions using our Docker image for those interested Note that this version will not update as what is running on the edison currently does and our tech support will not currently be able to help you install Fabmo on a pi But for those so inclined in attempting this.

This image will run with the latest firmware from 1.7.2

1.) Update a pi3 or 4 with most current OS
2.) Make sure your pi is connected to the internet via ethernet.
3.) Install latest Docker using the following command 'curl -sSL [get.docker.com] | sh'
4.) Disable wpa_suplicant on host pi since the Docker container will take over networking responsibilities (Why you need to be on ethernet).
    [] 'sudo systemctl mask wpa_supplicant.service'
    [] 'sudo mv /sbin/wpa_supplicant /sbin/no_wpa_supplicant'
  • 'sudo pkill wpa_supplicant'
5.) Download and run the docker image with correct permissions 'docker run -d -it -e PLATFORM="raspberry-pi" -v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /opt/fabmo:/opt/fabmo --privileged --net=host --restart unless-stopped --name fabmo --device=/dev/ttyACM0 shopbot/fabmo'

As for the 5v from the handibot. There is a voltage problem with the Pi really needing 5.1-5.2 and the regulator on the Handibot which supplies the 5v for the handibot really doesn't supply this.

While this is very much in beta, docker image updates will come much more often once the platform is a little more solid. Hope this helps.


If there is interest right now we would also be happy to provide a full pi image with the docker container already loaded init.


Best,

Brendan
Re: Running Fabmo in Docker
August 12, 2020 05:58PM
Thanks Brendan!

I think being able to separate the lightweight and rapidly changing compute hardware (everything up to the G2) and the long-term components that don't need to change (the G2, tool control board and the physical mechanisms).

I'm going to try your more official build and see if it works even better than my hacked together version, but I'd urge you guys to provide more of this kind of 'beta' content if you're going to sell tools labeled the 'Adventure' edition.

I did also go ahead and try the 5v terminals on the board for powering the Pi directly and had no problems with either a 2b or a 3b, but I'll monitor it closely to see if it causes dropouts.
Re: Running Fabmo in Docker
February 16, 2021 10:40AM
“ If there is interest right now we would also be happy to provide a full pi image with the docker container already loaded init.”

Thanks for the offer. Please provide a link to get this pi image w/docker to try it as it will greatly speed the learning curve.
Sorry, only registered users may post in this forum.