Zudoku
Example apps

Node AllKaraoke

Allkaraoke offers an ultrastar deluxe-like online platform for karaoke.

To run this example, follow these steps:

  1. Install the unikraft CLI. You need a BuildKit builder. The easiest way to get one is via Docker. Alternatively, you can also directly set up and use BuildKit, see the quick start.

  2. Clone the examples repository and cd into the examples/node24-karaoke directory:

    TerminalCode
    git clone https://github.com/unikraft-cloud/examples cd examples/node24-karaoke/

Make sure to log into Unikraft Cloud and pick a metro close to you. This guide uses fra (Frankfurt, 🇩🇪):

TerminalCode
unikraft login

When done, invoke the following command to deploy this app on Unikraft Cloud:

TerminalCode
unikraft build . --output <my-org>/node24-karaoke:latest unikraft run --metro fra \ -m 2G \ -p 443:8080/tls+http \ --scale-to-zero policy=on,cooldown-time=2000,stateful=true \ --image <my-org>/node24-karaoke:latest

The output shows the instance address and other details:

TerminalCode
metro: fra name: node24-karaoke-9lw5q uuid: e5f6a7b8-c9d0-1234-efab-345678901234 state: starting image: <my-org>/node24-karaoke resources: memory: 2GiB vcpus: 1 service: uuid: ef4112f8-10fc-fe6e-f48c-43a6623ec878 name: wild-song-p5q2nrwx domains: - fqdn: wild-song-p5q2nrwx.fra.unikraft.app networks: - uuid: cf5f3cbb-abf5-632e-3dd6-2de91885c6d9 private-ip: 10.0.3.8 mac: 12:b0:30:64:22:f9 timestamps: created: just now

In this case, the instance name is node24-karaoke-9lw5q and the address is https://wild-song-p5q2nrwx.fra.unikraft.app. They're different for each run.

Use curl to query the Unikraft Cloud instance of the AllKaraoke instance:

TerminalCode
curl https://wild-song-p5q2nrwx.fra.unikraft.app
Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" href="/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>AllKaraoke.Party - Free Online Karaoke</title> ... </head> ... </html>

You can list information about the instance by running:

TerminalCode
unikraft instances list
TerminalCode
METRO NAME STATE IMAGE ARGS MEMORY VCPUS FQDN CREATED fra node24-karaoke-9lw5q running <my-org>/node24-karaoke 2GiB 1 wild-song-p5q2nrwx.fra.unikraft.app 2 minutes ago

When done, you can remove the instance:

TerminalCode
unikraft instances delete node24-karaoke-9lw5q

Customize your app

To customize the app, update the files in the repository, listed below:

  • Kraftfile: the Unikraft Cloud specification
  • Dockerfile: the Docker-specified app filesystem
  • entrypoint.sh: the shell script used to start the AllKaraoke server

Lines in the Kraftfile have the following roles:

  • spec: v0.7: The current Kraftfile specification version is 0.7.

  • runtime: base-compat:latest: The kernel to use.

  • rootfs: Build the app root filesystem. source: ./Dockerfile means the filesystem is built using the Dockerfile. format: erofs means the filesystem type is EROFS.

  • cmd: ["/entrypoint.sh"]: Use /entrypoint.sh as the starting command of the instance.

Lines in the Dockerfile have the following roles:

  • FROM node:24-bookworm-slim AS build: Build the AllKaraoke project using the Node.js 24 Bookworm slim image.

  • RUN git clone ...; pnpm install; pnpm build: Clone the AllKaraoke repository, install dependencies, and build it for production.

  • FROM node:24-bookworm-slim AS prod: Use a fresh Node.js 24 Bookworm slim image for the runtime.

  • COPY ...: Copy required files to the app filesystem: the node binary executable, system libraries, the built AllKaraoke artifacts, and the entrypoint script.

The following options are available for customizing the app:

  • If you want to use a specific version of AllKaraoke, update the git clone command in the Dockerfile to pin a particular commit or tag.

  • If you want to add extra files, you need to copy them into the filesystem using the COPY command in the Dockerfile.

  • If you want to change the startup behavior, update the entrypoint.sh script.

  • More extensive changes may require extending the Dockerfile (see Dockerfile syntax reference).

Learn more

Use the --help option for detailed information on using Unikraft Cloud:

TerminalCode
unikraft --help

Or visit the CLI Reference.

Last modified on