Thread overview
Running a website using a 1.3MB self-contained executable
4 days ago
Andrea Fontana
3 days ago
Andrea Fontana
3 days ago
Johan
4 days ago

I’ve published an example showcasing how to use serverino to serve a web server that generates QR codes, without any external dependencies (not even glibc) and without reading or writing any files to disk.

It’s a single file, 1.3MB in size, which you can try by downloading it from the project’s GitHub page: https://github.com/trikko/serverino-demo/ or by checking the result at https://test.andreafontana.it.

The file can run inside a Docker scratch container or completely isolated from the rest of the system with bwrap, and it works perfectly!

Using upx/gzexe size goes down to <500KB

If you want to try serverino:



  █▀▀▀▀▀█ █▄▀  ███ ▄█▄  █▀▀▀▀▀█
  █ ███ █ ▀█▄▄█▀█▄▄▄ █▄ █ ███ █
  █ ▀▀▀ █ ▀▀▀▀ █▄▀  █▀  █ ▀▀▀ █
  ▀▀▀▀▀▀▀ ▀ ▀▄▀ █▄█ ▀ █ ▀▀▀▀▀▀▀
  █▄▄█▀█▀▀██▄ ▄▀█▄▀█▄█▀█ ▄█ ██▀
   ▄▀▀ ▄▀  ▀▀ █ ██ ▄  █▄▄█▀▄▀ ▄
   ▄ ██ ▀██▄███▀▀▄█▄█▀  ██▄▄▄▄█
  ▄▀▄▄ ▄▀▄▄▀█▀▄▄█▀▄▀ █▀▀▀▄█ █ █
  █▄▄ █▀▀▄ ▄ ▄▀  ▄ ▄ █▀▀  ▄▀▄▄
  ██ ▄▄ ▀▀▄▀▄███▀█▀ ▀█  ▄ ▀█▄ ▀
  ▀▀▀▀ ▀▀▀███▄▀█ █ ▀▄ █▀▀▀██▀▀
  █▀▀▀▀▀█ █▀ ▄▄█ ▀▀█ ██ ▀ █▀ ▄
  █ ███ █ █  ███▄██  ▀▀█▀▀▀▀ ▀█
  █ ▀▀▀ █  ▄ ▀▀▀ █▀▀█ ▀▀▄█▀▄█▀█
  ▀▀▀▀▀▀▀ ▀    ▀▀▀▀  ▀▀ ▀ ▀

Andrea Fontana

3 days ago

On Sunday, 19 January 2025 at 21:17:29 UTC, Andrea Fontana wrote:

>

I’ve published an example showcasing how to use serverino to serve a web server that generates QR codes, without any external dependencies (not even glibc) and without reading or writing any files to disk.

Awesome. I tried this many times but due to (transitive) dependencies on glibc always had to give up (e.g. gethostname).

Switching to musl often failed as well because it isn't as supported as glibc in druntime.

3 days ago

On Monday, 20 January 2025 at 08:55:43 UTC, Sebastiaan Koppe wrote:

>

On Sunday, 19 January 2025 at 21:17:29 UTC, Andrea Fontana wrote:

>

I’ve published an example showcasing how to use serverino to serve a web server that generates QR codes, without any external dependencies (not even glibc) and without reading or writing any files to disk.

Awesome. I tried this many times but due to (transitive) dependencies on glibc always had to give up (e.g. gethostname).

Switching to musl often failed as well because it isn't as supported as glibc in druntime.

In this case musl worked! You can see the workflow here:

https://github.com/trikko/serverino-demo/blob/main/.github/workflows/main.yml

Andrea

3 days ago

On Monday, 20 January 2025 at 08:55:43 UTC, Sebastiaan Koppe wrote:

>

On Sunday, 19 January 2025 at 21:17:29 UTC, Andrea Fontana wrote:

>

I’ve published an example showcasing how to use serverino to serve a web server that generates QR codes, without any external dependencies (not even glibc) and without reading or writing any files to disk.

Awesome. I tried this many times but due to (transitive) dependencies on glibc always had to give up (e.g. gethostname).

Switching to musl often failed as well because it isn't as supported as glibc in druntime.

LDC 1.39 and up has improved support of musl, including CI testing on Alpine. Pretty soon there will also be alpine-musl release packages of LDC on Github: https://github.com/ldc-developers/ldc/pull/4826 thanks to kinke's work.

cheers,
Johan