Imaginary
This example uses Imaginary
, an HTTP microservice for high-level image processing.
Imaginary can be deployed as Unikraft Cloud service and can be queried via HTTP to process images.
To run this example, follow these steps:
-
Install the
kraft
CLI tool and a container runtime engine, e.g. Docker. -
Clone the
examples
repository andcd
into theexamples/imaginary/
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
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 imaginary-mwb4y
and the URL is https://divine-wind-1ycjvhqs.fra0.kraft.host
.
They are 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.fra0.kraft.host/form
URL 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.
Endpoints are provided, together with parameters, for different image processing options: /crop
, /resize
, /flip
, /convert
, /watermark
, /rotate
, /blur
etc.
At any point in time, you can list information about the instance:
Code
Code
When done, you can remove the instance:
Code
The Imaginary Unikraft Cloud service mostly 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:
Code
Or visit the CLI Reference.