Migrating a Vespa application to Vespa Cloud is straightforward, as applications on Vespa Cloud supports all the same features as your self-hosted Vespa instances, you're just gaining some new capabilities and avoid the operational work.
The high-level process is as follows:
The rest of this guide assumes you have a tenant ready for deployment:
$ export VESPA_TENANT_NAME=mytenant
Prerequisites:
NO_SPACE
- the vespaengine/vespa container image + headroom for data requires disk space.
Read more.
An application package from a self-hosted system
can be deployed with minor modifications to the Vespa Cloud dev
environment.
The root of an application package might look at this:
├── schemas
│ └── doc.sd
└── services.xml
There are often more files, the above is a minimum. This is the root of the application package - make this the current working directory:
$ cd /location/of/app/package
Make sure the Vespa CLI is installed, see pre-requisites above:
$ vespa
Usage:
vespa [flags]
vespa [command]
Configure the local environment and log in to Vespa Cloud:
$ vespa config set target cloud && \
vespa config set application $VESPA_TENANT_NAME.myapp && \
vespa auth login
Create and get security credentials:
$ vespa auth cert
This will add the security
directory to the application package,
and add a public certificate to it:
├── schemas
│ └── doc.sd
├── security
│ └── clients.pem
└── services.xml
The command also installs a key/certificate pair in the Vespa CLI home directory, see vespa auth cert. This pair is used in subsequent accesses to the data plane for document and query operations.
Add deployment.xml with your cloud provider account - This ensures the deployment uses resources from the correct account - examples:
<deployment version="1.0" cloud-account="gcp:project-name">
<dev />
</deployment>
<deployment version="1.0" cloud-account="aws:123456789012">
<dev />
</deployment>
The application package should look like:
├── deployment.xml
├── schemas
│ └── doc.sd
├── security
│ └── clients.pem
└── services.xml
hosts.xml
is not used in Vespa Cloud, remove it.
Edit the <nodes>
configuration in services.xml
- from:
<container id="default" version="1.0">
<document-api/>
<document-processing/>
<search/>
<nodes>
<node hostalias="node4" />
<node hostalias="node5" />
</nodes>
</container>
to:
<container id="default" version="1.0">
<document-api/>
<document-processing/>
<search/>
<nodes count="2">
<resources vcpu="2" memory="8Gb" disk="50Gb"/>
</nodes>
</container>
In short, this is the Vespa Cloud syntax for resource specifications.
Example, migrating from a cluster using c7i.2xlarge
instance type,
with a 200G disk - from the AWS specifications:
c7i.2xlarge 8 16 EBS-Only
Equivalent Vespa Cloud configuration:
<resources vcpu="8" memory="16Gb" disk="200Gb"/>
Repeat this for all clusters in services.xml
. Notes:
dev
environment, what is actually deployed is a minimized version.
The configuration changes above are easily tested in this environment.count=2
is best practise at this point.At this point, the local environment and the application package is ready for deployment:
$ vespa deploy --wait 600
Please note that a first-time deployment normally takes a few minutes, as resources are provisioned.
At this point, we recommend opening the console to observe the deployed application.
The link will be https://console.vespa-cloud.com/tenant/mytenant/application/myapp/dev/instance/default
(replace with your own names) - this is also easily found in the console main page:
Refer to vespa8 release notes for troubleshooting in case the deployments fails, based on a Vespa 7 (or earlier) version.
The endpoints are shown in the console, one can also list them like:
$ vespa status query
Container default at https://aa1c1234.b225678e.z.vespa-app.cloud/ is ready
Test the query endpoint, expect totalCount: 0
:
$ vespa query 'select * from sources * where true'
{
"root": {
"id": "toplevel",
"relevance": 1.0,
"fields": {
"totalCount": 0
},
In the services.xml
examples at the start of this guide,
both <search>
and <document>
and configured in the same cluster, named default
.
In case of multiple container clusters, select the one configured with <search>
:
vespa query 'select * from sources * where true' --cluster myquerycluster
Finally, feed a document to the cluster (this is the cluster configured with <document>
)
vespa feed mydoc.jsonl --cluster myfeedcluster
Redo the query and observe nonzero totalCount
.
This is the final step in the functional validation. Please note:
dev
expire after 7 days of inactivity,
i.e., 7 days after the last deployment.
This applies to all plans.
Use the Vespa Console to extend the expiry period, or redeploy the application to add 7 more days.