Follow these steps to deploy an application to the dev zone in the Vespa Cloud. Find more details and tips in the developer guide, and see next steps for self-hosted deployment options. Alternative versions of this guide:
Prerequisites:
Get a sample application:
$ git clone --depth 1 https://github.com/vespa-engine/sample-apps.git && \ cd sample-apps/album-recommendation
An application package is the full application configuration. See sample-apps for other sample apps you can start from instead.
Create a self-signed certificate:
On Unix or Mac, use openssl
:
$ openssl req -x509 -nodes -days 14 -newkey rsa:4096 \ -subj "/CN=cloud.vespa.example" \ -keyout data-plane-private-key.pem -out data-plane-public-cert.pem
On Windows, the certificate has to be created with New-SelfSignedCertificate in PowerShell, and then exported to PEM format using certutil.
Once the certificate has been created, add it to the application package.
$ mkdir -p security && \ cp data-plane-public-cert.pem security/clients.pem
This certificate and key will be used to send requests to Vespa Cloud. See the security model for more details.
Create the application package:
$ zip -r application.zip . \ -x application.zip "ext/*" README.md .gitignore ".git/*"
application.zip
is the artifact to be deployed in next steps.
Create a tenant in the Vespa Cloud:
Create a tenant at console.vespa-cloud.com (unless you already have one).
Create and deploy the application:
Click Create Application.
Use "myapp" as application name, leave the defaults.
Make sure Dev is selected, and upload application.zip
.
The first deployment will take a few minutes while nodes are provisioned. Subsequent deployments on existing nodes will be quicker.
Verify the application endpoint:
$ ENDPOINT=https://name.myapp.tenant-name.aws-us-east-1c.dev.z.vespa-app.cloud/
$ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem $ENDPOINT
Find the endpoint in the console output, set it for later use and test it. You can also do this in a browser. Sample output:
{ "handlers" : [ { "id" : "com.yahoo.search.handler.SearchHandler", "class" : "com.yahoo.search.handler.SearchHandler", "bundle" : "container-search-and-docproc:8.57.18", "serverBindings" : [ "http://*/search/*" ] } ...
Write documents:
$ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \ -H "Content-Type:application/json" \ --data-binary @ext/A-Head-Full-of-Dreams.json \ $ENDPOINT/document/v1/mynamespace/music/docid/a-head-full-of-dreams
$ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \ -H "Content-Type:application/json" \ --data-binary @ext/Love-Is-Here-To-Stay.json \ $ENDPOINT/document/v1/mynamespace/music/docid/love-is-here-to-stay
$ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \ -H "Content-Type:application/json" \ --data-binary @ext/Hardwired...To-Self-Destruct.json \ $ENDPOINT/document/v1/mynamespace/music/docid/hardwired-to-self-destruct
This writes documents using /document/v1.
Send queries:
curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \ -X POST -H "Content-Type: application/json" --data ' { "yql": "select * from music where true", "ranking": { "profile": "rank_albums", "features": { "query(user_profile)": "{{cat:pop}:0.8,{cat:rock}:0.2,{cat:jazz}:0.1}" } } }' \ $ENDPOINT/search/
Query with a user profile to get album recommendations using the Query API.
dev
are removed 7 days after you last deployed it.
You can extend the expiry time in the Vespa Console.
Read more.