Showing posts with label docker. Show all posts
Showing posts with label docker. Show all posts

Thursday, December 1, 2022

Into the world of 3d printing

I have long been interested in 3d printing, but I have mostly had other people print for me.  I got myself a Prusa MK3s+, and have been doing the SD card shuffle to get my prints to the printer, which has been working flawlessly.  


I have a raspberry pi lying around, but for reasons I cannot figure out, my previous install had docker, docker-compose, and k3s installed on it.  Whenever I accessed the pi, I would always get a 404, and I didn't see any processes listening to 80/443 on my system.  There was probably something that the k3s install had done, but I wasn't able to track it down.  

To verify that I didn't have some other phantom issue on my network, I pulled down the latest copy of raspbian, cloned https://github.com/OctoPrint/octoprint-docker and went to install docker-compose, using the way I knew (which was apparently the 'old way'), through pip.

I tried to `sudo pip3 install docker-compose` and ran into an error that I hadn't seen before when installing python modules.... `error: can't find Rust compiler`...  One of the dependencies of docker-compose is the cryptography package, and the newest version that was being pulled in now requires rust to build it.  The error message itself and various resources online said they've fixed it by updating pip... `sudo pip3 install --upgrade pip`, but that didn't solve my problem.  

I installed the rust tools `sudo pip3 install setuptools_rust` but it still failed the same way.  I installed the packages for my raspberry pi using apt( `sudo apt-get install cargo`, but they had to old of a compiler... The dependency required 1.56, and the package installed for raspbian was 1.42.

I followed the instructions from the error installing the crypto module, and that wanted me to use `rustup` to manage my rust version.  I pulled down the rustup installer, and that went fine, but when I tried to install docker-compose with sudo (a mistake, but oh well, I'll be reinstalling the OS onto my harddrive instead of an SD card later), the install of docker-compose still failed, due to my user having rustc on their path, but the root user not having it.  So I switched to a root shell, installed rustup, and was able to run my pip install of docker-compose.


As a side path, while I was trying to figure out how to install docker-compose, I saw some mention that the python version was v1, and v2 was a statically linked go binary to run as a docker plugin.... which led me to having to do a little  bit of manual fighting with https://github.com/docker/compose ... The install script was detecting me as arm64, but I had installed the 32 bit OS, and my system reported as arm7.  So I had to manually download the correct build, and update the binary to use that instead of what it pulled down.


the Octoprint-docker guides are all using the old docker-compose syntax, so I needed to use  utility called compose-switch to convert my syntax for me..... one problem, they didn't build the arm7 binary, only amd64 and arm64 (I had installed the 32 bit os..) 

So no problem right?  Someone even had a snippet in a github issue to cross-compile it using the go toolchain in a docker run on my laptop then copy it over to my pi...   But when I was following the advice in the last comment in the issue thread, they mentioned that the initial poster had the path wrong, but I was getting an error during the `docker cp` step... After a bit of digging, it turned out the initial suggestion of copying from /go/bin/linux_arm/compose-switch was correct, and /go/bin/compose-switch was wrong.  Once I fixed that up, I could copy over the compose-swich binary and manually follow the setup steps to set compose-switch as the etc-alternatives for docker-compose, which would remap my commands to `docker compose`.  


Once I fixe all the above, I was able to run `docker-compose up -d` and see octoprint running on my pi!


I didn't have my printer plugged in yet, but I was seeing the interface and not getting a 404 when trying to contact my pi.  

I did want to verify that the webcam worked properly, and I had to remember to go into `raspi-config` and enable 3. Interface Options and I1 Legacy Camera Enable.  Once I did that (and rebooted), and updated my paths for my camera according to the octoprint docker image readme, and added the right env vars and devices to my docker compose file (uncommented from the octoprint-docker provided docker-compose.yml file, I was able to see my camera stills/stream from within the Octoprint UI.


Lots of jumping around for something that I thought was going to be about 3 commands from a fresh raspbian install!

Friday, November 11, 2016

docker-flow-swarm

#vDM30in30 - 9

I was reading through this week's Docker Weekly, and I saw something that caught my eye... docker-flow.  There was a great video demo about using it.

It serves as a similar role to Registrator, tied to HAProxy, tied with consul template, but directly compatible with docker swarm, and it can bridge to the docker network that you have created to run your swarm containers on.

This looks pretty interesting, and I think I will start using it for my configuration at home, as well as facilitating any demos that I give for our local DevOps Meetup group!

youtube-dl followup - with more docker!

#vDM30in30 - 10

Following up about youtube-dl, I saw in this week's Docker Weekly that someone had a post about running youtube-dl in a container to avoid the messy setup.

https://blog.rphl.io/selfhosted-youtube-downloader-with-docker/

I didn't have to much trouble installing it on my mac, with homebrew, but keeping different applications running in docker (possibly with swarm and docker network bridging/proxying)

Tuesday, November 8, 2016

Hello from the otherside.... (inside the container)

#vDM30in30 - 7

Hello!

I have used ec2 tags to gather information into facter, and I had wanted to duplicate that same kind of logic using docker containers and labels... Unfortunately it seems like labels are 'external' only to the container.
I found several issues which all end up pointing at this 'introspection' issue.
https://github.com/docker/docker/issues/8427

It looks like the only way currently is to have some sort of external service manage that information for you (etcd/consul/mesos/pass it in via environment variables to your container / kubernettes downward-api) OR to mount the docker socket inside your container and go through the json output (not very secure)

Reasons for getting that information seem to range from enabling service discovery (knowing what actual host/IP you are bound to) to knowing what size JVM heap args to set inside a container based on actual container run environment.

It seems like memory information was added with https://github.com/docker/docker/pull/13312/files which allows a readonly mount of the /sys/fs/cgroup location specific to the container...

$ docker run --rm -it --entrypoint /bin/bash puppet/puppet-agent-ubuntu
root@96acc60738a7:/# cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
19025920
root@96acc60738a7:/# exit
exit
$ docker run -m 2048m --rm -it --entrypoint /bin/bash puppet/puppet-agent-ubuntu
WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.
root@dab851113412:/#  cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
2654208
root@dab851113412:/#


Thursday, November 3, 2016

DevOps Nov3rd Followup links

#vDM30in30 number 3!

Here are some links of interest from my DevOps Meetup talk tonight!

Slides and Videos are now posted at https://puppet.com/blog/puppetconf-2016-videos-slides-and-photos-are-here

https://puppetconf2016.sched.org/ - Schedule
Videos from puppetconf 2015
http://www.slideshare.net/DavidDanzilio/puppet-design-patterns-puppetconf
https://speakerdeck.com/garethr/running-puppet-in-docker - Gareth's presentation with examples of running a full version of puppetserver/puppetdb/puppetdashboard via docker.  https://github.com/puppetlabs/puppet-in-docker
https://speakerdeck.com/garethr/the-future-of-testing-puppet-code
Troubleshooting Puppet - https://twitter.com/uphillian/status/789218304619458560 - https://docs.google.com/presentation/d/1AT2j97HV_y2QNH_HFKwZ6ExQDKvfC_lt6qBZaai4ATo/edit#slide=id.g1839748d2e_0_11
Hashicorp Vault with Kubernettes - https://twitter.com/HashiCorp/status/793479714195243008
Seth Vargo didn't really have any actual slides, everything was based on examples that he has in this git repo.. https://github.com/sethvargo/vault-puppet


Here is a link to my slides.. you can clone the repo and open the html file in your browser.
https://github.com/Cinderhaze/DevOpsMeetupTalks/blob/master/2016_11_03_PuppetConf.html