Relationships

Last updated 12th February 2021

Objective

The relationships block defines how services are mapped within your application. By default, your application may not talk to any other container within a project. To access another container you must define a relationship to it.

Relationships Diagram

Each relationship has an arbitrary name, although by convention the primary SQL database of an application (if any) is usually database. That is the name by which the relationship will be known in the PLATFORM_RELATIONSHIPS environment variable, which will include credentials for accessing the service.

The relationship is specified in the form service_name:endpoint_name. The "service name" is the name of the service given in .platform/services.yaml, or the name of another application in the same project (that is, the name property of the .platform.app.yaml file for that application).

The "endpoint" is the exposed functionality of the service to use. For most services the endpoint is the same as the service type. On a few services (i.e. MariaDB and Solr) you can define additional explicit endpoints for multiple databases and cores in your services.yaml file, and you will need to match those endpoints in your relationships. See the Services documentation for a full list of currently supported service types and service endpoints.

How do I get access to multiple services?

In the following example, there is a single MySQL service named mysqldb offering two databases, a Redis cache service named rediscache, and an Elasticsearch service named searchserver.

relationships:
    database: 'mysqldb:db1'
    database2: 'mysqldb:db2'
    cache: 'rediscache:redis'
    search: 'searchserver:elasticsearch'

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.


These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices exclude VAT. VAT may vary according to the customer's country of residence.