Getting to Production

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.

1. Understand prod deployments

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.

2. Add tests to your application

Here we are using the files that fit with album recommendation the application used in getting started.

  1. 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.

  2. If you haven't, update the tenant and application properties in pom.xml to match the names of your tenant and application.

  3. 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-tests/src/test/java/ai/vespa/example in sample-apps.

Refer to developing tests to create your own tests.

3. Add a deployment descriptor to your application

Create a deployment.xml file in src/main/application containing

<deployment version="1.0">
        <region active="true">aws-us-east-1c</region>

4. Build and submit the application revision

Now you are ready to build and submit the application revision:

  1. Add the Vespa Cloud compile version to the application package:

    $ mvn vespa:compileVersion -DapiKeyFile=$HOME/Downloads/TENANTNAME.pem
  2. Compile the application package with test artifacts:

    $ mvn package -Dvespa.compile.version="$(cat target/vespa.compile.version)"
  3. 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.

Next steps

The Vespa Cloud application is now running in a production zone. Congratulations! After this you can further enhance the production application:

  1. To have redundancy for business continuity, consider setting up multiple production zones in deployment.xml, and use a global endpoint for queries.

  2. To create more tests to protect your production deployments, see developing tests.

  3. 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.

Removing a production instance

Follow the guide at deleting an application to remove instances or applications from production.