Objet : Discussion list for Belenios
Archives de la liste
- From: Alban Bruder <alban.bruder AT uni-weimar.de>
- To: Stéphane Glondu <stephane.glondu AT inria.fr>, belenios-discuss AT inria.fr
- Subject: Re: [belenios-discuss] Statically linking Belenios
- Date: Wed, 18 Aug 2021 18:39:03 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=alban.bruder AT uni-weimar.de; spf=None smtp.mailfrom=alban.bruder AT uni-weimar.de; spf=None smtp.helo=postmaster AT smtpout.uni-weimar.de
- Ironport-hdrordr: A9a23:FWwlfK+LlQnIP9F9MP9uk+DkI+orL9Y04lQ7vn2ZOiYlFPBw8Pre+8jztCWE7Ar5N0tBpTntAse9qDbnhPtICOoqTNWftWvd2VdARbsKheCJ/9SjIULDH4VmuJuIHZITNDS9NykYsS8k2njALz7wqOP3iJyVuQ==
- Ironport-phdr: A9a23:V++48R3iOtdkBsmWsmDOlwMyDhhOgF0UFjAc5pdvsb9SaKPrp82kYBaHo6Q0xwKWFazgqNt8w9LMtK7hXWFSqb2gi1slNKJ2ahkelM8NlBYhCsPWQWfyLfrtcjBoVJ8aDAwt8H60K1VaF9jjbFPOvHKy8SQSGhLiPgZpO+j5AIHfg9qr2+yo/5DffgpEiTq/bLhvMBi4sALdu9UMj4B/MKgx0BzJonVJe+RS22xlIE+Ykgj/6Mmt4pNt6jxctP09+cFOV6X6ZLk4QqdDDDs6KWA15dbkugfFQACS+3YTSGQWkh5PAwjY8BH3W4r6vyXmuuZh3iSRINb7Rq4oVzu886hrSQfoiCYZOD4/7GHXkdF7gKZCrB68uxBz34vYbYeIP/R8Y6zdZ8sXS3dfUMZfVyJPAY2yYIUAAOUDIelWoJLwp0cNoBakGQWgGO3ixz1Oi3Tr3aM6yeMhEQTe0QE8G9IBq27brNPoP6oPS+C10bTHwivZb/hL3jry8ozIfQs7rvGKR75/atDRyVQyGAzblFWdspHlPzWU1ugUvWmU8etgVee1hG49sQ1+vyagy94qh4LUiY0b1krK+j9lwIYpO9K4Ukh7bMamHZZUsyyXN5V6T8M+T2x1pSo0xKAKtIC5cSUU1pkr2hHRZviHfoSV7B/uWuicLDd7iXxrdr+yhhe//Va9xuP8UMS/zVhEri1AktbWt3AN0QTe6smBSvtn/0euwyyD1w7J6uxCPEs6lrLbJoY8zrM/i5Yfq0TOEyDslEnrlqOaa1go9+mw5+njYrjqvJuRO5Nuhg3jM6kjmtazDOc+PwMTRWaU4/6826fm/UDhQLVFkPk2kq7BvZDBIMQbura5AwhI0oY/8Rq/EjGm0NUBkXgJMl1FeReHgJLzO13UPf/3E++zg1WqkDh12/DLJqDtD5rQInTZkLrscqxx51NGxAYu0NxS5opYCrQbL/LyXk/xusbYDhg8MwGs2ennDM5y2ZkYWW6VGaCZKr7SvkKW6eI1OOSMeYkVuDfkJ/kr+fHujHo5lkUHfaWzwJQYdmi0Hu56LEWBfXrsntABHH8RsQUgSOzllluCUT9UZ3apRq4z+zA7CJm6AofeXYCtm6eM3Dy7H51TfmBJEEqAEXbud4WeWvcDcjieIsF7kjYcT7iuV5ch1Q2ytA/907dnIe7U+ioetZ3+ydh4/OzSlRA39TNvFcSSyXuBT2BynmMSRj85xrpzoUJnygTL7a8tuODZDdxa4f5+fQM9M5LBh7hhF93qWgvHc5GGTFGgTsiOADcrT9t3zcVYJw53FtGviBHExG+mAqQeiqeQLJ0y6KPVmXbrdOhnzHOT/a0rhl9uaNFSOWC8zvp28wLaAcjDiViVmryCaKIdmTHA9WKK1yyCsRcLA0ZLTazZUCVHNQPtptPj6xaHFuf2YVzIGhZHyIudJ6pPY8evgVgUHJ8L2fzFZn6pnHqsQwuOx/aTYYvvcn9b0CiPUCDsdigO+3fDKgU/Ay675W7TXmQGKA==
Thank you for the quick response,
this sounds great. Thanks to the approach taken in the nspawn example I managed to build an Alpine Linux based Docker image with less than 100MB. (:
In the end we don't need a fully static build. The smaller footprint is sufficient.
Thanks!
On 18.08.21 14:48, Stéphane Glondu wrote:
Dear Alban,
Le 18/08/2021 à 14:07, Alban Bruder a écrit :
for a slimmed down installation, I am trying to statically linkThis is exactly what is done in doc/nspawn:
Belenios. My incentive is that the whole OPAM installation is quite big
(around 3 GB) and I wonder if this could be less. E.G for a distribution
where only the binaries and the Belenios source code would be required.
https://gitlab.inria.fr/belenios/belenios/-/tree/master/doc/nspawn
With Belenios 1.15, one can get a ~200 MB image; with 1.16, it is ~400
MB and with master, it is ~125 MB.
My understanding of OCAML/OPAM is that this might be possible byThis might work for belenios-tool, but not for the web server (at least
including "(flags (-ccopt -static))" in the dune files. Did one of you
already try this or is it a bad idea?
in <= 1.16). Indeed, ocsigenserver does dynamic lookups and loading of
numerous OCaml libraries which cannot be avoided by merely stuffing
-static into the linking command line.
However, in master, I've implemented so-called "static linking" (in the
Ocsigen/Eliom sense; beware, this is not exactly what you mean) of the
web server. It consists in creating a new executable, "belenios-server"
that embeds ocsigenserver, eliom, belenios and all OCaml libraries. It
still uses shared libraries (such as libc and libssl), though. I guess
it could be workable to turn this "belenios-server" executable into a
true static binary but I didn't try. The reduced size of the nspawn
image in master is due to this new strategy.
If your goal is to reduce the footprint of Belenios and its dependencies
on a production server, I would recommend to use nspawn as instructed above.
Cheers,
--
Alban Bruder
Studiengang Medieninformatik, B.Sc.
Bauhaus-Universität Weimar
Mitglied des StudierendenKonvents
Mitglied des Fachschaftsrats Medien
Büro der Studierendenvertretungen
Marienstraße 18
D-99423 Weimar
- [belenios-discuss] Statically linking Belenios, Alban Bruder, 18/08/2021
- Re: [belenios-discuss] Statically linking Belenios, Stéphane Glondu, 18/08/2021
- Re: [belenios-discuss] Statically linking Belenios, Alban Bruder, 18/08/2021
- Re: [belenios-discuss] Statically linking Belenios, Stéphane Glondu, 18/08/2021
Archives gérées par MHonArc 2.6.19+.