Getting to Production

This guide assumes you have deployed an application to the dev zone as detailed in getting started.

Prerequisites:

To get to production with an application with custom Java code, see getting to production with Java.

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. This is done by creating a build job in a continuous build tool that builds the application and submits it to Vespa Cloud 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

The album recommendation sample application, used in getting started, already contains some sample tests. Now it is time to review the HTTP testing reference, and update the tests in src/test/application to match your src/main/application.

With the Vespa CLI, it is easy deploy your application to dev, and run tests against that deployment:

$ vespa deploy --wait 600
$ vespa test src/test/application/tests/system-test

3. Add a deployment descriptor to your application

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 file in src/main/application containing

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

4. Build and submit the application revision

Now you are ready to build and submit the application revision—with the Vespa CLI, run:

$ vespa prod submit

This packages the application and its tests as separate zip archives, and uploads them to Vespa Cloud.

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 this command whenever a change to the application source is made.

Manual submission

To build and submit without the Vespa CLI, create the zip archives, and upload through the console:

$ (cd src/main/application && zip -r ../../../application.zip .)
$ (cd src/test/application && zip -r ../../../application-test.zip .)

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 submit command above. See an example using GitHub actions.

Removing a production instance

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