Caravaggio can be deployed easily on any platform. You can run it from its cli or run inside docker. Here we focus on how to deploy in some function as a service platform, such as AWS Lambda or Vercel.
TL;DR: there is a repository that contains a collection of ready-made examples to deploy Caravaggio on several FaaS platforms and you can find it here.
When you run Caravaggio, you basically have a complete webservice, but the core of Caravaggio is not a server, instead it's a simple function. It has been designed like that with the explicit purpose of making it easily deployable on FaaS platforms. Often these platform have their own entry point and provide their own web server solution.
Vercel (formerly Zeit, Now)
To deploy on Vercel, you can just click on the button below and follow instructions.
This will create a deployment on Vercel with the correct configuration.
If you want to handle code by yourself instead, just create a new node project and install caravaggio as dependency.
Create a folder called
Inside it create a file called
index.js and put this content inside
Vercel is able to put a cache in front of your service and Caravaggio is able to take advantage of this by setting
Now everytime the same image is asked, the caravaggio function is not run anymore and the result will come directly from Vercel cache. To know more about Vercel cache, read its documentation.
In the root folder of your project crate a file called
now.json and put this content inside.
This is telling vercel that any call to the service should be routed to the api we just created, which is Caravaggio.
If not installed, install now cli
and then deploy Caravaggio
and follow the instructions on screen