This guide assumes you have deployed an application to the
zone as detailed in getting started.
To get to production without custom Java code, see getting to production.
While applications in the
dev zone are deployed manually by a developer,
prod zones should happen automatically on source changes.
This is done by creating a build job in your preferred continuous build tool that
builds the application and submits it to Vespa Cloud for production roll-out.
GitHub Actions example.
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.
album recommendation Java sample application,
used in getting started with Java, already contains some sample tests.
Now it is time to review the Java testing reference,
and update the tests in
src/test/java to match your
Ensure you have set tenant, application and instance consistently with Vespa CLI and in
(instance will be specified as an argument to
mvn test), as per the getting started guide.
Then it is easy to build and deploy your application, and run tests against that deployment
$ mvn package && \ vespa deploy --wait 600
$ mvn test -D test.categories=system -D instance=my-instance
The Vespa CLI can be used to initialize your application for deployment to production:
$ vespa prod init
To do it by hand, create a deployment.xml
<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:
Find a Vespa version to compile your custom Java code against, which is compatible with your current (and later) runtime in production:
$ mvn vespa:compileVersion -DapiKeyFile=$HOME/Downloads/TENANTNAME.pem
The API key is either the key generated in the getting-started guide with Vespa CLI, or one generated in the Vespa Cloud console. Prefer an application API key for CI jobs, as these have fewer privileges—see security model for details.
Compile and build the application package and test bundle:
$ 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 in deployment.xml.
Track deployment progress and view logs in the console.
With good tests, it is always safe to submit a new revision of your application. You should now configure a continuous build job in your preferred build service to run 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 create more tests to protect your production deployments, see developing tests.