YannickB / odoo-hosting

Other
64 stars 50 forks source link

[IMP] Switch to ash #189

Open lasley opened 7 years ago

lasley commented 7 years ago

I noticed that we have bash pretty engrained into the templates and whatnot. Now that we're using Alpine, we should switch up to ash instead so that we're not installing another dependency.

This ticket is for the discussion and tracking of that effort.

amon-ra commented 7 years ago

Alpine use busybox and adds 900kb of memory per running instance, I propose to use dash for shell in docker images

YannickB commented 7 years ago

Well I think I understand why @lasley suggest ash it's the default shell in alpine. It's made for it.

Personal preference, I don't really like the user experience when I'm in the container but that's mainly because I'm too much attached to bash. No real reason then.

When we feel ready, we mainly have to remove bash from base image https://github.com/clouder-community/clouder/blob/master/clouder/images/base/Dockerfile#L4 and change shell in execution function https://github.com/clouder-community/clouder/blob/master/clouder/models/model.py#L571 That should do the trick.

Propose your best shell for alpine use and let's vote.

lasley commented 7 years ago

Yeah the only reason I proposed ash is because it's included. It's actually quite limited - such as lacking arrays. My vote is still on it though, I'm starting to like these tiny instances.

YannickB commented 7 years ago

Yep, that said a shell doesn't take much space and it's something really convenient. We should vote for the best user experience, for our own sake.

For execution, I think we should use either ash or even sh, because maybe sometimes the image will not be based on alpine.

lasley commented 7 years ago

Yeah really here I was referring more to execution and not the use. You're probably right with sh in terms of compatibility though.

So we would basically just want the user shell in the ssh-exec container, right?

I like bash personally in terms of experience, but it's a bit heavy.

cc @tedsalmon

YannickB commented 7 years ago

Not only ssh-exec, we often connect to any kind of container through docker exec, but yeah it's the main use case.

Same for me with bash. Alpine with bash take 1.5Mo http://www.blang.io/posts/2015-04_how-to-build-the-smallest-docker-containers/, clearly not a problem (remember the 200Mo ubuntu image?). But let's take the opportunity to consider other shell I don't know that much.

tedsalmon commented 7 years ago

I agree that sh would be best for cross-compatibility. bash, though heavy, makes life on the CLI much better IMO.

lasley commented 7 years ago

Hmmm ok so lack of arrays is really setting me back here. I took a look at dash too, and it seems that wouldn't provide either.

What are your thoughts? Do we have another solution for an array like structure?

The thing that's killing me is the SC2086 - Double quote to prevent globbing and word splitting Lint, which I can't totally argue with. But that makes something as simple as:

ENV BUILD_DEPS="python-dev openldap-dev"
RUN apk add --no-cache $BUILD_DEPS

turn into a real pain. Well or disabling the lint, but I honestly don't consider that an option.