ericstoneking / 42

Simulation for spacecraft attitude control system analysis and design
247 stars 82 forks source link

Make it dockerifyable #114

Open a3ng7n opened 1 year ago

a3ng7n commented 1 year ago

I don't really know what I'm doing with pull requests, so forgive me if this is out of the blue. This adds a dockerfile so one could build and run 42 as a container. Everyone's putting things in docker these days, I figured it was just the hip thing to do. Hope this is useful.

ericstoneking commented 1 year ago

Hi Aaron,

Interesting. I will need to study up on Docker before I buy in. Hipness has its upsides and downsides. I'll get back to you.

Regards, -Eric (he/him)

a3ng7n commented 1 year ago

Sounds good - thanks for taking a look. The intent would be to be able to run 42 without necessarily having to compile the code locally. With that being said it would require you setup a github ci script to build this docker image, and push it to either docker hub or github container registry (I believe both are free for open source projects?). It would be an investment above and beyond what's detailed in this commit, but it could widen the reach a bit.

The project I'm using this for has 42 getting input and supplying data as a backend-only application, so I must confess that I haven't got the gui working with 42 running as a docker container. With that said it shouldn't be impossible.

ericstoneking commented 1 year ago

Hi Aaron,

My first impression of Docker isn't favorable, for a couple of reasons. First off, even though this project is open source, I'm pretty sure Docker would see me as a government entity, and therefore require a subscription. I decline.

My second reservation is perhaps just lack of familiarity. I tried installing Docker on my home PC (my testbed for the noob experience), and the first thing it did was tell me to upgrade my WSL. Is it any less work setting up a Docker container than it is installing the dependencies and building 42 locally as a command-line executable?

So help me understand. Can a container be set up so that a neophyte can, from scratch, get 42 up and running "easily", or are we just trading one dependency hell for another? If a new user has to learn something new, I'd rather it be something empowering, like how to install things on their operating system, than something that makes them dependent on a middleman who charges subscriptions. Or, is there another use case that I'm missing?

An anecdote: Awhile back, I guest-lectured a college course, and we installed 42 on every student's laptop. This was a big chore, because the diversity of computers in a college classroom is a little startling. One of my colleagues tried solving the problem with virtual machines. (I forget the open-source one we used.) As I understand it, containers are a lightweight version of this idea; carry the dependencies with you, and handle all the nonportable stuff at a low level transparent to the user. It seems like a great idea, but we had just as much work setting up the virtual machines as we had just installing everything natively.

I see a couple alternatives, you may be able to suggest more. One, is there a free container system that doesn't care that I'm a government entity? Two, would you like to fork this project and manage the containerization yourself?

Let me know what you think.

Regards, -Eric (he/him)

dmccomas commented 1 year ago

For those who want to pursue a docker solution the following project may help: https://github.com/kestr31/Docker-OpenSatKit

Kestr31 created the project for OpenSatKit(OSK) to run in a container. OSK includes the COSMOS ground system, core Flight System, and 42. I haven't tried it yet and I don't have Docker experience but the overview sounds like the GUI has been addressed.

On Wed, Apr 12, 2023 at 8:37 AM Eric T. Stoneking @.***> wrote:

Hi Aaron,

My first impression of Docker isn't favorable, for a couple of reasons. First off, even though this project is open source, I'm pretty sure Docker would see me as a government entity, and therefore require a subscription. I decline.

My second reservation is perhaps just lack of familiarity. I tried installing Docker on my home PC (my testbed for the noob experience), and the first thing it did was tell me to upgrade my WSL. Is it any less work setting up a Docker container than it is installing the dependencies and building 42 locally as a command-line executable?

So help me understand. Can a container be set up so that a neophyte can, from scratch, get 42 up and running "easily", or are we just trading one dependency hell for another? If a new user has to learn something new, I'd rather it be something empowering, like how to install things on their operating system, than something that makes them dependent on a middleman who charges subscriptions. Or, is there another use case that I'm missing?

An anecdote: Awhile back, I guest-lectured a college course, and we installed 42 on every student's laptop. This was a big chore, because the diversity of computers in a college classroom is a little startling. One of my colleagues tried solving the problem with virtual machines. (I forget the open-source one we used.) As I understand it, containers are a lightweight version of this idea; carry the dependencies with you, and handle all the nonportable stuff at a low level transparent to the user. It seems like a great idea, but we had just as much work setting up the virtual machines as we had just installing everything natively.

I see a couple alternatives, you may be able to suggest more. One, is there a free container system that doesn't care that I'm a government entity? Two, would you like to fork this project and manage the containerization yourself?

Let me know what you think.

Regards, -Eric (he/him)

— Reply to this email directly, view it on GitHub https://github.com/ericstoneking/42/pull/114#issuecomment-1505202105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMGKCC5X3ODF7OSTDHD2ITXA2OZJANCNFSM6AAAAAAWM4AUUI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ericstoneking commented 1 year ago

Hi Aaron,

Just so you know, Dave was the colleague in my anecdote about virtual machines. He is the proprietor of OpenSatKit, which uses 42 as a component in a larger architecture along with other parts. (In that vein, see also NOS3.)

Regards, -Eric (he/him)

a3ng7n commented 1 year ago

My first impression of Docker isn't favorable, for a couple of reasons. First off, even though this project is open source, I'm pretty sure Docker would see me as a government entity, and therefore require a subscription. I decline.

I'm not a lawyer, maybe there's a special provision for governments. There's supposed to be an equivalent tool called "podman" but I haven't had experience with it - in theory this whole set of changes should work with podman equivalently though.

My second reservation is perhaps just lack of familiarity. I tried installing Docker on my home PC (my testbed for the noob experience), and the first thing it did was tell me to upgrade my WSL. Is it any less work setting up a Docker container than it is installing the dependencies and building 42 locally as a command-line executable?

It can be less work; given that you can have some guarantees about which packages are present when the container is built, and thus exactly which packages are used at build time, you can have a more consistently successful build (across different machines, users, etc.). I mostly develop on linux, so I can't speak to mac/windows, but getting docker engine installed once has been a pretty easy hurdle to tackle, and has been preferrable; correspondingly I can vividly recall the many times I've had to compile something from source on my native machine only to fail halfway through because I had a newer version of some package than what was required. Heck, I've even tried compiling programs from source, failed, and then reverted to building or pulling the corresponding docker container.

So help me understand. Can a container be set up so that a neophyte can, from scratch, get 42 up and running "easily", or are we just trading one dependency hell for another? If a new user has to learn something new, I'd rather it be something empowering, like how to install things on their operating system, than something that makes them dependent on a middleman who charges subscriptions. Or, is there another use case that I'm missing?

Yeah - there are two things you could advertise to the neophyte.

  1. Build the container from source: "clone the 42 repo, then run docker build ... within repo directory, then run docker run 42" or
  2. Pull the pre-built container from a registry, such as Dockerhub or GitHub Container Registry using docker pull [container registry url]/42, then run docker run 42

I'll mention two other things:

This is your project, and although I have my own biases, I think being able to containerize programs is a healthy thing for most audiences (as a user, and a developer I've really enjoyed using them). Although it's useful to know and understand how to compile programs from source, this would give users the option to skip to the part where they get to use 42 out of the box if they happen to have an accomodating container engine. If not, it's business as usual, no change.

But feel free to take it or leave it - if it's a matter of not having the time to get this all set up, I'm more than happy to help. Otherwise I don't know that I can really make this any more palatable.