Imaginary
This example uses imaginary, an HTTP microservice for high-level image processing.
To run this example, follow these steps:
-
Install the CLI and a container runtime engine, for example Docker. Use the unikraft CLI or the legacy kraft CLI.
-
Clone the
examplesrepository andcdinto theexamples/imaginary/directory:
Code
Make sure to log into Unikraft Cloud and pick a metro close to you.
This guide uses fra (Frankfurt, 🇩🇪):
When done, invoke the following command to deploy this app on Unikraft Cloud:
The output shows the instance address and other details:
Code
In this case, the instance name is imaginary-mwb4y and the address is https://divine-wind-1ycjvhqs.fra.unikraft.app.
They're different for each run.
Use curl to query the Unikraft Cloud instance of Imaginary.
You will get a health status of the service:
Code
Code
To test the Imaginary instance on Unikraft Cloud use the /form endpoint.
That is, open the https://divine-wind-1ycjvhqs.fra.unikraft.app/form address in the browser and use the existing forms to process an image.
To make actual use of the Imaginary instance, use the endpoints of the HTTP API.
The API provides endpoints, together with parameters, for different image processing options: /crop, /resize, /flip, /convert, /watermark, /rotate, /blur etc.
You can list information about the instance by running:
Code
When done, you can remove the instance:
The Imaginary Unikraft Cloud service works as is: you deploy it and then you query the endpoints of the HTTP API.
You can customize the command line options used to start the service, by updating the cmd line in the Kraftfile:
Code
You can update the cmd line with command line option for Imaginary.
Learn more
Use the --help option for detailed information on using Unikraft Cloud:
Or visit the CLI Reference or the legacy CLI Reference.