An application package is a set of files in a specific structure that defines a deployable application. An application package contains all the configuration, components and auxiliary files needed to specify how a given cloud config-enabled set of subsystems should behave to run the application. The application package can also have Java components that implement parts of the application running in a Vespa container.
The Vespa application is hence fully defined by its application package - all code and config is there.
Changes to code and configuration is atomically deployed to running instances. To ensure code and config consistency, config definition files are compiled to Java code, discrepancies causes build failures, which is easier to manage than production errors. Read more in configuring components.
The application package is a directory with the same name as the application, containing at minimum:
application/services.xml - mandatory specification of services required application/hosts.xml - mapping of host ids to physical hostsAdditionally, services.xml might consume other files or directories from the application package - a quick summary of optional content (see the reference for a full list):
application/components/ - OSGi components to be deployed to container nodes. See component types application/searchdefinitions/ - Vespa document schemas, and optionally how to search them application/search/query-profiles/ - Vespa query profiles; named collections of search request parameters
Most application packages are stored as source code in a code repository. However, some resources are generated and/or too large to store in a code repository, like an FSA. See below for how to use the url config type to download resources to container nodes.
Deploy the application package using vespa-deploy. The application package is validated at deploy, and destructive changes blocked. To allow such changes to pass the validation in deploy prepare, add validation-overrides.xml. Making changes to search definitions (e.g. add a field) is followed by a deployment to the application instance. Most such changes do not require restarts or re-indexing, if they do, deployment fails, and a validation override is required. Use deploy to:
- prepare: Upload, validate and distribute to nodes
- activate: Waits for prepare to complete before activation. Activate on nodes - this reloads the application bundles, while serving.
During development it can also be handy to just wipe the state of Vespa completely and start over:
The application package can have components and other large files. At vespa-deploy prepare, these files are distributed to the nodes:
- Components (i.e bundles)
- Files with type path and url in config, see Adding files to the component configuration
- Constant tensors
Use vespa-status-filedistribution to check if files have been distributed to all the hosts.
services.xml specifies the services that makes the application - each top-level element specifies one service. Example:
<?xml version="1.0" encoding="utf-8" ?> <services version="1.0"> <container id="default" version="1.0"> <processing/> <!-- Request-response processors go here. --> <search/> <!-- Use to run the search middleware. Searchers go here. --> <docproc/> <!-- Use to run the document processing middleware. DocumentProcessors go here. --> <nodes> <!-- Nodes in the container cluster --> <node hostalias="node1"/> <node hostalias="node2"/> <node hostalias="node3"/> </nodes/> </container> <content id="my-content" version="1.0"> <redundancy>1</redundancy> <documents> <!-- Add document schemas here --> <document type="my-searchable-type" mode="index"/> <document type="my-other-type" mode="streaming"/> </documents> <nodes> <!-- # nodes in the content cluster --> <node hostalias="node4"/> <node hostalias="node5"/> <node hostalias="node6"/> </nodes/> </content> </services>Refer to the services.xml reference for different service types and configuration. The application package may also specify arbitrary binaries to be started and given configuration specified explicitly in the services file, see application-specific services.
The application's custom Java code (in components) is configured in services.xml. E.g, a port number for a remote service:
<container id="default" version="1.0"> <handler id="com.myapp.vespatest.ConfiguredHandler"> <config name="vespatest.port"> <port>12345</port> </config>Read more in configuring components.