Deploy Puppeteer
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:
Make sure to log into Unikraft Cloud by setting your token and a metro close to you.
We use fra0
(Frankfurt, 🇩🇪) in this guide:
When done, invoke the following command to deploy this application on Unikraft Cloud:
The output shows the instance URL and other details:
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:
When done, you can remove the instance:
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:
Or visit the CLI Reference.