Compute is in preview, and the
v1alpha API can change.microvm runtime class. When you finish, your app runs in a MicroVM with its secrets, a public URL, a rollback path, and deploys from CI.
A MicroVM is a lightweight virtual machine with a minimal kernel. It starts in a fraction of a second. You write an ordinary Dockerfile, and datumctl compute build packages it into an image that Compute can boot. For more information, see Build and deploy a MicroVM image.
How Vercel concepts map to Compute
Before you begin
- Install
datumctland thecomputeplugin, and log in. For more information, see Compute commands. - Enable Compute for your project. Compute turns on the first time you run a
datumctl computecommand in the project. For more information, see Limits and quotas. - Use an app that runs as a long-lived Node server. Your framework needs a server build, not a Vercel-only build output.
- Use compute plugin v0.12.0 or later, which adds
datumctl compute logs. To upgrade, rundatumctl plugin upgrade compute. - Install the
albplugin withdatumctl plugin install alb. You use it to attach a domain and to set basic authentication. - Run Docker with BuildKit enabled, and log in to your registry with
docker login.datumctl compute builduses your local Docker credentials. - Choose a place to push images. For a private registry, see Use images from a private registry.
Migrate the app
1
Package the app as a MicroVM image
Vercel builds your app for you. On Compute, you provide the image. The following Follow these rules:To apply the Dockerfile changes that the report suggests, run A new GitHub Container Registry package is private, and the workload pulls the image anonymously unless you configure a pull Secret. Either make the package public in the GitHub package settings, or follow the private registry steps in Configuration.
Dockerfile.datum builds an Astro app with the Node adapter. datumctl compute build uses Dockerfile.datum if it exists, and Dockerfile otherwise. Adjust the build output paths and the CMD for your framework:Dockerfile.datum
- Listen on
::, not0.0.0.0. Instances have IPv6 addresses only. An app bound to IPv4 starts but never answers. Make your server read the host from an environment variable, asHOSTdoes here. - Serve plain HTTP on one port. The load balancer terminates TLS. You pass the port as
--http-portwhen you deploy. - Keep secrets out of the image. Add
.env*to.dockerignore. Secrets arrive at runtime from a Secret. - Tag every build with a new, unique tag. Datum doesn’t replace an Instance when the image tag is unchanged, so a moved tag does nothing.
- Keep the final image small. A MicroVM holds its root filesystem in memory, and the unpacked image counts against the Instance’s 2 GiB of memory. Run
npm prune --omit=dev, as the Dockerfile does, and copy only what the server needs. - Include everything the app loads. The final stage needs Node, its shared libraries, and any native modules. A native module such as
sharploads shared libraries at runtime.
datumctl compute build --fix .. The analysis can’t detect libraries that your app loads at runtime with dlopen, so copy those files into the image yourself.Build always targets linux/amd64, so you don’t need --platform on Apple Silicon. Build the image and push it to your registry:2
Move your environment variables into a Secret
Export the variables from Vercel. Save the file outside your repository, and never paste its contents into a chat:Drop the Vercel-only variables, such as
VERCEL, VERCEL_URL, and VERCEL_ENV. If your code reads them, replace them with your own variables.Create a Secret named APP-secrets in the default namespace, with one key for each variable. For the steps, see Secrets. Use the same names for the keys as for the variables. Create it with datumctl apply, then check for leftover Vercel placeholders. The following command prints key names only, never values:3
Deploy the workload
A deploy writes a
workload.yaml file into the current folder, which you shouldn’t commit. Create an empty folder outside your repository, and run the deploy from there. Choose one of the following paths:- Deploy the image you pushed
- Build and deploy from source
Use the image that you built and pushed in the previous steps. This path needs no source files, so you can run it from the empty folder:
microvm is the default runtime class, and naming it makes the choice clear to anyone who reads the command later. A workload keeps its runtime class. To change it, deploy under a new name and destroy the old workload.The last line of the output is the public URL. For the locations that your project can use, see Placement and scaling.4
Verify before you switch traffic
Watch the rollout and read the app’s output:While a rollout runs, the edge can return an HTML error page instead of your app. Poll a health route until it returns Compare the app with Vercel page by page: key routes, data from your CMS or API, forms, sign-in, and anything that calls a third party. Test login-protected pages and email forms yourself.
200 before you judge the result.A new *.datumproxy.net hostname might not resolve on your machine right away. Look it up through a public resolver and pin the address. If your machine has no IPv6 route, the request fails with no status code. Pin an IPv4 address from dig +short A $H @1.1.1.1 instead:5
Switch your domain
Attach your hostname to the load balancer. For the full flow, including domain verification, see Custom domains:If Datum runs your domain’s DNS, attaching a hostname writes the record and takes over that name. Check what the name points to today before you attach it. For apex domains and other records, see Point a domain at a load balancer.Before and after you switch, keep these points in mind:
- Keep the Vercel project until you’re sure. Pointing DNS back at Vercel is your fallback.
- Build with the final domain. If your app builds absolute URLs, sitemaps, or canonical links at build time, build the image with the production domain.
- Keep search indexing off on the
*.datumproxy.netURL. Otherwise the staging copy is indexed as a duplicate of your site. If your app has an “allow indexing” setting, turn it off in the Secret and turn it on at cutover. - Don’t change the framework adapter on a branch that Vercel deploys. Merging an adapter change, such as
@astrojs/vercelto@astrojs/node, to the branch that Vercel watches breaks Vercel and your rollback path. Keep the change on a separate branch until DNS has moved.
6
Deploy from CI
Vercel deploys on every push. On Compute, build and push the image in your pipeline with
datumctl compute build --push, then run datumctl compute deploy with the new tag. Log in as a service account. For the workflow, see GitHub Actions, and for service accounts, see Service accounts.A common pattern is a push to main that deploys staging, and a published release that deploys production with the release tag. Don’t run destroy in the pipeline, because it removes the URL and the load balancer settings.Roll back and update
To roll back, redeploy the last good tag. The image is already in the registry, so nothing is rebuilt:Protect the app with basic authentication
Vercel password protection maps to basic authentication on the load balancer. Run the following command and type the password when prompted:401 until then. Basic authentication protects every route on the load balancer, including health routes, and webhooks that call the URL get 401. To protect a single route, use a SecurityPolicy. For both methods, see Basic authentication.
Replace Vercel-only features
Check each feature that your app uses. The examples use Astro and Node, and the same pattern applies to other frameworks.Plan for these gaps
- Preview URLs for each branch aren’t available.
- Vercel-managed features such as Edge and Serverless Functions, ISR and its cache, Analytics, and Web Vitals have no direct equivalent. Check each one that your app uses.
- With more than one replica, the cache and any in-memory state are no longer shared. Add a shared store before you scale out.
- A MicroVM holds its root filesystem in memory, and Instances have 1 vCPU and 2 GiB of memory. If your app needs more memory or a large filesystem, it doesn’t fit. For all limits, see MicroVM limitations.
- Use scoped tokens in the Secret, not personal ones, before you move real traffic.
Troubleshooting
For other problems, see Compute troubleshooting.