work log - first attempt

03 Aug 2018

I’m going to try a new thing. I keep a million tabs open all the time, and I’m pretty tired of it. I also need a place to keep track of projects and my line of thinking while working on them. I’m so often interrupted in the middle of a project and can’t get back to it for weeks or months, and when I open a project file, it takes me forever to figure out my train of thought or what I was even working toward. Maybe with some notes and links I’ll be able to keep track of this stuff so I can get back up to speed faster. Maybe not. But it’s worth a shot.

I’ve been keeping paper notes of my latest project. It filled a bunch of space, so it’s hard to jump around and see important bits at a glance. I’m going to type these up here with the hope that I will be able to search for them in the future.

raspberry pi image / docker image of people counter app

2 july

Trying to think through this imaging thing…

What if I…

But how would I pull down raspberry pi updates/upgrades? Obviously docker will run my app on whichever version of raspbian I want, but to keep the pis secure, I’ll need to be able to pull down upgrades of OSes via apt-get unattended-upgrades

Other things to do (see 5 best basic security tips):

I’m having a hard time wrapping my brain around this, but maybe pretend I want to run this at home… I don’t have raspbian installed on my home machine, but my people-counter image will have raspbian. I’m caught up on why I need raspbian on the SD card and in the Dockerfile, but I think the previous is why. Docker will run whichever version of raspbian I want, even if my Pi is auto-upgrading. See Simple way to build a custom Docker-ready raspberry pi image.

3 july

I think I figured out the docker container mess, so onto creating an image for people-counter.

Steps I took

  1. create new directory docker-container
  2. cp gate-counter.js from old dir => docker-counter
  3. create a package.json folder with dependencies
  4. run npm init
  5. run npm install --save (packages from README)
  6. run sudo node gate-counter.js to make sure it initializes GPIOs
  7. create Dockerfile, .dockerignore
  8. added script start: sudo node gate-counter.js to package.json
  9. build testing!
    • $ sudo docker build -t carylwyatt/docker-counter
    • build failing during step 4: npm install
      • thought it might be related to sudo issues, so I added ‘pi’ as $USER to docker, but still failing
      • tried to install each package individually to figure out which one was causing issues; turns out it’s raspi-io
      • raspi-io README notes: “warning: this module must be installed as a normal user, but run as the root user” whaaaaaaaat.
      • now trying to figure out how to add user, give permissions, switch user, & npm install
    • changed users and permissions and still got the error…
    • when I get back on 5 july, start by trying to build docker container in ~/new-test and go from there!

5 july

After getting back up to speed, several stack overflow helper are suggesting either/both clearing the cache npm cache clean and/or deleting node_modules. Buuuuuut my .dockerignore file already includes node_modules, so those shouldn’t be there anyway, yes?

more steps

Since pigpio is the hold-up, I RTFM and it has to be installed locally before npm install

9 july

The Docker saga continues to unfold…

17 july

RasPi people counter saga, continued

Tomorrow: try building fresh app outside of Docker; see if you can eliminate all the node-gyp, i2c-bus, pigpio, serialport because they’re causing issues

24 july

Digging around on raspi i2c stuff

2 aug

Current day. Spent about an hour writing up this post, and it helped me remember where I am in this project. I’m still wondering what road to take. The way I see it, I have three options:

  1. remove dependencies my app doesn’t rely on, especially i2c stuff
  2. use a the resin-recommended GPIO library and rewrite gate-counter/people-counter app
  3. build docker container from a different base image and hope i2c is no longer an issue

…or burn it all down and start over. Maybe I should install raspbian jessie on a new SD card and try to npm install dependencies. I’m just so confused about how my app is running in my current raspi environment but the docker situation is completely melting down.

“Only time will tell, my friends!” - Michael Scott, Casino Night

3 aug

It’s been a month since I started this whole Docker/raspi imaging fun. Let’s see if I can wrap it up.

I’ve decided to try building a new image from a different base image: schachr/raspbian-stretch

Went back and looked at the errors from the npm install. The largest chunk of errors is from attempting to install serialport. I found the github repo and started devling through the issues, and surprise surprise, I’m not alone in this. Most of the issues similar to mine mention Docker.

It’s 4pm, so it’s time to wind down and go sit with Bob, but here are the salient links open in my browser:

I’m still not sure any of this serialport has anything to do with the main issue of running the app on the device. I reopened an old terminal tab today and remembered that the error I was working through before vacation was a modprobe error. This could be related to the serialport stuff or it could not. I’m still pretty lost in the sauce on all this.