Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it dockerifyable #114

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

a3ng7n
Copy link

@a3ng7n a3ng7n commented Mar 30, 2023

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
Copy link
Owner

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
Copy link
Author

a3ng7n commented Apr 12, 2023

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
Copy link
Owner

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
Copy link

dmccomas commented Apr 12, 2023 via email

@ericstoneking
Copy link
Owner

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
Copy link
Author

a3ng7n commented Jul 28, 2023

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:

  • Uploading pre-built 42 containers to one of these registries is not a trivial exercise, so I don't want to pretend that it is. There's just a bunch of silly crap you have to deal with that everyone just "expects" you to know how to do. With that said this project is open source, so I'm fairly certain you should be able to do it at no cost; the whole thing - e.g. every time you push a new version tag, a github action would automatically build and upload the container.
  • All of this is opt-in; all of this docker building stuff shouldn't need to interfere at all with being able to compile and run 42 natively.

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.

a3ng7n and others added 10 commits August 5, 2023 20:12
* making docker image smaller
* remove gui from build by default
* Remove git files unnecessarily causing docker rebuilds
* Add variable comments for MTBType
* Added Spline option for Central Orbits

Central orbits may now read time/position/velocity points from an input file (as from GMAT, for instance) and interpolate with cubic splines.

* Cleanup before push

* Merge branch 'master' of https://github.com/ericstoneking/42

* Fixed GPS Epoch

Added offset between UTC and TT at GPS epoch in GpsTimeToJD and JDToGpsTime

* GPS Time Accuracy

Replaced JDToGpsTime with GpsTimeToGpsDate to reduce roundoff error.

* Add docker push github action

---------

Co-authored-by: Eric Stoneking <[email protected]>
* Add docker description update job
* Update readme and remove duplicate readme
* Change default input files location to be relative to executable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants