Imaginary
This example uses imaginary, an HTTP microservice for high-level image processing.
To run this example, follow these steps:
-
Install the
kraftCLI tool and a container runtime engine, for example Docker. -
Clone the
examplesrepository andcdinto theexamples/imaginary/directory:
Code(bash)
Make sure to log into Unikraft Cloud by setting your token and a metro close to you.
This guide uses fra (Frankfurt, ๐ฉ๐ช):
Code(bash)
When done, invoke the following command to deploy this app on Unikraft Cloud:
Code(bash)
The output shows the instance address and other details:
Code(ansi)
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(bash)
Code(json)
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(bash)
Code(text)
When done, you can remove the instance:
Code(bash)
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(yaml)
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(bash)
Or visit the CLI Reference.