Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service default/explicit endpoint definition #4063

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7444609
Slight updates on the clickhouse service page
thomasdiluccio Apr 24, 2024
9841a6d
adding explicit and default endpoint def for add-services
flovntp Apr 29, 2024
2813eea
adding explicit and default endpoint def for clickhouse
flovntp Apr 29, 2024
5d38efc
Upsun default/explicit service endpoint (stopped at memcached)
flovntp Jun 12, 2024
f4c29e8
Upsun default/explicit service endpoint (complete)
flovntp Jun 13, 2024
1fb22b7
refacto on explicit (with comment to legacy version)
flovntp Jun 17, 2024
c76c268
revert removing sites/upsun/.yaml file
flovntp Jun 17, 2024
5d52a31
Merge branch 'main' into fix-service-def-expl
flovntp Jun 17, 2024
81a84d0
remove legacy relationship definition
flovntp Jun 17, 2024
fa051d6
revert automatic removal of trailing space at the end of snippets (de…
flovntp Jun 17, 2024
2f2de53
P.sh changing link to service env variable
flovntp Jun 17, 2024
aa78aa9
P.sh changing dead link
flovntp Jun 17, 2024
947a90c
Merge branch 'main' into fix-service-def-expl
flovntp Jun 18, 2024
3922f3a
Apply consistency and remove cf to legacy syntax on Upsun side
AnouckColson Jun 19, 2024
fa095cd
Consistency -finishing touches
AnouckColson Jun 20, 2024
097dc1d
Merge branch 'main' into fix-service-def-expl
chadwcarlson Jul 10, 2024
ce923f3
Merge branch 'main' into fix-service-def-expl
chadwcarlson Jul 10, 2024
05441b8
Merge branch 'main' into fix-service-def-expl
chadwcarlson Jul 11, 2024
bc6c0f5
Merge branch 'main' into fix-service-def-expl
flovntp Jul 24, 2024
897fcdd
Merge branch 'main' into fix-service-def-expl
chadwcarlson Aug 5, 2024
775472f
remove service def from relationship def on Upsun side
flovntp Aug 7, 2024
453bbc9
align with .platform/applications.yaml config def
flovntp Aug 8, 2024
56684c5
indentation for snippets on Upsun
flovntp Aug 8, 2024
4ff0653
P.sh remove promotion of .platform/applications.yaml --> .platform.ap…
flovntp Aug 9, 2024
9e08dc3
indentation of Yaml snippets with 2 spaces (#4145)
flovntp Sep 4, 2024
172b77b
Merge branch 'main' into fix-service-def-expl
chadwcarlson Sep 4, 2024
a451c02
Merge branch 'main' into fix-service-def-expl
chadwcarlson Sep 27, 2024
5784e30
Merge branch 'main' into fix-service-def-expl
chadwcarlson Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 74 additions & 8 deletions sites/platform/src/add-services/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Configure your service in the following pattern:
```yaml {configFile="services"}
# The name of the service container. Must be unique within a project.
SERVICE_NAME:
type: {{<variable "SERVICE_TYPE" >}}:{{<variable "VERSION" >}}
type: <SERVICE_TYPE>:<VERSION>
# Other options...
```

Expand All @@ -48,7 +48,7 @@ postgresql:
```

This YAML file is a dictionary defining all of the services you want to use.
The top-level key is a custom service name ({{<variable "SERVICE_NAME" >}}; in the example, `mariadb` and `postgresql`), which you use to identify the service in step 2.
The top-level key is a custom service name (``<SERVICE_NAME>``: in the example, `mariadb` and `postgresql`), which you use to identify the service in step 2.

You can give it any name you want with lowercase alphanumeric characters, hyphens, and underscores.

Expand Down Expand Up @@ -102,17 +102,23 @@ This is done in your [app configuration for relationships](/create-apps/app-refe

The relationship follows this pattern:

{{< codetabs >}}

+++
title=Using default endpoints
+++

```yaml {configFile="app"}
# Other options...

# Relationships enable an app container's access to a service.
# The example below shows simplified configuration leveraging a default service (identified from the relationship name) and a default endpoint.
# See the Application reference for all options for defining relationships and endpoints.
relationships:
{{<variable "SERVICE_NAME" >}}:
<SERVICE_NAME>:
```

You can define `<SERVICE_NAME>` as you like, so long as it's unique between all defined services
You can define `<SERVICE_NAME>` as you like, so long as it's unique between all defined services
and matches in both the application and services configuration.

The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships.
Expand All @@ -122,8 +128,44 @@ That is, it uses default endpoints behind-the-scenes, providing a [relationship]
Depending on your needs, instead of default endpoint configuration,
you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships).

<--->

+++
title=Using explicit endpoints
+++

```yaml {configFile="apps"}
# Relationships enable access from this app to a given service.
# The example below shows configuration with an explicitly set service name and endpoint.
# See the Application reference for all options for defining relationships and endpoints.
# Note that legacy definition of the relationship is still supported.
# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships
relationships:
<RELATIONSHIP_NAME>:
service: <SERVICE_NAME>
endpoint: <ENDPOINT_NAME>
```

You can define ``<SERVICE_NAME>`` and ``<RELATIONSHIP_NAME>`` as you like, so long as it's unique between all defined services and relationships
and matches in both the application and services configuration. `<ENDPOINT_NAME>` is the endpoint your app will use to connect to the service (refer to the service reference to know which value to use).

The example above leverages [explicit endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships.

Depending on your needs, instead of explicit endpoint configuration,
you can use [default endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships).

With the above definition, the application container now has access to the service via the relationship `<RELATIONSHIP_NAME>` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables).

{{< /codetabs >}}

An example relationship to connect to the databases given in the [example in step 1](#1-configure-the-service):

{{< codetabs >}}

+++
title=Using default endpoints
+++

```yaml {configFile="app"}
# Other options...

Expand All @@ -133,6 +175,31 @@ relationships:
postgresql:
```

<--->

+++
title=Using explicit endpoints
+++

```yaml {configFile="app"}
# Other options...

# Relationships enable access from this app to a given service.
# The example below shows configuration with explicitly set service names and endpoints.
# See the Application reference for all options for defining relationships and endpoints.
# Note that legacy definition of the relationship is still supported.
# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships
relationships:
mariadb:
service: mariadb
endpoint: mysql
postgresql:
service: postgresql
endpoint: mysql
```

{{< /codetabs >}}

```yaml {configFile="services"}
mariadb:
type: mariadb:{{% latest "mariadb" %}}
Expand Down Expand Up @@ -201,7 +268,6 @@ Connecting to a service using an SSH tunnel is a two-step process.

### 1. Obtain service credentials


To get the credentials for a given service, run the following command:

```bash
Expand Down Expand Up @@ -258,10 +324,10 @@ With the example above, you connect to a URL like the following:

## Upgrading services

{{% vendor/name %}} provides a large number of [managed service versions](#available-services).
{{% vendor/name %}} provides a large number of [managed service versions](#available-services).
As new versions are made available, you will inevitably upgrade infrastructure to a more recent (or latest version).

When you do so, we would recommend:

1. **Use preview environments**. Leverage preview (non-production environments) to perform the upgrade, then merge the upgrade into production (promotion). This will give you an opportunity to test inherited production data in a safe, isolated environment first.
1. **Upgrade progressively**. For one reason or another, you may be more than a single version behind the upgrade you are trying to perform. To avoid data loss issues caused by large differences in versions, [upgrade one version at a time](https://www.rabbitmq.com/upgrade.html#rabbitmq-version-upgradability).
1. **Use preview environments**. Leverage preview (non-production environments) to perform the upgrade, then merge the upgrade into production (promotion). This will give you an opportunity to test inherited production data in a safe, isolated environment first.
1. **Upgrade progressively**. For one reason or another, you may be more than a single version behind the upgrade you are trying to perform. To avoid data loss issues caused by large differences in versions, [upgrade one version at a time](https://www.rabbitmq.com/upgrade.html#rabbitmq-version-upgradability).
82 changes: 72 additions & 10 deletions sites/platform/src/add-services/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ If you use one of the following frameworks, follow its guide:
From version 7.11 onward:

{{% note title="Premium Service" theme="info" %}}
Elasticsearch isn’t included in any {{< vendor/name >}} plan.
You need to add it separately at an additional cost.
Elasticsearch isn’t included in any {{< vendor/name >}} plan.
You need to add it separately at an additional cost.
To add Elasticsearch, [contact Sales](https://platform.sh/contact/).
{{% /note %}}

Expand All @@ -52,7 +52,7 @@ The following premium versions are supported:

You can select the major and minor version.

Patch versions are applied periodically for bug fixes and the like.
Patch versions are applied periodically for bug fixes and the like.
When you deploy your app, you always get the latest available patches.

## Deprecated versions
Expand Down Expand Up @@ -100,7 +100,7 @@ Note that the information about the relationship can change when an app is redep
"hostname": "azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}",
"port": 9200,
"cluster": "azertyuiopqsdf-main-7rqtwti",
"host": "essearch.internal",
"host": "elasticsearch.internal",
"rel": "elasticsearch",
"path": null,
"query": [],
Expand Down Expand Up @@ -128,23 +128,29 @@ To define the service, use the `elasticsearch` type:

If you’re using a [premium version](add-services/elasticsearch.md#supported-versions), use the `elasticsearch-enterprise` type instead.

Note that changing the name of the service replaces it with a brand new service and all existing data is lost.
Note that changing the name of the service replaces it with a brand new service and all existing data is lost.
Back up your data before changing the service.

### 2. Add the relationship

To define the relationship, use the following configuration:

{{< codetabs >}}

+++
title=Using default endpoints
+++

```yaml {configFile="apps"}
# Relationships enable access from this app to a given service.
# The example below shows simplified configuration leveraging a default service
# (identified from the relationship name) and a default endpoint.
# See the Application reference for all options for defining relationships and endpoints.
relationships:
<SERVICE_NAME>:
<SERVICE_NAME>:
```

You can define `<SERVICE_NAME>` as you like, so long as it's unique between all defined services
You can define `<SERVICE_NAME>` as you like, so long as it's unique between all defined services
and matches in both the application and services configuration.

The example above leverages [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships.
Expand All @@ -154,8 +160,38 @@ That is, it uses default endpoints behind-the-scenes, providing a [relationship]
Depending on your needs, instead of default endpoint configuration,
you can use [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships).

With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `<SERVICE_NAME>` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables).

<--->

+++
title=Using explicit endpoints
+++

```yaml {configFile="apps"}
# Relationships enable access from this app to a given service.
# The example below shows configuration with an explicitly set service name and endpoint.
# See the Application reference for all options for defining relationships and endpoints.
# Note that legacy definition of the relationship is still supported.
# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships
relationships:
<RELATIONSHIP_NAME>:
service: <SERVICE_NAME>
endpoint: elasticsearch
```

You can define ``<SERVICE_NAME>`` and ``<RELATIONSHIP_NAME>`` as you like, so long as it's unique between all defined services and relationships
and matches in both the application and services configuration.

The example above leverages [explicit endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships.

Depending on your needs, instead of explicit endpoint configuration,
you can use [default endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships).

With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `<RELATIONSHIP_NAME>` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables).

{{< /codetabs >}}

### Example configuration

### [Service definition](/add-services.html)
Expand All @@ -167,19 +203,45 @@ elasticsearch:
disk: 256
```

If you're using a [premium version](add-services/elasticsearch.md#supported-versions),
use the `elasticsearch-enterprise` type in the service definition.

#### [App configuration](/create-apps/_index.md)

{{< codetabs >}}

+++
title=Using default endpoints
+++

```yaml {configFile="apps"}
# Relationships enable access from this app to a given service.
# The example below shows simplified configuration leveraging a default service
# (identified from the relationship name) and a default endpoint.
# See the Application reference for all options for defining relationships and endpoints.
relationships:
elasticsearch:
elasticsearch:
```

If you're using a [premium version](add-services/elasticsearch.md#supported-versions),
use the `elasticsearch-enterprise` type in the service definition.
<--->

+++
title=Using explicit endpoints
+++

```yaml {configFile="apps"}
# Relationships enable access from this app to a given service.
# The example below shows configuration with an explicitly set service name and endpoint.
# See the Application reference for all options for defining relationships and endpoints.
# Note that legacy definition of the relationship is still supported.
# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships
relationships:
elasticsearch:
service: elasticsearch
endpoint: elasticsearch
```

{{< /codetabs >}}

### Use in app

Expand Down
Loading
Loading