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 k8s container 39 MB smaller by using vim-tiny #11826

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

rhpvorderman
Copy link
Contributor

@rhpvorderman rhpvorderman commented Apr 13, 2021

What did you do?

  • Replace vim with vim-tiny
  • Add nano nano-tiny

Why did you make this change?

A text editor is useful for on the fly changes and debugging. Full-fledged vim is not necessary in the container. Nano is a useful alternative for people who use a US international keyboard instead of an ADM-3A terminal, which comes with an intuitive vim keyboard.

This makes the image 39 MB smaller. So in docker image terms, that is pretty great.

galaxy/galaxy-k8s     before              23337ecfcf23        32 minutes ago      889MB
galaxy/galaxy-k8s     after               0a5bce934752        20 minutes ago      850MB

How to test the changes?

(select the most appropriate option; if the latter, provide steps for testing below)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:

Since vim is not called by the Galaxy process, there should be no bugs whatsoever. Unless Galaxy has some vimscript dependencies that I do not know about.

License

For UI Components

  • I've included a screenshot of the changes

@github-actions github-actions bot added this to the 21.05 milestone Apr 13, 2021
Copy link
Member

@nuwang nuwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great @rhpvorderman! gradual steps towards an ever smaller image size. Do we need both nano and vim-tiny though? Since this is purely to aid debugging, wouldn't just one editor suffice, and if another is desired, it should be possible to exec as root into the container and install the desired editor? Don't mind either way though.

@rhpvorderman
Copy link
Contributor Author

rhpvorderman commented Apr 14, 2021

$ docker images  | grep galaxy-k8s
galaxy/galaxy-k8s     after               9cda303e11a0        14 seconds ago      850MB
galaxy/galaxy-k8s     afterafter          90aba9900156        11 minutes ago      848MB  <--- BOTH NANO AND VIM REMOVED

Going nano-only or vim-only will not make much of a difference. 848 or 849 MB is not an earth shattering difference.

Leaving them both out saves just 2 MB. So that's not really worth it. Having a functional editor is worth that very small cost. With galaxy it never works as you want on first deployment. Being able to make changes on the fly immediately to test out some stuff and not having to go trough the hassle of apt update && apt install <editor is quite a time-saver.

What a functional editor is well, there is a group of people on this planet who have become so familiar with vi keybindings that they can't use any other software. Instead they will scoure the internet for vim-keybindings for every program. Then there is another group of people that cannot work with vim to save their lives because its interface is so alien to anyone who was not a UNIX user back in the seventies.

So I opt to having them both in. 2 MB and a functional editor for everyone. That's less than 0,25% of the image.

@rhpvorderman
Copy link
Contributor Author

rhpvorderman commented Apr 14, 2021

Debian ships with nano as default editor, but also with vim-tiny. I wanted to reference that decision here so I searched the mailing lists and found this e-mail: https://lists.debian.org/debian-devel/2020/03/msg00245.html . Apparantly there is also a nano-tiny!
I opened up an ubuntu 20.04 container and used apt show to check the sizes:

root@2f591e170bea:/# apt show vim-tiny 2>/dev/null| grep Installed-Size
Installed-Size: 1567 kB
root@2f591e170bea:/# apt show nano 2>/dev/null| grep Installed-Size
Installed-Size: 868 kB
root@2f591e170bea:/# apt show nano-tiny 2>/dev/null| grep Installed-Size
Installed-Size: 181 kB

So maybe it is best to only ship with nano-tiny, and remove vim and nano.

@jmchilton jmchilton merged commit e557f3e into galaxyproject:dev Apr 14, 2021
@rhpvorderman rhpvorderman deleted the smallerimage branch April 16, 2021 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants