Headless Browsers
Headless browsers power web scraping, automated testing, SEO rendering, and synthetic monitoring. They are resource-intensive, security-sensitive, and often run in short bursts—making them ideal candidates for unikernel-based, scale-to-zero infrastructure.
Why Headless Browsers on Unikraft Cloud?
⚡ Instant Startups
Instances on Unikraft Cloud boot in microseconds, so browsers spin up only when needed:
- Perfect for on-demand scraping and CI/CD testing.
- No idle costs when browsers aren’t running.
🔒 Strong Security
Browsers are exposed to untrusted content. With Unikraft Cloud:
- Each browser runs in its own VM, isolated by design.
- Minimal OS footprint drastically reduces attack surface.
- Immutable unikernel images prevent tampering.
💸 Cost-Efficient Scale-to-Zero
Scraping jobs or test suites often run in short, irregular bursts:
- Browsers scale to zero when idle, cutting infrastructure waste.
- Pay only for the seconds of actual execution.
🌍 Serverless-Ready
Easily integrate with pipelines and workloads that demand ephemeral execution:
- Trigger browsers via APIs or serverless functions.
- Distribute workloads globally to run close to data sources.
Getting Started
Headless browsers on Unikraft Cloud run faster, safer, and cheaper. Whether scraping, testing, or monitoring, you get instant scale-out and zero idle costs—without sacrificing isolation.
This guide shows you how to use Puppeteer, a Node.js library which provides a high-level API to control browsers, including the option to run them headless (no UI).
To run it, follow these steps:
-
Install the
kraft
CLI tool and a container runtime engine, e.g. Docker. -
Clone the
examples
repository andcd
into theexamples/node-express-puppeteer/
directory:
Code
Make sure to log into Unikraft Cloud by setting your token and a
metro close to you. We use fra0
(Frankfurt, 🇩🇪) in this
guide:
Code
A Puppeteer instance on Unikraft Cloud requires 4GB to run. You may be required to request increasing the instance memory quota.
When done, invoke the following command to deploy this application on Unikraft Cloud:
Code
The output shows the instance URL and other details:
Code
In this case, the instance name is node-express-puppeteer-7afg3
.
They are different for each run.
Use a browser to access the landing page of the Puppeteer (that uses ExpressJS). The application and the landing page are part of this repository.
In the example run above the landing page is at https://nameless-fog-0tvh1uov.fra0.kraft.host You can use the landing page to generate the PDF version of a remote page.
At any point in time, you can list information about the instance:
Code
Code
When done, you can remove the instance:
Code
Customize Your Deployment
The current deployment uses an ExpressJS service that uses the PDF generating functionality of Puppeteer. Customizing the deployment generally means updating the service, such as adding new functionalities provided by Puppeteer. The service itself can be updated to provided a REST-like interface.
Learn More
Use the --help
option for detailed information on using Unikraft Cloud:
Code
Or visit the CLI Reference.