This guide assumes you have deployed an application to the dev
zone as detailed in getting started.
Prerequisites: git, openssl, JDK 11 or higher, mvn 3.6 or higher.
While applications in the dev
zone are deployed manually by a developer,
deployments to prod
zones should happen automatically on source changes
by creating a build job in your preferred continuous build tool that
builds the application and submits it to Vespa for production roll-out.
To make this safe the application needs tests that validate it. These tests are executed automatically on each deployment. See automated deployments for more details.
Here we are using the files that fit with album recommendation the application used in getting started.
If you don't have it, add a pom.xml
file to the application root.
This is the Maven project configuration, and is needed to build with the Vespa Cloud test framework.
See this this example.
If you haven't, update the tenant
and application
properties in pom.xml
to match the names of your tenant and application.
<properties> ... <tenant>MYTENANT</tenant> <application>MYAPP</tenant> </properties>
Add the tests that build the test framework.
These tests reside in the src/test/java
directory of the application.
You can copy the sample tests in
album-recommendation-prod/src/test/java/ai/vespa/example
in sample-apps.
Refer to developing tests to create your own tests.
Create a deployment.xml
file in src/main/application
containing
<deployment version="1.0"> <prod> <region active="true">aws-us-east-1c</region> </prod> </deployment>
Now you are ready to build and submit the application revision:
Add the Vespa Cloud compile version to the application package:
$ mvn vespa:compileVersion -DapiKeyFile=$HOME/Downloads/TENANTNAME.pem
Compile the application package with test artifacts:
$ mvn package -Dvespa.compile.version="$(cat target/vespa.compile.version)"
Submit the application package to Vespa Cloud for deployment:
$ mvn vespa:submit -DapiKeyFile=$HOME/Downloads/TENANTNAME.pem
The application revision is now being tested and (if successful) deployed to the production zones prescribed in your deployment.xml.
You can track deployment progress and view logs in the console.
It is always safe to submit a new revision of your application. You should now configure a continuous build job in your preferred build tool to perform these three commands whenever a change to your application source is checked in and merged.
The Vespa Cloud application is now running in a production zone. Congratulations! After this you can further enhance the production application:
To have redundancy for business continuity, consider setting up multiple production zones in deployment.xml, and use a global endpoint for queries.
To create more tests to protect your production deployments, see developing tests.
Don't forget to set up a continuous build to initiate automatic deployment of changes to your application by running the three commands above. See an example usiung GitHub actions here.
Follow the guide at deleting an application to remove instances or applications from production.