From d6ec3c239ae2df5aca195d30744ee6e65c8868f1 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Sat, 9 Mar 2024 01:39:10 +0200 Subject: [PATCH] feat(library): Introduce Imaginary as library Introduce Imaginary 1.2 image (ELF Loader) for bincompat runs. Add `Kraftfile` to build for QMEU and Firecracker on x86_64 using initrd for volume support. The current build uses embedded initrd to build a single image consisting of both the kernel and the initial ramdisk. Add GitHub workflow to build and deploy the image. Add success badge in `README.md`. Signed-off-by: Razvan Deaconescu --- .github/workflows/library-imaginary1.2.yaml | 75 +++++++++ README.md | 2 + library/imaginary/1.2/.dockerignore | 3 + library/imaginary/1.2/.gitignore | 3 + library/imaginary/1.2/Dockerfile | 161 ++++++++++++++++++++ library/imaginary/1.2/Kraftfile | 143 +++++++++++++++++ library/imaginary/1.2/README.md | 91 +++++++++++ 7 files changed, 478 insertions(+) create mode 100644 .github/workflows/library-imaginary1.2.yaml create mode 100644 library/imaginary/1.2/.dockerignore create mode 100644 library/imaginary/1.2/.gitignore create mode 100644 library/imaginary/1.2/Dockerfile create mode 100644 library/imaginary/1.2/Kraftfile create mode 100644 library/imaginary/1.2/README.md diff --git a/.github/workflows/library-imaginary1.2.yaml b/.github/workflows/library-imaginary1.2.yaml new file mode 100644 index 00000000..6bd84b54 --- /dev/null +++ b/.github/workflows/library-imaginary1.2.yaml @@ -0,0 +1,75 @@ +name: library/imaginary1.2 + +on: + schedule: + - cron: '0 0 * * *' # Everyday at 12AM + + push: + branches: [main] + paths: + - 'library/imaginary/1.2/**' + - '.github/workflows/library-imaginary1.2.yaml' + - '!library/imaginary/1.2/README.md' + + pull_request: + types: [opened, synchronize, reopened] + branches: [main] + paths: + - 'library/imaginary/1.2/**' + - '.github/workflows/library-imaginary1.2.yaml' + - '!library/imaginary/1.2/README.md' + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - plat: qemu + arch: x86_64 + - plat: fc + arch: x86_64 + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build imaginary1.2 + uses: unikraft/kraftkit@staging + with: + loglevel: debug + workdir: library/imaginary/1.2 + runtimedir: /github/workspace/.kraftkit + plat: ${{ matrix.plat }} + arch: ${{ matrix.arch }} + push: false + output: oci://index.unikraft.io/unikraft.org/imaginary:1.2 + + - name: Archive OCI digests + uses: actions/upload-artifact@v3 + with: + name: oci-digests-${{ matrix.arch }}-${{ matrix.plat }} + path: ${{ github.workspace }}/.kraftkit/oci/digests + if-no-files-found: error + + push: + if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} + needs: [ build ] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Login to OCI registry + uses: docker/login-action@v2 + with: + registry: index.unikraft.io + username: ${{ secrets.REG_USERNAME }} + password: ${{ secrets.REG_TOKEN }} + + - name: Retrieve, merge and push OCI digests + uses: ./.github/actions/merge-oci-digests + with: + name: index.unikraft.io/unikraft.org/imaginary:1.2 + push: true diff --git a/README.md b/README.md index 1b992966..5eef8505 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ kraft pkg ls --apps --update | [![](https://github.com/unikraft/catalog/actions/workflows/library-caddy2.7.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-caddy2.7.yaml) | [`unikraft.org/caddy:2.7`](library/caddy/2.7) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-helloworld.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-helloworld.yaml) | [`unikraft.org/helloworld:latest`](library/helloworld) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-hugo0.122.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-hugo0.122.yaml) | [`unikraft.org/hugo:0.122`](library/hugo/0.122) | +| [![](https://github.com/unikraft/catalog/actions/workflows/library-imaginary1.2.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-imaginary1.2.yaml) | [`unikraft.org/imaginary:1.2`](library/imaginary/1.2) | +| [![](https://github.com/unikraft/catalog/actions/workflows/library-helloworld.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-helloworld.yaml) | [`unikraft.org/helloworld:latest`](library/helloworld) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-lua5.4.4.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-lua5.4.4.yaml) | [`unikraft.org/lua:5.4.4`](library/lua/5.4.4) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-lua5.4.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-lua5.4.yaml) | [`unikraft.org/lua:5.4`](library/lua/5.4) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-memcached1.6.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-memcached1.6.yaml) | [`unikraft.org/memcached:1.6`](library/memcached/1.6) | diff --git a/library/imaginary/1.2/.dockerignore b/library/imaginary/1.2/.dockerignore new file mode 100644 index 00000000..a154b6ff --- /dev/null +++ b/library/imaginary/1.2/.dockerignore @@ -0,0 +1,3 @@ +/Makefile.uk +/.unikraft/ +/.config* diff --git a/library/imaginary/1.2/.gitignore b/library/imaginary/1.2/.gitignore new file mode 100644 index 00000000..a154b6ff --- /dev/null +++ b/library/imaginary/1.2/.gitignore @@ -0,0 +1,3 @@ +/Makefile.uk +/.unikraft/ +/.config* diff --git a/library/imaginary/1.2/Dockerfile b/library/imaginary/1.2/Dockerfile new file mode 100644 index 00000000..6c7e05af --- /dev/null +++ b/library/imaginary/1.2/Dockerfile @@ -0,0 +1,161 @@ +FROM golang:1.21.6-bookworm AS build + +ARG IMAGINARY_VERSION=1.2.4 + +RUN set -xe; \ + apt-get -yqq update; \ + apt-get -yqq install \ + wget \ + unzip \ + libvips-dev \ + ; + +WORKDIR /src + +RUN set -xe; \ + wget https://github.com/h2non/imaginary/archive/refs/tags/v${IMAGINARY_VERSION}.zip; \ + unzip v${IMAGINARY_VERSION}.zip \ + ; + +RUN set -xe; \ + cd imaginary-${IMAGINARY_VERSION}; \ + CGO_ENABLED=1 go build -buildmode=pie -o /usr/bin/imaginary \ + ; + +FROM alpine:3 AS sys + +RUN set -xe; \ + mkdir -p /target/etc; \ + mkdir -p /blank; \ + apk --no-cache add \ + ca-certificates \ + tzdata \ + ; \ + update-ca-certificates; \ + ln -sf ../usr/share/zoneinfo/Etc/UTC /target/etc/localtime; \ + echo "Etc/UTC" > /target/etc/timezone; + +FROM scratch + +COPY --from=sys /target/etc /etc +COPY --from=sys /usr/share/zoneinfo/Etc/UTC /usr/share/zoneinfo/Etc/UTC +COPY --from=sys /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=sys /blank /tmp + +# Imaginary binary +COPY --from=build /usr/bin/imaginary /usr/bin/imaginary + +# Libraries +COPY --from=build /lib/x86_64-linux-gnu/libvips.so.42 /lib/x86_64-linux-gnu/libvips.so.42 +COPY --from=build /lib/x86_64-linux-gnu/libgobject-2.0.so.0 /lib/x86_64-linux-gnu/libgobject-2.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libglib-2.0.so.0 /lib/x86_64-linux-gnu/libglib-2.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libgio-2.0.so.0 /lib/x86_64-linux-gnu/libgio-2.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libexpat.so.1 /lib/x86_64-linux-gnu/libexpat.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libgsf-1.so.114 /lib/x86_64-linux-gnu/libgsf-1.so.114 +COPY --from=build /lib/x86_64-linux-gnu/libfftw3.so.3 /lib/x86_64-linux-gnu/libfftw3.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libcfitsio.so.10 /lib/x86_64-linux-gnu/libcfitsio.so.10 +COPY --from=build /lib/x86_64-linux-gnu/libimagequant.so.0 /lib/x86_64-linux-gnu/libimagequant.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libcgif.so.0 /lib/x86_64-linux-gnu/libcgif.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libexif.so.12 /lib/x86_64-linux-gnu/libexif.so.12 +COPY --from=build /lib/x86_64-linux-gnu/libjpeg.so.62 /lib/x86_64-linux-gnu/libjpeg.so.62 +COPY --from=build /lib/x86_64-linux-gnu/libpng16.so.16 /lib/x86_64-linux-gnu/libpng16.so.16 +COPY --from=build /lib/x86_64-linux-gnu/libwebp.so.7 /lib/x86_64-linux-gnu/libwebp.so.7 +COPY --from=build /lib/x86_64-linux-gnu/libwebpmux.so.3 /lib/x86_64-linux-gnu/libwebpmux.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libwebpdemux.so.2 /lib/x86_64-linux-gnu/libwebpdemux.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libpango-1.0.so.0 /lib/x86_64-linux-gnu/libpango-1.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libcairo.so.2 /lib/x86_64-linux-gnu/libcairo.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libfontconfig.so.1 /lib/x86_64-linux-gnu/libfontconfig.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libtiff.so.6 /lib/x86_64-linux-gnu/libtiff.so.6 +COPY --from=build /lib/x86_64-linux-gnu/librsvg-2.so.2 /lib/x86_64-linux-gnu/librsvg-2.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libmatio.so.11 /lib/x86_64-linux-gnu/libmatio.so.11 +COPY --from=build /lib/x86_64-linux-gnu/liblcms2.so.2 /lib/x86_64-linux-gnu/liblcms2.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libOpenEXR-3_1.so.30 /lib/x86_64-linux-gnu/libOpenEXR-3_1.so.30 +COPY --from=build /lib/x86_64-linux-gnu/libopenjp2.so.7 /lib/x86_64-linux-gnu/libopenjp2.so.7 +COPY --from=build /lib/x86_64-linux-gnu/liborc-0.4.so.0 /lib/x86_64-linux-gnu/liborc-0.4.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libm.so.6 /lib/x86_64-linux-gnu/libm.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libffi.so.8 /lib/x86_64-linux-gnu/libffi.so.8 +COPY --from=build /lib/x86_64-linux-gnu/libpcre2-8.so.0 /lib/x86_64-linux-gnu/libpcre2-8.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libmount.so.1 /lib/x86_64-linux-gnu/libmount.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libselinux.so.1 /lib/x86_64-linux-gnu/libselinux.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libxml2.so.2 /lib/x86_64-linux-gnu/libxml2.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libbz2.so.1.0 /lib/x86_64-linux-gnu/libbz2.so.1.0 +COPY --from=build /lib/x86_64-linux-gnu/libcurl-gnutls.so.4 /lib/x86_64-linux-gnu/libcurl-gnutls.so.4 +COPY --from=build /lib/x86_64-linux-gnu/libgomp.so.1 /lib/x86_64-linux-gnu/libgomp.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libharfbuzz.so.0 /lib/x86_64-linux-gnu/libharfbuzz.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libfribidi.so.0 /lib/x86_64-linux-gnu/libfribidi.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libthai.so.0 /lib/x86_64-linux-gnu/libthai.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libpixman-1.so.0 /lib/x86_64-linux-gnu/libpixman-1.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libfreetype.so.6 /lib/x86_64-linux-gnu/libfreetype.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libxcb-shm.so.0 /lib/x86_64-linux-gnu/libxcb-shm.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libxcb.so.1 /lib/x86_64-linux-gnu/libxcb.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libxcb-render.so.0 /lib/x86_64-linux-gnu/libxcb-render.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libXrender.so.1 /lib/x86_64-linux-gnu/libXrender.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libX11.so.6 /lib/x86_64-linux-gnu/libX11.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libXext.so.6 /lib/x86_64-linux-gnu/libXext.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libzstd.so.1 /lib/x86_64-linux-gnu/libzstd.so.1 +COPY --from=build /lib/x86_64-linux-gnu/liblzma.so.5 /lib/x86_64-linux-gnu/liblzma.so.5 +COPY --from=build /lib/x86_64-linux-gnu/libLerc.so.4 /lib/x86_64-linux-gnu/libLerc.so.4 +COPY --from=build /lib/x86_64-linux-gnu/libjbig.so.0 /lib/x86_64-linux-gnu/libjbig.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libdeflate.so.0 /lib/x86_64-linux-gnu/libdeflate.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libcairo-gobject.so.2 /lib/x86_64-linux-gnu/libcairo-gobject.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib/x86_64-linux-gnu/libgcc_s.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libhdf5_serial.so.103 /lib/x86_64-linux-gnu/libhdf5_serial.so.103 +COPY --from=build /lib/x86_64-linux-gnu/libImath-3_1.so.29 /lib/x86_64-linux-gnu/libImath-3_1.so.29 +COPY --from=build /lib/x86_64-linux-gnu/libIlmThread-3_1.so.30 /lib/x86_64-linux-gnu/libIlmThread-3_1.so.30 +COPY --from=build /lib/x86_64-linux-gnu/libIex-3_1.so.30 /lib/x86_64-linux-gnu/libIex-3_1.so.30 +COPY --from=build /lib/x86_64-linux-gnu/libstdc++.so.6 /lib/x86_64-linux-gnu/libstdc++.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libblkid.so.1 /lib/x86_64-linux-gnu/libblkid.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libicuuc.so.72 /lib/x86_64-linux-gnu/libicuuc.so.72 +COPY --from=build /lib/x86_64-linux-gnu/libnghttp2.so.14 /lib/x86_64-linux-gnu/libnghttp2.so.14 +COPY --from=build /lib/x86_64-linux-gnu/libidn2.so.0 /lib/x86_64-linux-gnu/libidn2.so.0 +COPY --from=build /lib/x86_64-linux-gnu/librtmp.so.1 /lib/x86_64-linux-gnu/librtmp.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libssh2.so.1 /lib/x86_64-linux-gnu/libssh2.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libpsl.so.5 /lib/x86_64-linux-gnu/libpsl.so.5 +COPY --from=build /lib/x86_64-linux-gnu/libnettle.so.8 /lib/x86_64-linux-gnu/libnettle.so.8 +COPY --from=build /lib/x86_64-linux-gnu/libgnutls.so.30 /lib/x86_64-linux-gnu/libgnutls.so.30 +COPY --from=build /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libldap-2.5.so.0 /lib/x86_64-linux-gnu/libldap-2.5.so.0 +COPY --from=build /lib/x86_64-linux-gnu/liblber-2.5.so.0 /lib/x86_64-linux-gnu/liblber-2.5.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libbrotlidec.so.1 /lib/x86_64-linux-gnu/libbrotlidec.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libgraphite2.so.3 /lib/x86_64-linux-gnu/libgraphite2.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libdatrie.so.1 /lib/x86_64-linux-gnu/libdatrie.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libXau.so.6 /lib/x86_64-linux-gnu/libXau.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libXdmcp.so.6 /lib/x86_64-linux-gnu/libXdmcp.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libcrypto.so.3 /lib/x86_64-linux-gnu/libcrypto.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libcurl.so.4 /lib/x86_64-linux-gnu/libcurl.so.4 +COPY --from=build /lib/x86_64-linux-gnu/libsz.so.2 /lib/x86_64-linux-gnu/libsz.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libicudata.so.72 /lib/x86_64-linux-gnu/libicudata.so.72 +COPY --from=build /lib/x86_64-linux-gnu/libunistring.so.2 /lib/x86_64-linux-gnu/libunistring.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libhogweed.so.6 /lib/x86_64-linux-gnu/libhogweed.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libgmp.so.10 /lib/x86_64-linux-gnu/libgmp.so.10 +COPY --from=build /lib/x86_64-linux-gnu/libp11-kit.so.0 /lib/x86_64-linux-gnu/libp11-kit.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libtasn1.so.6 /lib/x86_64-linux-gnu/libtasn1.so.6 +COPY --from=build /lib/x86_64-linux-gnu/libkrb5.so.3 /lib/x86_64-linux-gnu/libkrb5.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libk5crypto.so.3 /lib/x86_64-linux-gnu/libk5crypto.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libcom_err.so.2 /lib/x86_64-linux-gnu/libcom_err.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libkrb5support.so.0 /lib/x86_64-linux-gnu/libkrb5support.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libsasl2.so.2 /lib/x86_64-linux-gnu/libsasl2.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libbrotlicommon.so.1 /lib/x86_64-linux-gnu/libbrotlicommon.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libbsd.so.0 /lib/x86_64-linux-gnu/libbsd.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libssl.so.3 /lib/x86_64-linux-gnu/libssl.so.3 +COPY --from=build /lib/x86_64-linux-gnu/libaec.so.0 /lib/x86_64-linux-gnu/libaec.so.0 +COPY --from=build /lib/x86_64-linux-gnu/libkeyutils.so.1 /lib/x86_64-linux-gnu/libkeyutils.so.1 +COPY --from=build /lib/x86_64-linux-gnu/libresolv.so.2 /lib/x86_64-linux-gnu/libresolv.so.2 +COPY --from=build /lib/x86_64-linux-gnu/libmd.so.0 /lib/x86_64-linux-gnu/libmd.so.0 + +COPY --from=build /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 + +#COPY --from=build /usr/lib /usr/lib +#COPY --from=build /lib/x86_64-linux-gnu /lib/x86_64-linux-gnu +# +## Temporary copy +#COPY --from=build /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.6 +#COPY --from=build /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so.2 +#COPY --from=build /bin/bash /bin/bash +#COPY --from=build /usr/bin/ldd /usr/bin/ldd diff --git a/library/imaginary/1.2/Kraftfile b/library/imaginary/1.2/Kraftfile new file mode 100644 index 00000000..5d78ab8a --- /dev/null +++ b/library/imaginary/1.2/Kraftfile @@ -0,0 +1,143 @@ +spec: v0.6 + +name: imaginary + +rootfs: ./Dockerfile + +cmd: ["/usr/bin/imaginary", "-p", "8080", "-enable-url-source"] + +template: + source: https://github.com/unikraft/app-elfloader.git + version: staging + +unikraft: + source: https://github.com/unikraft/unikraft.git + version: staging + kconfig: + # Configurations options for app-elfloader + # (they can't be part of the template atm) + CONFIG_APPELFLOADER_ARCH_PRCTL: 'y' + CONFIG_APPELFLOADER_BRK: 'y' + CONFIG_APPELFLOADER_CUSTOMAPPNAME: 'y' + CONFIG_APPELFLOADER_STACK_NBPAGES: 128 + CONFIG_APPELFLOADER_VFSEXEC_EXECBIT: 'n' + CONFIG_APPELFLOADER_VFSEXEC: 'y' + CONFIG_APPELFLOADER_HFS: 'y' + CONFIG_APPELFLOADER_HFS_ETCRESOLVCONF: 'y' + CONFIG_APPELFLOADER_HFS_ETCHOSTS: 'y' + CONFIG_APPELFLOADER_HFS_ETCHOSTNAME: 'y' + CONFIG_APPELFLOADER_HFS_REPLACEEXIST: 'y' + # Unikraft options + CONFIG_HAVE_PAGING_DIRECTMAP: 'y' + CONFIG_HAVE_PAGING: 'y' + CONFIG_I8042: 'y' + CONFIG_LIBDEVFS_AUTOMOUNT: 'y' + CONFIG_LIBDEVFS_DEV_NULL: 'y' + CONFIG_LIBDEVFS_DEV_STDOUT: 'y' + CONFIG_LIBDEVFS_DEV_ZERO: 'y' + CONFIG_LIBDEVFS: 'y' + CONFIG_LIBPOSIX_ENVIRON_ENVP0: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + CONFIG_LIBPOSIX_ENVIRON_ENVP1: "LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib" + CONFIG_LIBPOSIX_ENVIRON_ENVP2: "HOME=/" + CONFIG_LIBPOSIX_ENVIRON: 'y' + CONFIG_LIBPOSIX_ENVIRON_LIBPARAM: 'y' + CONFIG_LIBPOSIX_ENVIRON_LIBPARAM_MAXCOUNT: '64' + CONFIG_LIBPOSIX_EVENTFD: 'y' + CONFIG_LIBPOSIX_FDIO: 'y' + CONFIG_LIBPOSIX_FDTAB: 'y' + CONFIG_LIBPOSIX_FUTEX: 'y' + CONFIG_LIBPOSIX_MMAP: 'y' + CONFIG_LIBPOSIX_NETLINK: 'y' + CONFIG_LIBPOSIX_PIPE: 'y' + CONFIG_LIBPOSIX_POLL: 'y' + CONFIG_LIBPOSIX_PROCESS_CLONE: 'y' + CONFIG_LIBPOSIX_SOCKET: 'y' + CONFIG_LIBPOSIX_SYSINFO: 'y' + CONFIG_LIBPOSIX_TIME: 'y' + CONFIG_LIBPOSIX_TIMERFD: 'y' + CONFIG_LIBPOSIX_UNIXSOCKET: 'y' + CONFIG_LIBPOSIX_USER_GID: 0 + CONFIG_LIBPOSIX_USER_GROUPNAME: "root" + CONFIG_LIBPOSIX_USER_UID: 0 + CONFIG_LIBPOSIX_USER_USERNAME: "root" + CONFIG_LIBPOSIX_USER: 'y' + CONFIG_LIBRAMFS: 'y' + CONFIG_LIBSYSCALL_SHIM_HANDLER_ULTLS: 'y' + CONFIG_LIBSYSCALL_SHIM_HANDLER: 'y' + CONFIG_LIBSYSCALL_SHIM_LEGACY_VERBOSE: 'y' + CONFIG_LIBSYSCALL_SHIM: 'y' + CONFIG_LIBUKALLOCPOOL: 'y' + CONFIG_LIBUKBLKDEV_MAXNBQUEUES: '1' + CONFIG_LIBUKBLKDEV_DISPATCHERTHREADS: 'y' + CONFIG_LIBUKBLKDEV_SYNC_IO_BLOCKED_WAITING: 'y' + CONFIG_LIBUKBLKDEV: 'y' + CONFIG_LIBUKBOOT_BANNER_MINIMAL: 'y' + CONFIG_LIBUKBOOT_HEAP_BASE: '0x400000000' + CONFIG_LIBUKBOOT_MAINTHREAD: 'y' + CONFIG_LIBUKBOOT_SHUTDOWNREQ_HANDLER: 'y' + CONFIG_LIBUKCPIO: 'y' + CONFIG_LIBUKDEBUG_CRASH_SCREEN: 'y' + CONFIG_LIBUKDEBUG_ENABLE_ASSERT: 'y' + CONFIG_LIBUKDEBUG_PRINT_SRCNAME: 'n' + CONFIG_LIBUKDEBUG_PRINT_TIME: 'y' + CONFIG_LIBUKDEBUG_PRINTK_ERR: 'y' + CONFIG_LIBUKDEBUG_PRINTK: 'y' + CONFIG_LIBUKDEBUG: 'y' + CONFIG_LIBUKFALLOC: 'y' + CONFIG_LIBUKMPI: 'n' + CONFIG_LIBUKSIGNAL: 'y' + CONFIG_LIBUKSWRAND_DEVFS: 'y' + CONFIG_LIBUKSWRAND: 'y' + CONFIG_LIBUKVMEM_DEFAULT_BASE: '0x0000001000000000' + CONFIG_LIBUKVMEM_DEMAND_PAGE_IN_SIZE: 12 + CONFIG_LIBUKVMEM_PAGEFAULT_HANDLER_PRIO: 4 + CONFIG_LIBUKVMEM: 'y' + CONFIG_LIBVFSCORE_AUTOMOUNT_CI: 'y' + CONFIG_LIBVFSCORE_AUTOMOUNT_CI_EINITRD: 'y' + CONFIG_LIBVFSCORE_AUTOMOUNT_UP: 'y' + CONFIG_LIBVFSCORE_AUTOMOUNT: 'y' + CONFIG_LIBVFSCORE_NONLARGEFILE: 'y' + CONFIG_LIBVFSCORE: 'y' + CONFIG_OPTIMIZE_DEADELIM: 'y' + CONFIG_OPTIMIZE_LTO: 'y' + CONFIG_PAGING: 'y' + CONFIG_STACK_SIZE_PAGE_ORDER: 4 # 128 * 4K = 512K + CONFIG_UKPLAT_MEMREGION_MAX_COUNT: 64 + CONFIG_LIBUKNETDEV_EINFO_LIBPARAM: 'y' + + # Debug options + # CONFIG_LIBUKDEBUG_PRINTD: 'y' + # CONFIG_LIBUKDEBUG_PRINTK_INFO: 'y' + # CONFIG_LIBSYSCALL_SHIM_STRACE: 'y' + # CONFIG_LIBSYSCALL_SHIM_DEBUG: 'y' + +libraries: + lwip: + source: https://github.com/unikraft/lib-lwip.git + version: staging + kconfig: + CONFIG_LWIP_LOOPIF: 'y' + CONFIG_LWIP_UKNETDEV: 'y' + CONFIG_LWIP_LOOPBACK: 'y' + CONFIG_LWIP_TCP: 'y' + CONFIG_LWIP_UDP: 'y' + CONFIG_LWIP_RAW: 'y' + CONFIG_LWIP_WND_SCALE: 'y' + CONFIG_LWIP_TCP_KEEPALIVE: 'y' + CONFIG_LWIP_THREADS: 'y' + CONFIG_LWIP_HEAP: 'y' + CONFIG_LWIP_SOCKET: 'y' + CONFIG_LWIP_AUTOIFACE: 'y' + CONFIG_LWIP_IPV4: 'y' + CONFIG_LWIP_DHCP: 'y' + CONFIG_LWIP_DNS: 'y' + CONFIG_LWIP_NUM_TCPCON: 64 + CONFIG_LWIP_NUM_TCPLISTENERS: 64 + CONFIG_LWIP_ICMP: 'y' + libelf: + source: https://github.com/unikraft/lib-libelf.git + version: staging + +targets: +- fc/x86_64 +- qemu/x86_64 diff --git a/library/imaginary/1.2/README.md b/library/imaginary/1.2/README.md new file mode 100644 index 00000000..8a9590eb --- /dev/null +++ b/library/imaginary/1.2/README.md @@ -0,0 +1,91 @@ +# Imaginary + +This directory contains the [Imaginary](https://github.com/h2non/imaginary) runtime on Unikraft, in binary compatibility mode. +It implements Imaginary running on Unikraft. + +## Run and Use + +Use `kraft` to run the image and start a Unikraft instance: + +```bash +kraft run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 512M unikraft.org/imaginary:1.2 +``` + +If the `--plat` argument is left out, it defaults to `qemu`. +If the `--arch` argument is left out, it defaults to your system's CPU architecture. + +Once executed, it will open port `8080` and wait for connections. +To test it, you can use `curl` to get the health status: + +```console +curl -s localhost:8080/health | jq +``` + +You will get a on output such as: + +```text +{ + "uptime": 86, + "allocatedMemory": 0.19, + "totalAllocatedMemory": 0.39, + "goroutines": 6, + "completedGCCycles": 2, + "cpus": 1, + "maxHeapUsage": 3.66, + "heapInUse": 0.19, + "objectsInUse": 890, + "OSMemoryObtained": 7.48 +} +``` + +## Inspect and Close + +To list information about the Unikraft instance, use: + +```bash +kraft ps +``` + +```text +NAME KERNEL ARGS CREATED STATUS MEM PORTS PLAT +wizardly_moja project://imaginary:qemu/x86_64 /usr/bin/imaginary -p 8080 -enable-url-source 2 minutes ago running 488M 0.0.0.0:8080->8080/tcp qemu/x86_64 +``` + +The instance name is `wizardly_moja`. +To close the Unikraft instance, close the `kraft` process (e.g., via `Ctrl+c`) or run: + +```bash +kraft rm wizardly_moja +``` + +## Build and Run Locally + +The commands so far used the pre-build Ruby image available in the Unikraft registry. + +In oder to to build a local image, clone this repository and `cd` into this directory. +Then use `kraft` to build an image locally: + +```bash +kraft build --no-cache --no-update --plat qemu --arch x86_64 +``` + +Similar to the `kraft run` command, if the `--plat` argument is left out, it defaults to `qemu`. +If the `--arch` argument is left out, it defaults to your system's CPU architecture. + +In order to run the locally built image, use `.` (_dot_, the current directory) as the final argument to the `kraft run` command: + +```bash +kraft run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 512M . +``` + +Same as above, it will open port `8080` and wait for connections. + +## `kraft` and `sudo` + +Mixing invocations of `kraft` and `sudo` can lead to unexpected behavior. +Read more about how to start `kraft` without `sudo` at [https://unikraft.org/sudoless](https://unikraft.org/sudoless). + +## Learn More + +- [How to run unikernels locally](https://unikraft.org/docs/cli/running) +- [How to build `Dockerfile` root filesystems with BuildKit](https://unikraft.org/guides/building-dockerfile-images-with-buildkit)