From 7444609b4e8b1787ae60991f10f0ec0e83e73ad4 Mon Sep 17 00:00:00 2001 From: Thomas di Luccio Date: Wed, 24 Apr 2024 14:15:25 +0200 Subject: [PATCH 01/22] Slight updates on the clickhouse service page --- sites/upsun/src/add-services/clickhouse.md | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index 68948d8801..c875485910 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -34,23 +34,23 @@ title= Service environment variables {{% service-values-change %}} ```bash -CLICKHOUSEDATABASE_USERNAME=main -CLICKHOUSEDATABASE_FRAGMENT= -CLICKHOUSEDATABASE_IP=123.456.78.90 -CLICKHOUSEDATABASE_CLUSTER=azertyuiop-main-afdwftq -CLICKHOUSEDATABASE_HOST=clickhousedatabase.internal -CLICKHOUSEDATABASE_PATH=main -CLICKHOUSEDATABASE_QUERY={'is_master': True} -CLICKHOUSEDATABASE_PASSWORD=ChangeMe -CLICKHOUSEDATABASE_PORT=9000 -CLICKHOUSEDATABASE_HOST_MAPPED=false -CLICKHOUSEDATABASE_SERVICE=clickhouse -CLICKHOUSEDATABASE_HOSTNAME=azertyuiopqsdfghjklm.clickhouse.service._.eu-1.{{< vendor/urlraw "hostname" >}} -CLICKHOUSEDATABASE_EPOCH=0 -CLICKHOUSEDATABASE_REL=clickhouse -CLICKHOUSEDATABASE_SCHEME=clickhouse -CLICKHOUSEDATABASE_TYPE=clickhouse:24 -CLICKHOUSEDATABASE_PUBLIC=false +CLICKHOUSE_USERNAME=main +CLICKHOUSE_FRAGMENT= +CLICKHOUSE_IP=123.456.78.90 +CLICKHOUSE_CLUSTER=azertyuiop-main-afdwftq +CLICKHOUSE_HOST=clickhouse.internal +CLICKHOUSE_PATH=main +CLICKHOUSE_QUERY={'is_master': True} +CLICKHOUSE_PASSWORD=ChangeMe +CLICKHOUSE_PORT=9000 +CLICKHOUSE_HOST_MAPPED=false +CLICKHOUSE_SERVICE=clickhouse +CLICKHOUSE_HOSTNAME=azertyuiopqsdfghjklm.clickhouse.service._.eu-1.{{< vendor/urlraw "hostname" >}} +CLICKHOUSE_EPOCH=0 +CLICKHOUSE_REL=clickhouse +CLICKHOUSE_SCHEME=https/http +CLICKHOUSE_TYPE=clickhouse:24 +CLICKHOUSE_PUBLIC=false ``` <---> @@ -68,7 +68,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "fragment": null, "ip": "123.456.78.90", "cluster": "azertyuiop-main-afdwftq", - "host": "clickhousedatabase.internal", + "host": "clickhouse.internal", "path": "main", "query": { "is_master": true @@ -80,7 +80,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "hostname": "azertyuiopqsdfghjklm.clickhouse.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "epoch": 0, "rel": "clickhouse", - "scheme": "clickhouse", + "scheme": "https", "type": "clickhouse:24", "public": false } @@ -94,7 +94,7 @@ in a [`.environment` file](/development/variables/set-variables.md#use-env-files export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_CLICKHOUSE_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.clickhousedatabase[0].host')" +export APP_CLICKHOUSE_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.clickhouse[0].host')" ``` {{< /codetabs >}} @@ -139,7 +139,7 @@ services: type: clickhouse: ``` -You can define ```` and ```` as you like, but it’s best if they’re distinct. +You can define ```` and ```` as you like, but it's best if they're distinct. With this definition, the application container (````) now has access to the service via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). #### `clickhouse-http` endpoint @@ -163,7 +163,7 @@ services: type: clickhouse: ``` -You can define ```` and ```` as you like, but it’s best if they’re distinct. +You can define ```` and ```` as you like, but it's best if they're distinct. With this definition, the application container (````) now has access to the service via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). ### Example configuration @@ -183,7 +183,7 @@ applications: root: "myapp" # Relationships enable an app container's access to a service. relationships: - clickhousedatabase: "clickhouse:clickhouse" + clickhouse: "clickhouse:clickhouse" services: # The name of the service container. Must be unique within a project. type: clickhouse:24 @@ -204,7 +204,7 @@ applications: root: "myapp" # Relationships enable an app container's access to a service. relationships: - clickhousedatabase: "clickhouse:clickhouse-http" + clickhouse: "clickhouse:clickhouse-http" services: # The name of the service container. Must be unique within a project. type: clickhouse:24 @@ -250,4 +250,3 @@ services: privileges: legacy: rw ``` - From 9841a6dd942533370bd215dcfca642977f3502c5 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 29 Apr 2024 11:35:54 +0200 Subject: [PATCH 02/22] adding explicit and default endpoint def for add-services --- sites/upsun/src/add-services/_index.md | 72 ++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index 8938508d05..7f55f4c962 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -82,6 +82,12 @@ For more information, see how to [manage resources](/manage-resources.md). To connect the service, use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -101,7 +107,7 @@ services: # Other options... ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -111,8 +117,45 @@ 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="app"} +applications: + # The name of the app container. Must be unique within a project. + {{}}: + # ... + relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}} + # OR as a shorter notation + {{% variable "RELATIONSHIP_NAME" %}}: {{% variable "SERVICE_NAME" %}}:{{% variable "ENDPOINT_NAME" %}} + +services: + # The name of the service container. Must be unique within a project. + {{}}: + type: {{}}:{{}} + # Other options... +``` + +- `RELATIONSHIP_NAME` is the name you want to give to the relationship. +- `SERVICE_NAME` is the name of the service as defined in the `services` section. +- `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). + +{{< /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="apps"} applications: # The name of the app container. Must be unique within a project. @@ -127,10 +170,31 @@ services: type: postgresql:{{% latest "postgresql" %}} ``` +<---> + ++++ +title=Using explicit endpoints ++++ +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + {{}}: + relationships: + database: mariadb:mysql + database2: postgresql:postgresql +services: + mariadb: + type: mariadb:{{% latest "mariadb" %}} + postgresql: + type: postgresql:{{% latest "postgresql" %}} +``` + As with the service name, you can give the relationship any name you want with lowercase alphanumeric characters, hyphens, and underscores. It helps if the service name and relationship name are different, but it isn't required. +{{< /codetabs >}} + Each service offers one or more endpoints for connections, depending on the service. An endpoint is a named set of credentials to give access to other apps and services in your project. If you don't specify one in the [service configuration](#service-options), a default endpoint is created. @@ -243,10 +307,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). From 2813eeafa5a772f2421c625420c5d765ae409555 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 29 Apr 2024 11:36:07 +0200 Subject: [PATCH 03/22] adding explicit and default endpoint def for clickhouse --- sites/upsun/src/add-services/clickhouse.md | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index c875485910..9cb6af690a 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -125,6 +125,32 @@ This protocol is used by ClickHouse apps and processes such as `clickhouse-serve Use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + # Relationships enable access from this app to a given service. + relationships: + : + +services: + # The name of the service container. Must be unique within a project. + : + type: clickhouse: +``` +You can define ```` as you like. +<---> + ++++ +title=Using explicit endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -140,6 +166,9 @@ services: ``` You can define ```` and ```` as you like, but it's best if they're distinct. + +{{< /codetabs >}} + With this definition, the application container (````) now has access to the service via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). #### `clickhouse-http` endpoint @@ -148,6 +177,33 @@ The `clickhouse-http` endpoint allows you to use the HTTP API Port for HTTP requ This protocol is used by [JDBC](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/), [ODBC](https://learn.microsoft.com/en-us/sql/odbc/microsoft-open-database-connectivity-odbc?view=sql-server-ver16), and web interfaces. Use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + # Relationships enable access from this app to a given service. + relationships: + : + +services: + # The name of the service container. Must be unique within a project. + : + type: clickhouse: +``` + +You can define ```` as you like. + +<---> + ++++ +title=Using explicit endpoints ++++ ```yaml {configFile="app"} applications: @@ -164,6 +220,9 @@ services: ``` You can define ```` and ```` as you like, but it's best if they're distinct. + +{{< /codetabs >}} + With this definition, the application container (````) now has access to the service via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). ### Example configuration @@ -210,6 +269,8 @@ services: type: clickhouse:24 ``` +If you want to change the ``clickhouse`` endpoint to ``clickhouse-http``, you need to use explicit endpoint definition as it defaults to ``clickhouse`` endpoint when using default endpoint (aka. {{% variable "SERVICE_NAME" %}} as relationship definition). + {{< /codetabs >}} ## Multiple databases From f4c29e876ce765862693399fa05932f0aa9ec3b7 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Thu, 13 Jun 2024 09:09:59 +0200 Subject: [PATCH 04/22] Upsun default/explicit service endpoint (complete) --- sites/upsun/src/add-services/mongodb.md | 274 ++++++++++++- .../upsun/src/add-services/network-storage.md | 16 +- sites/upsun/src/add-services/opensearch.md | 109 ++++- sites/upsun/src/add-services/postgresql.md | 162 +++++++- sites/upsun/src/add-services/rabbitmq.md | 108 ++++- sites/upsun/src/add-services/redis.md | 387 +++++++++++++++++- sites/upsun/src/add-services/solr.md | 114 +++++- 7 files changed, 1111 insertions(+), 59 deletions(-) diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index 4becfc90a5..586b653787 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -134,6 +134,11 @@ Note that changing the name of the service replaces it with a brand new service #### 2. Add the relationship To define the relationship, use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ ```yaml {configFile="apps"} applications: @@ -144,7 +149,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -161,50 +166,154 @@ 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 ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container (````) now has [access to the service](#use-in-app) via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":mongodb" +services: + # The name of the service container. Must be unique within a project. + : + type: mongodb-enterprise: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions.md) for the service: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="apps"} applications: # The name of the app container. Must be unique within a project. : - # PHP extensions. + # PHP extensions. runtime: extensions: - mongodb - # Relationships enable access from this app to a given service. + # 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: - : + : +services: + # The name of the service container. Must be unique within a project. + : + type: mongodb-enterprise: +``` + +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + : ":mongodb" services: # The name of the service container. Must be unique within a project. : type: mongodb-enterprise: ``` +{{< /codetabs >}} + #### Example configuration +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="apps"} applications: # The name of the app container. Must be unique within a project. myapp: + # PHP extensions. + runtime: + extensions: + - mongodb # 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: - mongodb-enterprise: + mongodb-enterprise: +services: + # The name of the service container. Must be unique within a project. + mongodb-enterprise: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} +``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + mongodb-enterprise: "mongodb-enterprise:mongodb" services: # The name of the service container. Must be unique within a project. mongodb-enterprise: type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` +{{< /codetabs >}} + ### Legacy edition example #### 1. Configure the service @@ -222,6 +331,12 @@ Note that changing the name of the service replaces it with a brand new service #### 2. Add the relationship +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -231,7 +346,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -248,54 +363,164 @@ 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 ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container (````) now has [access to the service](#use-in-app) via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":mongodb" +services: + # The name of the service container. Must be unique within a project. + : + type: mongodb: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions.md) for the service: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : - # PHP extensions. + # PHP extensions. runtime: extensions: - mongodb - # Relationships enable access from this app to a given service. + # 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: - : + : +services: + # The name of the service container. Must be unique within a project. + : + type: mongodb: +``` + +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + : ":mongodb" services: # The name of the service container. Must be unique within a project. : type: mongodb: ``` +{{< /codetabs >}} + #### Example configuration +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. myapp: + # PHP extensions. + runtime: + extensions: + - mongodb # 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: - mongodb: + mongodb: +services: + # The name of the service container. Must be unique within a project. + mongodb: + type: mongodb:4.0.3 +``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + mongodb: "mongodb:mongodb" services: # The name of the service container. Must be unique within a project. mongodb: type: mongodb:4.0.3 ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -309,12 +534,37 @@ applications: # Relationships enable an app container's access to a service. relationships: mongodb: +service: + mongodb: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} +``` + +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "/" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + mongodb: "mongodb:mongodb" service: mongodb: type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `mongodb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). diff --git a/sites/upsun/src/add-services/network-storage.md b/sites/upsun/src/add-services/network-storage.md index f3fc5a9186..a6d614c978 100644 --- a/sites/upsun/src/add-services/network-storage.md +++ b/sites/upsun/src/add-services/network-storage.md @@ -52,7 +52,7 @@ services: This is due to the fact that `` is used as hostname for the network storage. -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 mount @@ -63,7 +63,7 @@ To define the mount accessible by your application, use the following configurat applications: # The name of the app container. Must be unique within a project. : - mounts: + mounts: '': source: service service: @@ -88,7 +88,7 @@ services: applications: # The name of the app container. Must be unique within a project. myapp: - mounts: + mounts: 'my/files': source: service service: network-storage @@ -119,7 +119,7 @@ applications: # The location of the application's code. source: root: "app1" - + [...] mounts: @@ -137,7 +137,7 @@ applications: # The location of the application's code. source: root: "app2" - + [...] mounts: @@ -149,9 +149,9 @@ applications: service: network-storage # Specifies where your mount points inside the external directory that is mounted to your app container. # Since the target is the uploads directory app1's mount already points to, - # the network storage service is effectively shared between app1 and app2. + # the network storage service is effectively shared between app1 and app2. source_path: uploads/incoming - # The path to your mount within the app container (relative to the app's root). + # The path to your mount within the app container (relative to the app's root). 'done': # Specifies that the mount points to a network storage service that can be shared between apps. source: service @@ -159,7 +159,7 @@ applications: service: network-storage # Specifies where your mount points inside the external directory that is mounted to your app container. # Since the target is the uploads directory app1's mount already points to, - # the network storage service is effectively shared between app1 and app2. + # the network storage service is effectively shared between app1 and app2. source_path: uploads/done ``` diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index 31831d3468..641ffbd948 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -133,6 +133,12 @@ Note that changing the name of the service replaces it with a brand new service To define the relationship, use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -142,7 +148,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -159,10 +165,50 @@ 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 ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container (````) now has [access to the service](#use-in-app) via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":opensearch" +services: + # The name of the service container. Must be unique within a project. + : + type: opensearch: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -172,18 +218,47 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - opensearch: + opensearch: +services: + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} +``` + +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # 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: + opensearch: "opensearch:opensearch" services: # The name of the service container. Must be unique within a project. opensearch: - type: opensearch:2 + type: opensearch:{{% latest "opensearch" %}} ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -197,13 +272,39 @@ applications: # Relationships enable an app container's access to a service. relationships: opensearch: +services: + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + [...] + + # Relationships enable an app container's access to a service. + relationships: + opensearch: "opensearch:opensearch" services: # The name of the service container. Must be unique within a project. opensearch: type: opensearch:{{% latest "opensearch" %}} ``` +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index 1e0c40808e..f59231e2cd 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -128,6 +128,12 @@ Note that changing the name of the service replaces it with a brand new service To define the relationship, use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -137,7 +143,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -154,54 +160,164 @@ 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 via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container (````) now has access to the service via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="services"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":postgresql" +services: + # The name of the service container. Must be unique within a project. + : + type: postgresql: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions) for the service: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="apps"} applications: # The name of the app container. Must be unique within a project. : - # PHP extensions. + # PHP extensions. runtime: extensions: - pdo_pgsql - # Relationships enable access from this app to a given service. + # 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: - : + : +services: + # The name of the service container. Must be unique within a project. + : + type: postgresql: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ +```yaml {configFile="apps"} +applications: + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + # 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: + : ":postgresql" services: # The name of the service container. Must be unique within a project. : type: postgresql: ``` +{{< /codetabs >}} + ### Example configuration +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. myapp: + # PHP extensions. + runtime: + extensions: + - pdo_pgsql # 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: - postgresql: + postgresql: +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} +``` + +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + # 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: + postgresql: "postgresql:postgresql" services: # The name of the service container. Must be unique within a project. postgresql: - type: postgresql:16 + type: postgresql:{{% latest "postgresql" %}} ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -215,13 +331,39 @@ applications: # Relationships enable an app container's access to a service. relationships: postgresql: +services: + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} +``` + +<---> + ++++ +title=Using explicit endpoints ++++ +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + postgresql: "postgresql:postgresql" services: # The name of the service container. Must be unique within a project. postgresql: - type: postgresql:16 + type: postgresql:{{% latest "postgresql" %}} ``` +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `postgresql` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). @@ -393,10 +535,10 @@ applications: [...] relationships: - database: + database: service: postgresql endpoint: admin - reports: + reports: service: postgresql endpoint: reporter imports: diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index f05c539792..f5e246b4f7 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -122,6 +122,12 @@ Note that changing the name of the service replaces it with a brand new service To define the relationship, use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -131,7 +137,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -148,10 +154,50 @@ 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 via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container (````) now has access to the service via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="services"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":rabbitmq" +services: + # The name of the service container. Must be unique within a project. + : + type: rabbitmq: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -161,18 +207,47 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - rabbitmq: + rabbitmq: +services: + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} +``` + +<---> + ++++ +title=Using explicit endpoints ++++ +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # 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: + rabbitmq: "rabbitmq:rabbitmq" services: # The name of the service container. Must be unique within a project. rabbitmq: type: rabbitmq:{{% latest "rabbitmq" %}} ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -180,18 +255,43 @@ applications: # The location of the application's code. source: root: "myapp" - + [...] # Relationships enable an app container's access to a service. relationships: rabbitmq: +services: + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + [...] + + # Relationships enable an app container's access to a service. + relationships: + rabbitmq: "rabbitmq:rabbitmq" services: # The name of the service container. Must be unique within a project. rabbitmq: type: rabbitmq:{{% latest "rabbitmq" %}} ``` +{{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `rabbitmq` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index fe86b35df7..4c0a42150e 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -164,13 +164,19 @@ Back up your data before changing the service. To define the relationship, use the `redis` endpoint : +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + [...] # Relationships enable access from this app to a given service. @@ -189,44 +195,113 @@ The example above leverages [default endpoint](/create-apps/app-reference/single 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="services"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":redis" +services: + # The name of the service container. Must be unique within a project. + : + type: redis-persistent: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +{{< /codetabs >}} + For PHP, enable the [extension](/languages/php/extensions) for the service: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : - source: - root: "myapp" - - [...] - + # PHP extensions. runtime: extensions: - redis - # Relationships enable access from this app to a given service. relationships: : +services: + # The name of the service container. Must be unique within a project. + : + type: redis-persistent: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - redis + # Relationships enable access from this app to a given service. + relationships: + : ":redis" services: # The name of the service container. Must be unique within a project. : type: redis-persistent: ``` +{{< /codetabs >}} + ### Configuration example +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + [...] + # PHP extensions. + runtime: + extensions: + - redis # Relationships enable access from this app to a given service. relationships: redis: @@ -237,29 +312,100 @@ services: type: redis-persistent:{{% latest "redis" %}} ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + # Relationships enable access from this app to a given service. + relationships: + redis: "redis:redis" + +services: + # The name of the service container. Must be unique within a project. + redis: + type: redis-persistent:{{% latest "redis" %}} +``` + +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + + # PHP extensions. + runtime: + extensions: + - redis + [...] # Relationships enable access from this app to a given service. relationships: redis: +services: + # The name of the service container. Must be unique within a project. + redis: + type: redis-persistent:{{% latest "redis" %}} +``` +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + # PHP extensions. + runtime: + extensions: + - redis + + [...] + + # Relationships enable access from this app to a given service. + relationships: + redis: "redis:redis" services: # The name of the service container. Must be unique within a project. redis: type: redis-persistent:{{% latest "redis" %}} ``` +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). @@ -322,13 +468,19 @@ Back up your data before changing the service. To define the relationship, use the `redis` endpoint : +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + [...] # Relationships enable access from this app to a given service. @@ -347,19 +499,60 @@ The example above leverages [default endpoint](/create-apps/app-reference/single 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="services"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":redis" +services: + # The name of the service container. Must be unique within a project. + : + type: redis: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +{{< /codetabs >}} + For PHP, enable the [extension](/languages/php/extensions) for the service: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + [...] + # PHP extensions. runtime: extensions: - redis @@ -367,57 +560,166 @@ applications: # Relationships enable access from this app to a given service. relationships: : +services: + # The name of the service container. Must be unique within a project. + : + type: redis: +``` + +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # Relationships enable access from this app to a given service. + relationships: + : ":redis" services: # The name of the service container. Must be unique within a project. : type: redis: ``` +{{< /codetabs >}} + ### Configuration example +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + [...] + # PHP extensions. + runtime: + extensions: + - redis + # Relationships enable access from this app to a given service. relationships: redis: +services: + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # Relationships enable access from this app to a given service. + relationships: + redis: "redis:redis" services: # The name of the service container. Must be unique within a project. redis: type: redis:{{% latest "redis" %}} ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. : source: root: "myapp" - + [...] + # PHP extensions. + runtime: + extensions: + - redis # Relationships enable access from this app to a given service. relationships: redis: +services: + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} +``` +<---> ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + # Relationships enable access from this app to a given service. + relationships: + redis: "redis:redis" services: # The name of the service container. Must be unique within a project. redis: type: redis:{{% latest "redis" %}} ``` +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). @@ -544,10 +846,10 @@ The following table presents the possible values: For more information on the different policies, see the official [Redis documentation](https://redis.io/docs/reference/eviction/). -## Access your Redis service +## Access your Redis service After you've [configured your Redis service](#usage-example), -you can access it using either the {{% vendor/name %}} CLI +you can access it using either the {{% vendor/name %}} CLI or through the [Redis CLI](https://redis.io/docs/ui/cli/). ### {{% vendor/name %}} CLI @@ -589,6 +891,12 @@ which means Redis stores and retrieves the data saved into sessions. To set up Redis as your session handler, add a configuration similar to the following: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -598,6 +906,11 @@ applications: type: "php:{{% latest "php" %}}" + # PHP extensions. + runtime: + extensions: + - redis + relationships: redissession: @@ -611,9 +924,51 @@ applications: '/': root: 'web' passthru: '/index.php' - + +services: + # The name of the service container. Must be unique within a project. + redissession: + type: "redis-persistent:{{% latest "redis" %}}" +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + source: + root: "myapp" + + type: "php:{{% latest "php" %}}" + + # PHP extensions. + runtime: + extensions: + - redis + + relationships: + redissession: "redissession:redis" + + variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" + + web: + locations: + '/': + root: 'web' + passthru: '/index.php' + services: # The name of the service container. Must be unique within a project. redissession: type: "redis-persistent:{{% latest "redis" %}}" ``` + +{{< /codetabs >}} diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index 14bd15cb5e..2e4f7eb1e5 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -120,6 +120,12 @@ Note that changing the name of the service replaces it with a brand new service To define the relationship, use the following configuration: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -129,7 +135,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -146,10 +152,50 @@ 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 via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container (````) now has access to the service via the relationship ```` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="services"} +applications: + # The name of the app container. Must be unique within a project. + : + # 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: + : ":solr" +services: + # The name of the service container. Must be unique within a project. + : + type: solr: +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -159,18 +205,48 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - solr: + solr: +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} +``` + +<---> + ++++ +title=Using explicit endpoints ++++ +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # 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: + solr: "solr:solr" services: # The name of the service container. Must be unique within a project. solr: type: solr:{{% latest "solr" %}} ``` +{{< /codetabs >}} + + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -191,6 +267,34 @@ services: type: solr:{{% latest "solr" %}} ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + solr: "solr:solr" + +services: + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} +``` + +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `solr` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). @@ -281,7 +385,7 @@ Each endpoint is then available in the relationships definition in `{{< vendor/c applications: # The name of the app container. Must be unique within a project. myapp: - + type: "php:{{% latest "php" %}}" source: @@ -290,7 +394,7 @@ applications: [...] relationships: - solrsearch1: + solrsearch1: service: solr endpoint: main solrsearch2: From 1fb22b7b349190ac571c1fd9f85d16b573dfa18d Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 17 Jun 2024 15:17:31 +0200 Subject: [PATCH 05/22] refacto on explicit (with comment to legacy version) --- sites/platform/src/add-services/_index.md | 74 +++++- .../src/add-services/elasticsearch.md | 82 ++++++- sites/platform/src/add-services/gotenberg.md | 106 +++++--- .../src/add-services/headless-chrome.md | 82 ++++++- sites/platform/src/add-services/influxdb.md | 108 ++++++++- sites/platform/src/add-services/kafka.md | 74 +++++- sites/platform/src/add-services/memcached.md | 73 +++++- sites/platform/src/add-services/mongodb.md | 146 ++++++++++- .../platform/src/add-services/mysql/_index.md | 118 ++++++++- .../add-services/mysql/mysql-replication.md | 14 +- .../src/add-services/mysql/troubleshoot.md | 16 +- sites/platform/src/add-services/opensearch.md | 101 +++++++- sites/platform/src/add-services/postgresql.md | 94 ++++++-- sites/platform/src/add-services/rabbitmq.md | 74 +++++- sites/platform/src/add-services/redis.md | 228 +++++++++++++++--- sites/platform/src/add-services/solr.md | 82 ++++++- sites/platform/src/add-services/varnish.md | 16 +- sites/platform/src/add-services/vault.md | 18 +- sites/upsun/src/add-services/_index.md | 15 +- sites/upsun/src/add-services/clickhouse.md | 85 ++++--- sites/upsun/src/add-services/elasticsearch.md | 100 ++++---- sites/upsun/src/add-services/gotenberg.md | 16 +- .../upsun/src/add-services/headless-chrome.md | 25 +- sites/upsun/src/add-services/influxdb.md | 30 ++- sites/upsun/src/add-services/kafka.md | 18 +- sites/upsun/src/add-services/memcached.md | 8 +- sites/upsun/src/add-services/mongodb.md | 56 +++-- sites/upsun/src/add-services/mysql/_index.md | 54 ++++- .../upsun/src/add-services/network-storage.md | 3 - sites/upsun/src/add-services/opensearch.md | 22 +- sites/upsun/src/add-services/postgresql.md | 32 ++- sites/upsun/src/add-services/rabbitmq.md | 22 +- sites/upsun/src/add-services/redis.md | 68 ++++-- sites/upsun/src/add-services/solr.md | 34 +-- sites/upsun/src/add-services/varnish.md | 12 +- sites/upsun/src/add-services/vault.md | 42 ++-- sites/upsun/src/create-apps/hooks/_index.md | 16 +- .../multi-app/project-structure.md | 4 +- .../create-apps/multi-app/relationships.md | 4 +- .../src/get-started/here/configure/nodejs.md | 6 +- .../stacks/express/add-database.md | 8 +- .../stacks/laravel/environment-variables.md | 8 +- .../get-started/stacks/laravel/setup-redis.md | 4 +- .../get-started/stacks/strapi/add-database.md | 6 +- .../upsun/src/get-started/stacks/wordpress.md | 4 +- sites/upsun/src/languages/lisp.md | 29 ++- 46 files changed, 1747 insertions(+), 490 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index 104a4c1a49..5de7390fec 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -102,6 +102,12 @@ 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... @@ -109,10 +115,10 @@ The relationship follows this pattern: # 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: - {{}}: + {{" >}}: ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -122,17 +128,75 @@ 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + {{" >}}: + service: {{" >}} + endpoint: {{" >}} +``` + +You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships +and matches in both the application and services configuration. `` 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](#use-in-app) via the relationship `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-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... + +# Relationships enable an app container's access to a service. +relationships: + mariadb: + postgresql: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + ```yaml {configFile="app"} # Other options... # Relationships enable an app container's access to a service. +# Please note: 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" %}} @@ -258,10 +322,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). diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index 11f1f2974f..c20afc85e6 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -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 %}} @@ -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 @@ -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": [], @@ -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -154,7 +160,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: + endpoint: "elasticsearch" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -167,19 +202,44 @@ 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 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: + service: "elasticsearch" + endpoint: "elasticsearch" +``` + +{{< /codetabs >}} ### Use in app diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index 3955e71c39..3e7e9332ad 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -1,7 +1,7 @@ --- title: "Gotenberg" weight: -95 -description: Gotenberg is a user-friendly API for PDF files. +description: Gotenberg is a user-friendly API for PDF files. --- Gotenberg is a stateless API for converting various document formats into PDF files. @@ -13,7 +13,7 @@ For more information, see the [Gotenberg documentation](https://gotenberg.dev/do You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden. -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. ## Relationship reference @@ -21,50 +21,20 @@ When you deploy your app, you always get the latest available patches. Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -{{< codetabs >}} -+++ -title= Service environment variables -+++ - -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. -So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. - -```bash -GOTENBERG_INSTANCE_IPS=["249.45.240.83"] -GOTENBERG_SCHEME=http -GOTENBERG_HOSTNAME=rssjaxyeoorjje6axcq35xu5gq.gotenberg.service._.eu-5.{{< vendor/urlraw "hostname" >}} -GOTENBERG_SERVICE=gotenberg -GOTENBERG_CLUSTER=p2f2xrzyq7a6k-main-bvxea6i -GOTENBERG_IP=169.254.137.3 -GOTENBERG_TYPE=gotenberg:8 -GOTENBERG_HOST=gotenberg.internal -GOTENBERG_PORT=3000 -GOTENBERG_REL=http -``` - -<---> - -+++ -title= `PLATFORM_RELATIONSHIPS` environment variable -+++ - -For some advanced use cases, you can use the [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). -The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtained by running `{{< vendor/cli >}} relationships` in your terminal: - ```json { "host": "gotenberg.internal", - "hostname": "rssjaxyeoorjje6axcq35xu5gq.gotenberg.service._.eu-5.{{< vendor/urlraw "hostname" >}}", - "cluster": "p2f2xrzyq7a6k-main-bvxea6i", + "hostname": "azertyuiopqsdfghjklm.gotenberg.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiopqsdf-main-7rqtwti", "service": "gotenberg", "rel": "http", "scheme": "http", "port": "3000", "type": "gotenberg:8", "instance_ips": [ - "249.45.240.83" + "123.456.78.90" ], - "ip": "169.254.137.3", + "ip": "123.456.78.90", "url": "http://gotenberg.internal:3000" } ``` @@ -80,8 +50,6 @@ export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) export APP_GOTENBERG_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.gotenberg[0].host')" ``` -{{< /codetabs >}} - ## Usage example ### 1. Configure the service @@ -100,10 +68,16 @@ Note that changing the name of the service replaces it with a brand new service To define the relationship, use the ``http`` endpoint: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} # Relationships enable access from this app to a given service. relationships: - : ":http" + : ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -113,6 +87,34 @@ providing a [relationship](/create-apps/app-reference/single-runtime-image#relat The application has access to the service via this relationship and its corresponding `PLATFORM_RELATIONSHIPS` [environment variable](/development/variables/use-variables.md#use-provided-variables). +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +# Relationships enable access from this app to a given service. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: + endpoint: "http" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} + The `http` endpoint uses port `3000` by default. ### Example configuration @@ -127,12 +129,36 @@ gotenberg: #### [App configuration](/create-apps/_index.md) +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} # Relationships enable access from this app to a given service. relationships: - gotenberg: "gotenberg:http" + gotenberg: ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +# Relationships enable access from this app to a given service. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + gotenberg: + service: "gotenberg" + endpoint: "http" +``` + +{{< /codetabs >}} + ## Generate a PDF using Gotenberg As an example, to generate a PDF file of the {{% vendor/name %}} website, run the following cURL command: diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index 535f620f4e..42cd268c99 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -15,7 +15,7 @@ Puppeteer can be used to generate PDFs and screenshots of web pages, automate fo You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden. -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. @@ -40,16 +40,16 @@ When you deploy your app, you always get the latest available patches. Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. -```yaml +```json { - "service": "chromeheadless", + "service": "chrome-headless", "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.chromeheadless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "hostname": "azertyuiopqsdfghjklm.chrome-headless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", "cluster": "azertyuiop-main-7rqtwti", - "host": "chromeheadless.internal", + "host": "chrome-headless.internal", "rel": "http", "scheme": "http", "type": "chrome-headless:{{< latest "chrome-headless" >}}", @@ -77,23 +77,29 @@ To define the service, use the `chrome-headless` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -103,7 +109,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "http" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -117,15 +152,40 @@ chrome-headless: #### [App configuration](/create-apps) +{{< 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: - chrome-headless: + chrome-headless: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + chrome-headless: + service: "chrome-headless" + endpoint: "http" ``` +{{< /codetabs >}} + ### Use in app After configuration, include [Puppeteer](https://www.npmjs.com/package/puppeteer) as a dependency: diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 3c55acd033..82afcbf2f6 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -14,7 +14,7 @@ It exposes an HTTP API for client interaction. See the [InfluxDB documentation]( 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.
@@ -65,7 +65,7 @@ See more information on [how to upgrade to version 2.3 or later](#upgrade-to-ver Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -89,6 +89,9 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir "fragment": null, "public": false, "host_mapped": false, + "instance_ips": [ + "123.456.78.90" + ], "ip": "123.456.78.90" } ``` @@ -106,23 +109,29 @@ To define the service, use the `influxdb` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -132,7 +141,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + {{" >}}: + service: {{" >}} + endpoint: "influxdb" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -147,19 +185,68 @@ influxdb: #### [App configuration](/create-apps) +{{< 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: - influxdb: + influxdb: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: expended version of the explicit relationship (Legacy) is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + influxdb: + service: + endpoint: "influxdb" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +```yaml {configFile="app"} +# The name of the app container. Must be unique within a project. +name: myapp + +[...] + +# Relationships enable an app container's access to a service. +relationships: + influxdb: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + + ```yaml {configFile="app"} # The name of the app container. Must be unique within a project. name: myapp @@ -167,9 +254,14 @@ name: myapp [...] # Relationships enable an app container's access to a service. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships relationships: - influxdb: + influxdb: + service: "influxdb" + endpoint: "influxdb" ``` +{{< /codetabs >}} ```yaml {configFile="services"} influxdb: diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index 73e620bca4..18a1678177 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -36,7 +36,7 @@ Patch versions are applied periodically for bug fixes and the like. When you dep Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -66,23 +66,29 @@ To define the service, use the `kafka` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -92,7 +98,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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 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: {{" >}} + endpoint: "kafka" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -107,15 +142,40 @@ kafka: #### [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: - kafka: + kafka: ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + kafka: + service: "kafka" + endpoint: "kafka" +``` + +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. @@ -157,5 +217,5 @@ end {{< /codetabs >}} -The specific way to inject configuration into your application varies. +The specific way to inject configuration into your application varies. Consult your application or framework's documentation. diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index afdc1ab6a4..921aa3bada 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -48,7 +48,7 @@ Patch versions are applied periodically for bug fixes and the like. When you dep Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -78,23 +78,29 @@ To define the service, use the `memcached` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -104,7 +110,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "memcached" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -118,15 +153,41 @@ memcached: #### [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: - memcached: + memcached: ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + memcached: + service: "memcached" + endpoint: "memcached" +``` + +{{< /codetabs >}} + + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index 42ed37e4fd..021b90ad0a 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -28,8 +28,8 @@ Patch versions are applied periodically for bug fixes and the like. When you dep ### Enterprise edition {{% note title="Premium Service" theme="info" %}} -MongoDB Enterprise isn’t included in any {{< vendor/name >}} plan. -You need to add it separately at an additional cost. +MongoDB Enterprise isn’t included in any {{< vendor/name >}} plan. +You need to add it separately at an additional cost. To add MongoDB Enterprise, [contact Sales](https://platform.sh/contact/). {{% /note %}} @@ -102,7 +102,7 @@ so migrate to one of the [supported versions](#supported-versions). Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -140,23 +140,29 @@ To define the service, use the `mongodb-enterprise` type: disk: 512 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -166,7 +172,36 @@ 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 via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "mongodb" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions) for the service: @@ -190,15 +225,40 @@ mongodb-enterprise: ##### [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: - mongodb-enterprise: + mongodb-enterprise: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + mongodb-enterprise: + service: "mongodb-enterprise" + endpoint: "mongodb" ``` +{{< /codetabs >}} + ### Legacy edition example #### 1. Configure the service @@ -212,23 +272,29 @@ To define the service, use the `mongodb` type: disk: 512 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -238,7 +304,36 @@ 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 via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "mongodb" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions) for the service: @@ -262,15 +357,40 @@ mongodb: ##### [App configuration](/create-apps) +{{< 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: - mongodb: + mongodb: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + mongodb: + service: "mongodb" + endpoint: "mongodb" ``` +{{< /codetabs >}} + {{< codetabs >}} +++ diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 026d3f962c..dc26db1ee3 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -118,23 +118,29 @@ To define the service, use the `mariadb` or `mysql` type for MariaDB or the `ora disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -144,7 +150,36 @@ 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 `` and its corresponding [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`{{% vendor/prefix %}}_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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported. +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: + endpoint: "mysql" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### MariaDB example @@ -159,15 +194,40 @@ mariadb: #### [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: - mariadb: + mariadb: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: 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" ``` +{{< /codetabs >}} + ### OracleMySQL example #### [Service definition](/add-services) @@ -181,14 +241,38 @@ oraclemysql: #### [App configuration](/create-apps) +{{< 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: - oraclemysql: + oraclemysql: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + oraclemysql: + service: "oraclemysql" + endpoint: "mysql" ``` +{{< /codetabs >}} ### Use in app @@ -250,7 +334,7 @@ To get the URL to connect to the database, run the following command: The result is the complete [information for all relationships](#relationship-reference) with an additional `url` property. Use the `url` property as your connection. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `PLATFORM_RELATIONSHIPS` environment variable directly rather than hard coding any values. You can also see a guide on how to [convert the `{{< vendor/prefix >}}_RELATIONSHIPS` environment variable to a different form](https://community.platform.sh/t/convert-platform-relationships-to-database-url/841). @@ -460,9 +544,17 @@ name: myapp # Relationships enable an app container's access to a service. relationships: - database: "mariadb:admin" - reports: "mariadb:reporter" - imports: "mariadb:importer" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + database: + service: "mariadb" + endpoint: "admin" + reports: + service: "mariadb" + endpoint: "reporter" + imports: + service: "mariadb" + endpoint: "importer" ``` These relationships are then available in the [`{{< vendor/prefix >}}_RELATIONSHIPS` environment variable](#relationship-reference). @@ -519,9 +611,9 @@ ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ For further details, see the [MariaDB documentation](https://mariadb.com/kb/en/character-set-and-collation-overview/). {{% note theme="info" %}} -MariaDB configuration properties like [`max_connections`](https://mariadb.com/docs/server/ref/mdb/system-variables/max_connections/) and [`innodb_buffer_pool_size`](https://mariadb.com/kb/en/innodb-buffer-pool/#innodb_buffer_pool_size) are not directly configurable from `configuration.properties` in your services configuration. -They can, however, be set indirectly, which can be useful for solving `Too many connection` errors. -See [the troubleshooting documentation](/add-services/mysql/troubleshoot#too-many-connections) for more details. +MariaDB configuration properties like [`max_connections`](https://mariadb.com/docs/server/ref/mdb/system-variables/max_connections/) and [`innodb_buffer_pool_size`](https://mariadb.com/kb/en/innodb-buffer-pool/#innodb_buffer_pool_size) are not directly configurable from `configuration.properties` in your services configuration. +They can, however, be set indirectly, which can be useful for solving `Too many connection` errors. +See [the troubleshooting documentation](/add-services/mysql/troubleshoot#too-many-connections) for more details. {{% /note %}} ## Password generation diff --git a/sites/platform/src/add-services/mysql/mysql-replication.md b/sites/platform/src/add-services/mysql/mysql-replication.md index 402b788f69..3500df9c05 100644 --- a/sites/platform/src/add-services/mysql/mysql-replication.md +++ b/sites/platform/src/add-services/mysql/mysql-replication.md @@ -50,12 +50,14 @@ name: myapp # Relationships enable an app container's access to a service. relationships: - database: - service: mariadb - endpoint: mysql - replication: - service: mariadb - endpoint: replicator + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + database: + service: "mariadb" + endpoint: "mysql" + replication: + service: "mariadb" + endpoint: "replicator" ``` ## Getting the Primary's Binary Log Co-ordinates diff --git a/sites/platform/src/add-services/mysql/troubleshoot.md b/sites/platform/src/add-services/mysql/troubleshoot.md index fc67a4bf42..a4d42d834f 100644 --- a/sites/platform/src/add-services/mysql/troubleshoot.md +++ b/sites/platform/src/add-services/mysql/troubleshoot.md @@ -97,7 +97,7 @@ This information applies to DG3 and Professional/Grid {{% vendor/name %}} projec For DG2 projects, [contact Support](/learn/overview/get-support.md) to configure the `max_connections` property. {{% /note %}} -You cannot configure `max_connections` directly in {{% vendor/name %}} service configurations. +You cannot configure `max_connections` directly in {{% vendor/name %}} service configurations. However, to solve `Error 1040`, you can increase `max_connections` indirectly. For example, in the following service configuration for MariaDB, `max_connections` is `188` as [set by {{% vendor/name %}}](#how-it-works): @@ -123,17 +123,17 @@ To **increase** `max_connections`, you can **either**: Behind the scenes, `max_connections` (for Professional and DG3 projects) is calculated from values that you _can_ change: 1. **`max_allowed_packet`**: `max_allowed_packet` is [directly configurable](/add-services/mysql#configure-the-database) - in your `.platform/services.yaml` file with an integer value. + in your `.platform/services.yaml` file with an integer value. The default value of `16` is shown below to illustrate: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - configuration: - properties: - max_allowed_packet: 16 + disk: 2048 + configuration: + properties: + max_allowed_packet: 16 ``` 1. **The memory available to the service**: Resources are distributed across the containers @@ -161,7 +161,7 @@ If we assume the configuration above, where: - `mariadb.size: L`, which we know is 1280 MB, referred to below as `application_size` - `mariadb.configuration.properties.max_allowed_packet: 16` -`max_allowed_packet` is `188`, which is determined by {{% vendor/name %}} according to: +`max_allowed_packet` is `188`, which is determined by {{% vendor/name %}} according to: \begin{aligned} \texttt{max_connections} = \text{int}\Biggl[ \min \left( \frac{\texttt{FREE_MEMORY}}{\texttt{max_allowed_packet}}, 500 \right) \Biggr] @@ -211,7 +211,7 @@ and for a number of `max_allow_packet` settings.
- + diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index bb466ccd51..01268e8f3a 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -68,12 +68,12 @@ or are no longer the recommended way to configure the service on {{% vendor/name To ensure your project remains stable in the future, switch to [a supported version](#supported-versions). -## Relationship reference +## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -110,23 +110,29 @@ To define the service, use the `opensearch` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -136,7 +142,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "opensearch" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -151,28 +186,78 @@ opensearch: #### [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: - opensearch: + opensearch: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + opensearch: + service: "opensearch" + endpoint: "opensearch" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +```yaml {configFile="app"} +name: myapp + +[...] + +relationships: + opensearch: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + ```yaml {configFile="app"} name: myapp [...] relationships: - opensearch: + opensearch: + service: "opensearch" + endpoint: "opensearch" ``` +{{< /codetabs >}} + This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index 22306fc626..64f8d8f54b 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -68,12 +68,12 @@ so migrate to one of the [supported versions](#supported-versions).
MariaDB max_connections
for common combinations
of size &
max_allow_packet
application_size

size (memory in MB)
-## Relationship reference +## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -112,23 +112,29 @@ To define the service, use the `postgresql` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -138,7 +144,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "postgresql" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions) for the service: @@ -162,15 +197,40 @@ postgresql: #### [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: - postgresql: + postgresql: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + postgresql: + service: "ostgresql" + endpoint: "postgresql" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. @@ -350,15 +410,17 @@ Once these endpoints are defined, you need to expose them to your application as ```yaml {configFile="app"} relationships: - database: - service: postgresql - endpoint: admin - reports: - service: postgresql - endpoint: reporter + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + database: + service: "postgresql" + endpoint: "admin" + reports: + service: "postgresql" + endpoint: "reporter" imports: - service: postgresql - endpoint: importer + service: "postgresql" + endpoint: "importer" ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. @@ -428,7 +490,7 @@ Note that you can't customize these automatically generated passwords. After your custom endpoints are exposed as relationships in your [app configuration](../../create-apps/_index.md), you can retrieve the password for each endpoint -through the `{{< vendor/prefix >}}_RELATIONSHIPS` [environment variable](../../development/variables/use-variables.md#use-provided-variables) +through the `{{< vendor/prefix >}}_RELATIONSHIPS` [environment variable](../../development/variables/use-variables.md#use-provided-variables) within your [application containers](/development/variables/use-variables.md#access-variables-in-your-app). The password value changes automatically over time, to avoid downtime its value has to be read dynamically by your app. Globally speaking, having passwords hard-coded into your codebase can cause security issues and should be avoided. diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index 8a8c4333c5..ef0aafaac1 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -63,12 +63,12 @@ so migrate to one of the [supported versions](#supported-versions). -## Relationship reference +## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -105,23 +105,29 @@ To define the service, use the `rabbitmq` type: disk: 512 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -131,7 +137,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "rabbitmq" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -146,15 +181,40 @@ rabbitmq: #### [App configuration](/create-apps) +{{< 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: - rabbitmq: + rabbitmq: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + rabbitmq: + service: "rabbitmq" + endpoint: "rabbitmq" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 41c0fcc4ac..d54a802b0d 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -78,6 +78,38 @@ while Redis 2.8 only supports a single database. Depending on your needs, you can set up Redis as [persistent](#persistent-redis) or [ephemeral](#ephemeral-redis). + +## Relationship reference + +Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) +or by running `{{% vendor/cli %}} relationships`. + +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. + +```json +{ + "username": null, + "scheme": "redis", + "service": "redis", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 6379, + "cluster": "azertyuiopqsdf-main-7rqtwti", + "host": "redis.internal", + "rel": "redis", + "path": null, + "query": [], + "password": null, + "type": "redis:{{% latest "redis" %}}", + "public": false, + "host_mapped": false +} +``` + +The format of the relationship is identical whether your Redis service is [ephemeral](#ephemeral-redis) or [persistent](#persistent-redis). + ## Persistent Redis By default, Redis is an ephemeral service that stores data in memory. @@ -127,13 +159,19 @@ Back up your data before changing the service. To define the relationship, use the `redis` endpoint : +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} # 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: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -142,7 +180,36 @@ The example above leverages [default endpoint](/create-apps/app-reference/single 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 via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "redis" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions) for the service: @@ -166,11 +233,32 @@ redis: #### [App configuration](/create-apps/_index.md) +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +```yaml {configFile="app"} +relationships: + redis: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + ```yaml {configFile="app"} relationships: - redis: + redis: + service: "redis" + endpoint: "redis" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. @@ -241,7 +329,13 @@ Back up your data before changing the service. #### 2. Add the relationship -To define the relationship, use the `redis` endpoint : +To define the relationship, use the following configuration: + +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ ```yaml {configFile="app"} # Relationships enable access from this app to a given service. @@ -249,7 +343,7 @@ To define the relationship, use the `redis` endpoint : # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -258,7 +352,36 @@ The example above leverages [default endpoint](/create-apps/app-reference/single 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "redis" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} For PHP, enable the [extension](/languages/php/extensions) for the service: @@ -282,11 +405,32 @@ redis: #### [App configuration](/create-apps/_index.md) +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + +```yaml {configFile="app"} +relationships: + redis: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + ```yaml {configFile="app"} relationships: redis: + service: "redis" + endpoint: "redis" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. @@ -393,37 +537,6 @@ const value = await client.get('x'); // returns 42 {{< /codetabs >}} -## Relationship reference - -Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) -or by running `{{% vendor/cli %}} relationships`. - -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. -So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. - -```json -{ - "username": null, - "scheme": "redis", - "service": "redis", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 6379, - "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "redis.internal", - "rel": "redis", - "path": null, - "query": [], - "password": null, - "type": "redis:{{% latest "redis" %}}", - "public": false, - "host_mapped": false -} -``` - -The format of the relationship is identical whether your Redis service is [ephemeral](#ephemeral-redis) or [persistent](#persistent-redis). - ## Eviction policy When Redis reaches its memory limit, @@ -454,10 +567,10 @@ The following table presents the possible values: For more information on the different policies, see the official [Redis documentation](https://redis.io/docs/reference/eviction/). -## Access your Redis service +## Access your Redis service After you've [configured your Redis service](#usage-example), -you can access it using either the {{% vendor/name %}} CLI +you can access it using either the {{% vendor/name %}} CLI or through the [Redis CLI](https://redis.io/docs/ui/cli/). ### {{% vendor/name %}} CLI @@ -506,11 +619,17 @@ redissessions: disk: 256 ``` +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} type: "php:{{% latest "php" %}}" relationships: - redissessions: + redissessions: variables: php: @@ -523,3 +642,32 @@ web: root: 'web' passthru: '/index.php' ``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +type: "php:{{% latest "php" %}}" + +relationships: + redissessions: + service: "redissessions" + endpoint: "redis" + +variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" + +web: + locations: + '/': + root: 'web' + passthru: '/index.php' +``` + +{{< /codetabs >}} + diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index cfa1e46344..427c94d384 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -63,12 +63,12 @@ so migrate to one of the [supported versions](#supported-versions). -## Relationship reference +## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -105,23 +105,29 @@ To define the service, use the `solr` type: disk: 256 ``` -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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -131,7 +137,36 @@ 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` 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. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + : + service: "" + endpoint: "solr" +``` + +You can define ```` and ```` 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). + +{{< /codetabs >}} ### Example configuration @@ -146,15 +181,40 @@ solr: #### [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: - solr: + solr: +``` + +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="apps"} +# Relationships enable access from this app to a given service. +# See the Application reference for all options for defining relationships and endpoints. +# Please note: Legacy definition of the relationship is still supported: +# More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships +relationships: + solr: + service: "solr" + endpoint: "solr" ``` +{{< /codetabs >}} + ### Use in app To use the configured service in your app, add a configuration file similar to the following to your project. @@ -268,12 +328,8 @@ type: "php:{{% latest "php" %}}" [...] relationships: - solrsearch1: - service: solr - endpoint: main - solrsearch2: - service: solr - endpoint: extra + solrsearch1: "solr:main" + solrsearch2: "solr:extra" ``` That is, the application's environment would include a `solrsearch1` relationship that connects to the `main` endpoint, which is the `mainindex` core, and a `solrsearch2` relationship that connects to the `extra` endpoint, which is the `extraindex` core. diff --git a/sites/platform/src/add-services/varnish.md b/sites/platform/src/add-services/varnish.md index ba480b498b..08c7b0c455 100644 --- a/sites/platform/src/add-services/varnish.md +++ b/sites/platform/src/add-services/varnish.md @@ -62,7 +62,7 @@ To define the service, use the `varnish` type: path: config.vcl ``` -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. The `relationships` block defines the connection between Varnish and your app. @@ -152,12 +152,8 @@ For example, you might have the following configuration for two apps: varnish: type: varnish:{{% latest "varnish" %}} relationships: - blog: - service: blog - endpoint: http - main: - service: app - endpoint: http + blog: 'blog:http' + main: 'app:http' configuration: vcl: !include type: string @@ -333,7 +329,7 @@ stats-app: # Unique relationship _to_ Varnish from 'stats-app', where no relationship # is defined _from_ Varnish to the same app, to avoid circular relationships. relationships: - varnishstats: + varnishstats: service: varnish endpoint: "http+stats" # The name of the app container. Must be unique within a project. @@ -352,9 +348,7 @@ varnish: # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship # is defined _to_ Varnish to the same app, to avoid circular relationships. relationships: - main: - service: "main-app" - endpoint: http + main: "main-app:http" configuration: vcl: !include type: string diff --git a/sites/platform/src/add-services/vault.md b/sites/platform/src/add-services/vault.md index 8930054761..bdc704fdcc 100644 --- a/sites/platform/src/add-services/vault.md +++ b/sites/platform/src/add-services/vault.md @@ -35,12 +35,12 @@ Patch versions are applied periodically for bug fixes and the like. When you dep -## Relationship reference +## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -88,7 +88,7 @@ To define the service, use the `vault-kms` type: type: ``` -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. - {{< variable "SERVICE_NAME" >}} is the name you choose to identify the service. @@ -122,10 +122,10 @@ relationships: endpoint: ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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 [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships) for relationships. +The example above leverages [explicit endpoint configuration](/create-apps/app-reference/single-runtime-image#relationships) for relationships. That is, it utilizes the `endpoint` key to explicitly connect an individually accessible `relationship` to a specific Vault endpoint. With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). @@ -159,7 +159,11 @@ vault-kms: ```yaml {configFile="apps"} relationships: - vault_secret: "vault-kms:manage_keys" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + vault_secret: + service: "vault-kms" + endpoint: "manage_keys" ``` ### Multiple endpoints configuration @@ -190,6 +194,8 @@ vault-kms: ```yaml {configFile="apps"} relationships: + # Please note: Legacy definition of the relationship is still supported. + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships vault_manage: service: vault-kms endpoint: management diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index 08271c9fa8..ad5f82d77d 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -134,12 +134,15 @@ title=Using explicit endpoints applications: # The name of the app container. Must be unique within a project. {{}}: - # ... + # Other options... + + # Relationships enable an app container's access to a service. + # See the Application reference for all options for defining relationships and endpoints. relationships: {{% variable "RELATIONSHIP_NAME" %}}: service: {{% variable "SERVICE_NAME" %}} endpoint: {{% variable "ENDPOINT_NAME" %}} - # OR as a shorter notation + # OR as a shorter notation (Legacy) {{% variable "RELATIONSHIP_NAME" %}}: {{% variable "SERVICE_NAME" %}}:{{% variable "ENDPOINT_NAME" %}} services: @@ -187,8 +190,12 @@ applications: # The name of the app container. Must be unique within a project. {{}}: relationships: - database: mariadb:mysql - database2: postgresql:postgresql + database: + service: "mariadb" + endpoint: "mysql" + postgresql: + service: "postgresql" + endpoint: "postgresql" services: mariadb: type: mariadb:{{% latest "mariadb" %}} diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index 13ec6c5d93..7d3af14580 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -146,7 +146,6 @@ applications: # Relationships enable access from this app to a given service. relationships: : - services: # The name of the service container. Must be unique within a project. : @@ -165,8 +164,11 @@ applications: : # Relationships enable access from this app to a given service. relationships: - : ":clickhouse" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "clickhouse" services: # The name of the service container. Must be unique within a project. : @@ -197,7 +199,6 @@ applications: # Relationships enable access from this app to a given service. relationships: : - services: # The name of the service container. Must be unique within a project. : @@ -218,8 +219,9 @@ applications: : # Relationships enable access from this app to a given service. relationships: - : ":clickhouse-http" - + : + service: "" + endpoint: "clickhouse-http" services: # The name of the service container. Must be unique within a project. : @@ -272,7 +274,11 @@ applications: root: "myapp" # Relationships enable an app container's access to a service. relationships: - clickhouse: "clickhouse:clickhouse" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + clickhouse: + service: "clickhouse" + endpoint: "clickhouse" services: clickhouse: # The name of the service container. Must be unique within a project. @@ -294,7 +300,11 @@ applications: root: "myapp" # Relationships enable an app container's access to a service. relationships: - clickhouse: "clickhouse:clickhouse-http" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + clickhouse: + service: "clickhouse" + endpoint: "clickhouse-http" services: # The name of the service container. Must be unique within a project. clickhouse: @@ -313,33 +323,40 @@ To do so, you can use a configuration similar to the following: ```yaml {configFile="app"} # Complete list of all available properties: https://docs.upsun.com/create-apps/app-reference.html applications: - myapp: - relationships: - clickhouse-admin: "clickhouse:admin" - clickhouse-reporter: "clickhouse:reporter" - clickhouse-importer: "clickhouse:importer" - + myapp: + relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + clickhouse-admin: + service: "clickhouse" + endpoint: "admin" + clickhouse-reporter: + service: "clickhouse" + endpoint: "reporter" + clickhouse-importer: + service: "clickhouse" + endpoint: "importer" services: - clickhouse: - type: clickhouse:24 - configuration: - databases: - - main - - legacy - endpoints: - admin: - port: 9000 # binary port - privileges: - main: admin - legacy: admin + clickhouse: + type: clickhouse:24 + configuration: + databases: + - main + - legacy + endpoints: + admin: + port: 9000 # binary port + privileges: + main: admin + legacy: admin reporter: - default_database: main - port: 8123 # http port - privileges: - main: ro + default_database: main + port: 8123 # http port + privileges: + main: ro importer: - default_database: legacy - port: 9000 # binary port - privileges: - legacy: rw + default_database: legacy + port: 9000 # binary port + privileges: + legacy: rw ``` diff --git a/sites/upsun/src/add-services/elasticsearch.md b/sites/upsun/src/add-services/elasticsearch.md index b0a419249f..8fa9cc5507 100644 --- a/sites/upsun/src/add-services/elasticsearch.md +++ b/sites/upsun/src/add-services/elasticsearch.md @@ -51,22 +51,22 @@ You can obtain the complete list of available service environment variables in y Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the [service environment variables](/development/variables/_index.md#service-environment-variables) directly rather than hard coding any values. ```bash -ESSEARCH_USERNAME= -ESSEARCH_SCHEME=http -ESSEARCH_SERVICE=elasticsearch -ESSEARCH_FRAGMENT=null -ESSEARCH_IP=123.456.78.90 -ESSEARCH_HOSTNAME=azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}} -ESSEARCH_PORT=9200 -ESSEARCH_CLUSTER=azertyuiopqsdf-main-7rqtwti -ESSEARCH_HOST=essearch.internal -ESSEARCH_REL=elasticsearch -ESSEARCH_PATH= -ESSEARCH_QUERY=[] -ESSEARCH_PASSWORD=ChangeMe -ESSEARCH_TYPE=elasticsearch:{{< latest "elasticsearch" >}} -ESSEARCH_PUBLIC=false -ESSEARCH_HOST_MAPPED=false +ELASTICSEARCH_USERNAME= +ELASTICSEARCH_SCHEME=http +ELASTICSEARCH_SERVICE=elasticsearch +ELASTICSEARCH_FRAGMENT=null +ELASTICSEARCH_IP=123.456.78.90 +ELASTICSEARCH_HOSTNAME=azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}} +ELASTICSEARCH_PORT=9200 +ELASTICSEARCH_CLUSTER=azertyuiopqsdf-main-7rqtwti +ELASTICSEARCH_HOST=elasticsearch.internal +ELASTICSEARCH_REL=elasticsearch +ELASTICSEARCH_PATH= +ELASTICSEARCH_QUERY=[] +ELASTICSEARCH_PASSWORD=ChangeMe +ELASTICSEARCH_TYPE=elasticsearch:{{< latest "elasticsearch" >}} +ELASTICSEARCH_PUBLIC=false +ELASTICSEARCH_HOST_MAPPED=false ``` <---> @@ -88,7 +88,7 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain "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": [], @@ -106,7 +106,7 @@ Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variab export RELATIONSHIPS_JSON=$(echo $PLATFORM_RELATIONSHIPS | base64 --decode) # Set environment variables for individual credentials. -export APP_ELASTICSEARCH_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.essearch[0].host')" +export APP_ELASTICSEARCH_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.elasticsearch[0].host')" ``` {{< /codetabs >}} @@ -180,11 +180,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "elasticsearch" services: # The name of the service container. Must be unique within a project. : @@ -221,7 +223,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: elasticsearch: - services: # The name of the service container. Must be unique within a project. elasticsearch: @@ -241,12 +242,13 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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:elasticsearch" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + elasticsearch: + service: "elasticsearch" + endpoint: "elasticsearch" services: # The name of the service container. Must be unique within a project. elasticsearch: @@ -271,18 +273,17 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # Relationships enable access from this app to a given service. - relationships: - elasticsearch: - + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + # Relationships enable access from this app to a given service. + relationships: + elasticsearch: services: - elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} + elasticsearch: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` @@ -293,18 +294,21 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # Relationships enable access from this app to a given service. - relationships: - elasticsearch: "elasticsearch:elasticsearch" - + # The name of the app container. Must be unique within a project. + myapp: + # The location of the application's code. + source: + root: "myapp" + # Relationships enable access from this app to a given service. + relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + elasticsearch: + service: "elasticsearch" + endpoint: "elasticsearch" services: - elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} + elasticsearch: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` {{< /codetabs >}} diff --git a/sites/upsun/src/add-services/gotenberg.md b/sites/upsun/src/add-services/gotenberg.md index 4e32fa90ab..fdda9e0f52 100644 --- a/sites/upsun/src/add-services/gotenberg.md +++ b/sites/upsun/src/add-services/gotenberg.md @@ -118,7 +118,6 @@ applications: # Relationships enable access from this app to a given service. relationships: : - services: # The name of the service container. Must be unique within a project. : @@ -137,8 +136,11 @@ applications: : # Relationships enable access from this app to a given service. relationships: - : ":http" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "http" services: # The name of the service container. Must be unique within a project. : @@ -168,7 +170,6 @@ applications: # Relationships enable access from this app to a given service. relationships: gotenberg: - services: # The name of the service container. Must be unique within a project. gotenberg: @@ -187,8 +188,11 @@ applications: myapp: # Relationships enable access from this app to a given service. relationships: - gotenberg: "gotenberg:http" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + gotenberg: + service: "gotenberg" + endpoint: "http" services: # The name of the service container. Must be unique within a project. gotenberg: diff --git a/sites/upsun/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md index fd08b4b438..55912d7b70 100644 --- a/sites/upsun/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -149,16 +149,19 @@ With the above definition, the application container now has [access to the serv +++ title=Using explicit endpoints +++ + ```yaml {configFile="services"} applications: # The name of the app container. Must be unique within a project. : # 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: - : ":http" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "http" services: # The name of the service container. Must be unique within a project. : @@ -195,7 +198,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: chrome-headless: - services: # The name of the service container. Must be unique within a project. chrome-headless: @@ -213,12 +215,13 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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: - chrome-headless: "chrome-headless:http" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + chrome-headless: + service: "chrome-headless" + endpoint: "http" services: # The name of the service container. Must be unique within a project. chrome-headless: @@ -313,11 +316,11 @@ applications: # Relationships enable an app container's access to a service. relationships: chrome-headless: - service: chrome-headless_service - endpoint: http + service: "chrome-headless" + endpoint: "http" services: # The name of the service container. Must be unique within a project. - chrome-headless_service: + chrome-headless: type: chrome-headless:{{% latest "chrome-headless" %}} ``` diff --git a/sites/upsun/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md index 74bd80da6f..84988998e4 100644 --- a/sites/upsun/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -176,11 +176,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":influxdb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "influxdb" services: # The name of the service container. Must be unique within a project. : @@ -217,7 +219,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: influxdb: - services: # The name of the service container. Must be unique within a project. influxdb: @@ -235,15 +236,16 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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: - influxdb: "influxdb_service:influxdb" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + influxdb: + service: "influxdb" + endpoint: "influxdb" services: # The name of the service container. Must be unique within a project. - influxdb_service: + influxdb: type: influxdb:{{% latest "influxdb" %}} ``` @@ -273,7 +275,6 @@ applications: # Relationships enable an app container's access to a service. relationships: influxdb: - service: influxdb: type: influxdb:{{% latest "influxdb" %}} @@ -297,10 +298,13 @@ applications: # Relationships enable an app container's access to a service. relationships: - influxdb: "influxdb_service:influxdb" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + influxdb: + service: "influxdb" + endpoint: "influxdb" service: - influxdb_service: + influxdb: type: influxdb:{{% latest "influxdb" %}} ``` diff --git a/sites/upsun/src/add-services/kafka.md b/sites/upsun/src/add-services/kafka.md index ee5b46f7fa..1da5162096 100644 --- a/sites/upsun/src/add-services/kafka.md +++ b/sites/upsun/src/add-services/kafka.md @@ -148,11 +148,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":kafka" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "kafka" services: # The name of the service container. Must be unique within a project. : @@ -189,7 +191,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: kafka: - services: # The name of the service container. Must be unique within a project. kafka: @@ -207,12 +208,13 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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: - kafka: "kafka:kafka" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + kafka: + service: "kafka" + endpoint: "kafka" services: # The name of the service container. Must be unique within a project. kafka: diff --git a/sites/upsun/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md index d5eea9c077..f893fd618c 100644 --- a/sites/upsun/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -355,7 +355,6 @@ applications: # Relationships enable an app container's access to a service. relationships: memcached: - service: memcached: type: memcached:{{% latest "memcached" %}} @@ -379,8 +378,11 @@ applications: # Relationships enable an app container's access to a service. relationships: - memcached: "memcached:memcached" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + memcached: + service: "memcached" + endpoint: "memcached" service: memcached: type: memcached:{{% latest "memcached" %}} diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index 586b653787..c43fa10554 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -59,7 +59,7 @@ Note that the information about the relationship can change when an app is redep ```bash MONGODB_USERNAME=main -MONGODBBASE_SCHEME=mongodb +MONGODB_SCHEME=mongodb MONGODB_SERVICE=mongodb MONGODB_IP=123.456.78.90 MONGODB_HOSTNAME=azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}} @@ -179,11 +179,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "mongodb" services: # The name of the service container. Must be unique within a project. : @@ -245,11 +247,13 @@ applications: extensions: - mongodb # 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: - : ":mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "mongodb" services: # The name of the service container. Must be unique within a project. : @@ -301,11 +305,13 @@ applications: extensions: - mongodb # 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: - mongodb-enterprise: "mongodb-enterprise:mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + mongodb-enterprise: + service: "mongodb-enterprise" + endpoint: "mongodb" services: # The name of the service container. Must be unique within a project. mongodb-enterprise: @@ -376,11 +382,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "mongodb" services: # The name of the service container. Must be unique within a project. : @@ -442,11 +450,13 @@ applications: extensions: - mongodb # 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: - : ":mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "mongodb" services: # The name of the service container. Must be unique within a project. : @@ -498,11 +508,13 @@ applications: extensions: - mongodb # 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: - mongodb: "mongodb:mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + mongodb: + service: "mongodb" + endpoint: "mongodb" services: # The name of the service container. Must be unique within a project. mongodb: @@ -557,7 +569,11 @@ applications: # Relationships enable an app container's access to a service. relationships: - mongodb: "mongodb:mongodb" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + mongodb: + service: "mongodb" + endpoint: "mongodb" service: mongodb: type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index f93a2affca..2c21ba6fd9 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -288,11 +288,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":mysql" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "mysql" services: # The name of the service container. Must be unique within a project. : @@ -313,6 +315,12 @@ With the above definition, the application container now has [access to the serv ### MariaDB example +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -329,6 +337,32 @@ services: type: mariadb:{{% latest "mariadb" %}} ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + # The name of the app container. Must be unique within a project. + myapp: + # Relationships enable access from this app to a given service. + # See the Application reference for all options for defining relationships and endpoints. + relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + mariadb: + service: "mariadb" + endpoint: "mysql" +services: + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} +``` + +{{< /codetabs >}} + ### OracleMySQL example {{< codetabs >}} @@ -362,7 +396,11 @@ applications: myapp: # The location of the application's code. relationships: - oracle-mysql: "oracle-mysql_service:mysql" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + oracle-mysql: + service: "oracle-mysql_service" + endpoint: "mysql" service: # The name of the service container. Must be unique within a project. oracle-mysql_service: @@ -417,8 +455,12 @@ applications: [...] # Relationships enable an app container's access to a service. + # Please note: 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: "mariadb:mysql" + mariadb: + service: "mariadb" + endpoint: "mysql" service: mariadb: type: mariadb:{{% latest "mariadb" %}} @@ -627,6 +669,8 @@ applications: [...] # Relationships enable an app container's access to a service. + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships relationships: database: service: "mariadb" diff --git a/sites/upsun/src/add-services/network-storage.md b/sites/upsun/src/add-services/network-storage.md index a6d614c978..fdfd85826a 100644 --- a/sites/upsun/src/add-services/network-storage.md +++ b/sites/upsun/src/add-services/network-storage.md @@ -186,9 +186,6 @@ applications: type: "php:{{% latest "php" %}}" - relationships: - mariadb: - [...] mounts: diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index 641ffbd948..fbedf659ab 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -178,11 +178,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":opensearch" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "opensearch" services: # The name of the service container. Must be unique within a project. : @@ -236,11 +238,13 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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: - opensearch: "opensearch:opensearch" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + opensearch: + service: "opensearch" + endpoint: "opensearch" services: # The name of the service container. Must be unique within a project. opensearch: @@ -296,7 +300,11 @@ applications: # Relationships enable an app container's access to a service. relationships: - opensearch: "opensearch:opensearch" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + opensearch: + service: "opensearch" + endpoint: "opensearch" services: # The name of the service container. Must be unique within a project. opensearch: diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index f59231e2cd..7392b6d7c0 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -173,11 +173,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":postgresql" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "postgresql" services: # The name of the service container. Must be unique within a project. : @@ -239,11 +241,13 @@ applications: extensions: - pdo_pgsql # 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: - : ":postgresql" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "postgresql" services: # The name of the service container. Must be unique within a project. : @@ -295,11 +299,13 @@ applications: extensions: - pdo_pgsql # 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: - postgresql: "postgresql:postgresql" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + postgresql: + service: "postgresql" + endpoint: "postgresql" services: # The name of the service container. Must be unique within a project. postgresql: @@ -355,7 +361,11 @@ applications: # Relationships enable an app container's access to a service. relationships: - postgresql: "postgresql:postgresql" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + postgresql: + service: "postgresql" + endpoint: "postgresql" services: # The name of the service container. Must be unique within a project. postgresql: @@ -535,6 +545,8 @@ applications: [...] relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships database: service: postgresql endpoint: admin diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index f5e246b4f7..1132314a5b 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -167,11 +167,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":rabbitmq" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "rabbitmq" services: # The name of the service container. Must be unique within a project. : @@ -225,11 +227,13 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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: - rabbitmq: "rabbitmq:rabbitmq" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + rabbitmq: + service: "rabbitmq" + endpoint: "rabbitmq" services: # The name of the service container. Must be unique within a project. rabbitmq: @@ -285,7 +289,11 @@ applications: # Relationships enable an app container's access to a service. relationships: - rabbitmq: "rabbitmq:rabbitmq" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + rabbitmq: + service: "rabbitmq" + endpoint: "rabbitmq" services: # The name of the service container. Must be unique within a project. rabbitmq: diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index 4c0a42150e..c6dfa53278 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -182,7 +182,6 @@ applications: # Relationships enable access from this app to a given service. relationships: : - services: # The name of the service container. Must be unique within a project. : @@ -207,12 +206,18 @@ title=Using explicit endpoints applications: # The name of the app container. Must be unique within a project. : + source: + root: "myapp" + + [...] + # 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: - : ":redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. : @@ -272,7 +277,11 @@ applications: - redis # Relationships enable access from this app to a given service. relationships: - : ":redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. : @@ -305,7 +314,6 @@ applications: # Relationships enable access from this app to a given service. relationships: redis: - services: # The name of the service container. Must be unique within a project. redis: @@ -333,8 +341,11 @@ applications: - redis # Relationships enable access from this app to a given service. relationships: - redis: "redis:redis" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + redis: + service: "redis" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. redis: @@ -397,7 +408,11 @@ applications: # Relationships enable access from this app to a given service. relationships: - redis: "redis:redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + redis: + service: "redis" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. redis: @@ -486,7 +501,6 @@ applications: # Relationships enable access from this app to a given service. relationships: : - services: # The name of the service container. Must be unique within a project. : @@ -512,11 +526,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. : @@ -588,7 +604,11 @@ applications: # Relationships enable access from this app to a given service. relationships: - : ":redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. : @@ -650,7 +670,11 @@ applications: # Relationships enable access from this app to a given service. relationships: - redis: "redis:redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + redis: + service: "redis" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. redis: @@ -711,7 +735,11 @@ applications: - redis # Relationships enable access from this app to a given service. relationships: - redis: "redis:redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + redis: + service: "redis" + endpoint: "redis" services: # The name of the service container. Must be unique within a project. redis: @@ -952,7 +980,11 @@ applications: - redis relationships: - redissession: "redissession:redis" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + redissession: + service: "redissession" + endpoint: "redis" variables: php: diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index 2e4f7eb1e5..31c03c9484 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -165,11 +165,13 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : ":solr" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + : + service: "" + endpoint: "solr" services: # The name of the service container. Must be unique within a project. : @@ -223,11 +225,13 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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: - solr: "solr:solr" + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + solr: + service: "solr" + endpoint: "solr" services: # The name of the service container. Must be unique within a project. solr: @@ -260,7 +264,6 @@ applications: # Relationships enable an app container's access to a service. relationships: solr: - services: # The name of the service container. Must be unique within a project. solr: @@ -285,8 +288,11 @@ applications: # Relationships enable an app container's access to a service. relationships: - solr: "solr:solr" - + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + solr: + service: "solr" + endpoint: "solr" services: # The name of the service container. Must be unique within a project. solr: @@ -304,11 +310,11 @@ From this, ``myapp`` can retrieve access credentials to the service through the ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. # For more information, please visit https://docs.upsun.com/development/variables.html#service-environment-variables. -export QUEUE_SCHEME=${RABBITMQ_SCHEME} -export QUEUE_USERNAME=${RABBITMQ_USERNAME} -export QUEUE_PASSWORD=${RABBITMQ_PASSWORD} -export QUEUE_HOST=${RABBITMQ_HOST} -export QUEUE_PORT=${RABBITMQ_PORT} +export QUEUE_SCHEME=${SOLR_SCHEME} +export QUEUE_USERNAME=${SOLR_USERNAME} +export QUEUE_PASSWORD=${SOLR_PASSWORD} +export QUEUE_HOST=${SOLR_HOST} +export QUEUE_PORT=${SOLR_PORT} # Set a single RabbitMQ connection string variable for AMQP. export AMQP_URL="${QUEUE_SCHEME}://${QUEUE_USERNAME}:${QUEUE_PASSWORD}@${QUEUE_HOST}:${QUEUE_PORT}/" diff --git a/sites/upsun/src/add-services/varnish.md b/sites/upsun/src/add-services/varnish.md index 54c9d95209..5b6a9844b0 100644 --- a/sites/upsun/src/add-services/varnish.md +++ b/sites/upsun/src/add-services/varnish.md @@ -49,7 +49,7 @@ services: path: config.vcl ``` -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. The `relationships` block defines the connection between Varnish and your app. @@ -329,8 +329,10 @@ applications: # Unique relationship _to_ Varnish from 'stats-app', where no relationship # is defined _from_ Varnish to the same app, to avoid circular relationships. relationships: - varnishstats: - service: varnish + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + varnishstats: + service: "varnish" endpoint: "http+stats" # The name of the app container. Must be unique within a project. main-app: @@ -347,9 +349,9 @@ services: # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship # is defined _to_ Varnish to the same app, to avoid circular relationships. relationships: - main: + main: service: "main-app" - endpoint: http + endpoint: "http configuration: vcl: !include type: string diff --git a/sites/upsun/src/add-services/vault.md b/sites/upsun/src/add-services/vault.md index 550077227f..51bb26459b 100644 --- a/sites/upsun/src/add-services/vault.md +++ b/sites/upsun/src/add-services/vault.md @@ -41,24 +41,24 @@ You can obtain the complete list of available service environment variables in y Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the [service environment variables](/development/variables/_index.md#service-environment-variables) directly rather than hard coding any values. ```bash -VAULT_SERVICE_USERNAME= -VAULT_SERVICE_SCHEME=http -VAULT_SERVICE_SERVICE=vault-kms -VAULT_SERVICE_FRAGMENT= -VAULT_SERVICE_IP=123.456.78.90 -VAULT_SERVICE_INSTANCE_IPS=['123.456.78.90'] -VAULT_SERVICE_HOSTNAME=azertyuiopqsdfghjklm.vault-kms.service._.eu-1.{{< vendor/urlraw "hostname" >}} -VAULT_SERVICE_PORT=8200 -VAULT_SERVICE_CLUSTER=azertyuiopqsdf-main-afdwftq -VAULT_SERVICE_HOST=vault_secret.internal -VAULT_SERVICE_REL=manage_keys -VAULT_SERVICE_PATH=/ -VAULT_SERVICE_QUERY={'is_master': True} -VAULT_SERVICE_PASSWORD=ChangeMe -VAULT_SERVICE_EPOCH=0 -VAULT_SERVICE_TYPE=vault-kms:{{% latest "vault-kms" %}} -VAULT_SERVICE_PUBLIC=false -VAULT_SERVICE_HOST_MAPPED=false +VAULT_USERNAME= +VAULT_SCHEME=http +VAULT_SERVICE=vault-kms +VAULT_FRAGMENT= +VAULT_IP=123.456.78.90 +VAULT_INSTANCE_IPS=['123.456.78.90'] +VAULT_HOSTNAME=azertyuiopqsdfghjklm.vault-kms.service._.eu-1.{{< vendor/urlraw "hostname" >}} +VAULT_PORT=8200 +VAULT_CLUSTER=azertyuiopqsdf-main-afdwftq +VAULT_HOST=vault_secret.internal +VAULT_REL=manage_keys +VAULT_PATH=/ +VAULT_QUERY={'is_master': True} +VAULT_PASSWORD=ChangeMe +VAULT_EPOCH=0 +VAULT_TYPE=vault-kms:{{% latest "vault-kms" %}} +VAULT_PUBLIC=false +VAULT_HOST_MAPPED=false ``` <---> @@ -127,7 +127,7 @@ services: type: ``` -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. - {{< variable "SERVICE_NAME" >}} is the name you choose to identify the service. @@ -155,10 +155,10 @@ applications: # The name of the app container. Must be unique within a project. : # 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: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : service: endpoint: diff --git a/sites/upsun/src/create-apps/hooks/_index.md b/sites/upsun/src/create-apps/hooks/_index.md index bb5b60b6ed..d028059a37 100644 --- a/sites/upsun/src/create-apps/hooks/_index.md +++ b/sites/upsun/src/create-apps/hooks/_index.md @@ -153,7 +153,9 @@ So you don't have to rebuild Drupal but you still get fresh content. root: client relationships: - api: 'api:http' + api: + service: 'api' + endpoint: 'http' ``` 2. Set [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). @@ -228,8 +230,12 @@ applications: # The relationships of the app with services or other apps. relationships: - database: 'db:mysql' - redis: 'cache:redis' + database: + service: 'db' + endpoint: 'mysql' + redis: + service: 'cache' + endpoint: 'redis' # The hooks executed at various points in the lifecycle of the app. hooks: @@ -262,7 +268,9 @@ applications: flavor: none relationships: - api: 'api:http' + api: + service: 'api' + endpoint: 'http' # The hooks that are triggered when the package is deployed. hooks: diff --git a/sites/upsun/src/create-apps/multi-app/project-structure.md b/sites/upsun/src/create-apps/multi-app/project-structure.md index a5d064d09b..d651f98538 100644 --- a/sites/upsun/src/create-apps/multi-app/project-structure.md +++ b/sites/upsun/src/create-apps/multi-app/project-structure.md @@ -74,7 +74,9 @@ applications: type: php:8.2 relationships: - database: "database:postgresql" + database: + service: "database" + endpoint: "postgresql" mounts: "/var/cache": "shared:files/cache" diff --git a/sites/upsun/src/create-apps/multi-app/relationships.md b/sites/upsun/src/create-apps/multi-app/relationships.md index 0d9e9d7c3b..875370a8c5 100644 --- a/sites/upsun/src/create-apps/multi-app/relationships.md +++ b/sites/upsun/src/create-apps/multi-app/relationships.md @@ -31,7 +31,9 @@ In your app configuration for `app1`, define a relationship to `app2`: applications: app1: relationships: - api: "app2:http" + api: + service: "app2" + endpoint: "http" ``` Once they're both built, `app1` can access `app2` at the following URL: `http://api.internal`.
diff --git a/sites/upsun/src/get-started/here/configure/nodejs.md b/sites/upsun/src/get-started/here/configure/nodejs.md index 03a42cd206..fd6bcdb88b 100644 --- a/sites/upsun/src/get-started/here/configure/nodejs.md +++ b/sites/upsun/src/get-started/here/configure/nodejs.md @@ -13,7 +13,7 @@ These sections provide Javascript/Node.js-specific configuration details, but yo ## Build flavors -By default, {{% vendor/name %}} makes assumptions about how you want to build your application. +By default, {{% vendor/name %}} makes assumptions about how you want to build your application. Namely, that you are managing your dependencies with npm, and that the very first thing you'd like to run is a particular and common production flavor of `npm install`. This is called a build `flavor`, but its assumption may prove inappropriate for your application and cause your builds to fail (such as if you'd like to use yarn or bun instead of npm). @@ -113,7 +113,7 @@ applications: root: "/" type: "nodejs:20" relationships: - postgresql: "postgresql:postgresql" + postgresql: mounts: ... web: @@ -158,7 +158,7 @@ The {{% vendor/name %}} documentation includes a wide array of community resourc While there are virtually no restrictions to you deploying any kind of application on {{% vendor/name %}}, configuration may still be unclear at this point. -Not to worry! The {{% vendor/name %}} community is here to help. +Not to worry! The {{% vendor/name %}} community is here to help. Come and say hello, share your work, ask for help, and peek in on what others are working on. Welcome to the {{% vendor/name %}} community! diff --git a/sites/upsun/src/get-started/stacks/express/add-database.md b/sites/upsun/src/get-started/stacks/express/add-database.md index 355645f819..c865eef555 100644 --- a/sites/upsun/src/get-started/stacks/express/add-database.md +++ b/sites/upsun/src/get-started/stacks/express/add-database.md @@ -53,7 +53,7 @@ applications: [...] relationships: - database: "database:mysql" + database: {{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: database: @@ -74,8 +74,8 @@ or [amend those default container resources](/manage-resources/adjust-resources. ## 3. Connect to the service -To configure your Express app so it uses your new database, -you need a Node.s module named `mysql2`. +To configure your Express app so it uses your new database, +you need a Node.s module named `mysql2`. To install it, run the following command: ```bash {location="Terminal"} @@ -85,7 +85,7 @@ npm install mysql2 Wherever your application code attemps to connect to the database service, {{% vendor/name %}} will automatically generate environment variables containing connection credentials as a function of the relationship name. -In this example, the MariaDB service access is granted to the application container via the relationship `database`. +In this example, the MariaDB service access is granted to the application container via the relationship `database`. {{% vendor/name %}} will therefore generate the variable `DATABASE_HOST` (among many others), using this name. Here's an example of how this credential variable naming convention is used to connect to a MariaDB service: diff --git a/sites/upsun/src/get-started/stacks/laravel/environment-variables.md b/sites/upsun/src/get-started/stacks/laravel/environment-variables.md index 539c28e1d3..fd511c55b5 100644 --- a/sites/upsun/src/get-started/stacks/laravel/environment-variables.md +++ b/sites/upsun/src/get-started/stacks/laravel/environment-variables.md @@ -79,7 +79,9 @@ For example, if you have the following relationships in your configuration: ```yaml {configFile="app"} relationships: - database: "securitydb:postgresql" + database: + service: "securitydb" + endpoint: "postgresql" ``` The environment variables for the database service is prefixed by `DATABASE_`, @@ -96,7 +98,7 @@ To add specific variables available during the build, run `{{% vendor/cli %}} va ### Emails -{{% vendor/name %}} provides a SMTP service for sending emails. +{{% vendor/name %}} provides a SMTP service for sending emails. To configure email in Laravel, add the following mapping to your `.environment` file: ```bash {configFile="env"} @@ -249,4 +251,4 @@ The [Apache Kafka](/add-services/kafka) configuration is exposed via the followi - `KAFKA_PORT` - `KAFKA_IP` -{{< guide-buttons previous="Back" next="Set up Redis" nextLink="/get-started/stacks/laravel/setup-redis.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Set up Redis" nextLink="/get-started/stacks/laravel/setup-redis.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md index 114280874a..6a62f90366 100644 --- a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md +++ b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md @@ -25,7 +25,7 @@ With Laravel, you can use Redis to handle session storage, cache storage, and qu myapp: [...] relationships: - redis: "redis:redis" + redis: services: [...] @@ -94,4 +94,4 @@ export QUEUE_CONNECTION="redis" For more information, see the [Laravel Queues documentation](https://laravel.com/docs/master/queues) and {{% vendor/name %}}'s [Horizon configuration page](./laravel-horizon). -{{< guide-buttons previous="Back" next="Handle queues with Horizon" nextLink="/get-started/stacks/laravel/laravel-horizon.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Handle queues with Horizon" nextLink="/get-started/stacks/laravel/laravel-horizon.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/strapi/add-database.md b/sites/upsun/src/get-started/stacks/strapi/add-database.md index 07730176ff..fab5571e43 100644 --- a/sites/upsun/src/get-started/stacks/strapi/add-database.md +++ b/sites/upsun/src/get-started/stacks/strapi/add-database.md @@ -98,7 +98,7 @@ applications: [...] relationships: - database: "database:postgresql" + database: services: database: @@ -119,7 +119,7 @@ applications: [...] relationships: - database: "database:mysql" + database: services: database: @@ -156,7 +156,7 @@ if [[ -z "$APP_KEYS" ]]; then fi ``` -{{% vendor/name %}} will actually generate service credentials automatically for you in the runtime container, so we don't need the first half of this file anymore. +{{% vendor/name %}} will actually generate service credentials automatically for you in the runtime container, so we don't need the first half of this file anymore. Remove the first block (pertaining to `DATABASE` credentials). Then, add a single additional variable that will set the `DATABASE_CLIENT` variable at the appropriate time: diff --git a/sites/upsun/src/get-started/stacks/wordpress.md b/sites/upsun/src/get-started/stacks/wordpress.md index cb6997d235..c6beed1569 100644 --- a/sites/upsun/src/get-started/stacks/wordpress.md +++ b/sites/upsun/src/get-started/stacks/wordpress.md @@ -232,8 +232,8 @@ routes: - '/^wp-*/' ``` -Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. -If these strings aren't the same, the WordPress deployment will not succeed. +Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. +If these strings aren't the same, the WordPress deployment will not succeed. ## 7. Update your MariaDB service relationship diff --git a/sites/upsun/src/languages/lisp.md b/sites/upsun/src/languages/lisp.md index 683b47cf63..d102d0d074 100644 --- a/sites/upsun/src/languages/lisp.md +++ b/sites/upsun/src/languages/lisp.md @@ -141,14 +141,41 @@ The following is an example of accessing a PostgreSQL instance: Given a relationship defined in `{{< vendor/configfile "app" >}}`: +{{< codetabs >}} + ++++ +title=Using default endpoints ++++ + ```yaml {configFile="app"} applications: app: type: 'lisp:{{% latest "lisp" %}}' relationships: - postgresql: + postgresql: ``` +<---> + ++++ +title=Using explicit endpoints ++++ + +```yaml {configFile="app"} +applications: + app: + type: 'lisp:{{% latest "lisp" %}}' + relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + postgresql: + service: 'postgresql' + endpoint: 'postgresql' +``` + +{{< /codetabs >}} + + The following would access that relationship, and provide your Lisp program the credentials to connect to a PostgreSQL instance. Add this to your `.asd` file: ```lisp From c76c2689876c3c6d9f5f52ac742c5a3cd4fd8343 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 17 Jun 2024 15:21:54 +0200 Subject: [PATCH 06/22] revert removing sites/upsun/.yaml file --- sites/upsun/.yaml | 1096 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1096 insertions(+) create mode 100644 sites/upsun/.yaml diff --git a/sites/upsun/.yaml b/sites/upsun/.yaml new file mode 100644 index 0000000000..9a65142781 --- /dev/null +++ b/sites/upsun/.yaml @@ -0,0 +1,1096 @@ +chrome-headless: + description: '' + disk: false + docs: + relationship_name: chrome-headless + service_name: chrome-headless + url: /add-services/headless-chrome.html + endpoint: http + min_disk_size: null + name: Headless Chrome + repo_name: chrome-headless + runtime: false + type: chrome-headless + versions: + deprecated: [] + supported: + - '120' + - '113' + - '95' + - '91' + - '86' + - '84' + - '83' + - '81' + - '80' + - '73' + legacy: + - '86' + - '84' + - '83' + - '81' + - '80' + - '73' + versions-dedicated-gen-3: + deprecated: [] + supported: + - '95' +dotnet: + description: ASP.NET 5 application container. + repo_name: dotnet + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/dotnet.html + web: + commands: + start: dotnet application.dll + locations: + /: + root: wwwroot + allow: true + passthru: true + hooks: + build: + - '|' + - set -e + - >- + dotnet publish --output "$PLATFORM_OUTPUT_DIR" + -p:UseRazorBuildServer=false -p:UseSharedCompilation=false + endpoint: null + min_disk_size: null + name: C#/.Net Core + runtime: true + type: dotnet + versions: + deprecated: + - '5.0' + - '3.1' + - '2.2' + - '2.1' + - '2.0' + supported: + - '7.0' + - '6.0' + legacy: + - '3.1' + - '2.2' + - '2.1' + - '2.0' +elasticsearch: + description: A manufacture service for Elasticsearch + disk: true + docs: + relationship_name: elasticsearch + service_name: elasticsearch + url: /add-services/elasticsearch.html + endpoint: elasticsearch + min_disk_size: 256 + name: Elasticsearch + repo_name: elasticsearch + runtime: false + type: elasticsearch + versions: + deprecated: + - '7.10' + - '7.9' + - '7.7' + - '7.5' + - '7.2' + - '6.8' + - '6.5' + - '5.4' + - '5.2' + - '2.4' + - '1.7' + - '1.4' + supported: + - '8.5' + - '7.17' + versions-dedicated-gen-2: + supported: + - '8.5' + - '7.17' + deprecated: + - '7.10' + - '7.9' + - '7.7' + - '7.6' + - '7.5' + - '7.2' + - '6.8' + - '6.5' + - '5.6' + - '5.2' + - '2.4' + - '1.7' + versions-dedicated-gen-3: + deprecated: + - '7.10' + - '7.9' + - '7.7' + - '7.5' + - '7.2' + - '6.8' + - '6.5' + supported: [] +elixir: + description: '' + repo_name: elixir + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/elixir.html + web: + commands: + start: mix run --no-halt + locations: + /: + allow: false + root: web + passthru: true + hooks: + build: + - '|' + - mix local.hex --force + - mix local.rebar --force + - mix do deps.get --only prod, deps.compile, compile + endpoint: null + min_disk_size: null + name: Elixir + runtime: true + type: elixir + versions: + deprecated: + - '1.13' + - '1.12' + - '1.11' + - '1.10' + - '1.9' + supported: + - '1.15' + - '1.14' + legacy: + - '1.10' + - '1.9' +golang: + description: '' + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/go.html + web: + upstream: + socket_family: tcp + protocol: http + commands: + start: ./bin/app + locations: + /: + allow: false + passthru: true + hooks: + build: + - go build -o bin/app + endpoint: null + min_disk_size: null + name: Go + repo_name: golang + runtime: true + type: golang + versions: + deprecated: + - '1.19' + - '1.18' + - '1.17' + - '1.16' + - '1.15' + - '1.14' + - '1.13' + - '1.12' + - '1.11' + - '1.10' + - '1.9' + - '1.8' + supported: + - '1.22' + - '1.21' + - '1.20' +influxdb: + description: '' + disk: true + docs: + relationship_name: influxdb + service_name: influxdb + url: /add-services/influxdb.html + endpoint: influxdb + min_disk_size: null + name: InfluxDB + repo_name: influxdb + runtime: false + type: influxdb + versions: + deprecated: + - '2.2' + - '1.8' + - '1.7' + - '1.3' + - '1.2' + supported: + - '2.7' + - '2.3' +java: + description: '' + docs: + relationship_name: null + service_name: null + url: /languages/java.html + web: + commands: + start: java -jar target/application.jar --server.port=$PORT + hooks: + build: + - mvn clean install + endpoint: null + min_disk_size: null + name: Java + repo_name: java + runtime: true + type: java + versions: + deprecated: + - '14' + - '13' + - '12' + supported: + - '21' + - '19' + - '18' + - '17' + - '11' + - '8' + versions-dedicated-gen-2: + supported: + - '17' + - '11' + - '8' + deprecated: + - '15' + - '13' + - '7' +kafka: + description: '' + disk: true + docs: + relationship_name: kafka + service_name: kafka + url: /add-services/kafka.html + endpoint: kafka + min_disk_size: 512 + name: Kafka + repo_name: kafka + runtime: false + type: kafka + versions: + deprecated: + - '2.7' + - '2.6' + - '2.5' + - '2.4' + - '2.3' + - '2.2' + - '2.1' + supported: + - '3.7' + - '3.6' + - '3.4' + - '3.2' + legacy: + - '2.6' + - '2.5' + - '2.4' + - '2.3' + - '2.2' + - '2.1' +lisp: + description: '' + id: 1102 + repo_name: lisp + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/lisp.html + web: + commands: + start: ./example + locations: + /: + allow: false + passthru: true + endpoint: null + min_disk_size: null + name: Lisp + runtime: true + type: lisp + versions: + deprecated: [] + supported: + - '2.1' + - '2.0' + - '1.5' +mariadb: + description: A manufacture-based container for MariaDB + repo_name: mariadb + disk: true + docs: + relationship_name: mariadb + service_name: mariadb + url: /add-services/mysql.html + endpoint: mysql + min_disk_size: 256 + name: MariaDB/MySQL + runtime: false + type: mariadb + versions: + deprecated: + - '10.2' + - '10.1' + - '10.3' + - '10.0' + - '5.5' + supported: + - '11.2' + - '11.0' + - '10.11' + - '10.6' + - '10.5' + - '10.4' + versions-dedicated-gen-2: + supported: + - 10.8 Galera + - 10.7 Galera + - 10.6 Galera + - 10.5 Galera + - 10.4 Galera + - 10.3 Galera + deprecated: + - 10.2 Galera + - 10.1 Galera + - 10.0 Galera + versions-dedicated-gen-3: + supported: + - 10.11 Galera + - 10.6 Galera + - 10.5 Galera + - 10.4 Galera + - 10.3 Galera + deprecated: + - 10.2 Galera + - 10.1 Galera +mysql: + description: A manufacture-based container for MariaDB + repo_name: mariadb + disk: true + docs: + relationship_name: mysql + service_name: mysql + url: /add-services/mysql.html + endpoint: mysql + min_disk_size: 256 + name: MariaDB/MySQL + runtime: false + type: mysql + versions: + deprecated: + - '10.2' + - '10.1' + - '10.0' + - '5.5' + supported: + - '11.0' + - '10.11' + - '10.6' + - '10.5' + - '10.4' + - '10.3' + versions-dedicated-gen-2: + supported: + - 10.5 Galera + - 10.4 Galera + - 10.3 Galera + deprecated: + - 10.2 Galera + - 10.1 Galera + - 10.0 Galera + versions-dedicated-gen-3: + supported: + - 10.11 Galera + - 10.6 Galera + - 10.5 Galera + - 10.4 Galera + - 10.3 Galera + deprecated: + - 10.2 Galera + - 10.1 Galera +memcached: + description: Memcached service. + repo_name: memcached + disk: false + docs: + relationship_name: memcached + service_name: memcached + url: /add-services/memcached.html + endpoint: memcached + min_disk_size: null + name: Memcached + runtime: false + type: memcached + versions: + deprecated: [] + supported: + - '1.6' + - '1.5' + - '1.4' + versions-dedicated-gen-2: + supported: + - 1.4* +mongodb: + description: Experimental MongoDB support on Platform.sh + repo_name: mongodb + disk: true + docs: + relationship_name: mongodb + service_name: mongodb + url: /add-services/mongodb.html + endpoint: mongodb + min_disk_size: 512 + name: MongoDB + runtime: false + type: mongodb + versions: + deprecated: + - 4.0.3 + - '3.6' + - '3.4' + - '3.2' + - '3.0' + supported: [] +mongodb-enterprise: + description: Support for the enterprise edition of MongoDB + repo_name: mongodb + disk: true + docs: + relationship_name: mongodb-enterprise + service_name: mongodb-enterprise + url: /add-services/mongodb.html + endpoint: mongodb + min_disk_size: 512 + name: MongoDB + runtime: false + type: mongodb-enterprise + premium: true + versions: + supported: + - '7.0' + - '6.0' + - '5.0' + - '4.4' + - '4.2' + deprecated: + - '4.0' + versions-dedicated-gen-2: + supported: + - '6.0' + - '5.0' + - '4.4' + - '4.2' + deprecated: + - '4.0' +network-storage: + description: '' + repo_name: network-storage + disk: true + docs: + relationship_name: 'null' + service_name: network-storage + url: /add-services/network-storage.html + endpoint: something + min_disk_size: null + name: Network Storage + runtime: false + type: network-storage + versions: + deprecated: + - '1.0' + supported: + - '2.0' + versions-dedicated-gen-3: + deprecated: [] + supported: + - '2.0' +nodejs: + description: NodeJS service for Platform + repo_name: nodejs + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/nodejs.html + web: + commands: + start: node index.js + endpoint: null + min_disk_size: null + name: JavaScript/Node.js + runtime: true + type: nodejs + versions: + deprecated: + - '14' + - '12' + - '10' + - '8' + - '6' + - '4.8' + - '4.7' + - '0.12' + supported: + - '20' + - '18' + - '16' + versions-dedicated-gen-2: + supported: [] + deprecated: + - '14' + - '12' + - '10' + - '9.8' +opensearch: + description: A manufacture service for OpenSearch + disk: true + docs: + relationship_name: opensearch + service_name: opensearch + url: /add-services/opensearch.html + endpoint: opensearch + min_disk_size: 256 + name: OpenSearch + repo_name: opensearch + runtime: false + type: opensearch + versions: + deprecated: + - '1.2' + - '1.1' + supported: + - '2' + - '1' + legacy: + - '1.1' + versions-dedicated-gen-2: + deprecated: [] + supported: + - '2.5' + - '1.2' + versions-dedicated-gen-3: + deprecated: [] + supported: + - '2' +oracle-mysql: + description: >- + Images using MySQL from Oracle instead of MariaDB still providing mysql + endpoints + repo_name: oracle-mysql + disk: true + docs: + relationship_name: oracle-mysql + service_name: oracle-mysql + url: /add-services/mysql.html + endpoint: mysql + min_disk_size: 256 + name: Oracle MySQL + runtime: false + type: oracle-mysql + versions: + deprecated: [] + supported: + - '8.0' + - '5.7' +php: + description: PHP service for Platform.sh. + repo_name: php + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/php.html + web: + locations: + /: + root: web + passthru: /index.php + hooks: + build: + - '|' + - set -e + deploy: + - '|' + - set -e + build: + flavor: composer + endpoint: null + min_disk_size: null + name: PHP + runtime: true + type: php + versions-dedicated-gen-2: + supported: + - '8.2' + - '8.1' + - '8.0' + deprecated: + - '7.4' + - '7.3' + - '7.2' + - '7.1' + - '7.0' + versions: + deprecated: + - '8.0' + - '7.4' + - '7.3' + - '7.2' + - '7.1' + - '7.0' + - '5.6' + - '5.5' + - '5.4' + supported: + - '8.3' + - '8.2' + - '8.1' +postgresql: + description: PostgreSQL service for Platform.sh. + repo_name: postgresql + disk: true + docs: + relationship_name: postgresql + service_name: postgresql + url: /add-services/postgresql.html + endpoint: postgresql + min_disk_size: null + name: PostgreSQL + runtime: false + type: postgresql + versions: + deprecated: + - '11' + - '10' + - '9.6' + - '9.5' + - '9.4' + - '9.3' + supported: + - '16' + - '15' + - '14' + - '13' + - '12' + versions-dedicated-gen-2: + deprecated: + - 11* + - 9.6* + - '9.5' + - '9.4' + - '9.3' + supported: [] + versions-dedicated-gen-3: + deprecated: + - '11' + - '10' + supported: + - '16' + - '15' + - '14' + - '13' + - '12' +python: + description: '' + repo_name: python + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/python.html + web: + commands: + start: python server.py + hooks: + build: + - '|' + - pipenv install --system --deploy + dependencies: + python3: + pipenv: 2018.10.13 + endpoint: null + min_disk_size: null + name: Python + runtime: true + type: python + versions: + deprecated: + - '3.7' + - '3.6' + - '3.5' + - 2.7* + supported: + - '3.12' + - '3.11' + - '3.10' + - '3.9' + - '3.8' +rabbitmq: + description: A manufacture-based container for RabbitMQ + repo_name: rabbitmq + disk: true + docs: + relationship_name: rabbitmq + service_name: rabbitmq + url: /add-services/rabbitmq.html + endpoint: rabbitmq + min_disk_size: 512 + name: RabbitMQ + runtime: false + type: rabbitmq + versions: + deprecated: + - '3.11' + - '3.10' + - '3.9' + - '3.8' + - '3.7' + - '3.6' + - '3.5' + supported: + - '3.13' + - '3.12' + legacy: + - '3.8' + - '3.7' + - '3.6' + - '3.5' + versions-dedicated-gen-2: + supported: + - '3.13' + - '3.12' + deprecated: + - '3.11' + - '3.10' + - '3.9' + - '3.8' + - '3.7' + versions-dedicated-gen-3: + deprecated: + - '3.11' + - '3.10' + - '3.9' + supported: + - '3.13' + - '3.12' +redis: + description: 'A manufacture-based Redis container ' + repo_name: redis + disk: false + docs: + relationship_name: redis + service_name: redis + url: /add-services/redis.html + endpoint: redis + min_disk_size: null + name: Redis + runtime: false + type: redis + versions: + deprecated: + - '6.0' + - '5.0' + - '4.0' + - '3.2' + - '3.0' + - '2.8' + supported: + - '7.2' + - '7.0' + - '6.2' + legacy: + - '6.0' + versions-dedicated-gen-2: + supported: + - '7.0' + - '6.2' + deprecated: + - '6.0' + - '5.0' + - '3.2' + versions-dedicated-gen-3: + deprecated: + - '6.0' + - '5.0' + - '4.0' + - '3.2' + - '3.0' + - '2.8' + supported: + - '7.2' + - '7.0' + - '6.2' +ruby: + description: '' + repo_name: ruby + disk: false + docs: + relationship_name: null + service_name: null + url: /languages/ruby.html + web: + upstream: + socket_family: unix + commands: + start: unicorn -l $SOCKET -E production config.ru + locations: + /: + root: public + passthru: true + expires: 1h + allow: true + hooks: + build: + - '|' + - bundle install --without development test + deploy: + - '|' + - RACK_ENV=production bundle exec rake db:migrate + endpoint: null + min_disk_size: null + name: Ruby + runtime: true + type: ruby + versions: + deprecated: + - '2.7' + - '2.6' + - '2.5' + - '2.4' + - '2.3' + supported: + - '3.3' + - '3.2' + - '3.1' + - '3.0' + legacy: + - '2.7' + - '2.6' + - '2.5' + - '2.4' + - '2.3' + versions-dedicated-gen-3: + deprecated: + - '2.7' + - '2.6' + - '2.5' + - '2.4' + - '2.3' + supported: + - '3.3' + - '3.2' + - '3.1' + - '3.0' + legacy: + - '2.7' + - '2.6' + - '2.5' + - '2.4' + - '2.3' +rust: + description: '' + repo_name: rust + disk: true + docs: + relationship_name: null + service_name: null + url: /languages/rust.html + web: + commands: + start: ./target/debug/hello + endpoint: null + min_disk_size: null + name: Rust + runtime: true + type: rust + versions: + deprecated: [] + supported: + - '1' +solr: + description: '' + repo_name: solr + disk: true + docs: + relationship_name: solr + service_name: solr + url: /add-services/solr.html + endpoint: solr + min_disk_size: 256 + name: Solr + runtime: false + type: solr + versions: + deprecated: + - '8.6' + - '8.4' + - '8.0' + - '7.7' + - '7.6' + - '6.6' + - '6.3' + - '4.10' + - '3.6' + supported: + - '9.4' + - '9.2' + - '9.1' + - '8.11' + versions-dedicated-gen-2: + supported: + - '8.11' + deprecated: + - '8.6' + - '8.0' + - '7.7' + - '6.6' + - '6.3' + - '4.10' + versions-dedicated-gen-3: + supported: + - '9.2' + - '9.1' + - '8.11' + deprecated: [] +varnish: + description: '' + repo_name: varnish + disk: false + docs: + relationship_name: varnish + service_name: varnish + url: /add-services/varnish.html + endpoint: http+stats + min_disk_size: null + configuration: |2- + configuration: + vcl: !include + type: string + path: config.vcl + service_relationships: 'application: ''app:http''' + name: Varnish + runtime: false + type: varnish + versions: + deprecated: + - '5.1' + - '5.2' + - '6.3' + - '6.4' + - '7.1' + supported: + - '7.3' + - '7.2' + - '6.0' +vault-kms: + description: '' + disk: true + docs: + relationship_name: vault-kms + service_name: vault-kms + url: /add-services/vault.html + endpoint: manage_keys + min_disk_size: 512 + configuration: |2- + configuration: + endpoints: + : + - policy: + key: + type: + name: Vault KMS + repo_name: vault-kms + runtime: false + type: vault-kms + versions: + supported: + - '1.12' + deprecated: + - '1.8' + - '1.6' + legacy: + - '1.6' + versions-dedicated-gen-2: + supported: + - '1.6' + versions-dedicated-gen-3: + supported: + - '1.12' + deprecated: + - '1.8' + - '1.6' +redis-persistent: + description: 'A manufacture-based Redis container ' + repo_name: redis + disk: true + docs: + relationship_name: redisdata + service_name: data + url: /add-services/redis.html + endpoint: redis + min_disk_size: null + name: Persistent Redis + runtime: false + type: redis-persistent + versions: + deprecated: + - '6.0' + - '5.0' + - '4.0' + - '3.2' + - '3.0' + - '2.8' + supported: + - '7.2' + - '7.0' + - '6.2' + legacy: + - '6.0' + versions-dedicated-gen-2: + supported: + - '7.0' + - '6.2' + deprecated: + - '6.0' + - '5.0' + - '3.2' + versions-dedicated-gen-3: + deprecated: + - '6.0' + - '5.0' + - '4.0' + - '3.2' + - '3.0' + - '2.8' + supported: + - '7.2' + - '7.0' + - '6.2' From 81a84d039f5ee99172f66bac571f9b0c5671a7ac Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 17 Jun 2024 15:34:28 +0200 Subject: [PATCH 07/22] remove legacy relationship definition --- sites/platform/src/create-apps/hooks/_index.md | 16 ++++++++++++---- .../create-apps/multi-app/project-structure.md | 4 +++- .../src/create-apps/multi-app/relationships.md | 4 +++- sites/platform/src/get-started/add-data/merge.md | 4 +++- sites/platform/src/guides/drupal/memcached.md | 4 ++-- sites/platform/src/guides/drupal/redis.md | 2 +- .../strapi/database-configuration/mongodb.md | 4 +++- .../strapi/database-configuration/mysql.md | 4 +++- 8 files changed, 30 insertions(+), 12 deletions(-) diff --git a/sites/platform/src/create-apps/hooks/_index.md b/sites/platform/src/create-apps/hooks/_index.md index 7e30ac1f62..88d4d77f25 100644 --- a/sites/platform/src/create-apps/hooks/_index.md +++ b/sites/platform/src/create-apps/hooks/_index.md @@ -161,7 +161,9 @@ So you don't have to rebuild Drupal but you still get fresh content. ```yaml {configfile="app" dir="client"} relationships: - api: 'api:http' + api: + service: 'api' + endpoint: 'http' ``` 2. Set [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). @@ -231,8 +233,12 @@ dependencies: # The relationships of the app with services or other apps. relationships: - database: 'db:mysql' - redis: 'cache:redis' + database: + service: 'db' + endpoint: 'mysql' + redis: + service: 'cache' + endpoint: 'redis' # The hooks executed at various points in the lifecycle of the app. hooks: @@ -275,7 +281,9 @@ build: flavor: none relationships: - api: 'api:http' + api: + service: 'api' + endpoint: 'http' # The hooks that are triggered when the package is deployed. hooks: diff --git a/sites/platform/src/create-apps/multi-app/project-structure.md b/sites/platform/src/create-apps/multi-app/project-structure.md index c77fe8b1e4..0bc908ef33 100644 --- a/sites/platform/src/create-apps/multi-app/project-structure.md +++ b/sites/platform/src/create-apps/multi-app/project-structure.md @@ -78,7 +78,9 @@ api: type: php:8.2 relationships: - database: "database:postgresql" + database: + service: "database" + endpoint: "postgresql" mounts: "/var/cache": "shared:files/cache" diff --git a/sites/platform/src/create-apps/multi-app/relationships.md b/sites/platform/src/create-apps/multi-app/relationships.md index 245e70f192..f4e516ed12 100644 --- a/sites/platform/src/create-apps/multi-app/relationships.md +++ b/sites/platform/src/create-apps/multi-app/relationships.md @@ -30,7 +30,9 @@ In your app configuration for `app1`, define a relationship to `app2`: ```yaml {configFile="apps"} app1: relationships: - api: "app2:http" + api: + service: "app2" + endpoint: "http" ``` Once they're both built, `app1` can access `app2` at the following URL: `http://api.internal`. diff --git a/sites/platform/src/get-started/add-data/merge.md b/sites/platform/src/get-started/add-data/merge.md index 44ad98d89d..cba2ea40aa 100644 --- a/sites/platform/src/get-started/add-data/merge.md +++ b/sites/platform/src/get-started/add-data/merge.md @@ -39,7 +39,9 @@ Add a database service (or choose [another service](../../add-services/_index.md ```yaml {configFile="app"} relationships: - database: "db:mysql" + database: + service: "db" + endpoint: "mysql" ``` This relationship is where connections are made. diff --git a/sites/platform/src/guides/drupal/memcached.md b/sites/platform/src/guides/drupal/memcached.md index 46e8c1b915..8a50ea6f64 100644 --- a/sites/platform/src/guides/drupal/memcached.md +++ b/sites/platform/src/guides/drupal/memcached.md @@ -25,7 +25,7 @@ To define the service, use the `memcached`: disk: 256 ``` -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 @@ -51,7 +51,7 @@ 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 via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). For PHP, enable the [extension](/languages/php/extensions) for the service: diff --git a/sites/platform/src/guides/drupal/redis.md b/sites/platform/src/guides/drupal/redis.md index a2f9d90bf1..86c78d3919 100644 --- a/sites/platform/src/guides/drupal/redis.md +++ b/sites/platform/src/guides/drupal/redis.md @@ -73,7 +73,7 @@ The example above leverages [default endpoint](/create-apps/app-reference/single 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 via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#use-provided-variables). For PHP, enable the [extension](/languages/php/extensions) for the service: diff --git a/sites/platform/src/guides/strapi/database-configuration/mongodb.md b/sites/platform/src/guides/strapi/database-configuration/mongodb.md index c8f040411a..e1fe2a1a84 100644 --- a/sites/platform/src/guides/strapi/database-configuration/mongodb.md +++ b/sites/platform/src/guides/strapi/database-configuration/mongodb.md @@ -30,7 +30,9 @@ To use MongoDB with a Strapi v3 application on {{% vendor/name %}}, follow these ```yaml relationships: - mongodatabase: "mongodb:mongodb" + mongodatabase: + service: "mongodb" + endpoint: "mongodb" ``` 1. In the `config` folder, locate the `database.js` file, and replace its content with the following: diff --git a/sites/platform/src/guides/strapi/database-configuration/mysql.md b/sites/platform/src/guides/strapi/database-configuration/mysql.md index 0cc980fde9..ba5298ae77 100644 --- a/sites/platform/src/guides/strapi/database-configuration/mysql.md +++ b/sites/platform/src/guides/strapi/database-configuration/mysql.md @@ -31,7 +31,9 @@ To configure a MySQL database for Strapi on {{% vendor/name %}}, follow these st ```yaml relationships: - mysqldatabase: "mysql:mysql" + mysqldatabase: + service: "mysql" + endpoint: "mysql" ``` 4. In the `config` folder, locate the `database.js` file, and replace its content with the following: From fa051d6a9a689130c3c6d60165ddde69c0a53f0f Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 17 Jun 2024 16:41:26 +0200 Subject: [PATCH 08/22] revert automatic removal of trailing space at the end of snippets (default service def) --- sites/platform/src/add-services/_index.md | 2 +- .../platform/src/add-services/elasticsearch.md | 4 ++-- sites/platform/src/add-services/gotenberg.md | 4 ++-- .../src/add-services/headless-chrome.md | 4 ++-- sites/platform/src/add-services/influxdb.md | 6 +++--- sites/platform/src/add-services/kafka.md | 4 ++-- sites/platform/src/add-services/memcached.md | 4 ++-- sites/platform/src/add-services/mongodb.md | 8 ++++---- .../platform/src/add-services/mysql/_index.md | 6 +++--- sites/platform/src/add-services/opensearch.md | 6 +++--- sites/platform/src/add-services/postgresql.md | 4 ++-- sites/platform/src/add-services/rabbitmq.md | 4 ++-- sites/platform/src/add-services/redis.md | 10 +++++----- sites/platform/src/add-services/solr.md | 4 ++-- sites/upsun/src/add-services/_index.md | 6 +++--- sites/upsun/src/add-services/clickhouse.md | 6 +++--- sites/upsun/src/add-services/elasticsearch.md | 6 +++--- sites/upsun/src/add-services/gotenberg.md | 4 ++-- .../upsun/src/add-services/headless-chrome.md | 6 +++--- sites/upsun/src/add-services/influxdb.md | 6 +++--- sites/upsun/src/add-services/kafka.md | 4 ++-- sites/upsun/src/add-services/memcached.md | 10 +++++----- sites/upsun/src/add-services/mongodb.md | 14 +++++++------- sites/upsun/src/add-services/mysql/_index.md | 8 ++++---- sites/upsun/src/add-services/opensearch.md | 6 +++--- sites/upsun/src/add-services/postgresql.md | 8 ++++---- sites/upsun/src/add-services/rabbitmq.md | 6 +++--- sites/upsun/src/add-services/redis.md | 18 +++++++++--------- sites/upsun/src/add-services/solr.md | 6 +++--- .../src/get-started/here/configure/nodejs.md | 2 +- .../get-started/stacks/express/add-database.md | 2 +- .../get-started/stacks/laravel/setup-redis.md | 2 +- .../get-started/stacks/strapi/add-database.md | 12 ++++++------ sites/upsun/src/languages/lisp.md | 2 +- 34 files changed, 102 insertions(+), 102 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index 5de7390fec..e96b13ef1d 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -115,7 +115,7 @@ title=Using default endpoints # 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: - {{" >}}: + {{" >}}: ``` You can define `` as you like, so long as it's unique between all defined services diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index c20afc85e6..b27c2bd2b4 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -147,7 +147,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -219,7 +219,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - elasticsearch: + elasticsearch: ``` <---> diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index 3e7e9332ad..4307c51ec3 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -77,7 +77,7 @@ title=Using default endpoints ```yaml {configFile="app"} # Relationships enable access from this app to a given service. relationships: - : + : ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -138,7 +138,7 @@ title=Using default endpoints ```yaml {configFile="app"} # Relationships enable access from this app to a given service. relationships: - gotenberg: + gotenberg: ``` <---> diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index 42cd268c99..bcfa861f69 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -96,7 +96,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -164,7 +164,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - chrome-headless: + chrome-headless: ``` <---> diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 82afcbf2f6..b0d4b65bb5 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -128,7 +128,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -197,7 +197,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - influxdb: + influxdb: ``` <---> @@ -237,7 +237,7 @@ name: myapp # Relationships enable an app container's access to a service. relationships: - influxdb: + influxdb: ``` <---> diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index 18a1678177..0ebe3b147a 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -85,7 +85,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -154,7 +154,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - kafka: + kafka: ``` <---> diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index 921aa3bada..cda3242226 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -97,7 +97,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -165,7 +165,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - memcached: + memcached: ``` <---> diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index 021b90ad0a..fa1db94010 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -159,7 +159,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -237,7 +237,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb-enterprise: + mongodb-enterprise: ``` <---> @@ -291,7 +291,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -369,7 +369,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb: + mongodb: ``` <---> diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index dc26db1ee3..2a2cd5bed5 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -137,7 +137,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -206,7 +206,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mariadb: + mariadb: ``` <---> @@ -253,7 +253,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - oraclemysql: + oraclemysql: ``` <---> diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 01268e8f3a..79d98a3fde 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -129,7 +129,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -198,7 +198,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - opensearch: + opensearch: ``` <---> @@ -236,7 +236,7 @@ name: myapp [...] relationships: - opensearch: + opensearch: ``` <---> diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index 64f8d8f54b..db6b0e6d8b 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -131,7 +131,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -209,7 +209,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - postgresql: + postgresql: ``` <---> diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index ef0aafaac1..82ac3de2eb 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -124,7 +124,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -193,7 +193,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - rabbitmq: + rabbitmq: ``` <---> diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index d54a802b0d..82201a3a87 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -171,7 +171,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -241,7 +241,7 @@ title=Using default endpoints ```yaml {configFile="app"} relationships: - redis: + redis: ``` <---> @@ -343,7 +343,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -413,7 +413,7 @@ title=Using default endpoints ```yaml {configFile="app"} relationships: - redis: + redis: ``` <---> @@ -629,7 +629,7 @@ title=Using default endpoints type: "php:{{% latest "php" %}}" relationships: - redissessions: + redissessions: variables: php: diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index 427c94d384..bf6f718c9d 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -124,7 +124,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -193,7 +193,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - solr: + solr: ``` <---> diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index ad5f82d77d..90776ecf99 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -106,7 +106,7 @@ applications: # 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: - {{}}: + {{}}: services: # The name of the service container. Must be unique within a project. {{}}: @@ -171,8 +171,8 @@ applications: # The name of the app container. Must be unique within a project. {{}}: relationships: - mariadb: - postgresql: + mariadb: + postgresql: services: mariadb: type: mariadb:{{% latest "mariadb" %}} diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index 7d3af14580..dace1eb0a2 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -145,7 +145,7 @@ applications: : # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -198,7 +198,7 @@ applications: : # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -252,7 +252,7 @@ applications: root: "myapp" # Relationships enable an app container's access to a service. relationships: - clickhouse: + clickhouse: services: clickhouse: # The name of the service container. Must be unique within a project. diff --git a/sites/upsun/src/add-services/elasticsearch.md b/sites/upsun/src/add-services/elasticsearch.md index 8fa9cc5507..200d4e830d 100644 --- a/sites/upsun/src/add-services/elasticsearch.md +++ b/sites/upsun/src/add-services/elasticsearch.md @@ -150,7 +150,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -222,7 +222,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - elasticsearch: + elasticsearch: services: # The name of the service container. Must be unique within a project. elasticsearch: @@ -280,7 +280,7 @@ applications: root: "myapp" # Relationships enable access from this app to a given service. relationships: - elasticsearch: + elasticsearch: services: elasticsearch: type: elasticsearch:{{% latest "elasticsearch" %}} diff --git a/sites/upsun/src/add-services/gotenberg.md b/sites/upsun/src/add-services/gotenberg.md index fdda9e0f52..bdb169e785 100644 --- a/sites/upsun/src/add-services/gotenberg.md +++ b/sites/upsun/src/add-services/gotenberg.md @@ -117,7 +117,7 @@ applications: : # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -169,7 +169,7 @@ applications: myapp: # Relationships enable access from this app to a given service. relationships: - gotenberg: + gotenberg: services: # The name of the service container. Must be unique within a project. gotenberg: diff --git a/sites/upsun/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md index 55912d7b70..d850ec9140 100644 --- a/sites/upsun/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -125,7 +125,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -197,7 +197,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - chrome-headless: + chrome-headless: services: # The name of the service container. Must be unique within a project. chrome-headless: @@ -289,7 +289,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - chrome-headless: + chrome-headless: services: # The name of the service container. Must be unique within a project. chrome-headless: diff --git a/sites/upsun/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md index 84988998e4..80c1456ccd 100644 --- a/sites/upsun/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -146,7 +146,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -218,7 +218,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - influxdb: + influxdb: services: # The name of the service container. Must be unique within a project. influxdb: @@ -274,7 +274,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - influxdb: + influxdb: service: influxdb: type: influxdb:{{% latest "influxdb" %}} diff --git a/sites/upsun/src/add-services/kafka.md b/sites/upsun/src/add-services/kafka.md index 1da5162096..215c5bd73f 100644 --- a/sites/upsun/src/add-services/kafka.md +++ b/sites/upsun/src/add-services/kafka.md @@ -118,7 +118,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -190,7 +190,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - kafka: + kafka: services: # The name of the service container. Must be unique within a project. kafka: diff --git a/sites/upsun/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md index f893fd618c..a76a112dbb 100644 --- a/sites/upsun/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -119,7 +119,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -190,7 +190,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -245,7 +245,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -299,7 +299,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - memcached: + memcached: services: # The name of the service container. Must be unique within a project. @@ -354,7 +354,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - memcached: + memcached: service: memcached: type: memcached:{{% latest "memcached" %}} diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index c43fa10554..308e4be739 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -149,7 +149,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -225,7 +225,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -283,7 +283,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb-enterprise: + mongodb-enterprise: services: # The name of the service container. Must be unique within a project. mongodb-enterprise: @@ -352,7 +352,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -428,7 +428,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -486,7 +486,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb: + mongodb: services: # The name of the service container. Must be unique within a project. mongodb: @@ -545,7 +545,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - mongodb: + mongodb: service: mongodb: type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index 2c21ba6fd9..c951a68651 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -260,7 +260,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -330,7 +330,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mariadb: + mariadb: services: # The name of the service container. Must be unique within a project. mariadb: @@ -377,7 +377,7 @@ applications: myapp: # The location of the application's code. relationships: - oracle-mysql: + oracle-mysql: service: # The name of the service container. Must be unique within a project. oracle-mysql: @@ -432,7 +432,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - mariadb: + mariadb: service: mariadb: type: mariadb:{{% latest "mariadb" %}} diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index fbedf659ab..f7ce095461 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -148,7 +148,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -220,7 +220,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - opensearch: + opensearch: services: # The name of the service container. Must be unique within a project. opensearch: @@ -275,7 +275,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - opensearch: + opensearch: services: # The name of the service container. Must be unique within a project. opensearch: diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index 7392b6d7c0..52910b03e8 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -143,7 +143,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -219,7 +219,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -277,7 +277,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - postgresql: + postgresql: services: # The name of the service container. Must be unique within a project. postgresql: @@ -336,7 +336,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - postgresql: + postgresql: services: # The name of the service container. Must be unique within a project. postgresql: diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index 1132314a5b..4e31dd7771 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -137,7 +137,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -209,7 +209,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - rabbitmq: + rabbitmq: services: # The name of the service container. Must be unique within a project. rabbitmq: @@ -264,7 +264,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - rabbitmq: + rabbitmq: services: # The name of the service container. Must be unique within a project. rabbitmq: diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index c6dfa53278..256261885a 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -181,7 +181,7 @@ applications: # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -254,7 +254,7 @@ applications: - redis # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -313,7 +313,7 @@ applications: - redis # Relationships enable access from this app to a given service. relationships: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -380,7 +380,7 @@ applications: # Relationships enable access from this app to a given service. relationships: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -500,7 +500,7 @@ applications: # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -575,7 +575,7 @@ applications: # Relationships enable access from this app to a given service. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -641,7 +641,7 @@ applications: # Relationships enable access from this app to a given service. relationships: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -708,7 +708,7 @@ applications: - redis # Relationships enable access from this app to a given service. relationships: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -940,7 +940,7 @@ applications: - redis relationships: - redissession: + redissession: variables: php: diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index 31c03c9484..857e4e8e28 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -135,7 +135,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -207,7 +207,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - solr: + solr: services: # The name of the service container. Must be unique within a project. solr: @@ -263,7 +263,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - solr: + solr: services: # The name of the service container. Must be unique within a project. solr: diff --git a/sites/upsun/src/get-started/here/configure/nodejs.md b/sites/upsun/src/get-started/here/configure/nodejs.md index fd6bcdb88b..329f9d0fc6 100644 --- a/sites/upsun/src/get-started/here/configure/nodejs.md +++ b/sites/upsun/src/get-started/here/configure/nodejs.md @@ -113,7 +113,7 @@ applications: root: "/" type: "nodejs:20" relationships: - postgresql: + postgresql: mounts: ... web: diff --git a/sites/upsun/src/get-started/stacks/express/add-database.md b/sites/upsun/src/get-started/stacks/express/add-database.md index c865eef555..835ee30b5f 100644 --- a/sites/upsun/src/get-started/stacks/express/add-database.md +++ b/sites/upsun/src/get-started/stacks/express/add-database.md @@ -53,7 +53,7 @@ applications: [...] relationships: - database: + database: {{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: database: diff --git a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md index 6a62f90366..147d5e9ff4 100644 --- a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md +++ b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md @@ -25,7 +25,7 @@ With Laravel, you can use Redis to handle session storage, cache storage, and qu myapp: [...] relationships: - redis: + redis: services: [...] diff --git a/sites/upsun/src/get-started/stacks/strapi/add-database.md b/sites/upsun/src/get-started/stacks/strapi/add-database.md index fab5571e43..9c1a4d3a3b 100644 --- a/sites/upsun/src/get-started/stacks/strapi/add-database.md +++ b/sites/upsun/src/get-started/stacks/strapi/add-database.md @@ -58,7 +58,7 @@ applications: services: database: - type: postgresql:{{% latest "postgresql" %}} + type: postgresql:{{% latest "postgresql" %}} ``` <---> @@ -76,7 +76,7 @@ applications: services: database: - type: oracle-mysql:{{% latest "oracle-mysql" %}} + type: oracle-mysql:{{% latest "oracle-mysql" %}} ``` {{< /codetabs >}} @@ -98,11 +98,11 @@ applications: [...] relationships: - database: + database: services: database: - type: postgresql:{{% latest "postgresql" %}} + type: postgresql:{{% latest "postgresql" %}} ``` <---> @@ -119,11 +119,11 @@ applications: [...] relationships: - database: + database: services: database: - type: oracle-mysql:{{% latest "oracle-mysql" %}} + type: oracle-mysql:{{% latest "oracle-mysql" %}} ``` {{< /codetabs >}} diff --git a/sites/upsun/src/languages/lisp.md b/sites/upsun/src/languages/lisp.md index d102d0d074..b583999515 100644 --- a/sites/upsun/src/languages/lisp.md +++ b/sites/upsun/src/languages/lisp.md @@ -152,7 +152,7 @@ applications: app: type: 'lisp:{{% latest "lisp" %}}' relationships: - postgresql: + postgresql: ``` <---> From 2f2de53a6db25de0c2b274993dc9e65e7b1beb83 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 17 Jun 2024 16:49:09 +0200 Subject: [PATCH 09/22] P.sh changing link to service env variable --- sites/platform/src/add-services/_index.md | 2 +- sites/platform/src/add-services/elasticsearch.md | 2 +- sites/platform/src/add-services/gotenberg.md | 2 +- sites/platform/src/add-services/headless-chrome.md | 2 +- sites/platform/src/add-services/influxdb.md | 2 +- sites/platform/src/add-services/kafka.md | 2 +- sites/platform/src/add-services/memcached.md | 2 +- sites/platform/src/add-services/mongodb.md | 4 ++-- sites/platform/src/add-services/mysql/_index.md | 2 +- sites/platform/src/add-services/opensearch.md | 2 +- sites/platform/src/add-services/postgresql.md | 2 +- sites/platform/src/add-services/rabbitmq.md | 2 +- sites/platform/src/add-services/redis.md | 4 ++-- sites/platform/src/add-services/solr.md | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index e96b13ef1d..8afa6df1b5 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -153,7 +153,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index b27c2bd2b4..0159dfbac3 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -187,7 +187,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index 4307c51ec3..b76e5ebab7 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -111,7 +111,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index bcfa861f69..a7d04d9e96 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -136,7 +136,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index b0d4b65bb5..5989e46450 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -168,7 +168,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index 0ebe3b147a..f0e72b2f7c 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -125,7 +125,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index cda3242226..fcc05ea9c1 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -137,7 +137,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index fa1db94010..dd1be7de73 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -199,7 +199,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} @@ -331,7 +331,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 2a2cd5bed5..3feebc6fe6 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -177,7 +177,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 79d98a3fde..9e11521685 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -169,7 +169,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index db6b0e6d8b..17de0e57ca 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -171,7 +171,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index 82ac3de2eb..fde5c69cc3 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -164,7 +164,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 82201a3a87..35886d324c 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -207,7 +207,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} @@ -379,7 +379,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index bf6f718c9d..08b4816284 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -164,7 +164,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). +With the above definition, the application container now has [access to the service](#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} From aa78aa99a17053bf8f5f975c928d7a7fec4a13ae Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Mon, 17 Jun 2024 16:56:30 +0200 Subject: [PATCH 10/22] P.sh changing dead link --- sites/platform/src/add-services/_index.md | 2 +- sites/platform/src/add-services/gotenberg.md | 2 +- sites/platform/src/add-services/mongodb.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index 8afa6df1b5..87e0e1c64e 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -153,7 +153,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index b76e5ebab7..969ba8e70b 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -111,7 +111,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index dd1be7de73..1d7d8861ae 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -199,7 +199,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} @@ -331,7 +331,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} From 3922f3a3750da04ff66be52600f10e77b79ccfc6 Mon Sep 17 00:00:00 2001 From: Anouck Colson Date: Wed, 19 Jun 2024 15:58:23 +0200 Subject: [PATCH 11/22] Apply consistency and remove cf to legacy syntax on Upsun side --- sites/platform/src/add-services/_index.md | 30 ++--- .../src/add-services/elasticsearch.md | 18 +-- sites/platform/src/add-services/gotenberg.md | 16 ++- .../src/add-services/headless-chrome.md | 18 +-- sites/platform/src/add-services/influxdb.md | 30 +++-- sites/platform/src/add-services/kafka.md | 20 +-- sites/platform/src/add-services/memcached.md | 18 +-- sites/platform/src/add-services/mongodb.md | 36 +++--- .../platform/src/add-services/mysql/_index.md | 39 +++--- .../src/add-services/network-storage.md | 2 +- sites/platform/src/add-services/opensearch.md | 22 ++-- sites/platform/src/add-services/postgresql.md | 30 ++--- sites/platform/src/add-services/rabbitmq.md | 18 +-- sites/platform/src/add-services/redis.md | 26 ++-- sites/platform/src/add-services/solr.md | 16 +-- sites/platform/src/add-services/vault.md | 15 +-- sites/upsun/src/add-services/_index.md | 53 ++++---- sites/upsun/src/add-services/clickhouse.md | 68 ++++++----- sites/upsun/src/add-services/elasticsearch.md | 31 ++--- sites/upsun/src/add-services/gotenberg.md | 28 +++-- .../upsun/src/add-services/headless-chrome.md | 33 ++--- sites/upsun/src/add-services/influxdb.md | 35 +++--- sites/upsun/src/add-services/kafka.md | 18 ++- sites/upsun/src/add-services/memcached.md | 44 ++++--- sites/upsun/src/add-services/mongodb.md | 71 ++++++----- sites/upsun/src/add-services/mysql/_index.md | 58 +++++---- .../upsun/src/add-services/network-storage.md | 2 +- sites/upsun/src/add-services/opensearch.md | 35 +++--- sites/upsun/src/add-services/postgresql.md | 47 ++++---- sites/upsun/src/add-services/rabbitmq.md | 35 +++--- sites/upsun/src/add-services/redis.md | 114 +++++++++++------- sites/upsun/src/add-services/solr.md | 38 +++--- sites/upsun/src/add-services/varnish.md | 8 +- sites/upsun/src/add-services/vault.md | 3 - 34 files changed, 577 insertions(+), 498 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index 87e0e1c64e..77cc1c46f4 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -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: {{}}:{{}} + type: : # Other options... ``` @@ -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 ({{}}; 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 (````: 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. @@ -115,7 +115,7 @@ title=Using default endpoints # 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: - {{" >}}: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -136,13 +136,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: - {{" >}}: - service: {{" >}} - endpoint: {{" >}} + : + service: + endpoint: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -183,16 +184,18 @@ title=Using explicit endpoints ```yaml {configFile="app"} # Other options... -# Relationships enable an app container's access to a service. -# Please note: Legacy definition of the relationship is still supported: +# 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" + service: mariadb + endpoint: mysql postgresql: - service: "postgresql" - endpoint: "mysql" + service: postgresql + endpoint: mysql ``` {{< /codetabs >}} @@ -265,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 diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index 0159dfbac3..f393b6d729 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -147,7 +147,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -170,13 +170,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : service: - endpoint: "elasticsearch" + endpoint: elasticsearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -219,7 +220,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - elasticsearch: + elasticsearch: ``` <---> @@ -230,13 +231,14 @@ title=Using explicit 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. +# 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" + service: elasticsearch + endpoint: elasticsearch ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index 969ba8e70b..4d1285f120 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -95,12 +95,14 @@ title=Using explicit endpoints ```yaml {configFile="app"} # Relationships enable access from this app to a given service. -# Please note: Legacy definition of the relationship is still supported: +# 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: : service: - endpoint: "http" + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -138,7 +140,7 @@ title=Using default endpoints ```yaml {configFile="app"} # Relationships enable access from this app to a given service. relationships: - gotenberg: + gotenberg: ``` <---> @@ -149,12 +151,14 @@ title=Using explicit endpoints ```yaml {configFile="app"} # Relationships enable access from this app to a given service. -# Please note: Legacy definition of the relationship is still supported: +# 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: gotenberg: - service: "gotenberg" - endpoint: "http" + service: gotenberg + endpoint: http ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index a7d04d9e96..c783a89414 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -96,7 +96,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -119,13 +119,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "http" + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -164,7 +165,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - chrome-headless: + chrome-headless: ``` <---> @@ -175,13 +176,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: chrome-headless: - service: "chrome-headless" - endpoint: "http" + service: chrome-headless + endpoint: http ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 5989e46450..6e881c11b6 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -128,7 +128,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -151,13 +151,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: - {{" >}}: - service: {{" >}} - endpoint: "influxdb" + : + service: + endpoint: influxdb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -197,7 +198,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - influxdb: + influxdb: ``` <---> @@ -208,13 +209,14 @@ 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. -# Please note: expended version of the explicit relationship (Legacy) is still supported: +# 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: influxdb: service: - endpoint: "influxdb" + endpoint: influxdb ``` {{< /codetabs >}} @@ -237,7 +239,7 @@ name: myapp # Relationships enable an app container's access to a service. relationships: - influxdb: + influxdb: ``` <---> @@ -253,13 +255,15 @@ name: myapp [...] -# Relationships enable an app container's access to a service. -# Please note: Legacy definition of the relationship is still supported: +# 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: influxdb: - service: "influxdb" - endpoint: "influxdb" + service: influxdb + endpoint: influxdb ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index f0e72b2f7c..e7801a8e8f 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -85,7 +85,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -108,13 +108,14 @@ title=Using explicit 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. +# 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: - {{" >}}: - service: {{" >}} - endpoint: "kafka" + : + service: + endpoint: kafka ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -165,13 +166,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: kafka: - service: "kafka" - endpoint: "kafka" + service: kafka + endpoint: kafka ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index fcc05ea9c1..03a9c0486f 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -97,7 +97,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -120,13 +120,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "memcached" + service: + endpoint: memcached ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -165,7 +166,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - memcached: + memcached: ``` <---> @@ -176,13 +177,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: memcached: - service: "memcached" - endpoint: "memcached" + service: memcached + endpoint: memcached ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index 1d7d8861ae..6905555c78 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -159,7 +159,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -182,13 +182,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "mongodb" + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -237,7 +238,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb-enterprise: + mongodb-enterprise: ``` <---> @@ -248,13 +249,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: mongodb-enterprise: - service: "mongodb-enterprise" - endpoint: "mongodb" + service: mongodb-enterprise + endpoint: mongodb ``` {{< /codetabs >}} @@ -291,7 +293,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -314,13 +316,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "mongodb" + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -369,7 +372,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb: + mongodb: ``` <---> @@ -380,13 +383,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: mongodb: - service: "mongodb" - endpoint: "mongodb" + service: mongodb + endpoint: mongodb ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 3feebc6fe6..cee4facd8f 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -137,7 +137,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -160,13 +160,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported. +# 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: : service: - endpoint: "mysql" + endpoint: mysql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -206,7 +207,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mariadb: + mariadb: ``` <---> @@ -217,13 +218,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported. +# 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" + service: mariadb + endpoint: mysql ``` {{< /codetabs >}} @@ -253,7 +255,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - oraclemysql: + oraclemysql: ``` <---> @@ -264,13 +266,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: oraclemysql: - service: "oraclemysql" - endpoint: "mysql" + service: oraclemysql + endpoint: mysql ``` {{< /codetabs >}} @@ -544,17 +547,17 @@ name: myapp # Relationships enable an app container's access to a service. relationships: - # Please note: Legacy definition of the relationship is still supported: + # 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 database: - service: "mariadb" - endpoint: "admin" + service: mariadb + endpoint: admin reports: - service: "mariadb" - endpoint: "reporter" + service: mariadb + endpoint: reporter imports: - service: "mariadb" - endpoint: "importer" + service: mariadb + endpoint: importer ``` These relationships are then available in the [`{{< vendor/prefix >}}_RELATIONSHIPS` environment variable](#relationship-reference). diff --git a/sites/platform/src/add-services/network-storage.md b/sites/platform/src/add-services/network-storage.md index 1973527896..8f983512fd 100644 --- a/sites/platform/src/add-services/network-storage.md +++ b/sites/platform/src/add-services/network-storage.md @@ -107,7 +107,7 @@ To define the mount accessible by your application, use the following configurat ```yaml {configFile="apps"} mounts: - '': + : source: service service: source_path: diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 9e11521685..a3d1966af0 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -129,7 +129,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -152,13 +152,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "opensearch" + service: + endpoint: opensearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -198,7 +199,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - opensearch: + opensearch: ``` <---> @@ -209,13 +210,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: opensearch: - service: "opensearch" - endpoint: "opensearch" + service: opensearch + endpoint: opensearch ``` {{< /codetabs >}} @@ -252,8 +254,8 @@ name: myapp relationships: opensearch: - service: "opensearch" - endpoint: "opensearch" + service: opensearch + endpoint: opensearch ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index 17de0e57ca..9297d9d7f3 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -131,7 +131,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -154,13 +154,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "postgresql" + service: + endpoint: postgresql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -209,7 +210,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - postgresql: + postgresql: ``` <---> @@ -220,13 +221,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: postgresql: - service: "ostgresql" - endpoint: "postgresql" + service: postgresql + endpoint: postgresql ``` {{< /codetabs >}} @@ -413,14 +415,14 @@ relationships: # Please note: Legacy definition of the relationship is still supported: # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships database: - service: "postgresql" - endpoint: "admin" + service: postgresql + endpoint: admin reports: - service: "postgresql" - endpoint: "reporter" + service: postgresql + endpoint: reporter imports: - service: "postgresql" - endpoint: "importer" + service: postgresql + endpoint: importer ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index fde5c69cc3..224a64eaaa 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -124,7 +124,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -147,13 +147,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "rabbitmq" + service: + endpoint: rabbitmq ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -193,7 +194,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - rabbitmq: + rabbitmq: ``` <---> @@ -204,13 +205,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: rabbitmq: - service: "rabbitmq" - endpoint: "rabbitmq" + service: rabbitmq + endpoint: rabbitmq ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 35886d324c..6aa1bf4883 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -171,7 +171,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -190,13 +190,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "redis" + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -253,8 +254,8 @@ title=Using explicit endpoints ```yaml {configFile="app"} relationships: redis: - service: "redis" - endpoint: "redis" + service: redis + endpoint: redis ``` {{< /codetabs >}} @@ -343,7 +344,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -362,13 +363,14 @@ 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. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "redis" + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -425,8 +427,8 @@ title=Using explicit endpoints ```yaml {configFile="app"} relationships: redis: - service: "redis" - endpoint: "redis" + service: redis + endpoint: redis ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index 08b4816284..183e7e2e4e 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -124,7 +124,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -148,12 +148,12 @@ title=Using explicit endpoints ```yaml {configFile="apps"} # Relationships enable access from this app to a given service. # See the Application reference for all options for defining relationships and endpoints. -# Please note: Legacy definition of the relationship is still supported: +# 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: : - service: "" - endpoint: "solr" + service: + endpoint: solr ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -193,7 +193,7 @@ title=Using default endpoints # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - solr: + solr: ``` <---> @@ -205,12 +205,12 @@ title=Using explicit endpoints ```yaml {configFile="apps"} # Relationships enable access from this app to a given service. # See the Application reference for all options for defining relationships and endpoints. -# Please note: Legacy definition of the relationship is still supported: +# 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: solr: - service: "solr" - endpoint: "solr" + service: solr + endpoint: solr ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/vault.md b/sites/platform/src/add-services/vault.md index bdc704fdcc..4087898836 100644 --- a/sites/platform/src/add-services/vault.md +++ b/sites/platform/src/add-services/vault.md @@ -91,11 +91,11 @@ To define the service, use the `vault-kms` type: 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. -- {{< variable "SERVICE_NAME" >}} is the name you choose to identify the service. -- {{< variable "VERSION" >}} is a supported version of the service. -- {{< variable "ENDPOINT_ID" >}} is an identifier you choose for the endpoint. -- {{< variable "KEY_NAME" >}} is the name of the key to be stored in the Vault KMS. -- {{< variable "POLICY" >}} is one of the available [policies](#policies) based on what you want to accomplish. +- ```` is the name you choose to identify the service. +- ```` is a supported version of the service. +- ```` is an identifier you choose for the endpoint. +- ```` is the name of the key to be stored in the Vault KMS. +- ```` is one of the available [policies](#policies) based on what you want to accomplish. - The `type` is one of: - `sign`: for signing payloads, with the type `ecdsa-p256` @@ -113,9 +113,10 @@ To define the relationship, use the following configuration: ```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. +# 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: : service: diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index 90776ecf99..1309828c53 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -98,7 +98,7 @@ title=Using default endpoints ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. - {{}}: + : # Other options... @@ -106,11 +106,11 @@ applications: # 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: - {{}}: + : services: # The name of the service container. Must be unique within a project. - {{}}: - type: {{}}:{{}} + : + type: : # Other options... ``` @@ -133,28 +133,27 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. - {{}}: + : # Other options... # Relationships enable an app container's access to a 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. relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}} - # OR as a shorter notation (Legacy) - {{% variable "RELATIONSHIP_NAME" %}}: {{% variable "SERVICE_NAME" %}}:{{% variable "ENDPOINT_NAME" %}} + : + service: + endpoint: services: # The name of the service container. Must be unique within a project. - {{}}: - type: {{}}:{{}} + : + type: : # Other options... ``` -- `RELATIONSHIP_NAME` is the name you want to give to the relationship. -- `SERVICE_NAME` is the name of the service as defined in the `services` section. -- `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). +- `` is the name you want to give to the relationship. +- `` is the name of the service as defined in the `services` section. +- `` is the endpoint your app will use to connect to the service (refer to the service reference to know which value to use). {{< /codetabs >}} @@ -168,11 +167,14 @@ title=Using default endpoints ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - {{}}: + # 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: - mariadb: - postgresql: + mariadb: + postgresql: services: mariadb: type: mariadb:{{% latest "mariadb" %}} @@ -188,14 +190,17 @@ title=Using explicit endpoints ```yaml {configFile="apps"} applications: # The name of the app container. Must be unique within a project. - {{}}: + : + # 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. relationships: database: - service: "mariadb" - endpoint: "mysql" + service: mariadb + endpoint: mysql postgresql: - service: "postgresql" - endpoint: "postgresql" + service: postgresql + endpoint: postgresql services: mariadb: type: mariadb:{{% latest "mariadb" %}} diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index dace1eb0a2..4eb0c10d32 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -144,8 +144,11 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : + : services: # The name of the service container. Must be unique within a project. : @@ -163,12 +166,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "clickhouse" + service: + endpoint: clickhouse services: # The name of the service container. Must be unique within a project. : @@ -197,8 +200,11 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : + : services: # The name of the service container. Must be unique within a project. : @@ -218,10 +224,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: : - service: "" - endpoint: "clickhouse-http" + service: + endpoint: clickhouse-http services: # The name of the service container. Must be unique within a project. : @@ -250,9 +258,12 @@ applications: # The location of the application's code. source: root: "myapp" - # Relationships enable an app container's access to a service. + # 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: - clickhouse: + clickhouse: services: clickhouse: # The name of the service container. Must be unique within a project. @@ -272,13 +283,13 @@ applications: # The location of the application's code. source: root: "myapp" - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships clickhouse: - service: "clickhouse" - endpoint: "clickhouse" + service: clickhouse + endpoint: clickhouse services: clickhouse: # The name of the service container. Must be unique within a project. @@ -298,13 +309,13 @@ applications: # The location of the application's code. source: root: "myapp" - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships clickhouse: - service: "clickhouse" - endpoint: "clickhouse-http" + service: clickhouse + endpoint: clickhouse-http services: # The name of the service container. Must be unique within a project. clickhouse: @@ -324,18 +335,19 @@ To do so, you can use a configuration similar to the following: # Complete list of all available properties: https://docs.upsun.com/create-apps/app-reference.html applications: myapp: + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships clickhouse-admin: - service: "clickhouse" - endpoint: "admin" + service: clickhouse + endpoint: admin clickhouse-reporter: - service: "clickhouse" - endpoint: "reporter" + service: clickhouse + endpoint: reporter clickhouse-importer: - service: "clickhouse" - endpoint: "importer" + service: clickhouse + endpoint: importer services: clickhouse: type: clickhouse:24 diff --git a/sites/upsun/src/add-services/elasticsearch.md b/sites/upsun/src/add-services/elasticsearch.md index 200d4e830d..f4a668e85e 100644 --- a/sites/upsun/src/add-services/elasticsearch.md +++ b/sites/upsun/src/add-services/elasticsearch.md @@ -150,7 +150,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -180,13 +180,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "elasticsearch" + service: + endpoint: elasticsearch services: # The name of the service container. Must be unique within a project. : @@ -222,7 +221,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - elasticsearch: + elasticsearch: services: # The name of the service container. Must be unique within a project. elasticsearch: @@ -242,13 +241,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships elasticsearch: - service: "elasticsearch" - endpoint: "elasticsearch" + service: elasticsearch + endpoint: elasticsearch services: # The name of the service container. Must be unique within a project. elasticsearch: @@ -279,8 +277,11 @@ applications: source: root: "myapp" # 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: services: elasticsearch: type: elasticsearch:{{% latest "elasticsearch" %}} @@ -300,12 +301,12 @@ applications: source: root: "myapp" # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships elasticsearch: - service: "elasticsearch" - endpoint: "elasticsearch" + service: elasticsearch + endpoint: elasticsearch services: elasticsearch: type: elasticsearch:{{% latest "elasticsearch" %}} diff --git a/sites/upsun/src/add-services/gotenberg.md b/sites/upsun/src/add-services/gotenberg.md index bdb169e785..73fd1d861b 100644 --- a/sites/upsun/src/add-services/gotenberg.md +++ b/sites/upsun/src/add-services/gotenberg.md @@ -116,8 +116,11 @@ applications: # The name of the app container. Must be unique within a project. : # 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: - : + : services: # The name of the service container. Must be unique within a project. : @@ -135,12 +138,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "http" + service: + endpoint: http services: # The name of the service container. Must be unique within a project. : @@ -167,9 +170,12 @@ title=Using default endpoints applications: # The name of the app container. Must be unique within a project. myapp: - # Relationships enable access from this app to a given service. + # 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: - gotenberg: + gotenberg: services: # The name of the service container. Must be unique within a project. gotenberg: @@ -187,12 +193,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships gotenberg: - service: "gotenberg" - endpoint: "http" + service: gotenberg + endpoint: http services: # The name of the service container. Must be unique within a project. gotenberg: diff --git a/sites/upsun/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md index d850ec9140..43f8ee9d96 100644 --- a/sites/upsun/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -125,7 +125,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -155,13 +155,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "http" + service: + endpoint: http services: # The name of the service container. Must be unique within a project. : @@ -197,7 +196,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - chrome-headless: + chrome-headless: services: # The name of the service container. Must be unique within a project. chrome-headless: @@ -215,13 +214,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships chrome-headless: - service: "chrome-headless" - endpoint: "http" + service: chrome-headless + endpoint: http services: # The name of the service container. Must be unique within a project. chrome-headless: @@ -287,9 +285,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - chrome-headless: + chrome-headless: services: # The name of the service container. Must be unique within a project. chrome-headless: @@ -313,11 +314,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: chrome-headless: - service: "chrome-headless" - endpoint: "http" + service: chrome-headless + endpoint: http services: # The name of the service container. Must be unique within a project. chrome-headless: diff --git a/sites/upsun/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md index 80c1456ccd..330915170f 100644 --- a/sites/upsun/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -146,7 +146,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -176,13 +176,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "influxdb" + service: + endpoint: influxdb services: # The name of the service container. Must be unique within a project. : @@ -218,7 +217,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - influxdb: + influxdb: services: # The name of the service container. Must be unique within a project. influxdb: @@ -236,13 +235,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships influxdb: - service: "influxdb" - endpoint: "influxdb" + service: influxdb + endpoint: influxdb services: # The name of the service container. Must be unique within a project. influxdb: @@ -272,9 +270,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - influxdb: + influxdb: service: influxdb: type: influxdb:{{% latest "influxdb" %}} @@ -296,13 +297,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships influxdb: - service: "influxdb" - endpoint: "influxdb" + service: influxdb + endpoint: influxdb service: influxdb: type: influxdb:{{% latest "influxdb" %}} diff --git a/sites/upsun/src/add-services/kafka.md b/sites/upsun/src/add-services/kafka.md index 215c5bd73f..68908a8644 100644 --- a/sites/upsun/src/add-services/kafka.md +++ b/sites/upsun/src/add-services/kafka.md @@ -118,7 +118,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -148,13 +148,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "kafka" + service: + endpoint: kafka services: # The name of the service container. Must be unique within a project. : @@ -190,7 +189,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - kafka: + kafka: services: # The name of the service container. Must be unique within a project. kafka: @@ -208,13 +207,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships kafka: - service: "kafka" - endpoint: "kafka" + service: kafka + endpoint: kafka services: # The name of the service container. Must be unique within a project. kafka: diff --git a/sites/upsun/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md index a76a112dbb..cad8bdd690 100644 --- a/sites/upsun/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -119,7 +119,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -146,8 +146,7 @@ applications: # The name of the app container. Must be unique within a project. : # 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. + # 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. relationships: : ":memcached" @@ -190,7 +189,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -212,8 +211,7 @@ applications: extensions: - memcached # 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. + # 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. relationships: : ":memcached" @@ -245,7 +243,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -268,8 +266,7 @@ applications: python: python-memcached: '*' # 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. + # 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. relationships: : ":memcached" @@ -299,7 +296,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - memcached: + memcached: services: # The name of the service container. Must be unique within a project. @@ -309,13 +306,16 @@ services: <---> ++++ +title=Using explicit endpoints ++++ + ```yaml {configFile="services"} applications: # The name of the app container. Must be unique within a project. myapp: # 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. + # 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. relationships: memcached: "memcached:memcached" @@ -326,10 +326,6 @@ services: type: memcached:{{% latest "memcached" %}} ``` -+++ -title=Using explicit endpoints -+++ - {{< /codetabs >}} ### Use in app @@ -352,9 +348,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - memcached: + memcached: service: memcached: type: memcached:{{% latest "memcached" %}} @@ -376,13 +375,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # Relationships enable access from this app to a given service. + # See the Application reference for all options for defining relationships and endpoints. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships memcached: - service: "memcached" - endpoint: "memcached" + service: memcached + endpoint: memcached service: memcached: type: memcached:{{% latest "memcached" %}} diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index 308e4be739..ff772aca5f 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -149,7 +149,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -179,13 +179,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "mongodb" + service: + endpoint: mongodb services: # The name of the service container. Must be unique within a project. : @@ -225,7 +224,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -247,13 +246,12 @@ applications: extensions: - mongodb # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "mongodb" + service: + endpoint: mongodb services: # The name of the service container. Must be unique within a project. : @@ -283,7 +281,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb-enterprise: + mongodb-enterprise: services: # The name of the service container. Must be unique within a project. mongodb-enterprise: @@ -305,13 +303,12 @@ applications: extensions: - mongodb # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships mongodb-enterprise: - service: "mongodb-enterprise" - endpoint: "mongodb" + service: mongodb-enterprise + endpoint: mongodb services: # The name of the service container. Must be unique within a project. mongodb-enterprise: @@ -352,7 +349,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -382,13 +379,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "mongodb" + service: + endpoint: mongodb services: # The name of the service container. Must be unique within a project. : @@ -428,7 +424,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -450,13 +446,12 @@ applications: extensions: - mongodb # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "mongodb" + service: + endpoint: mongodb services: # The name of the service container. Must be unique within a project. : @@ -486,7 +481,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mongodb: + mongodb: services: # The name of the service container. Must be unique within a project. mongodb: @@ -508,13 +503,12 @@ applications: extensions: - mongodb # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships mongodb: - service: "mongodb" - endpoint: "mongodb" + service: mongodb + endpoint: mongodb services: # The name of the service container. Must be unique within a project. mongodb: @@ -543,9 +537,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - mongodb: + mongodb: service: mongodb: type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} @@ -567,13 +564,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships mongodb: - service: "mongodb" - endpoint: "mongodb" + service: mongodb + endpoint: mongodb service: mongodb: type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index c951a68651..f82d90061d 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -288,13 +288,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "mysql" + service: + endpoint: mysql services: # The name of the service container. Must be unique within a project. : @@ -330,7 +329,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - mariadb: + mariadb: services: # The name of the service container. Must be unique within a project. mariadb: @@ -348,13 +347,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships mariadb: - service: "mariadb" - endpoint: "mysql" + service: mariadb + endpoint: mysql services: # The name of the service container. Must be unique within a project. mariadb: @@ -377,7 +375,7 @@ applications: myapp: # The location of the application's code. relationships: - oracle-mysql: + oracle-mysql: service: # The name of the service container. Must be unique within a project. oracle-mysql: @@ -394,13 +392,13 @@ title=Using explicit endpoints applications: # The name of the app container. Must be unique within a project. myapp: - # The location of the application's code. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships oracle-mysql: - service: "oracle-mysql_service" - endpoint: "mysql" + service: oracle-mysql_service + endpoint: mysql service: # The name of the service container. Must be unique within a project. oracle-mysql_service: @@ -432,7 +430,7 @@ applications: # Relationships enable an app container's access to a service. relationships: - mariadb: + mariadb: service: mariadb: type: mariadb:{{% latest "mariadb" %}} @@ -454,13 +452,13 @@ applications: [...] - # Relationships enable an app container's access to a service. - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + # 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. relationships: mariadb: - service: "mariadb" - endpoint: "mysql" + service: mariadb + endpoint: mysql service: mariadb: type: mariadb:{{% latest "mariadb" %}} @@ -668,19 +666,19 @@ applications: [...] - # Relationships enable an app container's access to a service. - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + # 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. relationships: database: - service: "mariadb" - endpoint: "admin" + service: mariadb + endpoint: admin reports: - service: "mariadb" - endpoint: "reporter" + service: mariadb + endpoint: reporter imports: - service: "mariadb" - endpoint: "importer" + service: mariadb + endpoint: importer ``` These relationships are then available in the [service environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/network-storage.md b/sites/upsun/src/add-services/network-storage.md index fdfd85826a..db242444da 100644 --- a/sites/upsun/src/add-services/network-storage.md +++ b/sites/upsun/src/add-services/network-storage.md @@ -64,7 +64,7 @@ applications: # The name of the app container. Must be unique within a project. : mounts: - '': + : source: service service: source_path: diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index f7ce095461..d30605f970 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -148,7 +148,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -178,13 +178,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "opensearch" + service: + endpoint: opensearch services: # The name of the service container. Must be unique within a project. : @@ -220,7 +219,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - opensearch: + opensearch: services: # The name of the service container. Must be unique within a project. opensearch: @@ -238,13 +237,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships opensearch: - service: "opensearch" - endpoint: "opensearch" + service: opensearch + endpoint: opensearch services: # The name of the service container. Must be unique within a project. opensearch: @@ -273,9 +271,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - opensearch: + opensearch: services: # The name of the service container. Must be unique within a project. opensearch: @@ -298,13 +299,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships opensearch: - service: "opensearch" - endpoint: "opensearch" + service: opensearch + endpoint: opensearch services: # The name of the service container. Must be unique within a project. opensearch: diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index 52910b03e8..442f732b9e 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -143,7 +143,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -173,13 +173,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "postgresql" + service: + endpoint: postgresql services: # The name of the service container. Must be unique within a project. : @@ -241,13 +240,12 @@ applications: extensions: - pdo_pgsql # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "postgresql" + service: + endpoint: postgresql services: # The name of the service container. Must be unique within a project. : @@ -277,7 +275,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - postgresql: + postgresql: services: # The name of the service container. Must be unique within a project. postgresql: @@ -299,13 +297,12 @@ applications: extensions: - pdo_pgsql # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships postgresql: - service: "postgresql" - endpoint: "postgresql" + service: postgresql + endpoint: postgresql services: # The name of the service container. Must be unique within a project. postgresql: @@ -334,9 +331,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - postgresql: + postgresql: services: # The name of the service container. Must be unique within a project. postgresql: @@ -359,13 +359,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships postgresql: - service: "postgresql" - endpoint: "postgresql" + service: postgresql + endpoint: postgresql services: # The name of the service container. Must be unique within a project. postgresql: @@ -544,9 +544,10 @@ applications: [...] + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships database: service: postgresql endpoint: admin diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index 4e31dd7771..5134b73460 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -137,7 +137,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -167,13 +167,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "rabbitmq" + service: + endpoint: rabbitmq services: # The name of the service container. Must be unique within a project. : @@ -209,7 +208,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - rabbitmq: + rabbitmq: services: # The name of the service container. Must be unique within a project. rabbitmq: @@ -227,13 +226,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships rabbitmq: - service: "rabbitmq" - endpoint: "rabbitmq" + service: rabbitmq + endpoint: rabbitmq services: # The name of the service container. Must be unique within a project. rabbitmq: @@ -262,9 +260,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - rabbitmq: + rabbitmq: services: # The name of the service container. Must be unique within a project. rabbitmq: @@ -287,13 +288,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships rabbitmq: - service: "rabbitmq" - endpoint: "rabbitmq" + service: rabbitmq + endpoint: rabbitmq services: # The name of the service container. Must be unique within a project. rabbitmq: diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index 256261885a..511016fb5a 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -180,8 +180,11 @@ applications: [...] # 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: - : + : services: # The name of the service container. Must be unique within a project. : @@ -212,12 +215,12 @@ applications: [...] # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "redis" + service: + endpoint: redis services: # The name of the service container. Must be unique within a project. : @@ -253,6 +256,9 @@ applications: extensions: - redis # 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: : services: @@ -276,12 +282,12 @@ applications: extensions: - redis # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "redis" + service: + endpoint: redis services: # The name of the service container. Must be unique within a project. : @@ -312,8 +318,11 @@ applications: extensions: - redis # 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: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -340,12 +349,12 @@ applications: extensions: - redis # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships redis: - service: "redis" - endpoint: "redis" + service: redis + endpoint: redis services: # The name of the service container. Must be unique within a project. redis: @@ -379,8 +388,11 @@ applications: [...] # 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: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -407,12 +419,12 @@ applications: [...] # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships redis: - service: "redis" - endpoint: "redis" + service: redis + endpoint: redis services: # The name of the service container. Must be unique within a project. redis: @@ -499,8 +511,11 @@ applications: [...] # 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: - : + : services: # The name of the service container. Must be unique within a project. : @@ -526,13 +541,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "redis" + service: + endpoint: redis services: # The name of the service container. Must be unique within a project. : @@ -573,9 +587,12 @@ applications: extensions: - redis - # Relationships enable access from this app to a given service. + # 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: - : + : services: # The name of the service container. Must be unique within a project. : @@ -603,12 +620,12 @@ applications: - redis # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "redis" + service: + endpoint: redis services: # The name of the service container. Must be unique within a project. : @@ -639,9 +656,12 @@ applications: extensions: - redis - # Relationships enable access from this app to a given service. + # 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: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -669,12 +689,12 @@ applications: - redis # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships redis: - service: "redis" - endpoint: "redis" + service: redis + endpoint: redis services: # The name of the service container. Must be unique within a project. redis: @@ -707,8 +727,11 @@ applications: extensions: - redis # 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: - redis: + redis: services: # The name of the service container. Must be unique within a project. redis: @@ -734,12 +757,12 @@ applications: extensions: - redis # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships redis: - service: "redis" - endpoint: "redis" + service: redis + endpoint: redis services: # The name of the service container. Must be unique within a project. redis: @@ -979,12 +1002,13 @@ applications: extensions: - redis + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships redissession: - service: "redissession" - endpoint: "redis" + service: redissession + endpoint: redis variables: php: diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index 857e4e8e28..8a39febda3 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -135,7 +135,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : @@ -165,13 +165,12 @@ applications: # The name of the app container. Must be unique within a project. : # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : - service: "" - endpoint: "solr" + service: + endpoint: solr services: # The name of the service container. Must be unique within a project. : @@ -207,7 +206,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - solr: + solr: services: # The name of the service container. Must be unique within a project. solr: @@ -225,13 +224,12 @@ applications: # The name of the app container. Must be unique within a project. myapp: # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships solr: - service: "solr" - endpoint: "solr" + service: solr + endpoint: solr services: # The name of the service container. Must be unique within a project. solr: @@ -261,9 +259,12 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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: - solr: + solr: services: # The name of the service container. Must be unique within a project. solr: @@ -286,13 +287,13 @@ applications: [...] - # Relationships enable an app container's access to a service. + # 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. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships solr: - service: "solr" - endpoint: "solr" + service: solr + endpoint: solr services: # The name of the service container. Must be unique within a project. solr: @@ -399,6 +400,9 @@ applications: [...] + # 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. relationships: solrsearch1: service: solr diff --git a/sites/upsun/src/add-services/varnish.md b/sites/upsun/src/add-services/varnish.md index 5b6a9844b0..3cade24b6e 100644 --- a/sites/upsun/src/add-services/varnish.md +++ b/sites/upsun/src/add-services/varnish.md @@ -327,13 +327,11 @@ applications: # The type of the application to build. type: "python:{{% latest "python" %}}" # Unique relationship _to_ Varnish from 'stats-app', where no relationship - # is defined _from_ Varnish to the same app, to avoid circular relationships. + # is defined _from_ Varnish to the same app, to avoid circular relationships. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships varnishstats: - service: "varnish" - endpoint: "http+stats" + service: varnish + endpoint: http+stats # The name of the app container. Must be unique within a project. main-app: # The location of the application's code. diff --git a/sites/upsun/src/add-services/vault.md b/sites/upsun/src/add-services/vault.md index 51bb26459b..98da54f0e4 100644 --- a/sites/upsun/src/add-services/vault.md +++ b/sites/upsun/src/add-services/vault.md @@ -155,10 +155,7 @@ applications: # The name of the app container. Must be unique within a project. : # Relationships enable access from this app to a given service. - # See the Application reference for all options for defining relationships and endpoints. relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships : service: endpoint: From fa095cda994600ae4b00e5bc20dee8f01c0c604e Mon Sep 17 00:00:00 2001 From: Anouck Colson Date: Thu, 20 Jun 2024 10:30:25 +0200 Subject: [PATCH 12/22] Consistency -finishing touches --- sites/platform/src/add-services/opensearch.md | 2 +- sites/platform/src/add-services/redis.md | 4 ++-- sites/platform/src/add-services/vault.md | 2 -- sites/upsun/src/add-services/_index.md | 6 +++--- sites/upsun/src/add-services/mysql/_index.md | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index a3d1966af0..564b6ac03c 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -238,7 +238,7 @@ name: myapp [...] relationships: - opensearch: + opensearch: ``` <---> diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 6aa1bf4883..b03930ee25 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -242,7 +242,7 @@ title=Using default endpoints ```yaml {configFile="app"} relationships: - redis: + redis: ``` <---> @@ -415,7 +415,7 @@ title=Using default endpoints ```yaml {configFile="app"} relationships: - redis: + redis: ``` <---> diff --git a/sites/platform/src/add-services/vault.md b/sites/platform/src/add-services/vault.md index 4087898836..4f474c55b2 100644 --- a/sites/platform/src/add-services/vault.md +++ b/sites/platform/src/add-services/vault.md @@ -115,8 +115,6 @@ To define the relationship, use the following configuration: # 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: : service: diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index 1309828c53..30fe42d78e 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -28,8 +28,8 @@ Configure your service in the following pattern: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. services: - {{}}: - type: {{}}:{{}} + : + type: : # Other options... ``` @@ -106,7 +106,7 @@ applications: # 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: - : + : services: # The name of the service container. Must be unique within a project. : diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index f82d90061d..60850b64f9 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -260,7 +260,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : + : services: # The name of the service container. Must be unique within a project. : From 775472f15b46e34224d56101387ce35318e071f0 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Wed, 7 Aug 2024 17:08:32 +0200 Subject: [PATCH 13/22] remove service def from relationship def on Upsun side --- sites/upsun/src/add-services/_index.md | 20 ++------ sites/upsun/src/add-services/clickhouse.md | 42 +-------------- sites/upsun/src/add-services/elasticsearch.md | 10 +--- sites/upsun/src/add-services/gotenberg.md | 10 +--- .../upsun/src/add-services/headless-chrome.md | 10 +--- sites/upsun/src/add-services/influxdb.md | 10 +--- sites/upsun/src/add-services/kafka.md | 10 +--- sites/upsun/src/add-services/memcached.md | 38 +++++--------- sites/upsun/src/add-services/mongodb.md | 48 +++++------------ sites/upsun/src/add-services/mysql/_index.md | 10 +--- .../add-services/mysql/mysql-replication.md | 24 ++------- sites/upsun/src/add-services/opensearch.md | 10 +--- sites/upsun/src/add-services/postgresql.md | 30 +++++------ sites/upsun/src/add-services/rabbitmq.md | 10 +--- sites/upsun/src/add-services/redis.md | 51 +++---------------- sites/upsun/src/add-services/solr.md | 10 +--- sites/upsun/src/add-services/vault.md | 2 +- 17 files changed, 64 insertions(+), 281 deletions(-) diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index ee652313ab..c378315598 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -85,9 +85,9 @@ If you do so, be aware that: Backups from before the downsize cannot be restored unless you increase the disk size again. - The downsize fails if there's more data on the disk than the desired size. -### 2. Connect the service +### 2. Define the relationship -To connect the service, use the following configuration: +To define the relationship, use the following configuration: {{< codetabs >}} @@ -99,7 +99,6 @@ title=Using default endpoints applications: # The name of the app container. Must be unique within a project. : - # Other options... # Relationships enable an app container's access to a service. @@ -107,11 +106,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: : - # Other options... ``` You can define `` as you like, so long as it's unique between all defined services @@ -143,12 +137,6 @@ applications: : service: endpoint: - -services: - # The name of the service container. Must be unique within a project. - : - type: : - # Other options... ``` - `` is the name you want to give to the relationship. @@ -189,11 +177,11 @@ title=Using explicit endpoints +++ ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - : # 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. + + : relationships: database: service: mariadb diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index 4eb0c10d32..5e30a4e3e8 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -122,7 +122,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use one of the following endpoints. @@ -149,10 +149,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: clickhouse: ``` You can define ```` as you like. <---> @@ -172,10 +168,6 @@ applications: : service: endpoint: clickhouse -services: - # The name of the service container. Must be unique within a project. - : - type: clickhouse: ``` You can define ```` and ```` as you like, but it's best if they're distinct. @@ -189,36 +181,6 @@ This protocol is used by [JDBC](https://docs.oracle.com/javase/8/docs/technotes/ Use the following configuration: -{{< codetabs >}} - -+++ -title=Using default endpoints -+++ - -```yaml {configFile="app"} -applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : -services: - # The name of the service container. Must be unique within a project. - : - type: clickhouse: -``` - -You can define ```` as you like. - -<---> - -+++ -title=Using explicit endpoints -+++ - ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. @@ -241,8 +203,6 @@ and matches in both the application and services configuration. With this definition, the application container (````) now has access to the service via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables). -{{< /codetabs >}} - ### Example configuration {{< codetabs >}} diff --git a/sites/upsun/src/add-services/elasticsearch.md b/sites/upsun/src/add-services/elasticsearch.md index 2fac286239..09265e5a5b 100644 --- a/sites/upsun/src/add-services/elasticsearch.md +++ b/sites/upsun/src/add-services/elasticsearch.md @@ -131,7 +131,7 @@ If you’re using a [premium version](/add-services/elasticsearch.md#supported-v 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -151,10 +151,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: elasticsearch: ``` You can define `` as you like, so long as it's unique between all defined services @@ -186,10 +182,6 @@ applications: : service: endpoint: elasticsearch -services: - # The name of the service container. Must be unique within a project. - : - type: elasticsearch: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/gotenberg.md b/sites/upsun/src/add-services/gotenberg.md index 73fd1d861b..e193e63968 100644 --- a/sites/upsun/src/add-services/gotenberg.md +++ b/sites/upsun/src/add-services/gotenberg.md @@ -101,7 +101,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the ``http`` endpoint: @@ -121,10 +121,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: gotenberg: ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. <---> @@ -144,10 +140,6 @@ applications: : service: endpoint: http -services: - # The name of the service container. Must be unique within a project. - : - type: gotenberg: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships and matches in both the application and services configuration. diff --git a/sites/upsun/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md index 43f8ee9d96..29ffa1832c 100644 --- a/sites/upsun/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -106,7 +106,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -126,10 +126,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: chrome-headless: ``` You can define `` as you like, so long as it's unique between all defined services @@ -161,10 +157,6 @@ applications: : service: endpoint: http -services: - # The name of the service container. Must be unique within a project. - : - type: chrome-headless: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md index 330915170f..a5fbc665e0 100644 --- a/sites/upsun/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -128,7 +128,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: {{< codetabs >}} @@ -147,10 +147,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: influxdb: ``` You can define `` as you like, so long as it's unique between all defined services @@ -182,10 +178,6 @@ applications: : service: endpoint: influxdb -services: - # The name of the service container. Must be unique within a project. - : - type: influxdb: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/kafka.md b/sites/upsun/src/add-services/kafka.md index 68908a8644..437ea93698 100644 --- a/sites/upsun/src/add-services/kafka.md +++ b/sites/upsun/src/add-services/kafka.md @@ -99,7 +99,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -119,10 +119,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: kafka: ``` You can define `` as you like, so long as it's unique between all defined services @@ -154,10 +150,6 @@ applications: : service: endpoint: kafka -services: - # The name of the service container. Must be unique within a project. - : - type: kafka: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md index cad8bdd690..70f8fe9e67 100644 --- a/sites/upsun/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -101,7 +101,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: {{< codetabs >}} @@ -120,10 +120,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: memcached: ``` You can define `` as you like, so long as it's unique between all defined services @@ -150,10 +146,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : ":memcached" -services: - # The name of the service container. Must be unique within a project. - : - type: memcached: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -190,10 +182,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: memcached: ``` <---> @@ -215,10 +203,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : ":memcached" -services: - # The name of the service container. Must be unique within a project. - : - type: memcached: ``` {{< /codetabs >}} @@ -244,10 +228,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: memcached: ``` <---> @@ -270,10 +250,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : ":memcached" -services: - # The name of the service container. Must be unique within a project. - : - type: memcached: ``` {{< /codetabs >}} @@ -346,7 +322,12 @@ applications: source: root: "/" - [...] + # PHP extensions. + runtime: + extensions: + - memcached + + [...] # Relationships enable access from this app to a given service. # The example below shows simplified configuration leveraging a default service @@ -373,6 +354,11 @@ applications: source: root: "/" + # PHP extensions. + runtime: + extensions: + - memcached + [...] # Relationships enable access from this app to a given service. diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index ff772aca5f..c8be69f39b 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -131,7 +131,7 @@ services: 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 +#### 2. Define the relationship To define the relationship, use the following configuration: {{< codetabs >}} @@ -150,10 +150,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb-enterprise: ``` You can define `` as you like, so long as it's unique between all defined services @@ -185,10 +181,6 @@ applications: : service: endpoint: mongodb -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb-enterprise: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -225,10 +217,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb-enterprise: ``` <---> @@ -252,10 +240,6 @@ applications: : service: endpoint: mongodb -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb-enterprise: ``` {{< /codetabs >}} @@ -332,7 +316,9 @@ services: 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 +#### 2. Define the relationship + +To define the relationship, use the following configuration: {{< codetabs >}} @@ -350,10 +336,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb: ``` You can define `` as you like, so long as it's unique between all defined services @@ -385,10 +367,6 @@ applications: : service: endpoint: mongodb -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -425,10 +403,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb: ``` <---> @@ -452,10 +426,6 @@ applications: : service: endpoint: mongodb -services: - # The name of the service container. Must be unique within a project. - : - type: mongodb: ``` {{< /codetabs >}} @@ -535,6 +505,11 @@ applications: source: root: "/" + # PHP extensions. + runtime: + extensions: + - mongodb + [...] # Relationships enable access from this app to a given service. @@ -562,6 +537,11 @@ applications: source: root: "/" + # PHP extensions. + runtime: + extensions: + - mongodb + [...] # Relationships enable access from this app to a given service. diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index 60850b64f9..b13a2bdc70 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -241,7 +241,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -261,10 +261,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: mariadb: ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -294,10 +290,6 @@ applications: : service: endpoint: mysql -services: - # The name of the service container. Must be unique within a project. - : - type: mariadb: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/mysql/mysql-replication.md b/sites/upsun/src/add-services/mysql/mysql-replication.md index a2517014c6..28ebec9469 100644 --- a/sites/upsun/src/add-services/mysql/mysql-replication.md +++ b/sites/upsun/src/add-services/mysql/mysql-replication.md @@ -38,7 +38,7 @@ services: This creates a `replicator` user, and grants read-only and table locking rights on the `main` database (namely `Select_priv`, `Show_view_priv`, `Create_tmp_table_priv`, `Lock_tables_priv` privileges) along with global replication rights (namely `Repl_slave_priv` and `Repl_client_priv` privileges) and flushing rights (`Reload_priv` used for flushing before reading the binary log position). If there is at least one `replication` permission defined, the bin-logging is enabled on the primary server, which is essential for the replication. -## Add a relationship for the new endpoint +## Define a relationship for the new endpoint Even if you won't be accessing the replication endpoint from your application, you still need to expose it to an application as a relationship so that you can connect to it over SSH. Add a new relationship to your application container: @@ -50,34 +50,18 @@ applications: # The location of the application's code. source: root: "myapp" - + [...] # Relationships enable an app container's access to a service. relationships: - database: + database: service: mariadb endpoint: mysql - replication: + replication: service: mariadb endpoint: replicator -services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - # Restate the default user to be used by your application. - mysql: - default_schema: main - privileges: - main: admin - replicator: - privileges: - main: replication ``` ## Getting the Primary's Binary Log Co-ordinates diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index fb7b2d98f2..e1661ddca3 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -129,7 +129,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -149,10 +149,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: opensearch: ``` You can define `` as you like, so long as it's unique between all defined services @@ -184,10 +180,6 @@ applications: : service: endpoint: opensearch -services: - # The name of the service container. Must be unique within a project. - : - type: opensearch: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index 442f732b9e..e3fe5f57ba 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -124,7 +124,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -144,10 +144,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: postgresql: ``` You can define `` as you like, so long as it's unique between all defined services @@ -179,10 +175,6 @@ applications: : service: endpoint: postgresql -services: - # The name of the service container. Must be unique within a project. - : - type: postgresql: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -218,11 +210,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : -services: - # The name of the service container. Must be unique within a project. - : - type: postgresql: + : ``` <---> @@ -246,10 +234,6 @@ applications: : service: endpoint: postgresql -services: - # The name of the service container. Must be unique within a project. - : - type: postgresql: ``` {{< /codetabs >}} @@ -329,6 +313,11 @@ applications: source: root: "myapp" + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + [...] # Relationships enable access from this app to a given service. @@ -357,6 +346,11 @@ applications: source: root: "myapp" + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + [...] # Relationships enable access from this app to a given service. diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index 5134b73460..b55f8219de 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -118,7 +118,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -138,10 +138,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: rabbitmq: ``` You can define `` as you like, so long as it's unique between all defined services @@ -173,10 +169,6 @@ applications: : service: endpoint: rabbitmq -services: - # The name of the service container. Must be unique within a project. - : - type: rabbitmq: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index 511016fb5a..171089b273 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -160,7 +160,7 @@ services: 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 +#### 2. Define the relationship To define the relationship, use the `redis` endpoint : @@ -174,21 +174,12 @@ title=Using default endpoints applications: # The name of the app container. Must be unique within a project. : - source: - root: "myapp" - - [...] - # 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: : -services: - # The name of the service container. Must be unique within a project. - : - type: redis-persistent: ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -209,11 +200,6 @@ title=Using explicit endpoints applications: # The name of the app container. Must be unique within a project. : - source: - root: "myapp" - - [...] - # 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. @@ -221,10 +207,6 @@ applications: : service: endpoint: redis -services: - # The name of the service container. Must be unique within a project. - : - type: redis-persistent: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -251,7 +233,7 @@ title=Using default endpoints applications: # The name of the app container. Must be unique within a project. : - # PHP extensions. + # PHP extensions. runtime: extensions: - redis @@ -260,11 +242,7 @@ applications: # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - : -services: - # The name of the service container. Must be unique within a project. - : - type: redis-persistent: + : ``` <---> @@ -288,10 +266,6 @@ applications: : service: endpoint: redis -services: - # The name of the service container. Must be unique within a project. - : - type: redis-persistent: ``` {{< /codetabs >}} @@ -317,6 +291,7 @@ applications: runtime: extensions: - redis + # 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. @@ -348,6 +323,7 @@ applications: runtime: extensions: - redis + # 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. @@ -491,7 +467,7 @@ services: 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 +#### 2. Define the relationship To define the relationship, use the `redis` endpoint : @@ -505,21 +481,12 @@ title=Using default endpoints applications: # The name of the app container. Must be unique within a project. : - source: - root: "myapp" - - [...] - # 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: : -services: - # The name of the service container. Must be unique within a project. - : - type: redis: ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -547,10 +514,6 @@ applications: : service: endpoint: redis -services: - # The name of the service container. Must be unique within a project. - : - type: redis: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -963,7 +926,7 @@ applications: - redis relationships: - redissession: + redissession: variables: php: diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index 8a39febda3..681709faad 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -116,7 +116,7 @@ services: 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -136,10 +136,6 @@ applications: # See the Application reference for all options for defining relationships and endpoints. relationships: : -services: - # The name of the service container. Must be unique within a project. - : - type: solr: ``` You can define `` as you like, so long as it's unique between all defined services @@ -171,10 +167,6 @@ applications: : service: endpoint: solr -services: - # The name of the service container. Must be unique within a project. - : - type: solr: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships diff --git a/sites/upsun/src/add-services/vault.md b/sites/upsun/src/add-services/vault.md index 98da54f0e4..6b29ba1412 100644 --- a/sites/upsun/src/add-services/vault.md +++ b/sites/upsun/src/add-services/vault.md @@ -146,7 +146,7 @@ You can create multiple endpoints, such as to have key management separate from 512 MB is the minimum required disk space for the Vault KMS service. -### 2. Add the relationship +### 2. Define the relationship To define the relationship, use the following configuration: From 453bbc90fcdc493158dbdcafea56e552f5c5ba4f Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Thu, 8 Aug 2024 11:56:35 +0200 Subject: [PATCH 14/22] align with .platform/applications.yaml config def --- sites/platform/src/add-services/_index.md | 124 ++++---- .../src/add-services/elasticsearch.md | 90 +++--- sites/platform/src/add-services/gotenberg.md | 62 ++-- .../src/add-services/headless-chrome.md | 62 ++-- sites/platform/src/add-services/influxdb.md | 101 ++++--- sites/platform/src/add-services/kafka.md | 68 +++-- sites/platform/src/add-services/memcached.md | 64 ++-- sites/platform/src/add-services/mongodb.md | 142 ++++----- .../platform/src/add-services/mysql/_index.md | 278 +++++++++--------- .../add-services/mysql/mysql-replication.md | 46 +-- .../src/add-services/mysql/troubleshoot.md | 34 +-- .../src/add-services/network-storage.md | 265 ++++++++--------- sites/platform/src/add-services/opensearch.md | 114 +++---- sites/platform/src/add-services/postgresql.md | 257 ++++++++-------- sites/platform/src/add-services/rabbitmq.md | 78 ++--- sites/platform/src/add-services/redis.md | 242 ++++++++------- sites/platform/src/add-services/solr.md | 182 ++++++------ sites/platform/src/add-services/varnish.md | 122 ++++---- sites/platform/src/add-services/vault.md | 107 +++---- .../src/administration/cli/api-tokens.md | 22 +- .../src/guides/drupal/elasticsearch.md | 78 ++++- sites/platform/src/guides/drupal/memcached.md | 70 ++++- sites/platform/src/guides/drupal/redis.md | 42 ++- sites/platform/src/languages/elixir.md | 14 +- sites/platform/src/languages/ruby.md | 15 +- 25 files changed, 1467 insertions(+), 1212 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index 7ade98f842..fd0928d7ee 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -30,8 +30,8 @@ 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: : - # Other options... + type: : + # Other options... ``` An example service configuration for two databases might look like this: @@ -39,12 +39,12 @@ An example service configuration for two databases might look like this: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 # The name of the service container. Must be unique within a project. postgresql: - type: postgresql:{{% latest "postgresql" %}} - disk: 1024 + type: postgresql:{{% latest "postgresql" %}} + disk: 1024 ``` This YAML file is a dictionary defining all of the services you want to use. @@ -107,13 +107,14 @@ The relationship follows this pattern: title=Using default endpoints +++ -```yaml {configFile="app"} -# Other options... +```yaml {configFile="apps"} +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: + # 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: : ``` @@ -134,15 +135,16 @@ 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: +app: + # 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: : - service: - endpoint: + service: + endpoint: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -165,11 +167,12 @@ An example relationship to connect to the databases given in the [example in ste title=Using default endpoints +++ -```yaml {configFile="app"} -# Other options... +```yaml {configFile="apps"} +app: + # Other options... -# Relationships enable an app container's access to a service. -relationships: + # Relationships enable an app container's access to a service. + relationships: mariadb: postgresql: ``` @@ -180,32 +183,33 @@ relationships: 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: +```yaml {configFile="apps"} +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 + service: mariadb + endpoint: mysql postgresql: - service: postgresql - endpoint: mysql + service: postgresql + endpoint: mysql ``` {{< /codetabs >}} ```yaml {configFile="services"} mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 postgresql: - type: postgresql:{{% latest "postgresql" %}} - disk: 1024 + type: postgresql:{{% latest "postgresql" %}} + disk: 1024 ``` As with the service name, you can give the relationship any name you want @@ -277,25 +281,25 @@ You get output like the following: ```yaml mariadb: - - - username: user - scheme: mysql - service: mariadb - fragment: null - ip: 198.51.100.37 - hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}} - public: false - cluster: abcdefgh1234567-main-abcd123 - host: mariadb.internal - rel: mysql - query: - is_master: true - path: main - password: '' - type: 'mariadb:10.6' - port: 3306 - host_mapped: false - url: 'mysql://user:@mariadb.internal:3306/main' + - + username: user + scheme: mysql + service: mariadb + fragment: null + ip: 198.51.100.37 + hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}} + public: false + cluster: abcdefgh1234567-main-abcd123 + host: mariadb.internal + rel: mysql + query: + is_master: true + path: main + password: '' + type: 'mariadb:10.6' + port: 3306 + host_mapped: false + url: 'mysql://user:@mariadb.internal:3306/main' ``` With this example, you can connect to the `mariadb` relationship diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index 9fc43df2d9..c899191d79 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -122,8 +122,8 @@ To define the service, use the `elasticsearch` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: elasticsearch: - disk: 256 + type: elasticsearch: + disk: 256 ``` If you’re using a [premium version](add-services/elasticsearch.md#supported-versions), use the `elasticsearch-enterprise` type instead. @@ -131,7 +131,7 @@ If you’re using a [premium version](add-services/elasticsearch.md#supported-ve 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -142,11 +142,12 @@ 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: +app: + # 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: : ``` @@ -169,15 +170,16 @@ 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: +app: + # 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: : - service: - endpoint: elasticsearch + service: + endpoint: elasticsearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -199,8 +201,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} - disk: 256 + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 256 ``` If you're using a [premium version](add-services/elasticsearch.md#supported-versions), @@ -215,11 +217,12 @@ 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: +app: + # 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: ``` @@ -230,15 +233,16 @@ 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: +app: + # 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 + service: elasticsearch + endpoint: elasticsearch ``` {{< /codetabs >}} @@ -302,11 +306,11 @@ To do so, include the following in your `{{< vendor/configfile "services" >}}` c ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} - disk: 2048 - configuration: - authentication: - enabled: true + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 2048 + configuration: + authentication: + enabled: true ``` If you're using a [premium version](#supported-versions), @@ -327,8 +331,8 @@ For example: ```yaml {configFile="routes"} "https://es.{default}/": - type: upstream - upstream: "elasticsearch:elasticsearch" + type: upstream + upstream: "elasticsearch:elasticsearch" ``` ## Plugins @@ -339,11 +343,11 @@ To enable them, list them under the `configuration.plugins` key in your `{{< ven ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} - disk: 1024 - configuration: - plugins: - - analysis-icu + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 1024 + configuration: + plugins: + - analysis-icu ``` If you're using a [premium version](#supported-versions), diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index 4d1285f120..f2bfba8e56 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -56,15 +56,15 @@ export APP_GOTENBERG_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.gotenberg[0].ho To define the service, use the `gotenberg` type: -```yaml {configFile="app"} +```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: gotenberg: + type: gotenberg: ``` 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 +### 2. Define the relationship To define the relationship, use the ``http`` endpoint: @@ -74,10 +74,11 @@ To define the relationship, use the ``http`` endpoint: title=Using default endpoints +++ -```yaml {configFile="app"} -# Relationships enable access from this app to a given service. -relationships: - : +```yaml {configFile="apps"} +app: + # Relationships enable access from this app to a given service. + relationships: + : ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -93,16 +94,17 @@ The application has access to the service via this relationship and its correspo title=Using explicit endpoints +++ -```yaml {configFile="app"} -# 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: +```yaml {configFile="apps"} +app: + # 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: : - service: - endpoint: http + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -126,7 +128,7 @@ The `http` endpoint uses port `3000` by default. ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. gotenberg: - type: gotenberg:8 + type: gotenberg:8 ``` #### [App configuration](/create-apps/_index.md) @@ -137,9 +139,10 @@ gotenberg: title=Using default endpoints +++ -```yaml {configFile="app"} -# Relationships enable access from this app to a given service. -relationships: +```yaml {configFile="apps"} +app: + # Relationships enable access from this app to a given service. + relationships: gotenberg: ``` @@ -149,16 +152,17 @@ relationships: title=Using explicit endpoints +++ -```yaml {configFile="app"} -# 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: +```yaml {configFile="apps"} +app: + # 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: gotenberg: - service: gotenberg - endpoint: http + service: gotenberg + endpoint: http ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index c783a89414..504443550b 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -73,14 +73,14 @@ To define the service, use the `chrome-headless` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: chrome-headless: - disk: 256 + type: chrome-headless: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -91,11 +91,12 @@ 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: +app: + # 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: : ``` @@ -118,15 +119,16 @@ 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: +app: + # 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: : - service: - endpoint: http + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -160,11 +162,12 @@ 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: +app: + # 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: chrome-headless: ``` @@ -175,15 +178,16 @@ 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: +app: + # 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: chrome-headless: - service: chrome-headless - endpoint: http + service: chrome-headless + endpoint: http ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 6e881c11b6..559779b3cd 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -105,14 +105,14 @@ To define the service, use the `influxdb` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: influxdb: - disk: 256 + type: influxdb: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -123,11 +123,12 @@ 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: +app: + # 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: : ``` @@ -150,15 +151,16 @@ 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: +app: + # 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: : - service: - endpoint: influxdb + service: + endpoint: influxdb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -180,8 +182,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. influxdb: - type: influxdb:{{% latest "influxdb" %}} - disk: 256 + type: influxdb:{{% latest "influxdb" %}} + disk: 256 ``` #### [App configuration](/create-apps) @@ -193,11 +195,12 @@ 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: +app: + # 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: influxdb: ``` @@ -208,15 +211,16 @@ 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: +app: + # 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: influxdb: - service: - endpoint: influxdb + service: + endpoint: influxdb ``` {{< /codetabs >}} @@ -231,14 +235,14 @@ To use the configured service in your app, add a configuration file similar to t title=Using default endpoints +++ -```yaml {configFile="app"} +```yaml {configFile="apps"} # The name of the app container. Must be unique within a project. -name: myapp +app: -[...] + [...] -# Relationships enable an app container's access to a service. -relationships: + # Relationships enable an app container's access to a service. + relationships: influxdb: ``` @@ -248,28 +252,27 @@ relationships: title=Using explicit endpoints +++ - -```yaml {configFile="app"} +```yaml {configFile="apps"} # The name of the app container. Must be unique within a project. -name: myapp +app: -[...] + [...] -# 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: + # 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: influxdb: - service: influxdb - endpoint: influxdb + service: influxdb + endpoint: influxdb ``` {{< /codetabs >}} ```yaml {configFile="services"} influxdb: - type: influxdb:{{% latest "influxdb" %}} + type: influxdb:{{% latest "influxdb" %}} ``` This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index e7801a8e8f..dc0a3c8388 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -62,14 +62,14 @@ To define the service, use the `kafka` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: kafka: - disk: 256 + type: kafka: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -80,11 +80,12 @@ 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: +app: + # 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: : ``` @@ -107,15 +108,16 @@ 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: +app: + # 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: : - service: - endpoint: kafka + service: + endpoint: kafka ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -137,8 +139,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. kafka: - type: kafka:{{% latest "kafka" %}} - disk: 256 + type: kafka:{{% latest "kafka" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -150,12 +152,13 @@ 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: - kafka: +app: + # 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: + kafka: ``` <---> @@ -165,15 +168,16 @@ 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: +app: + # 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: kafka: - service: kafka - endpoint: kafka + service: kafka + endpoint: kafka ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index 03a9c0486f..49a8403e61 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -74,14 +74,14 @@ To define the service, use the `memcached` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: memcached: - disk: 256 + type: memcached: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -92,11 +92,12 @@ 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: +app: + # 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: : ``` @@ -119,15 +120,16 @@ 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: +app: + # 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: : - service: - endpoint: memcached + service: + endpoint: memcached ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -149,7 +151,7 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. memcached: - type: memcached:{{% latest "memcached" %}} + type: memcached:{{% latest "memcached" %}} ``` #### [App configuration](/create-apps/_index.md) @@ -161,11 +163,12 @@ 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: +app: + # 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: memcached: ``` @@ -176,15 +179,16 @@ 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: +app: + # 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: memcached: - service: memcached - endpoint: memcached + service: memcached + endpoint: memcached ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index 6905555c78..75698153b2 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -136,14 +136,14 @@ To define the service, use the `mongodb-enterprise` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: mongodb-enterprise: - disk: 512 + type: mongodb-enterprise: + disk: 512 ``` 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 +#### 2. Define the relationship To define the relationship, use the following configuration: @@ -154,11 +154,12 @@ 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: +app: + # 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: : ``` @@ -181,15 +182,16 @@ 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: +app: + # 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: : - service: - endpoint: mongodb + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -207,10 +209,11 @@ With the above definition, the application container now has access to the servi For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="apps"} -# PHP extensions. -runtime: +app: + # PHP extensions. + runtime: extensions: - - mongodb + - mongodb ``` #### Example configuration @@ -220,8 +223,8 @@ runtime: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mongodb-enterprise: - type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} - disk: 512 + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} + disk: 512 ``` ##### [App configuration](/create-apps/_index.md) @@ -233,11 +236,12 @@ 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: +app: + # 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: mongodb-enterprise: ``` @@ -248,15 +252,16 @@ 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: +app: + # 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: mongodb-enterprise: - service: mongodb-enterprise - endpoint: mongodb + service: mongodb-enterprise + endpoint: mongodb ``` {{< /codetabs >}} @@ -270,14 +275,14 @@ To define the service, use the `mongodb` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: mongodb: - disk: 512 + type: mongodb: + disk: 512 ``` 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 +#### 2. Define the relationship To define the relationship, use the following configuration: @@ -288,11 +293,12 @@ 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: +app: + # 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: : ``` @@ -315,15 +321,16 @@ 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: +app: + # 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: : - service: - endpoint: mongodb + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -341,10 +348,11 @@ With the above definition, the application container now has access to the servi For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="apps"} -# PHP extensions. -runtime: +app: + # PHP extensions. + runtime: extensions: - - mongodb + - mongodb ``` #### Example configuration @@ -367,11 +375,12 @@ 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: +app: + # 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: mongodb: ``` @@ -382,15 +391,16 @@ 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: +app: + # 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: mongodb: - service: mongodb - endpoint: mongodb + service: mongodb + endpoint: mongodb ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 28bc844292..88cfae4316 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -114,14 +114,14 @@ To define the service, use the `mariadb` or `mysql` type for MariaDB or the `ora ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: mariadb: - disk: 256 + type: mariadb: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -132,11 +132,12 @@ 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: +app: + # 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: : ``` @@ -159,15 +160,16 @@ 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: +app: + # 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: : - service: - endpoint: mysql + service: + endpoint: mysql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -189,8 +191,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 256 + type: mariadb:{{% latest "mariadb" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -202,11 +204,12 @@ 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: +app: + # 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: mariadb: ``` @@ -217,15 +220,16 @@ 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: +app: + # 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: mariadb: - service: mariadb - endpoint: mysql + service: mariadb + endpoint: mysql ``` {{< /codetabs >}} @@ -237,8 +241,8 @@ relationships: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. oraclemysql: - type: oracle-mysql:{{% latest "oracle-mysql" %}} - disk: 256 + type: oracle-mysql:{{% latest "oracle-mysql" %}} + disk: 256 ``` #### [App configuration](/create-apps) @@ -250,11 +254,12 @@ 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: +app: + # 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: oraclemysql: ``` @@ -265,15 +270,16 @@ 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: +app: + # 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: oraclemysql: - service: oraclemysql - endpoint: mysql + service: oraclemysql + endpoint: mysql ``` {{< /codetabs >}} @@ -357,18 +363,18 @@ Example configuration: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - configuration: - schemas: - - main - endpoints: - mysql: - default_schema: main - privileges: - main: admin - properties: - max_allowed_packet: 64 + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + configuration: + schemas: + - main + endpoints: + mysql: + default_schema: main + privileges: + main: admin + properties: + max_allowed_packet: 64 ``` ## Relationship reference @@ -489,11 +495,12 @@ make sure you do the following: This results in the following configuration: -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-replica + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-replica ``` For example, if you define a `mariadb` database as follows: @@ -519,22 +526,24 @@ To create a replica of the `mariadb` database and allow your app to connect to i through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="app"} -relationships: - mariadb: - service: mariadb - endpoint: admin-replica +```yaml {configFile="apps"} +app: + relationships: + mariadb: + service: mariadb + endpoint: admin-replica ``` To create a replica of the `mariadb` database and allow your app to connect to it through the `reporter` endpoint with read-only permissions instead, use the following configuration: -```yaml {configFile="app"} -relationships: - mariadb: - service: mariadb - endpoint: reporter-replica +```yaml {configFile="apps"} +app: + relationships: + mariadb: + service: mariadb + endpoint: reporter-replica ``` ### Grant access to the main database and its replicas @@ -554,11 +563,12 @@ make sure you do the following: This results in the following configuration, which creates a replica on each of the secondary nodes: -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-all + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-all ``` For example, if you define a `mariadb` database as follows: @@ -584,22 +594,24 @@ To allow your app to connect to your main database and both its replicas through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="app"} -relationships: - mariadb: - service: mariadb - endpoint: admin-all +```yaml {configFile="apps"} +app: + relationships: + mariadb: + service: mariadb + endpoint: admin-all ``` To allow your app to connect to your main database and both its replicas through the `reporter` endpoint with read-only permissions, use the following configuration: -```yaml {configFile="app"} -relationships: - mariadb: - service: mariadb - endpoint: reporter-all +```yaml {configFile="apps"} +app: + relationships: + mariadb: + service: mariadb + endpoint: reporter-all ``` ## Multiple databases @@ -614,16 +626,16 @@ If neither `schemas` nor `endpoints` is included, it's equivalent to the followi ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - configuration: - schemas: - - main - endpoints: - mysql: - default_schema: main - privileges: - main: admin + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + configuration: + schemas: + - main + endpoints: + mysql: + default_schema: main + privileges: + main: admin ``` If either `schemas` or `endpoints` are defined, no default is applied and you have to specify the full configuration. @@ -647,47 +659,47 @@ Access to the database is defined through three endpoints: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - configuration: - schemas: - - main - - legacy - endpoints: - admin: - default_schema: main - privileges: - main: admin - legacy: admin - reporter: - privileges: - main: ro - importer: - default_schema: legacy - privileges: - legacy: rw + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + configuration: + schemas: + - main + - legacy + endpoints: + admin: + default_schema: main + privileges: + main: admin + legacy: admin + reporter: + privileges: + main: ro + importer: + default_schema: legacy + privileges: + legacy: rw ``` Expose these endpoints to your app as relationships in your [app configuration](../../create-apps/_index.md): -```yaml {configFile="app"} -name: myapp +```yaml {configFile="apps"} +app: -[...] + [...] -# Relationships enable an app container's access to a service. -relationships: + # Relationships enable an app container's access to a service. + relationships: # 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 database: - service: mariadb - endpoint: admin + service: mariadb + endpoint: admin reports: - service: mariadb - endpoint: reporter + service: mariadb + endpoint: reporter imports: - service: mariadb - endpoint: importer + service: mariadb + endpoint: importer ``` These relationships are then available in the [`{{< vendor/prefix >}}_RELATIONSHIPS` environment variable](#relationship-reference). @@ -719,13 +731,13 @@ An example of setting these properties: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - configuration: - properties: - max_allowed_packet: 64 - default_charset: utf8mb4 - default_collation: utf8mb4_unicode_ci + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + configuration: + properties: + max_allowed_packet: 64 + default_charset: utf8mb4 + default_collation: utf8mb4_unicode_ci ``` You can also change a table's character set and collation through `ALTER TABLE` commands: diff --git a/sites/platform/src/add-services/mysql/mysql-replication.md b/sites/platform/src/add-services/mysql/mysql-replication.md index 3500df9c05..9a5620de76 100644 --- a/sites/platform/src/add-services/mysql/mysql-replication.md +++ b/sites/platform/src/add-services/mysql/mysql-replication.md @@ -20,20 +20,20 @@ For each database that you'd like to replicate, you need to assign a `replicatio ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 1024 - configuration: - schemas: - - main - endpoints: - # Restate the default user to be used by your application. - mysql: - default_schema: main - privileges: - main: admin - replicator: - privileges: - main: replication + type: mariadb:{{% latest "mariadb" %}} + disk: 1024 + configuration: + schemas: + - main + endpoints: + # Restate the default user to be used by your application. + mysql: + default_schema: main + privileges: + main: admin + replicator: + privileges: + main: replication ``` This creates a `replicator` user, and grants read-only and table locking rights on the `main` database (namely `Select_priv`, `Show_view_priv`, `Create_tmp_table_priv`, `Lock_tables_priv` privileges) along with global replication rights (namely `Repl_slave_priv` and `Repl_client_priv` privileges) and flushing rights (`Reload_priv` used for flushing before reading the binary log position). If there is at least one `replication` permission defined, the bin-logging is enabled on the primary server, which is essential for the replication. @@ -43,21 +43,21 @@ This creates a `replicator` user, and grants read-only and table locking rights Even if you won't be accessing the replication endpoint from your application, you still need to expose it to an application as a relationship so that you can connect to it over SSH. Add a new relationship to your application container: -```yaml {configFile="app"} -name: myapp +```yaml {configFile="apps"} +app: -[...] + [...] -# Relationships enable an app container's access to a service. -relationships: + # Relationships enable an app container's access to a service. + relationships: # Please note: Legacy definition of the relationship is still supported: # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships database: - service: "mariadb" - endpoint: "mysql" + service: "mariadb" + endpoint: "mysql" replication: - service: "mariadb" - endpoint: "replicator" + service: "mariadb" + endpoint: "replicator" ``` ## Getting the Primary's Binary Log Co-ordinates diff --git a/sites/platform/src/add-services/mysql/troubleshoot.md b/sites/platform/src/add-services/mysql/troubleshoot.md index a4d42d834f..a60ff3dfd6 100644 --- a/sites/platform/src/add-services/mysql/troubleshoot.md +++ b/sites/platform/src/add-services/mysql/troubleshoot.md @@ -105,12 +105,12 @@ For example, in the following service configuration for MariaDB, `max_connection ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - size: L - configuration: - properties: - max_allowed_packet: 16 + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + size: L + configuration: + properties: + max_allowed_packet: 16 ``` To **increase** `max_connections`, you can **either**: @@ -129,11 +129,11 @@ Behind the scenes, `max_connections` (for Professional and DG3 projects) is calc ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - configuration: - properties: - max_allowed_packet: 16 + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + configuration: + properties: + max_allowed_packet: 16 ``` 1. **The memory available to the service**: Resources are distributed across the containers @@ -143,12 +143,12 @@ Behind the scenes, `max_connections` (for Professional and DG3 projects) is calc ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. mariadb: - type: mariadb:{{% latest "mariadb" %}} - disk: 2048 - size: L - configuration: - properties: - max_allowed_packet: 16 + type: mariadb:{{% latest "mariadb" %}} + disk: 2048 + size: L + configuration: + properties: + max_allowed_packet: 16 ``` The memory for a given container from its `size` depends on its [container profile***](/create-apps/app-reference/single-runtime-image#container-profiles-cpu-and-memory). diff --git a/sites/platform/src/add-services/network-storage.md b/sites/platform/src/add-services/network-storage.md index 795b8d6593..15c494f46d 100644 --- a/sites/platform/src/add-services/network-storage.md +++ b/sites/platform/src/add-services/network-storage.md @@ -85,8 +85,8 @@ To define the service, use the `network-storage` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: network-storage: - disk: 256 + type: network-storage: + disk: 256 ``` `` must be [RFC 1123](https://tools.ietf.org/html/rfc1123) compliant, and as such it must: @@ -98,7 +98,7 @@ To define the service, use the `network-storage` type: This is due to the fact that `` is used as hostname for the network storage. -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 mount @@ -106,11 +106,12 @@ Back up your data before changing the service. To define the mount accessible by your application, use the following configuration: ```yaml {configFile="apps"} -mounts: +app: + mounts: : - source: service - service: - source_path: + source: service + service: + source_path: ``` - `` is the path to your mount within the app container (relative to the app’s root). @@ -134,11 +135,12 @@ network-storage: #### [App configuration](/create-apps/_index.md) ```yaml {configFile="apps"} -mounts: +app: + mounts: 'my/files': - source: service - service: network-storage - source_path: files + source: service + service: network-storage + source_path: files ``` ## Multi-application usage @@ -153,52 +155,52 @@ For example: ```yaml {configFile="apps"} # The name of the app container. Must be unique within a project. app1: - # The location of the application's code. - source: - root: "app1" - - [...] - - mounts: - # The path to your mount within the app container (relative to the app's root). - 'web/uploads': - # Specifies that the mount points to a network storage service that can be shared between apps. - source: service - # The name of the network storage service the mount points to. - service: network-storage - # Specifies where your mount points inside the external directory that is mounted to your app container. - source_path: uploads + # The location of the application's code. + source: + root: "app1" + + [...] + + mounts: + # The path to your mount within the app container (relative to the app's root). + 'web/uploads': + # Specifies that the mount points to a network storage service that can be shared between apps. + source: service + # The name of the network storage service the mount points to. + service: network-storage + # Specifies where your mount points inside the external directory that is mounted to your app container. + source_path: uploads # The name of the app container. Must be unique within a project. app2: - # The location of the application's code. - source: - root: "app2" - - [...] - - mounts: - # The path to your mount within the app container (relative to the app's root). - 'process': - # Specifies that the mount points to a network storage service that can be shared between apps. - source: service - # The name of the network storage service the mount points to. - service: network-storage - # Specifies where your mount points inside the external directory that is mounted to your app container. - # Since the target is the uploads directory app1's mount already points to, - # the network storage service is effectively shared between app1 and app2. - source_path: uploads/incoming - - # The path to your mount within the app container (relative to the app's root). - 'done': - # Specifies that the mount points to a network storage service that can be shared between apps. - source: service - # The name of the network storage service the mount points to. - service: network-storage - # Specifies where your mount points inside the external directory that is mounted to your app container. - # Since the target is the uploads directory app1's mount already points to, - # the network storage service is effectively shared between app1 and app2. - source_path: uploads/done + # The location of the application's code. + source: + root: "app2" + + [...] + + mounts: + # The path to your mount within the app container (relative to the app's root). + 'process': + # Specifies that the mount points to a network storage service that can be shared between apps. + source: service + # The name of the network storage service the mount points to. + service: network-storage + # Specifies where your mount points inside the external directory that is mounted to your app container. + # Since the target is the uploads directory app1's mount already points to, + # the network storage service is effectively shared between app1 and app2. + source_path: uploads/incoming + + # The path to your mount within the app container (relative to the app's root). + 'done': + # Specifies that the mount points to a network storage service that can be shared between apps. + source: service + # The name of the network storage service the mount points to. + service: network-storage + # Specifies where your mount points inside the external directory that is mounted to your app container. + # Since the target is the uploads directory app1's mount already points to, + # the network storage service is effectively shared between app1 and app2. + source_path: uploads/done ``` In this example, `app1` has access to the entire `uploads` directory by writing to `web/uploads`. @@ -226,40 +228,39 @@ files: You can then use this service to define a `network_dir` network mount and a `local_dir` local mount, to be used by a `web` instance and a `queue` worker instance: -```yaml {configFile="app"} -name: myapp - -# The type of the application to build. -type: "nodejs:20" +```yaml {configFile="apps"} +app: + # The type of the application to build. + type: "nodejs:20" -# Defines how much space is available to local mounts. -disk: 512 + # Defines how much space is available to local mounts. + disk: 512 -mounts: + mounts: # Defines a network storage mount that can be shared by both worker instances. 'network_dir': - source: service - service: files - source_path: our_stuff + source: service + service: files + source_path: our_stuff # Defines a local mount that's available to each instance separately. 'local_dir': - source: local - source_path: my_stuff + source: local + source_path: my_stuff -# Defines a web instance. -web: + # Defines a web instance. + web: locations: - "/": - root: "public" - passthru: true - index: ['index.html'] + "/": + root: "public" + passthru: true + index: ['index.html'] -# Define a queue worker instance from the same code but with a different start. -workers: + # Define a queue worker instance from the same code but with a different start. + workers: queue: - commands: - start: ./start.sh + commands: + start: ./start.sh ``` Both the web instance and the `queue` worker have two mount points: @@ -278,61 +279,60 @@ For that case, all that's needed is to set the necessary file mounts as `service For example, the following `{{< vendor/configfile "app" >}}` file (fragment) keeps Drupal files directories shared between web and worker instances while keeping the Drush backup directory web-only (as it has no need to be shared). (This assumes a Network Storage service named `files` has also been defined in `{{< vendor/configfile "services" >}}`.) -```yaml {configFile="app"} -name: myapp - -# The type of the application to build. -type: "php:{{% latest "php" %}}" +```yaml {configFile="apps"} +app: + # The type of the application to build. + type: "php:{{% latest "php" %}}" -relationships: + relationships: mariadb: -disk: 1024 + disk: 1024 -mounts: + mounts: # The public and private files directories are # network mounts shared by web and workers. 'web/sites/default/files': - source: service - service: files - source_path: files + source: service + service: files + source_path: files 'private': - source: service - service: files - source_path: private + source: service + service: files + source_path: private # The backup, temp, and cache directories for # Drupal's CLI tools don't need to be shared. # It wouldn't hurt anything to make them network # shares, however. '/.drush': - source: local - source_path: drush + source: local + source_path: drush 'tmp': - source: local - source_path: tmp + source: local + source_path: tmp 'drush-backups': - source: local - source_path: drush-backups + source: local + source_path: drush-backups '/.console': - source: local - source_path: console + source: local + source_path: console -# Crons run on the web container, so they have the -# same mounts as the web container. -crons: + # Crons run on the web container, so they have the + # same mounts as the web container. + crons: drupal: - spec: '*/20 * * * *' - commands: - start: 'cd web ; drush core-cron' - -# The worker defined here also has the same 6 mounts; -# 2 of them are shared with the web container, -# the other 4 are local to the worker. -workers: + spec: '*/20 * * * *' + commands: + start: 'cd web ; drush core-cron' + + # The worker defined here also has the same 6 mounts; + # 2 of them are shared with the web container, + # the other 4 are local to the worker. + workers: queue: - commands: - start: | - cd web && drush queue-run myqueue + commands: + start: | + cd web && drush queue-run myqueue ``` ## How can I migrate a local storage to a network storage? @@ -342,11 +342,12 @@ However, the process is fundamentally "just" moving files around on disk, so it' Suppose you have this mount configuration: -```yaml {configFile="app"} -mounts: +```yaml {configFile="apps"} +app: + mounts: web/uploads: - source: local - source_path: uploads + source: local + source_path: uploads ``` And want to move that to a network storage mount. @@ -365,15 +366,16 @@ The following approximate steps do so with a minimum of service interruption. 2. Add a new mount (`new-uploads`) to the network storage service on a non-public directory. (Remember the `source_path` can be the same since they're on different storage services.) - ```yaml {configFile="app"} - mounts: + ```yaml {configFile="apps"} + app: + mounts: web/uploads: - source: local - source_path: uploads + source: local + source_path: uploads new-uploads: - source: service - service: files - source_path: uploads + source: service + service: files + source_path: uploads ``` 3. Deploy these changes. @@ -388,15 +390,16 @@ The following approximate steps do so with a minimum of service interruption. Point the `web/uploads` directory to the network mount instead. Commit and push the change, testing to make sure the network files are accessible. - ```yaml {configFile="app"} - mounts: + ```yaml {configFile="apps"} + app: + mounts: old-uploads: - source: local - source_path: uploads + source: local + source_path: uploads web/uploads: - source: service - service: files - source_path: uploads + source: service + service: files + source_path: uploads ``` 5. Clean up. diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 5effa5fdfa..98e6a9175a 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -106,14 +106,14 @@ To define the service, use the `opensearch` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: opensearch: - disk: 256 + type: opensearch: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -124,11 +124,12 @@ 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: +app: + # 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: : ``` @@ -151,15 +152,16 @@ 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: +app: + # 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: : - service: - endpoint: opensearch + service: + endpoint: opensearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -181,8 +183,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. opensearch: - type: opensearch:{{% latest "opensearch" %}} - disk: 256 + type: opensearch:{{% latest "opensearch" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -194,11 +196,12 @@ 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: +app: + # 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: opensearch: ``` @@ -209,15 +212,16 @@ 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: +app: + # 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: opensearch: - service: opensearch - endpoint: opensearch + service: opensearch + endpoint: opensearch ``` {{< /codetabs >}} @@ -232,12 +236,12 @@ To use the configured service in your app, add a configuration file similar to t title=Using default endpoints +++ -```yaml {configFile="app"} -name: myapp +```yaml {configFile="apps"} +app: -[...] + [...] -relationships: + relationships: opensearch: ``` @@ -247,15 +251,15 @@ relationships: title=Using explicit endpoints +++ -```yaml {configFile="app"} -name: myapp +```yaml {configFile="apps"} +app: -[...] + [...] -relationships: + relationships: opensearch: - service: opensearch - endpoint: opensearch + service: opensearch + endpoint: opensearch ``` {{< /codetabs >}} @@ -306,11 +310,11 @@ To do so, include the following in your `{{< vendor/configfile "services" >}}` c ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. opensearch: - type: opensearch:{{% latest "opensearch" %}} - disk: 2048 - configuration: - authentication: - enabled: true + type: opensearch:{{% latest "opensearch" %}} + disk: 2048 + configuration: + authentication: + enabled: true ``` That enables mandatory HTTP Basic auth on all requests. @@ -328,11 +332,11 @@ For example: ```yaml {configFile="routes"} "https://www.os.{default}/": - type: redirect - to: "https://os.{default}/" + type: redirect + to: "https://os.{default}/" "https://os.{default}/": - type: upstream - upstream: "opensearch:opensearch" + type: upstream + upstream: "opensearch:opensearch" ``` ## Plugins @@ -343,11 +347,11 @@ To enable them, list them under the `configuration.plugins` key in your `{{< ven ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. opensearch: - type: "opensearch:{{% latest "opensearch" %}}" - disk: 1024 - configuration: - plugins: - - analysis-icu + type: "opensearch:{{% latest "opensearch" %}}" + disk: 1024 + configuration: + plugins: + - analysis-icu ``` In this example you'd have the ICU analysis plugin and the size mapper plugin. diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index a2fc61b080..b6d396bff8 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -108,14 +108,14 @@ To define the service, use the `postgresql` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: postgresql: - disk: 256 + type: postgresql: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -126,11 +126,12 @@ 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: +app: + # 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: : ``` @@ -153,15 +154,16 @@ 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: +app: + # 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: : - service: - endpoint: postgresql + service: + endpoint: postgresql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -179,10 +181,11 @@ With the above definition, the application container now has [access to the serv For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="apps"} -# PHP extensions. -runtime: +app: + # PHP extensions. + runtime: extensions: - - pdo_pgsql + - pdo_pgsql ``` ### Example configuration @@ -192,8 +195,8 @@ runtime: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. postgresql: - type: postgresql:{{% latest "postgresql" %}} - disk: 256 + type: postgresql:{{% latest "postgresql" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -205,11 +208,12 @@ 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: +app: + # 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: postgresql: ``` @@ -220,15 +224,16 @@ 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: +app: + # 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: postgresql: - service: postgresql - endpoint: postgresql + service: postgresql + endpoint: postgresql ``` {{< /codetabs >}} @@ -379,25 +384,25 @@ Consider the following illustrative example: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - disk: 2048 - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro - importer: - default_database: legacy - privileges: - legacy: rw + type: "postgresql:{{% latest "postgresql" %}}" + disk: 2048 + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro + importer: + default_database: legacy + privileges: + legacy: rw ``` This example creates a single PostgreSQL service named `postgresql`. The server has two databases, `main` and `legacy` with three endpoints created. @@ -410,19 +415,20 @@ If a given endpoint has access to multiple databases you should also specify whi Once these endpoints are defined, you need to expose them to your application as a relationship. Continuing with the above example, your `relationships` in `{{< vendor/configfile "app" >}}` might look like: -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: # Please note: Legacy definition of the relationship is still supported: # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships database: - service: postgresql - endpoint: admin + service: postgresql + endpoint: admin reports: - service: postgresql - endpoint: reporter + service: postgresql + endpoint: reporter imports: - service: postgresql - endpoint: importer + service: postgresql + endpoint: importer ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. @@ -433,16 +439,16 @@ A service configuration without the `configuration` block defined is equivalent ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - disk: 2048 - configuration: - databases: - - main - endpoints: - postgresql: - default_database: main - privileges: - main: admin + type: "postgresql:{{% latest "postgresql" %}}" + disk: 2048 + configuration: + databases: + - main + endpoints: + postgresql: + default_database: main + privileges: + main: admin ``` If you do not define `database` but `endpoints` are defined, then the single database `main` is created with the following assumed configuration: @@ -450,12 +456,12 @@ If you do not define `database` but `endpoints` are defined, then the single dat ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - disk: 2048 - configuration: - databases: - - main - endpoints: + type: "postgresql:{{% latest "postgresql" %}}" + disk: 2048 + configuration: + databases: + - main + endpoints: ``` Alternatively, if you define multiple databases but no endpoints, a single user `main` is created with `admin` access to each of your databases, equivalent to the configuration below: @@ -463,18 +469,18 @@ Alternatively, if you define multiple databases but no endpoints, a single user ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - disk: 2048 - configuration: - databases: - - firstdb - - seconddb - - thirddb - endpoints: - main: - firstdb: admin - seconddb: admin - thirddb: admin + type: "postgresql:{{% latest "postgresql" %}}" + disk: 2048 + configuration: + databases: + - firstdb + - seconddb + - thirddb + endpoints: + main: + firstdb: admin + seconddb: admin + thirddb: admin ``` ## Password generation @@ -515,54 +521,57 @@ make sure you do the following: This results in the following configuration: -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-replica + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-replica ``` For example, if you define a `postgresql` database as follows: ```yaml {configFile="services"} postgresql: - type: "postgresql:16" - disk: 2048 - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro + type: "postgresql:16" + disk: 2048 + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro ``` To create a replica of the `postgresql` database and allow your app to connect to it through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="app"} -relationships: - postgresql: - service: postgresql - endpoint: admin-replica +```yaml {configFile="apps"} +app: + relationships: + postgresql: + service: postgresql + endpoint: admin-replica ``` To create a replica of the `postgresql` database and allow your app to connect to it through the `reporter` endpoint with read-only permissions instead, use the following configuration: -```yaml {configFile="app"} -relationships: - postgresql: - service: postgresql - endpoint: reporter-replica +```yaml {configFile="apps"} +app: + relationships: + postgresql: + service: postgresql + endpoint: reporter-replica ``` ## Service timezone @@ -576,12 +585,12 @@ To change the timezone for the current session, run `SET TIME ZONE {{< variable ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - disk: 2048 - configuration: - extensions: - - pg_trgm - - hstore + type: "postgresql:{{% latest "postgresql" %}}" + disk: 2048 + configuration: + extensions: + - pg_trgm + - hstore ``` In this case, you have `pg_trgm` installed, providing functions to determine the similarity of text based on trigram matching, and `hstore` providing a key-value store. diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index 224a64eaaa..a25c7a43ed 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -101,14 +101,14 @@ To define the service, use the `rabbitmq` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: rabbitmq: - disk: 512 + type: rabbitmq: + disk: 512 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -119,11 +119,12 @@ 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: +app: + # 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: : ``` @@ -146,15 +147,16 @@ 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: +app: + # 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: : - service: - endpoint: rabbitmq + service: + endpoint: rabbitmq ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -176,8 +178,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. rabbitmq: - type: rabbitmq:{{% latest "rabbitmq" %}} - disk: 512 + type: rabbitmq:{{% latest "rabbitmq" %}} + disk: 512 ``` #### [App configuration](/create-apps) @@ -189,11 +191,12 @@ 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: +app: + # 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: rabbitmq: ``` @@ -204,15 +207,16 @@ 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: +app: + # 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: rabbitmq: - service: rabbitmq - endpoint: rabbitmq + service: rabbitmq + endpoint: rabbitmq ``` {{< /codetabs >}} @@ -321,12 +325,12 @@ To create virtual hosts, add them to your configuration as in the following exam ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. rabbitmq: - type: "rabbitmq:{{% latest "rabbitmq" %}}" - disk: 512 - configuration: - vhosts: - - host1 - - host2 + type: "rabbitmq:{{% latest "rabbitmq" %}}" + disk: 512 + configuration: + vhosts: + - host1 + - host2 ``` ## Upgrading diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index abae101125..6dd6f259f6 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -78,7 +78,6 @@ while Redis 2.8 only supports a single database. Depending on your needs, you can set up Redis as [persistent](#persistent-redis) or [ephemeral](#ephemeral-redis). - ## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) @@ -149,13 +148,13 @@ To define the service, use the `redis-persistent` endpoint: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: redis-persistent: + type: redis-persistent: ``` 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 +#### 2. Define the relationship To define the relationship, use the `redis` endpoint : @@ -165,12 +164,13 @@ To define the relationship, use the `redis` endpoint : title=Using default endpoints +++ -```yaml {configFile="app"} -# 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: +```yaml {configFile="apps"} +app: + # 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: : ``` @@ -189,15 +189,16 @@ 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: +app: + # 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: : - service: - endpoint: redis + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -214,11 +215,12 @@ With the above definition, the application container now has [access to the serv For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="app"} -# PHP extensions. -runtime: +```yaml {configFile="apps"} +app: + # PHP extensions. + runtime: extensions: - - redis + - redis ``` ### Configuration example @@ -228,8 +230,8 @@ runtime: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. redis: - type: redis-persistent:{{% latest "redis" %}} - disk: 256 + type: redis-persistent:{{% latest "redis" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -240,8 +242,9 @@ redis: title=Using default endpoints +++ -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: redis: ``` @@ -251,11 +254,12 @@ relationships: title=Using explicit endpoints +++ -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: redis: - service: redis - endpoint: redis + service: redis + endpoint: redis ``` {{< /codetabs >}} @@ -322,13 +326,13 @@ To define the service, use the `redis` endpoint: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: redis: + type: redis: ``` 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 +#### 2. Define the relationship To define the relationship, use the following configuration: @@ -338,12 +342,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="app"} -# 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: +```yaml {configFile="apps"} +app: + # 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: : ``` @@ -362,15 +367,16 @@ 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: +app: + # 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: : - service: - endpoint: redis + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -387,11 +393,12 @@ With the above definition, the application container now has [access to the serv For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="app"} -# PHP extensions. -runtime: +```yaml {configFile="apps"} +app: + # PHP extensions. + runtime: extensions: - - redis + - redis ``` ### Configuration example @@ -401,8 +408,8 @@ runtime: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. redis: - type: redis:{{% latest "redis" %}} - disk: 256 + type: redis:{{% latest "redis" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -413,8 +420,9 @@ redis: title=Using default endpoints +++ -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: redis: ``` @@ -424,11 +432,12 @@ relationships: title=Using explicit endpoints +++ -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: redis: - service: redis - endpoint: redis + service: redis + endpoint: redis ``` {{< /codetabs >}} @@ -552,62 +561,65 @@ make sure you do the following: This results in the following configuration: -```yaml {configFile="app"} -relationships: +```yaml {configFile="apps"} +app: + relationships: {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-replica + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-replica ``` For example, if you define a `redis-persistent` database as follows: ```yaml {configFile="services"} postgresql: - type: "redis-persistent:16" - disk: 2048 - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro + type: "redis-persistent:16" + disk: 2048 + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro ``` To create a replica of the `redis-persistent` database and allow your app to connect to it through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="app"} -relationships: - redis-persistent: - service: redis-persistent - endpoint: admin-replica +```yaml {configFile="apps"} +app: + relationships: + redis-persistent: + service: redis-persistent + endpoint: admin-replica ``` To create a replica of the `redis-persistent` database and allow your app to connect to it through the `reporter` endpoint with read-only permissions instead, use the following configuration: -```yaml {configFile="app"} -relationships: - redis-persistent: - service: redis-persistent - endpoint: reporter-replica +```yaml {configFile="apps"} +app: + relationships: + redis-persistent: + service: redis-persistent + endpoint: reporter-replica ``` -## Relationship reference +## Relationship reference Example information available through the [`{{% vendor/prefix %}}_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) or by running `{{% vendor/cli %}} relationships`. -Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. +Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` environment variable directly rather than hard coding any values. ```json @@ -642,9 +654,9 @@ To customize those cache cleanups, set up an eviction policy such as the followi ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. redis: - type: "redis:{{% latest "redis" %}}" - configuration: - maxmemory_policy: allkeys-lfu + type: "redis:{{% latest "redis" %}}" + configuration: + maxmemory_policy: allkeys-lfu ``` The following table presents the possible values: @@ -721,22 +733,23 @@ redissessions: title=Using default endpoints +++ -```yaml {configFile="app"} -type: "php:{{% latest "php" %}}" +```yaml {configFile="apps"} +app: + type: "php:{{% latest "php" %}}" -relationships: - redissessions: + relationships: + redissessions: -variables: + variables: php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" + session.save_handler: redis + session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" -web: + web: locations: - '/': - root: 'web' - passthru: '/index.php' + '/': + root: 'web' + passthru: '/index.php' ``` <---> @@ -745,24 +758,25 @@ web: title=Using explicit endpoints +++ -```yaml {configFile="app"} -type: "php:{{% latest "php" %}}" +```yaml {configFile="apps"} +app: + type: "php:{{% latest "php" %}}" -relationships: + relationships: redissessions: - service: "redissessions" - endpoint: "redis" + service: "redissessions" + endpoint: "redis" -variables: + variables: php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" + session.save_handler: redis + session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" -web: + web: locations: - '/': - root: 'web' - passthru: '/index.php' + '/': + root: 'web' + passthru: '/index.php' ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index 183e7e2e4e..4451d7a7c6 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -101,14 +101,14 @@ To define the service, use the `solr` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: solr: - disk: 256 + type: solr: + disk: 256 ``` 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 +### 2. Define the relationship To define the relationship, use the following configuration: @@ -119,11 +119,12 @@ 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: +app: + # 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: : ``` @@ -146,14 +147,15 @@ title=Using explicit endpoints +++ ```yaml {configFile="apps"} -# Relationships enable access from this app to a given service. -# 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: +app: + # Relationships enable access from this app to a given service. + # 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: : - service: - endpoint: solr + service: + endpoint: solr ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -175,8 +177,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: solr:{{% latest "solr" %}} - disk: 256 + type: solr:{{% latest "solr" %}} + disk: 256 ``` #### [App configuration](/create-apps/_index.md) @@ -188,11 +190,12 @@ 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: +app: + # 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: solr: ``` @@ -203,14 +206,15 @@ title=Using explicit endpoints +++ ```yaml {configFile="apps"} -# Relationships enable access from this app to a given service. -# 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: +app + # Relationships enable access from this app to a given service. + # 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: solr: - service: solr - endpoint: solr + service: solr + endpoint: solr ``` {{< /codetabs >}} @@ -270,10 +274,10 @@ You must provide your own Solr configuration via a `core_config` key in your `{{ ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: "solr:4.10" - disk: 1024 - configuration: - core_config: !archive "{{< variable "DIRECTORY" >}}" + type: "solr:4.10" + disk: 1024 + configuration: + core_config: !archive "{{< variable "DIRECTORY" >}}" ``` {{< variable "DIRECTORY" >}} points to a directory in the Git repository, in or below the `{{< vendor/configdir >}}/` folder. This directory needs to contain everything that Solr needs to start a core. At the minimum, `solrconfig.xml` and `schema.xml`. @@ -283,10 +287,10 @@ For example, place them in `{{< vendor/configdir >}}/solr/conf/` such that the ` ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: "solr:4.10" - disk: 1024 - configuration: - core_config: !archive "solr/conf/" + type: "solr:4.10" + disk: 1024 + configuration: + core_config: !archive "solr/conf/" ``` ## Solr 6 and later @@ -296,19 +300,19 @@ For Solr 6 and later {{% vendor/name %}} supports multiple cores via different e ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: solr:{{% latest "solr" %}} - disk: 1024 - configuration: - cores: - mainindex: - conf_dir: !archive "core1-conf" - extraindex: - conf_dir: !archive "core2-conf" - endpoints: - main: - core: mainindex - extra: - core: extraindex + type: solr:{{% latest "solr" %}} + disk: 1024 + configuration: + cores: + mainindex: + conf_dir: !archive "core1-conf" + extraindex: + conf_dir: !archive "core2-conf" + endpoints: + main: + core: mainindex + extra: + core: extraindex ``` The above definition defines a single Solr {{% latest "solr" %}} server. That server has 2 cores defined: @@ -320,14 +324,14 @@ It then defines two endpoints: `main` is connected to the `mainindex` core while Each endpoint is then available in the relationships definition in `{{< vendor/configfile "app" >}}`. For example, to allow an application to talk to both of the cores defined above its configuration should contain the following: -```yaml {configFile="app"} -name: myapp +```yaml {configFile="apps"} +app: -type: "php:{{% latest "php" %}}" + type: "php:{{% latest "php" %}}" -[...] + [...] -relationships: + relationships: solrsearch1: "solr:main" solrsearch2: "solr:extra" ``` @@ -364,25 +368,25 @@ For even more customizability, it's also possible to define Solr configsets. For ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: solr:8.4 - disk: 1024 - configuration: - configsets: - mainconfig: !archive "configsets/solr8" - cores: - english_index: - core_properties: | - configSet=mainconfig - schema=english/schema.xml - arabic_index: - core_properties: | - configSet=mainconfig - schema=arabic/schema.xml - endpoints: - english: - core: english_index - arabic: - core: arabic_index + type: solr:8.4 + disk: 1024 + configuration: + configsets: + mainconfig: !archive "configsets/solr8" + cores: + english_index: + core_properties: | + configSet=mainconfig + schema=english/schema.xml + arabic_index: + core_properties: | + configSet=mainconfig + schema=arabic/schema.xml + endpoints: + english: + core: english_index + arabic: + core: arabic_index ``` In this example, `{{< vendor/configdir >}}/configsets/solr8` contains the configuration definition for multiple cores. There are then two cores created: @@ -403,14 +407,14 @@ If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: solr:{{% latest "solr" %}} - configuration: - cores: - collection1: - conf_dir: !archive "example" - endpoints: - solr: - core: collection1 + type: solr:{{% latest "solr" %}} + configuration: + cores: + collection1: + conf_dir: !archive "example" + endpoints: + solr: + core: collection1 ``` The example configuration directory is equivalent to the [Solr example configuration set](https://github.com/apache/solr/tree/main/solr/server/solr/configsets/sample_techproducts_configs/conf). @@ -424,13 +428,13 @@ If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. solr: - type: solr:{{% latest "solr" %}} - configuration: - cores: - collection1: {} - endpoints: - solr: - core: collection1 + type: solr:{{% latest "solr" %}} + configuration: + cores: + collection1: {} + endpoints: + solr: + core: collection1 ``` The default configuration is based on an older version of the Drupal 8 Search API Solr module that is no longer in use. diff --git a/sites/platform/src/add-services/varnish.md b/sites/platform/src/add-services/varnish.md index 08c7b0c455..5d33240347 100644 --- a/sites/platform/src/add-services/varnish.md +++ b/sites/platform/src/add-services/varnish.md @@ -53,13 +53,13 @@ To define the service, use the `varnish` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: varnish: - relationships: - : ':http' - configuration: - vcl: !include - type: string - path: config.vcl + type: varnish: + relationships: + : ':http' + configuration: + vcl: !include + type: string + path: config.vcl ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -79,13 +79,13 @@ The `path` defines the file relative to the `{{< vendor/configdir >}}` directory ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. varnish: - type: varnish:7.3 - relationships: - application: 'myapp:http' - configuration: - vcl: !include - type: string - path: config.vcl + type: varnish:7.3 + relationships: + application: 'myapp:http' + configuration: + vcl: !include + type: string + path: config.vcl ``` Notice the `relationship` (`application`) defined for the service `varnish` granting access to the application container `myapp`. @@ -150,30 +150,30 @@ For example, you might have the following configuration for two apps: ```yaml {configFile="services"} varnish: - type: varnish:{{% latest "varnish" %}} - relationships: - blog: 'blog:http' - main: 'app:http' - configuration: - vcl: !include - type: string - path: config.vcl + type: varnish:{{% latest "varnish" %}} + relationships: + blog: 'blog:http' + main: 'app:http' + configuration: + vcl: !include + type: string + path: config.vcl ``` ```yaml {configFile="apps"} blog: - # The location of the application's code. - source: - root: "backends/blog" - # The type of the application to build. - type: "php:{{% latest "php" %}}" + # The location of the application's code. + source: + root: "backends/blog" + # The type of the application to build. + type: "php:{{% latest "php" %}}" app: - # The location of the application's code. - source: - root: "backends/main" - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" ``` You could then define that all requests to `/blog/` go to the `blog` app and all other requests to the other app: @@ -197,10 +197,10 @@ To forward all incoming requests to Varnish rather than your app, you could have ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "varnish:http" - cache: - enabled: false + type: upstream + upstream: "varnish:http" + cache: + enabled: false ``` Varnish forwards requests to your app based on the specified VCL template. @@ -321,38 +321,38 @@ Define [app configuration](/create-apps/app-reference/single-runtime-image.md) s ```yaml {configFile="apps"} # The name of the app container. Must be unique within a project. stats-app: - # The location of the application's code. - source: - root: "stats" - # The type of the application to build. - type: "python:{{% latest "python" %}}" - # Unique relationship _to_ Varnish from 'stats-app', where no relationship - # is defined _from_ Varnish to the same app, to avoid circular relationships. - relationships: - varnishstats: - service: varnish - endpoint: "http+stats" + # The location of the application's code. + source: + root: "stats" + # The type of the application to build. + type: "python:{{% latest "python" %}}" + # Unique relationship _to_ Varnish from 'stats-app', where no relationship + # is defined _from_ Varnish to the same app, to avoid circular relationships. + relationships: + varnishstats: + service: varnish + endpoint: "http+stats" # The name of the app container. Must be unique within a project. main-app: - # The location of the application's code. - source: - root: "backends/main" - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" ``` ```yaml {configFile="services" v2Hide="true"} # The name of the service container. Must be unique within a project. varnish: - type: varnish:{{% latest "varnish" %}} - # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship - # is defined _to_ Varnish to the same app, to avoid circular relationships. - relationships: - main: "main-app:http" - configuration: - vcl: !include - type: string - path: config.vcl + type: varnish:{{% latest "varnish" %}} + # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship + # is defined _to_ Varnish to the same app, to avoid circular relationships. + relationships: + main: "main-app:http" + configuration: + vcl: !include + type: string + path: config.vcl ``` diff --git a/sites/platform/src/add-services/vault.md b/sites/platform/src/add-services/vault.md index 4f474c55b2..2d60da2cc6 100644 --- a/sites/platform/src/add-services/vault.md +++ b/sites/platform/src/add-services/vault.md @@ -78,14 +78,14 @@ To define the service, use the `vault-kms` type: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: vault-kms: - disk: 512 - configuration: - endpoints: - : - - policy: - key: - type: + type: vault-kms: + disk: 512 + configuration: + endpoints: + : + - policy: + key: + type: ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -107,18 +107,19 @@ You can create multiple endpoints, such as to have key management separate from 512 MB is the minimum required disk space for the Vault KMS service. -### 2. Add the relationship +### 2. Define the relationship To define the relationship, use the following configuration: ```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. -relationships: +app: + # 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. + relationships: : - service: - endpoint: + service: + endpoint: ``` You can define `` as you like, so long as it's unique between all defined services @@ -138,31 +139,32 @@ If you split the service into multiple endpoints, define multiple relationships. ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. vault-kms: - type: vault-kms:1.12 - disk: 512 - configuration: - endpoints: - manage_keys: - - policy: admin - key: vault-sign - type: sign - - policy: sign - key: vault-sign - type: sign - - policy: verify - key: vault-sign - type: sign + type: vault-kms:1.12 + disk: 512 + configuration: + endpoints: + manage_keys: + - policy: admin + key: vault-sign + type: sign + - policy: sign + key: vault-sign + type: sign + - policy: verify + key: vault-sign + type: sign ``` #### [App configuration](/create-apps) ```yaml {configFile="apps"} -relationships: +app: + relationships: # Please note: Legacy definition of the relationship is still supported: # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships vault_secret: - service: "vault-kms" - endpoint: "manage_keys" + service: "vault-kms" + endpoint: "manage_keys" ``` ### Multiple endpoints configuration @@ -172,35 +174,36 @@ relationships: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. vault-kms: - type: vault-kms:1.12 - disk: 512 - configuration: - endpoints: - management: - - policy: admin - key: admin-key - type: sign - sign_and_verify: - - policy: sign - key: signing-key - type: sign - - policy: verify - key: signing-key - type: sign + type: vault-kms:1.12 + disk: 512 + configuration: + endpoints: + management: + - policy: admin + key: admin-key + type: sign + sign_and_verify: + - policy: sign + key: signing-key + type: sign + - policy: verify + key: signing-key + type: sign ``` #### [App configuration](/create-apps) ```yaml {configFile="apps"} -relationships: +app: + relationships: # Please note: Legacy definition of the relationship is still supported. # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships vault_manage: - service: vault-kms - endpoint: management + service: vault-kms + endpoint: management vault_sign: - service: vault-kms - endpoint: sign_and_verify + service: vault-kms + endpoint: sign_and_verify ``` ## Use Vault KMS diff --git a/sites/platform/src/administration/cli/api-tokens.md b/sites/platform/src/administration/cli/api-tokens.md index 89dd03901e..1bd5d1f2d2 100644 --- a/sites/platform/src/administration/cli/api-tokens.md +++ b/sites/platform/src/administration/cli/api-tokens.md @@ -12,7 +12,7 @@ You need to set up an API token to authenticate the {{% vendor/name %}} CLI for You might need the [{{% vendor/name %}} CLI](../cli/_index.md) to perform certain tasks. For example, you need the CLI to do the following: -- [Check the validity of an API token](#optional-check-the-validity-of-your-api-token). +- [Check the validity of an API token](#optional-check-the-validity-of-your-api-token). - [Load the CLI SSH certificate for non-CLI commands](#use-the-cli-ssh-certificate-for-non-cli-commands). @@ -34,7 +34,7 @@ title=Using the CLI ```bash {{% vendor/cli %}} user:add {{< variable "EMAIL_ADDRESS" >}} --role viewer --role development:contributor ``` - This sets your machine user as a viewer on your project and a contributor on development environments, + This sets your machine user as a viewer on your project and a contributor on development environments, with no access to other environment types. Note that you can further [adjust user roles](../users.md#environment-type-roles) depending on your needs and each environment type. @@ -90,19 +90,19 @@ When an API token is compromised, revoke it immediately. After you create your API token, you can use it to do the following: - Allow a CI system to run automated tasks using the {{% vendor/name %}} CLI. -- Run automated tasks on an app container using the {{% vendor/name %}} CLI, - for example in a cron job. +- Run automated tasks on an app container using the {{% vendor/name %}} CLI, + for example in a cron job. Note that when running CLI commands in these cases, -some operations might take time to complete. -To avoid waiting for an operation to complete before moving on to the next one, +some operations might take time to complete. +To avoid waiting for an operation to complete before moving on to the next one, use the `--no-wait` flag. ### Authenticate in a CI system You can allow your CI system to run automated tasks using the {{% vendor/name %}} CLI. -To do so, create an environment variable named `{{% vendor/prefix_cli %}}_CLI_TOKEN` with your API token as its value. +To do so, create an environment variable named `{{% vendor/prefix_cli %}}_CLI_TOKEN` with your API token as its value. For more information, see your CI system's official documentation. To run SSH-based commands that aren't specific to the {{% vendor/name %}} CLI, @@ -177,8 +177,8 @@ To run SSH-based commands that aren't specific to the {{% vendor/name %}} CLI, see how to [load the proper SSH certificate](#use-the-cli-ssh-certificate-for-non-cli-commands). You can set up a cron job on a specific type of environment. -For example, to run the `update` source operation on your production environment, -use the following cron job: +For example, to run the `update` source operation on your production environment, +use the following cron job: ```yaml crons: @@ -195,7 +195,7 @@ crons: ## Use the CLI SSH certificate for non-CLI commands When you set a `{{% vendor/prefix_cli %}}_CLI_TOKEN` environment variable, -the CLI authentication isn't complete until your run a CLI command +the CLI authentication isn't complete until your run a CLI command or load the CLI SSH certificate. For example, after setting a `{{% vendor/prefix_cli %}}_CLI_TOKEN` environment variable, @@ -206,4 +206,4 @@ To do so, run the following command: ```bash {{% vendor/cli %}} ssh-cert:load --no-interaction -``` \ No newline at end of file +``` diff --git a/sites/platform/src/guides/drupal/elasticsearch.md b/sites/platform/src/guides/drupal/elasticsearch.md index 7dad321451..f3b05c764f 100644 --- a/sites/platform/src/guides/drupal/elasticsearch.md +++ b/sites/platform/src/guides/drupal/elasticsearch.md @@ -23,23 +23,29 @@ To define the service, use the `elasticsearch`: 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 +#### 2. Define 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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -49,7 +55,37 @@ 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](/add-services/elasticsearch.md#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](/add-services/elasticsearch.md#use-in-app) via the relationship `` 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: + : + service: + endpoint: elasticsearch +``` + +You can define ```` and ```` 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). + +{{< /codetabs >}} ### Example configuration @@ -62,19 +98,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) +{{< 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: + : + service: elasticsearch + endpoint: elasticsearch +``` + +{{< /codetabs >}} ### Add the Drupal modules diff --git a/sites/platform/src/guides/drupal/memcached.md b/sites/platform/src/guides/drupal/memcached.md index 8a50ea6f64..fe4e1e10d6 100644 --- a/sites/platform/src/guides/drupal/memcached.md +++ b/sites/platform/src/guides/drupal/memcached.md @@ -28,20 +28,26 @@ To define the service, use the `memcached`: 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 +### 2. Define 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: - : + : ``` -You can define `` as you like, so long as it's unique between all defined services +You can define `` 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. @@ -53,6 +59,36 @@ you can use [explicit endpoint configuration](/create-apps/app-reference/single- With the above definition, the application container now has access to the service via the relationship `` 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: + : + service: + endpoint: memcached +``` + +You can define ```` and ```` 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). + +{{< /codetabs >}} + For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} @@ -74,15 +110,41 @@ memcached: #### [App configuration](/create-apps) +{{< 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: - memcached: + memcached: ``` +<---> + ++++ +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: + memcached: + service: memcached + endpoint: memcached +``` + +{{< /codetabs >}} + ### Add the Drupal module You need to add the [Memcache](https://www.drupal.org/project/memcache) module to your project. diff --git a/sites/platform/src/guides/drupal/redis.md b/sites/platform/src/guides/drupal/redis.md index 86c78d3919..358301ef62 100644 --- a/sites/platform/src/guides/drupal/redis.md +++ b/sites/platform/src/guides/drupal/redis.md @@ -54,17 +54,23 @@ To define the service, use the `redis-persistent` endpoint: 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 +### 2. Define the relationship To define the relationship, use the `redis` endpoint : -```yaml {configFile="app"} +{{< 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: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -75,6 +81,36 @@ Depending on your needs, instead of default endpoint configuration, you can use With the above definition, the application container now has access to the service via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables#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: + : + service: + endpoint: redis +``` + +You can define ```` and ```` 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). + +{{< /codetabs >}} + For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} diff --git a/sites/platform/src/languages/elixir.md b/sites/platform/src/languages/elixir.md index bc4e0f018d..6bc5547b33 100644 --- a/sites/platform/src/languages/elixir.md +++ b/sites/platform/src/languages/elixir.md @@ -30,14 +30,16 @@ Patch versions are applied periodically for bug fixes and the like. When you dep {{% language-specification type="elixir" display_name="Elixir" %}} -```yaml {configFile="app"} -type: 'elixir:' +```yaml {configFile="apps"} +app: + type: 'elixir:' ``` For example: -```yaml {configFile="app"} -type: 'elixir:{{% latest "elixir" %}}' +```yaml {configFile="apps"} +app: + type: 'elixir:{{% latest "elixir" %}}' ``` ## Built-in variables @@ -155,11 +157,11 @@ Given a [relationship](/create-apps/app-reference/single-runtime-image#relations ```yaml {configFile="app"} # Relationships enable an app container's access to a service. -# The example below shows simplified configuration leveraging a default 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: - postgresql: + postgresql: ``` Assuming you have in `mix.exs` the Poison library to parse JSON: diff --git a/sites/platform/src/languages/ruby.md b/sites/platform/src/languages/ruby.md index 76110b8f4d..b597b5983c 100644 --- a/sites/platform/src/languages/ruby.md +++ b/sites/platform/src/languages/ruby.md @@ -35,14 +35,16 @@ Patch versions are applied periodically for bug fixes and the like. When you dep {{% language-specification type="ruby" display_name="Ruby" %}} -```yaml {configFile="app"} -type: 'ruby:' +```yaml {configFile="apps"} +app: + type: 'ruby:' ``` For example: -```yaml {configFile="app"} -type: 'ruby:{{% latest "ruby" %}}' +```yaml {configFile="apps"} +app: + type: 'ruby:{{% latest "ruby" %}}' ``` {{% deprecated-versions %}} @@ -59,8 +61,9 @@ A complete example is included at the end of this section. 1. Specify the language of your application (available versions are listed above): -```yaml {configFile="app"} -type: 'ruby:{{% latest "ruby" %}}' +```yaml {configFile="apps"} +app: + type: 'ruby:{{% latest "ruby" %}}' ``` 2. Setup environment variables. From 56684c5a4bbc0c70d50facc3e5ffa3b075499215 Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Thu, 8 Aug 2024 17:10:37 +0200 Subject: [PATCH 15/22] indentation for snippets on Upsun --- sites/upsun/src/add-services/_index.md | 150 ++-- sites/upsun/src/add-services/clickhouse.md | 264 +++---- sites/upsun/src/add-services/elasticsearch.md | 196 ++--- sites/upsun/src/add-services/gotenberg.md | 114 +-- .../upsun/src/add-services/headless-chrome.md | 184 ++--- sites/upsun/src/add-services/influxdb.md | 152 ++-- sites/upsun/src/add-services/kafka.md | 112 +-- sites/upsun/src/add-services/memcached.md | 278 +++---- sites/upsun/src/add-services/mongodb.md | 422 +++++------ sites/upsun/src/add-services/mysql/_index.md | 406 +++++----- .../add-services/mysql/mysql-replication.md | 62 +- .../src/add-services/mysql/troubleshoot.md | 24 +- .../upsun/src/add-services/network-storage.md | 329 ++++---- sites/upsun/src/add-services/opensearch.md | 204 ++--- sites/upsun/src/add-services/postgresql.md | 486 ++++++------ sites/upsun/src/add-services/rabbitmq.md | 208 ++--- sites/upsun/src/add-services/redis.md | 712 +++++++++--------- sites/upsun/src/add-services/solr.md | 406 +++++----- sites/upsun/src/add-services/varnish.md | 182 ++--- sites/upsun/src/add-services/vault.md | 88 +-- themes/psh-docs/layouts/partials/snippet.html | 14 +- 21 files changed, 2496 insertions(+), 2497 deletions(-) diff --git a/sites/upsun/src/add-services/_index.md b/sites/upsun/src/add-services/_index.md index c378315598..3c9c2ebadb 100644 --- a/sites/upsun/src/add-services/_index.md +++ b/sites/upsun/src/add-services/_index.md @@ -28,21 +28,21 @@ Configure your service in the following pattern: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. services: - : - type: : - # Other options... + : + type: : + # Other options... ``` An example service configuration for two databases might look like this: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - # The name of the service container. Must be unique within a project. - postgresql: - type: postgresql:{{% latest "postgresql" %}} + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` This YAML file contains a dictionary defining all of the services you want to use. @@ -97,15 +97,15 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -126,17 +126,17 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # Other options... - - # Relationships enable an app container's access to a 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. - relationships: - : - service: - endpoint: + # The name of the app container. Must be unique within a project. + : + # Other options... + + # Relationships enable an app container's access to a 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. + relationships: + : + service: + endpoint: ``` - `` is the name you want to give to the relationship. @@ -155,19 +155,19 @@ title=Using default endpoints ```yaml {configFile="apps"} applications: - # 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: - mariadb: - postgresql: + # 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: + mariadb: + postgresql: services: - mariadb: - type: mariadb:{{% latest "mariadb" %}} - postgresql: - type: postgresql:{{% latest "postgresql" %}} + mariadb: + type: mariadb:{{% latest "mariadb" %}} + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` <---> @@ -177,23 +177,23 @@ title=Using explicit endpoints +++ ```yaml {configFile="apps"} applications: - # 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. + # 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. - : - relationships: - database: - service: mariadb - endpoint: mysql - postgresql: - service: postgresql - endpoint: postgresql + : + relationships: + database: + service: mariadb + endpoint: mysql + postgresql: + service: postgresql + endpoint: postgresql services: - mariadb: - type: mariadb:{{% latest "mariadb" %}} - postgresql: - type: postgresql:{{% latest "postgresql" %}} + mariadb: + type: mariadb:{{% latest "mariadb" %}} + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` As with the service name, you can give the relationship any name you want @@ -268,25 +268,25 @@ You get output like the following: ```yaml mariadb: - - - username: user - scheme: mysql - service: mariadb - fragment: null - ip: 198.51.100.37 - hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}} - public: false - cluster: abcdefgh1234567-main-abcd123 - host: mariadb.internal - rel: mysql - query: - is_master: true - path: main - password: '' - type: 'mariadb:10.6' - port: 3306 - host_mapped: false - url: 'mysql://user:@mariadb.internal:3306/main' + - + username: user + scheme: mysql + service: mariadb + fragment: null + ip: 198.51.100.37 + hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}} + public: false + cluster: abcdefgh1234567-main-abcd123 + host: mariadb.internal + rel: mysql + query: + is_master: true + path: main + password: '' + type: 'mariadb:10.6' + port: 3306 + host_mapped: false + url: 'mysql://user:@mariadb.internal:3306/main' ``` With this example, you can connect to the `mariadb` relationship diff --git a/sites/upsun/src/add-services/clickhouse.md b/sites/upsun/src/add-services/clickhouse.md index 5e30a4e3e8..87630be1ab 100644 --- a/sites/upsun/src/add-services/clickhouse.md +++ b/sites/upsun/src/add-services/clickhouse.md @@ -73,26 +73,26 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": "main", - "fragment": null, - "ip": "123.456.78.90", - "cluster": "azertyuiop-main-afdwftq", - "host": "clickhouse.internal", - "path": "main", - "query": { - "is_master": true - }, - "password": "ChangeMe", - "port": 9000, - "host_mapped": false, - "service": "clickhouse", - "hostname": "azertyuiopqsdfghjklm.clickhouse.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "epoch": 0, - "rel": "clickhouse", - "scheme": "https", - "type": "clickhouse:24", - "public": false - } + "username": "main", + "fragment": null, + "ip": "123.456.78.90", + "cluster": "azertyuiop-main-afdwftq", + "host": "clickhouse.internal", + "path": "main", + "query": { + "is_master": true + }, + "password": "ChangeMe", + "port": 9000, + "host_mapped": false, + "service": "clickhouse", + "hostname": "azertyuiopqsdfghjklm.clickhouse.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "epoch": 0, + "rel": "clickhouse", + "scheme": "https", + "type": "clickhouse:24", + "public": false +} ``` Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) information in a [`.environment` file](/development/variables/set-variables.html#use-env-files): @@ -115,9 +115,9 @@ To define the service, use the `clickhouse` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: clickhouse: + # The name of the service container. Must be unique within a project. + : + type: clickhouse: ``` 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. @@ -141,14 +141,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define ```` as you like. <---> @@ -159,15 +159,15 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: clickhouse + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: clickhouse ``` You can define ```` and ```` as you like, but it's best if they're distinct. @@ -183,19 +183,19 @@ Use the following configuration: ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: clickhouse-http + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: clickhouse-http services: - # The name of the service container. Must be unique within a project. - : - type: clickhouse: + # The name of the service container. Must be unique within a project. + : + type: clickhouse: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -213,21 +213,21 @@ title= With ``clickhouse`` default endpoint ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # 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: - clickhouse: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + # 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: + clickhouse: services: - clickhouse: - # The name of the service container. Must be unique within a project. - type: clickhouse:24 + # The name of the service container. Must be unique within a project. + clickhouse: + type: clickhouse:24 ``` <---> @@ -238,22 +238,22 @@ title= With ``clickhouse`` explicit endpoint ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # 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. - relationships: - clickhouse: - service: clickhouse - endpoint: clickhouse + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + # 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. + relationships: + clickhouse: + service: clickhouse + endpoint: clickhouse services: - clickhouse: - # The name of the service container. Must be unique within a project. - type: clickhouse:24 + # The name of the service container. Must be unique within a project. + clickhouse: + type: clickhouse:24 ``` <---> @@ -264,22 +264,22 @@ title= With ``clickhouse-http`` endpoint ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # 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. - relationships: - clickhouse: - service: clickhouse - endpoint: clickhouse-http + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + # 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. + relationships: + clickhouse: + service: clickhouse + endpoint: clickhouse-http services: - # The name of the service container. Must be unique within a project. - clickhouse: - type: clickhouse:24 + # The name of the service container. Must be unique within a project. + clickhouse: + type: clickhouse:24 ``` If you want to change the ``clickhouse`` endpoint to ``clickhouse-http``, you need to use explicit endpoint definition as it defaults to ``clickhouse`` endpoint when using default endpoint (aka. {{% variable "SERVICE_NAME" %}} as relationship definition). @@ -294,41 +294,41 @@ To do so, you can use a configuration similar to the following: ```yaml {configFile="app"} # Complete list of all available properties: https://docs.upsun.com/create-apps/app-reference.html applications: - myapp: - # 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. - relationships: - clickhouse-admin: - service: clickhouse - endpoint: admin - clickhouse-reporter: - service: clickhouse - endpoint: reporter - clickhouse-importer: - service: clickhouse - endpoint: importer + app: + # 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. + relationships: + clickhouse-admin: + service: clickhouse + endpoint: admin + clickhouse-reporter: + service: clickhouse + endpoint: reporter + clickhouse-importer: + service: clickhouse + endpoint: importer services: - clickhouse: - type: clickhouse:24 - configuration: - databases: - - main - - legacy - endpoints: - admin: - port: 9000 # binary port - privileges: - main: admin - legacy: admin - reporter: - default_database: main - port: 8123 # http port - privileges: - main: ro - importer: - default_database: legacy - port: 9000 # binary port - privileges: - legacy: rw + clickhouse: + type: clickhouse:24 + configuration: + databases: + - main + - legacy + endpoints: + admin: + port: 9000 # binary port + privileges: + main: admin + legacy: admin + reporter: + default_database: main + port: 8123 # http port + privileges: + main: ro + importer: + default_database: legacy + port: 9000 # binary port + privileges: + legacy: rw ``` diff --git a/sites/upsun/src/add-services/elasticsearch.md b/sites/upsun/src/add-services/elasticsearch.md index 09265e5a5b..44843020d7 100644 --- a/sites/upsun/src/add-services/elasticsearch.md +++ b/sites/upsun/src/add-services/elasticsearch.md @@ -80,22 +80,22 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": null, - "scheme": "http", - "service": "elasticsearch", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 9200, - "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "elasticsearch.internal", - "rel": "elasticsearch", - "path": null, - "query": [], - "password": "ChangeMe", - "type": "elasticsearch:{{< latest "elasticsearch" >}}", - "public": false, - "host_mapped": false + "username": null, + "scheme": "http", + "service": "elasticsearch", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 9200, + "cluster": "azertyuiopqsdf-main-7rqtwti", + "host": "elasticsearch.internal", + "rel": "elasticsearch", + "path": null, + "query": [], + "password": "ChangeMe", + "type": "elasticsearch:{{< latest "elasticsearch" >}}", + "public": false, + "host_mapped": false } ``` @@ -122,9 +122,9 @@ To define the service, use the `elasticsearch` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: elasticsearch: + # The name of the service container. Must be unique within a project. + : + type: elasticsearch: ``` If you’re using a [premium version](/add-services/elasticsearch.md#supported-versions), use the ``elasticsearch-enterprise`` type instead. @@ -143,14 +143,14 @@ title=Using default endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -173,15 +173,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: elasticsearch + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: elasticsearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -206,14 +206,14 @@ title=Using default endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: + # The name of the app container. Must be unique within a project. + app: + # 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: services: # The name of the service container. Must be unique within a project. elasticsearch: @@ -230,19 +230,19 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - elasticsearch: - service: elasticsearch - endpoint: elasticsearch + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + elasticsearch: + service: elasticsearch + endpoint: elasticsearch services: - # The name of the service container. Must be unique within a project. - elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} + # The name of the service container. Must be unique within a project. + elasticsearch: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` If you’re using a [premium version](/add-services/elasticsearch.md#supported-versions), use the ``elasticsearch-enterprise`` type instead. @@ -263,20 +263,20 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # 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: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + # 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: services: - elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} + elasticsearch: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` @@ -287,30 +287,30 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - # 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. - relationships: - elasticsearch: - service: elasticsearch - endpoint: elasticsearch + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/myapp" + # 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. + relationships: + elasticsearch: + service: elasticsearch + endpoint: elasticsearch services: - elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} + elasticsearch: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `elasticsearch` service, via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `elasticsearch` service, via the corresponding [service environment variables](/development/variables/_index.md#service-environment-variables) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, `myapp` can retrieve access credentials to the service through the [relationship environment variable](/add-services/elasticsearch.md#relationship-reference). +From this, `app` can retrieve access credentials to the service through the [relationship environment variable](/add-services/elasticsearch.md#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials, @@ -352,10 +352,10 @@ To do so, include the following in your `{{< vendor/configfile "services" >}}` c ```yaml {configFile="services"} {{% snippet name="elasticsearch" config="service" %}} - type: elasticsearch:{{% latest "elasticsearch" %}} - configuration: - authentication: - enabled: true + type: elasticsearch:{{% latest "elasticsearch" %}} + configuration: + authentication: + enabled: true {{% /snippet %}} ``` @@ -380,10 +380,10 @@ For example: ```yaml {configFile="routes"} {{% snippet name="elasticsearch:elasticsearch" config="route" subDom="es" redirect="false" / %}} {{% snippet name="elasticsearch" config="service" placeholder="true" %}} - type: elasticsearch:{{% latest "elasticsearch" %}} - configuration: - authentication: - enabled: true + type: elasticsearch:{{% latest "elasticsearch" %}} + configuration: + authentication: + enabled: true {{% /snippet %}} ``` @@ -394,10 +394,10 @@ To enable them, list them under the `configuration.plugins` key in your `{{< ven ```yaml {configFile="services"} {{% snippet name="elasticsearch" config="service" %}} - type: elasticsearch:{{% latest "elasticsearch" %}} - configuration: - plugins: - - analysis-icu + type: elasticsearch:{{% latest "elasticsearch" %}} + configuration: + plugins: + - analysis-icu {{% /snippet %}} ``` diff --git a/sites/upsun/src/add-services/gotenberg.md b/sites/upsun/src/add-services/gotenberg.md index e193e63968..700219dd79 100644 --- a/sites/upsun/src/add-services/gotenberg.md +++ b/sites/upsun/src/add-services/gotenberg.md @@ -57,20 +57,20 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "host": "gotenberg.internal", - "hostname": "rssjaxyeoorjje6axcq35xu5gq.gotenberg.service._.eu-5.{{< vendor/urlraw "hostname" >}}", - "cluster": "p2f2xrzyq7a6k-main-bvxea6i", - "service": "gotenberg", - "rel": "http", - "scheme": "http", - "port": "3000", - "type": "gotenberg:8", - "instance_ips": [ - "249.45.240.83" - ], - "ip": "169.254.137.3", - "url": "http://gotenberg.internal:3000" - } + "host": "gotenberg.internal", + "hostname": "rssjaxyeoorjje6axcq35xu5gq.gotenberg.service._.eu-5.{{< vendor/urlraw "hostname" >}}", + "cluster": "p2f2xrzyq7a6k-main-bvxea6i", + "service": "gotenberg", + "rel": "http", + "scheme": "http", + "port": "3000", + "type": "gotenberg:8", + "instance_ips": [ + "249.45.240.83" + ], + "ip": "169.254.137.3", + "url": "http://gotenberg.internal:3000" +} ``` Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) information @@ -94,9 +94,9 @@ To define the service, use the `gotenberg` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: gotenberg: + # The name of the service container. Must be unique within a project. + : + type: gotenberg: ``` 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. @@ -113,14 +113,14 @@ title=Using default endpoints +++ ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. <---> @@ -131,15 +131,15 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: http + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships and matches in both the application and services configuration. @@ -160,18 +160,18 @@ title=Using default endpoints +++ ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - gotenberg: + # The name of the app container. Must be unique within a project. + app: + # 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: + gotenberg: services: - # The name of the service container. Must be unique within a project. - gotenberg: - type: gotenberg:8 + # The name of the service container. Must be unique within a project. + gotenberg: + type: gotenberg:8 ``` <---> @@ -182,19 +182,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - gotenberg: - service: gotenberg - endpoint: http + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + gotenberg: + service: gotenberg + endpoint: http services: - # The name of the service container. Must be unique within a project. - gotenberg: - type: gotenberg:8 + # The name of the service container. Must be unique within a project. + gotenberg: + type: gotenberg:8 ``` {{< /codetabs >}} diff --git a/sites/upsun/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md index 29ffa1832c..bc06fdbed7 100644 --- a/sites/upsun/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -60,15 +60,15 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "service": "chrome-headless", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.chrome-headless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiop-main-7rqtwti", - "host": "chrome-headless.internal", - "rel": "http", - "scheme": "http", - "type": "chrome-headless:{{< latest "chrome-headless" >}}", - "port": 9222 + "service": "chrome-headless", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.chrome-headless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiop-main-7rqtwti", + "host": "chrome-headless.internal", + "rel": "http", + "scheme": "http", + "type": "chrome-headless:{{< latest "chrome-headless" >}}", + "port": 9222 } ``` @@ -99,9 +99,9 @@ To define the service, use the `chrome-headless` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: chrome-headless: + # The name of the service container. Must be unique within a project. + : + type: chrome-headless: ``` 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. @@ -118,14 +118,14 @@ title=Using default endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -148,15 +148,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: http + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -181,18 +181,18 @@ title=Using default endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - chrome-headless: + # The name of the app container. Must be unique within a project. + app: + # 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: + chrome-headless: services: - # The name of the service container. Must be unique within a project. - chrome-headless: - type: chrome-headless:{{% latest "chrome-headless" %}} + # The name of the service container. Must be unique within a project. + chrome-headless: + type: chrome-headless:{{% latest "chrome-headless" %}} ``` <---> @@ -203,19 +203,19 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - chrome-headless: - service: chrome-headless - endpoint: http + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + chrome-headless: + service: chrome-headless + endpoint: http services: - # The name of the service container. Must be unique within a project. - chrome-headless: - type: chrome-headless:{{% latest "chrome-headless" %}} + # The name of the service container. Must be unique within a project. + chrome-headless: + type: chrome-headless:{{% latest "chrome-headless" %}} ``` {{< /codetabs >}} @@ -268,25 +268,25 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - type: "nodejs:{{% latest "nodejs" %}}" - - [...] - - # 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: - chrome-headless: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + type: "nodejs:{{% latest "nodejs" %}}" + + [...] + + # 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: + chrome-headless: services: - # The name of the service container. Must be unique within a project. - chrome-headless: - type: chrome-headless:{{% latest "chrome-headless" %}} + # The name of the service container. Must be unique within a project. + chrome-headless: + type: chrome-headless:{{% latest "chrome-headless" %}} ``` <---> @@ -297,36 +297,36 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - type: "nodejs:{{% latest "nodejs" %}}" - - [...] - - # 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. - relationships: - chrome-headless: - service: chrome-headless - endpoint: http + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + type: "nodejs:{{% latest "nodejs" %}}" + + [...] + + # 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. + relationships: + chrome-headless: + service: chrome-headless + endpoint: http services: - # The name of the service container. Must be unique within a project. - chrome-headless: - type: chrome-headless:{{% latest "chrome-headless" %}} + # The name of the service container. Must be unique within a project. + chrome-headless: + type: chrome-headless:{{% latest "chrome-headless" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `chromeheadless` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `chrome-headless` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, `myapp` can retrieve access credentials to the service through the [relationship environment variable](/add-services/elasticsearch.md#relationship-reference). +From this, `app` can retrieve access credentials to the service through the [relationship environment variable](/add-services/elasticsearch.md#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials, diff --git a/sites/upsun/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md index a5fbc665e0..3e8fbd2bf3 100644 --- a/sites/upsun/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -139,14 +139,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -169,15 +169,15 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: influxdb + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: influxdb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -202,18 +202,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - influxdb: + # The name of the app container. Must be unique within a project. + app: + # 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: + influxdb: services: - # The name of the service container. Must be unique within a project. - influxdb: - type: influxdb:{{% latest "influxdb" %}} + # The name of the service container. Must be unique within a project. + influxdb: + type: influxdb:{{% latest "influxdb" %}} ``` <---> @@ -224,19 +224,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - influxdb: - service: influxdb - endpoint: influxdb + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + influxdb: + service: influxdb + endpoint: influxdb services: - # The name of the service container. Must be unique within a project. - influxdb: - type: influxdb:{{% latest "influxdb" %}} + # The name of the service container. Must be unique within a project. + influxdb: + type: influxdb:{{% latest "influxdb" %}} ``` {{< /codetabs >}} @@ -254,23 +254,23 @@ title=Using default endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - [...] - - # 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: - influxdb: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + + [...] + + # 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: + influxdb: service: - influxdb: - type: influxdb:{{% latest "influxdb" %}} + influxdb: + type: influxdb:{{% latest "influxdb" %}} ``` <---> @@ -281,33 +281,33 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - [...] - - # 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. - relationships: - influxdb: - service: influxdb - endpoint: influxdb + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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. + relationships: + influxdb: + service: influxdb + endpoint: influxdb service: - influxdb: - type: influxdb:{{% latest "influxdb" %}} + influxdb: + type: influxdb:{{% latest "influxdb" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). +From this, ``app`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for common InfluxDB credentials. diff --git a/sites/upsun/src/add-services/kafka.md b/sites/upsun/src/add-services/kafka.md index 437ea93698..a966bd6306 100644 --- a/sites/upsun/src/add-services/kafka.md +++ b/sites/upsun/src/add-services/kafka.md @@ -60,15 +60,15 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "service": "kafka", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiop-main-7rqtwti", - "host": "kafka.internal", - "rel": "kafka", - "scheme": "kafka", - "type": "kafka:{{< latest "kafka" >}}", - "port": 9092 + "service": "kafka", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiop-main-7rqtwti", + "host": "kafka.internal", + "rel": "kafka", + "scheme": "kafka", + "type": "kafka:{{< latest "kafka" >}}", + "port": 9092 } ``` @@ -92,9 +92,9 @@ To define the service, use the ``kafka`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: kafka: + # The name of the service container. Must be unique within a project. + : + type: kafka: ``` 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. @@ -109,16 +109,16 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="services"} +```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -139,17 +139,17 @@ With the above definition, the application container (````) now has [a title=Using explicit endpoints +++ -```yaml {configFile="services"} +```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: kafka + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: kafka ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -172,20 +172,20 @@ With the above definition, the application container now has [access to the serv title=Using default endpoints +++ -```yaml {configFile="services"} +```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - kafka: + # The name of the app container. Must be unique within a project. + app: + # 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: + kafka: services: - # The name of the service container. Must be unique within a project. - kafka: - type: kafka:{{% latest "kafka" %}} + # The name of the service container. Must be unique within a project. + kafka: + type: kafka:{{% latest "kafka" %}} ``` <---> @@ -194,21 +194,21 @@ services: title=Using explicit endpoints +++ -```yaml {configFile="services"} +```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - kafka: - service: kafka - endpoint: kafka + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + kafka: + service: kafka + endpoint: kafka services: - # The name of the service container. Must be unique within a project. - kafka: - type: kafka:{{% latest "kafka" %}} + # The name of the service container. Must be unique within a project. + kafka: + type: kafka:{{% latest "kafka" %}} ``` {{< /codetabs >}} diff --git a/sites/upsun/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md index 70f8fe9e67..8dd7a7a3f2 100644 --- a/sites/upsun/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -62,15 +62,15 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "service": "memcached", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "memcached.internal", - "rel": "memcached", - "scheme": "memcached", - "type": "memcached:{{% latest "memcached" %}}", - "port": 11211 + "service": "memcached", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "memcached.internal", + "rel": "memcached", + "scheme": "memcached", + "type": "memcached:{{% latest "memcached" %}}", + "port": 11211 } ``` @@ -94,9 +94,9 @@ To define the service, use the ``memcached`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: memcached: + # The name of the service container. Must be unique within a project. + : + type: memcached: ``` 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. @@ -112,14 +112,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -139,13 +139,13 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : ":memcached" + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : ":memcached" ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -170,18 +170,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - memcached - # 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: - : + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - memcached + # 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: + : ``` <---> @@ -192,17 +192,17 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - memcached - # 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. - relationships: - : ":memcached" + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - memcached + # 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. + relationships: + : ":memcached" ``` {{< /codetabs >}} @@ -216,18 +216,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # Build dependencies per runtime. - dependencies: - python: - python-memcached: '*' - # 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: - : + # The name of the app container. Must be unique within a project. + : + # Build dependencies per runtime. + dependencies: + python: + python-memcached: '*' + # 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: + : ``` <---> @@ -239,17 +239,17 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # Build dependencies per runtime. - dependencies: - python: - python-memcached: '*' - # 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. - relationships: - : ":memcached" + # The name of the app container. Must be unique within a project. + : + # Build dependencies per runtime. + dependencies: + python: + python-memcached: '*' + # 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. + relationships: + : ":memcached" ``` {{< /codetabs >}} @@ -263,21 +263,21 @@ applications: title=Using default endpoints +++ -```yaml {configFile="services"} +```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - memcached: + # The name of the app container. Must be unique within a project. + app: + # 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: + memcached: services: - # The name of the service container. Must be unique within a project. - memcached: - type: memcached:{{% latest "memcached" %}} + # The name of the service container. Must be unique within a project. + memcached: + type: memcached:{{% latest "memcached" %}} ``` <---> @@ -288,18 +288,18 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - memcached: "memcached:memcached" + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + memcached: "memcached:memcached" services: - # The name of the service container. Must be unique within a project. - memcached: - type: memcached:{{% latest "memcached" %}} + # The name of the service container. Must be unique within a project. + memcached: + type: memcached:{{% latest "memcached" %}} ``` {{< /codetabs >}} @@ -316,28 +316,28 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - # PHP extensions. - runtime: - extensions: - - memcached - - [...] - - # 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: - memcached: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + + # PHP extensions. + runtime: + extensions: + - memcached + + [...] + + # 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: + memcached: service: - memcached: - type: memcached:{{% latest "memcached" %}} + memcached: + type: memcached:{{% latest "memcached" %}} ``` <---> @@ -348,34 +348,34 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - # PHP extensions. - runtime: - extensions: - - memcached - - [...] - - # Relationships enable access from this app to a given service. - # See the Application reference for all options for defining relationships and endpoints. - relationships: - memcached: - service: memcached - endpoint: memcached + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + + # PHP extensions. + runtime: + extensions: + - memcached + + [...] + + # Relationships enable access from this app to a given service. + # See the Application reference for all options for defining relationships and endpoints. + relationships: + memcached: + service: memcached + endpoint: memcached service: - memcached: - type: memcached:{{% latest "memcached" %}} + memcached: + type: memcached:{{% latest "memcached" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index c8be69f39b..b2994a1b0c 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -84,21 +84,21 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": "main", - "scheme": "mongodb", - "service": "mongodb", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiop-main-7rqtwti", - "host": "mongodb.internal", - "rel": "mongodb", - "query": { - "is_master": true - }, - "path": "main", - "password": null, - "type": "mongodb-enterprise:{{% latest "mongodb-enterprise" %}}", - "port": 27017 + "username": "main", + "scheme": "mongodb", + "service": "mongodb", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiop-main-7rqtwti", + "host": "mongodb.internal", + "rel": "mongodb", + "query": { + "is_master": true + }, + "path": "main", + "password": null, + "type": "mongodb-enterprise:{{% latest "mongodb-enterprise" %}}", + "port": 27017 } ``` @@ -122,11 +122,11 @@ export APP_MONGODBDATABASE_HOST="$(echo $RELATIONSHIPS_JSON | jq -r '.mongodb[0] To define the service, use the ``mongodb-enterprise`` type: -```yaml {configFile="apps"} +```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: mongodb-enterprise: + # The name of the service container. Must be unique within a project. + : + type: mongodb-enterprise: ``` 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. @@ -140,16 +140,16 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -172,15 +172,15 @@ title=Using explicit endpoints ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: mongodb + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -205,18 +205,18 @@ title=Using default endpoints ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - mongodb - # 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: - : + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + : ``` <---> @@ -227,19 +227,19 @@ title=Using explicit endpoints ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - mongodb - # 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. - relationships: - : - service: - endpoint: mongodb + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - mongodb + # 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. + relationships: + : + service: + endpoint: mongodb ``` {{< /codetabs >}} @@ -254,22 +254,22 @@ title=Using default endpoints ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # PHP extensions. - runtime: - extensions: - - mongodb - # 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: - mongodb-enterprise: + # The name of the app container. Must be unique within a project. + app: + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + mongodb-enterprise: services: - # The name of the service container. Must be unique within a project. - mongodb-enterprise: - type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} + # The name of the service container. Must be unique within a project. + mongodb-enterprise: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` <---> @@ -280,23 +280,23 @@ title=Using explicit endpoints ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # PHP extensions. - runtime: - extensions: - - mongodb - # 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. - relationships: - mongodb-enterprise: - service: mongodb-enterprise - endpoint: mongodb + # The name of the app container. Must be unique within a project. + app: + # PHP extensions. + runtime: + extensions: + - mongodb + # 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. + relationships: + mongodb-enterprise: + service: mongodb-enterprise + endpoint: mongodb services: - # The name of the service container. Must be unique within a project. - mongodb-enterprise: - type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} + # The name of the service container. Must be unique within a project. + mongodb-enterprise: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` {{< /codetabs >}} @@ -309,9 +309,9 @@ To define the service, use the ``mongodb`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: mongodb: + # The name of the service container. Must be unique within a project. + : + type: mongodb: ``` 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. @@ -328,14 +328,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -358,15 +358,15 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: mongodb + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -391,18 +391,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - mongodb - # 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: - : + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + : ``` <---> @@ -413,19 +413,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - mongodb - # 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. - relationships: - : - service: - endpoint: mongodb + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - mongodb + # 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. + relationships: + : + service: + endpoint: mongodb ``` {{< /codetabs >}} @@ -440,22 +440,22 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # PHP extensions. - runtime: - extensions: - - mongodb - # 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: - mongodb: + # The name of the app container. Must be unique within a project. + app: + # PHP extensions. + runtime: + extensions: + - mongodb + # 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: + mongodb: services: - # The name of the service container. Must be unique within a project. - mongodb: - type: mongodb:4.0.3 + # The name of the service container. Must be unique within a project. + mongodb: + type: mongodb:4.0.3 ``` <---> @@ -466,23 +466,23 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # PHP extensions. - runtime: - extensions: - - mongodb - # 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. - relationships: - mongodb: - service: mongodb - endpoint: mongodb + # The name of the app container. Must be unique within a project. + app: + # PHP extensions. + runtime: + extensions: + - mongodb + # 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. + relationships: + mongodb: + service: mongodb + endpoint: mongodb services: - # The name of the service container. Must be unique within a project. - mongodb: - type: mongodb:4.0.3 + # The name of the service container. Must be unique within a project. + mongodb: + type: mongodb:4.0.3 ``` {{< /codetabs >}} @@ -500,27 +500,27 @@ title=Using default endpoints ```yaml {configFile="app"} applications: # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - # PHP extensions. - runtime: - extensions: - - mongodb - - [...] - - # 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: - mongodb: + app: + # The location of the application's code. + source: + root: "/" + + # PHP extensions. + runtime: + extensions: + - mongodb + + [...] + + # 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: + mongodb: service: - mongodb: - type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} + mongodb: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` <---> @@ -531,29 +531,29 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - # PHP extensions. - runtime: - extensions: - - mongodb - - [...] - - # 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. - relationships: - mongodb: - service: mongodb - endpoint: mongodb + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + + # PHP extensions. + runtime: + extensions: + - mongodb + + [...] + + # 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. + relationships: + mongodb: + service: mongodb + endpoint: mongodb service: - mongodb: - type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} + mongodb: + type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}} ``` {{< /codetabs >}} diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index b13a2bdc70..2566389ffa 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -115,24 +115,24 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": "user", - "scheme": "mysql", - "service": "mariadb", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.mariadb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 3306, - "cluster": "azertyuiop-main-7rqtwti", - "host": "mariadb.internal", - "rel": "mysql", - "path": "main", - "query": { - "is_master": true - }, - "password": "", - "type": "mariadb:{{% latest "mariadb" %}}", - "public": false, - "host_mapped": false + "username": "user", + "scheme": "mysql", + "service": "mariadb", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.mariadb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 3306, + "cluster": "azertyuiop-main-7rqtwti", + "host": "mariadb.internal", + "rel": "mysql", + "path": "main", + "query": { + "is_master": true + }, + "password": "", + "type": "mariadb:{{% latest "mariadb" %}}", + "public": false, + "host_mapped": false } ``` @@ -190,24 +190,24 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": "user", - "scheme": "mysql", - "service": "oracle-mysql", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.oracle-mysql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 3306, - "cluster": "azertyuiop-main-afdwftq", - "host": "oracle_mysql.internal", - "rel": "mysql", - "path": "main", - "query": { - "is_master": true - }, - "password": "", - "type": "oracle-mysql:{{< latest "oracle-mysql" >}}", - "public": false, - "host_mapped": false + "username": "user", + "scheme": "mysql", + "service": "oracle-mysql", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.oracle-mysql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 3306, + "cluster": "azertyuiop-main-afdwftq", + "host": "oracle_mysql.internal", + "rel": "mysql", + "path": "main", + "query": { + "is_master": true + }, + "password": "", + "type": "oracle-mysql:{{< latest "oracle-mysql" >}}", + "public": false, + "host_mapped": false } ``` @@ -233,9 +233,9 @@ To define the service, use the ``mariadb`` or ``mysql`` type for MariaDB or the ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: mariadb: + # The name of the service container. Must be unique within a project. + : + type: mariadb: ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -253,14 +253,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -281,15 +281,15 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: mysql + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: mysql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -314,18 +314,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - mariadb: + # The name of the app container. Must be unique within a project. + app: + # 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: + mariadb: services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} ``` <---> @@ -336,19 +336,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - mariadb: - service: mariadb - endpoint: mysql + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + mariadb: + service: mariadb + endpoint: mysql services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} +# The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} ``` {{< /codetabs >}} @@ -363,15 +363,15 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - relationships: - oracle-mysql: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + relationships: + oracle-mysql: service: - # The name of the service container. Must be unique within a project. - oracle-mysql: - type: oracle-mysql:{{% latest "oracle-mysql" %}} + # The name of the service container. Must be unique within a project. + oracle-mysql: + type: oracle-mysql:{{% latest "oracle-mysql" %}} ``` <---> @@ -382,19 +382,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - oracle-mysql: - service: oracle-mysql_service - endpoint: mysql + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + oracle-mysql: + service: oracle-mysql_service + endpoint: mysql service: - # The name of the service container. Must be unique within a project. - oracle-mysql_service: - type: oracle-mysql:{{% latest "oracle-mysql" %}} + # The name of the service container. Must be unique within a project. + oracle-mysql_service: + type: oracle-mysql:{{% latest "oracle-mysql" %}} ``` {{< /codetabs >}} @@ -412,20 +412,20 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" - [...] + [...] - # Relationships enable an app container's access to a service. - relationships: - mariadb: + # Relationships enable an app container's access to a service. + relationships: + mariadb: service: - mariadb: - type: mariadb:{{% latest "mariadb" %}} + mariadb: + type: mariadb:{{% latest "mariadb" %}} ``` <---> @@ -436,34 +436,34 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "/" - - [...] - - # 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. - relationships: - mariadb: - service: mariadb - endpoint: mysql + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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. + relationships: + mariadb: + service: mariadb + endpoint: mysql service: - mariadb: - type: mariadb:{{% latest "mariadb" %}} + mariadb: + type: mariadb:{{% latest "mariadb" %}} ``` {{< /codetabs >}} -This configuration defines a single application (``myapp``), whose source code exists in the ``/myapp`` directory. -``myapp`` has access to the ``mariadb`` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (``app``), whose source code exists in the ``/myapp`` directory. +``app`` has access to the ``mariadb`` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image.md#relationships) configuration for relationships). -From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). +From this, ``app`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. @@ -521,19 +521,19 @@ Example configuration: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - mysql: - default_schema: main - privileges: - main: admin - properties: - max_allowed_packet: 64 + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + mysql: + default_schema: main + privileges: + main: admin + properties: + max_allowed_packet: 64 ``` ## Access the service directly @@ -591,17 +591,17 @@ If neither `schemas` nor `endpoints` is included, it's equivalent to the followi ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - mysql: - default_schema: main - privileges: - main: admin + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + mysql: + default_schema: main + privileges: + main: admin ``` If either `schemas` or `endpoints` are defined, no default is applied and you have to specify the full configuration. @@ -624,53 +624,53 @@ Access to the database is defined through three endpoints: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - - legacy - endpoints: - admin: - default_schema: main - privileges: - main: admin - legacy: admin - reporter: - privileges: - main: ro - importer: - default_schema: legacy - privileges: - legacy: rw + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + - legacy + endpoints: + admin: + default_schema: main + privileges: + main: admin + legacy: admin + reporter: + privileges: + main: ro + importer: + default_schema: legacy + privileges: + legacy: rw ``` Expose these endpoints to your app as relationships in your [app configuration](../../create-apps/_index.md): ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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. - relationships: - database: - service: mariadb - endpoint: admin - reports: - service: mariadb - endpoint: reporter - imports: - service: mariadb - endpoint: importer + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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. + relationships: + database: + service: mariadb + endpoint: admin + reports: + service: mariadb + endpoint: reporter + imports: + service: mariadb + endpoint: importer ``` These relationships are then available in the [service environment variables](#relationship-reference). @@ -701,14 +701,14 @@ An example of setting these properties: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - properties: - max_allowed_packet: 64 - default_charset: utf8mb4 - default_collation: utf8mb4_unicode_ci + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + properties: + max_allowed_packet: 64 + default_charset: utf8mb4 + default_collation: utf8mb4_unicode_ci ``` You can also change a table's character set and collation through `ALTER TABLE` commands: diff --git a/sites/upsun/src/add-services/mysql/mysql-replication.md b/sites/upsun/src/add-services/mysql/mysql-replication.md index 28ebec9469..3c66da3f96 100644 --- a/sites/upsun/src/add-services/mysql/mysql-replication.md +++ b/sites/upsun/src/add-services/mysql/mysql-replication.md @@ -19,21 +19,21 @@ For each database that you'd like to replicate, you need to assign a `replicatio ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - schemas: - - main - endpoints: - # Restate the default user to be used by your application. - mysql: - default_schema: main - privileges: - main: admin - replicator: - privileges: - main: replication + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + schemas: + - main + endpoints: + # Restate the default user to be used by your application. + mysql: + default_schema: main + privileges: + main: admin + replicator: + privileges: + main: replication ``` This creates a `replicator` user, and grants read-only and table locking rights on the `main` database (namely `Select_priv`, `Show_view_priv`, `Create_tmp_table_priv`, `Lock_tables_priv` privileges) along with global replication rights (namely `Repl_slave_priv` and `Repl_client_priv` privileges) and flushing rights (`Reload_priv` used for flushing before reading the binary log position). If there is at least one `replication` permission defined, the bin-logging is enabled on the primary server, which is essential for the replication. @@ -45,22 +45,22 @@ Add a new relationship to your application container: ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # Relationships enable an app container's access to a service. - relationships: - database: - service: mariadb - endpoint: mysql - replication: - service: mariadb - endpoint: replicator + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "/" + + [...] + + # Relationships enable an app container's access to a service. + relationships: + database: + service: mariadb + endpoint: mysql + replication: + service: mariadb + endpoint: replicator ``` diff --git a/sites/upsun/src/add-services/mysql/troubleshoot.md b/sites/upsun/src/add-services/mysql/troubleshoot.md index 86edf0ae5f..c91cc8c04e 100644 --- a/sites/upsun/src/add-services/mysql/troubleshoot.md +++ b/sites/upsun/src/add-services/mysql/troubleshoot.md @@ -102,12 +102,12 @@ Given the following services configuration for MariaDB: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - properties: - max_allowed_packet: 16 + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + properties: + max_allowed_packet: 16 ``` And assuming you have set the resources for that service using the following CLI command: @@ -132,12 +132,12 @@ The default value of `16` is shown below to illustrate: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - mariadb: - type: mariadb:{{% latest "mariadb" %}} - configuration: - properties: - max_allowed_packet: 16 + # The name of the service container. Must be unique within a project. + mariadb: + type: mariadb:{{% latest "mariadb" %}} + configuration: + properties: + max_allowed_packet: 16 ``` 1. **The memory available to the service**: Resources are provisioned to {{% vendor/name %}} containers according to your definition via the API, often through the `resources:set` CLI command: diff --git a/sites/upsun/src/add-services/network-storage.md b/sites/upsun/src/add-services/network-storage.md index ac22898ad5..a04704e9a1 100644 --- a/sites/upsun/src/add-services/network-storage.md +++ b/sites/upsun/src/add-services/network-storage.md @@ -38,9 +38,9 @@ To define the service, use the ``network-storage`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: network-storage: + # The name of the service container. Must be unique within a project. + : + type: network-storage: ``` `` must be [RFC 1123](https://tools.ietf.org/html/rfc1123) compliant, and as such it must: @@ -61,18 +61,18 @@ To define the mount accessible by your application, use the following configurat ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - mounts: - : - source: service - service: - source_path: + # The name of the app container. Must be unique within a project. + : + mounts: + : + source: service + service: + source_path: services: - # The name of the service container. Must be unique within a project. - : - type: network-storage: + # The name of the service container. Must be unique within a project. + : + type: network-storage: ``` - `` is the path to your mount within the app container (relative to the app’s root). @@ -86,18 +86,18 @@ services: ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - myapp: - mounts: - 'my/files': - source: service - service: network-storage - source_path: files + # The name of the app container. Must be unique within a project. + app: + mounts: + 'my/files': + source: service + service: network-storage + source_path: files services: - # The name of the service container. Must be unique within a project. - network-storage: - type: network-storage:{{% latest "network-storage" %}} + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} ``` ## Multi-application usage @@ -114,53 +114,53 @@ For example: ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - app1: - # The location of the application's code. - source: - root: "app1" - - [...] - - mounts: - # The path to your mount within the app container (relative to the app's root). - 'web/uploads': - # Specifies that the mount points to a network storage service that can be shared between apps. - source: service - # The name of the network storage service the mount points to. - service: network-storage - # Specifies where your mount points inside the external directory that is mounted to your app container. - source_path: uploads - - # The name of the app container. Must be unique within a project. - app2: - # The location of the application's code. - source: - root: "app2" - - [...] - - mounts: - # The path to your mount within the app container (relative to the app's root). - 'process': - # Specifies that the mount points to a network storage service that can be shared between apps. - source: service - # The name of the network storage service the mount points to. - service: network-storage - # Specifies where your mount points inside the external directory that is mounted to your app container. - # Since the target is the uploads directory app1's mount already points to, - # the network storage service is effectively shared between app1 and app2. - source_path: uploads/incoming - # The path to your mount within the app container (relative to the app's root). - 'done': - # Specifies that the mount points to a network storage service that can be shared between apps. - source: service - # The name of the network storage service the mount points to. - service: network-storage - # Specifies where your mount points inside the external directory that is mounted to your app container. - # Since the target is the uploads directory app1's mount already points to, - # the network storage service is effectively shared between app1 and app2. - source_path: uploads/done + # The name of the app container. Must be unique within a project. + app1: + # The location of the application's code. + source: + root: "app1" + + [...] + + mounts: + # The path to your mount within the app container (relative to the app's root). + 'web/uploads': + # Specifies that the mount points to a network storage service that can be shared between apps. + source: service + # The name of the network storage service the mount points to. + service: network-storage + # Specifies where your mount points inside the external directory that is mounted to your app container. + source_path: uploads + + # The name of the app container. Must be unique within a project. + app2: + # The location of the application's code. + source: + root: "app2" + + [...] + + mounts: + # The path to your mount within the app container (relative to the app's root). + 'process': + # Specifies that the mount points to a network storage service that can be shared between apps. + source: service + # The name of the network storage service the mount points to. + service: network-storage + # Specifies where your mount points inside the external directory that is mounted to your app container. + # Since the target is the uploads directory app1's mount already points to, + # the network storage service is effectively shared between app1 and app2. + source_path: uploads/incoming + # The path to your mount within the app container (relative to the app's root). + 'done': + # Specifies that the mount points to a network storage service that can be shared between apps. + source: service + # The name of the network storage service the mount points to. + service: network-storage + # Specifies where your mount points inside the external directory that is mounted to your app container. + # Since the target is the uploads directory app1's mount already points to, + # the network storage service is effectively shared between app1 and app2. + source_path: uploads/done ``` In this example, `app1` has access to the entire `uploads` directory by writing to `web/uploads`. @@ -179,59 +179,58 @@ while the Drush backup directory is unique to the `web` instance. ```yaml {configFile="app"} applications: - myapp: - - source: - root: "/" - - type: "php:{{% latest "php" %}}" - - [...] - - mounts: - # The public and private files directories are - # network mounts shared by web and workers. - 'web/sites/default/files': - source: service - service: files - source_path: files - 'private': - source: service - service: files - source_path: private - # The backup, temp, and cache directories for - # Drupal's CLI tools don't need to be shared between web and workers. - # It wouldn't hurt anything to make them network - # shares, however. - '/.drush': - source: storage - source_path: drush - 'tmp': - source: tmp - source_path: tmp - 'drush-backups': - source: storage - source_path: drush-backups - '/.console': - source: storage - source_path: console - - # Crons run on the web container, so they have the - # same mounts as the web container. - crons: - drupal: - spec: '*/20 * * * *' - commands: - start: 'cd web ; drush core-cron' - - # The worker defined here also has the same 6 mounts; - # 2 of them are shared with the web container, - # the other 4 are local to the worker. - workers: - queue: - commands: - start: | - cd web && drush queue-run myqueue + app: + source: + root: "/" + + type: "php:{{% latest "php" %}}" + + [...] + + mounts: + # The public and private files directories are + # network mounts shared by web and workers. + 'web/sites/default/files': + source: service + service: files + source_path: files + 'private': + source: service + service: files + source_path: private + # The backup, temp, and cache directories for + # Drupal's CLI tools don't need to be shared between web and workers. + # It wouldn't hurt anything to make them network + # shares, however. + '/.drush': + source: storage + source_path: drush + 'tmp': + source: tmp + source_path: tmp + 'drush-backups': + source: storage + source_path: drush-backups + '/.console': + source: storage + source_path: console + + # Crons run on the web container, so they have the + # same mounts as the web container. + crons: + drupal: + spec: '*/20 * * * *' + commands: + start: 'cd web ; drush core-cron' + + # The worker defined here also has the same 6 mounts; + # 2 of them are shared with the web container, + # the other 4 are local to the worker. + workers: + queue: + commands: + start: | + cd web && drush queue-run myqueue ``` ## How can I migrate data from a `storage` mount to a `service` mount? @@ -244,33 +243,33 @@ Assuming you have the following `storage` mount: ```yaml {configFile="app"} applications: - myapp: + app: - [...] + [...] - mounts: - web/uploads: - source: storage - source_path: uploads + mounts: + web/uploads: + source: storage + source_path: uploads ``` 1. Add a new `network-storage` service to your configuration: - ```yaml {configFile="services"} + ```yaml {configFile="app"} applications: - myapp: + myapp: - [...] + [...] - mounts: - web/uploads: - source: storage - source_path: uploads + mounts: + web/uploads: + source: storage + source_path: uploads services: - # The name of the service container. Must be unique within a project. - network-storage: - type: network-storage:{{% latest "network-storage" %}} + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} ``` {{< note >}} @@ -284,23 +283,23 @@ applications: ```yaml {configFile="services"} applications: - myapp: + myapp: - [...] + [...] - mounts: - web/uploads: - source: storage - source_path: uploads - new-uploads: - source: service - service: network-storage - source_path: uploads + mounts: + web/uploads: + source: storage + source_path: uploads + new-uploads: + source: service + service: network-storage + source_path: uploads services: - # The name of the service container. Must be unique within a project. - network-storage: - type: network-storage:{{% latest "network-storage" %}} + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} ``` Note that each mount is on a different storage service, which is why they can have the same `source_path`. @@ -318,23 +317,23 @@ applications: ```yaml {configFile="services"} applications: - myapp: + myapp: - [...] + [...] - mounts: - old-uploads: - source: storage - source_path: uploads - web/uploads: - source: service - service: network-storage - source_path: uploads + mounts: + old-uploads: + source: storage + source_path: uploads + web/uploads: + source: service + service: network-storage + source_path: uploads services: - # The name of the service container. Must be unique within a project. - network-storage: - type: network-storage:{{% latest "network-storage" %}} + # The name of the service container. Must be unique within a project. + network-storage: + type: network-storage:{{% latest "network-storage" %}} ``` 6. Push your changes and check that the files are now accessible from the `service` mount (now named `web/uploads`). diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index e1661ddca3..24134e43ff 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -122,9 +122,9 @@ To define the service, use the ``opensearch`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: opensearch: + # The name of the service container. Must be unique within a project. + : + type: opensearch: ``` 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. @@ -141,14 +141,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -171,15 +171,15 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: opensearch + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: opensearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -204,18 +204,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - opensearch: + # The name of the app container. Must be unique within a project. + app: + # 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: + opensearch: services: - # The name of the service container. Must be unique within a project. - opensearch: - type: opensearch:{{% latest "opensearch" %}} + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} ``` <---> @@ -226,19 +226,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - opensearch: - service: opensearch - endpoint: opensearch + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + opensearch: + service: opensearch + endpoint: opensearch services: - # The name of the service container. Must be unique within a project. - opensearch: - type: opensearch:{{% latest "opensearch" %}} + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} ``` {{< /codetabs >}} @@ -255,24 +255,24 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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: - opensearch: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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: + opensearch: services: - # The name of the service container. Must be unique within a project. - opensearch: - type: opensearch:{{% latest "opensearch" %}} + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} ``` <---> @@ -283,31 +283,31 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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. - relationships: - opensearch: - service: opensearch - endpoint: opensearch + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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. + relationships: + opensearch: + service: opensearch + endpoint: opensearch services: - # The name of the service container. Must be unique within a project. - opensearch: - type: opensearch:{{% latest "opensearch" %}} + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). @@ -351,12 +351,12 @@ To do so, include the following in your `{{< vendor/configfile "services" >}}` c ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - opensearch: - type: opensearch:{{% latest "opensearch" %}} - configuration: - authentication: - enabled: true + # The name of the service container. Must be unique within a project. + opensearch: + type: opensearch:{{% latest "opensearch" %}} + configuration: + authentication: + enabled: true ``` That enables mandatory HTTP Basic auth on all requests. @@ -375,19 +375,19 @@ For example: ```yaml {configFile="routes"} routes: - "https://www.os.{default}/": - type: redirect - to: "https://os.{default}/" - "https://os.{default}/": - type: upstream - upstream: "opensearch:opensearch" + "https://www.os.{default}/": + type: redirect + to: "https://os.{default}/" + "https://os.{default}/": + type: upstream + upstream: "opensearch:opensearch" services: - # The name of the service container. Must be unique within a project. - opensearch: - configuration: - authentication: - enabled: true + # The name of the service container. Must be unique within a project. + opensearch: + configuration: + authentication: + enabled: true ``` ## Plugins @@ -397,11 +397,11 @@ To enable them, list them under the `configuration.plugins` key in your `{{< ven ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - opensearch: - configuration: - plugins: - - analysis-icu + # The name of the service container. Must be unique within a project. + opensearch: + configuration: + plugins: + - analysis-icu ``` In this example you'd have the ICU analysis plugin and the size mapper plugin. diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index e3fe5f57ba..10abc87fca 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -76,24 +76,24 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": "main", - "scheme": "pgsql", - "service": "postgresql", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 5432, - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "postgresql.internal", - "rel": "postgresql", - "path": "main", - "query": { - "is_master": true - }, - "password": "ChangeMe", - "type": "postgresql:{{% latest "postgresql" %}}", - "public": false, - "host_mapped": false + "username": "main", + "scheme": "pgsql", + "service": "postgresql", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 5432, + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "postgresql.internal", + "rel": "postgresql", + "path": "main", + "query": { + "is_master": true + }, + "password": "ChangeMe", + "type": "postgresql:{{% latest "postgresql" %}}", + "public": false, + "host_mapped": false } ``` @@ -117,9 +117,9 @@ To define the service, use the ``postgresql`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: postgresql: + # The name of the service container. Must be unique within a project. + : + type: postgresql: ``` 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. @@ -136,14 +136,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -166,15 +166,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: postgresql + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: postgresql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -197,20 +197,20 @@ For PHP, enable the [extension](/languages/php/extensions) for the service: title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - pdo_pgsql - # 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: - : + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + # 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: + : ``` <---> @@ -219,21 +219,21 @@ applications: title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - pdo_pgsql - # 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. - relationships: - : - service: - endpoint: postgresql + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + # 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. + relationships: + : + service: + endpoint: postgresql ``` {{< /codetabs >}} @@ -248,22 +248,22 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # PHP extensions. - runtime: - extensions: - - pdo_pgsql - # 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: - postgresql: + # The name of the app container. Must be unique within a project. + app: + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + # 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: + postgresql: services: - # The name of the service container. Must be unique within a project. - postgresql: - type: postgresql:{{% latest "postgresql" %}} + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` <---> @@ -274,23 +274,23 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # PHP extensions. - runtime: - extensions: - - pdo_pgsql - # 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. - relationships: - postgresql: - service: postgresql - endpoint: postgresql + # The name of the app container. Must be unique within a project. + app: + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + # 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. + relationships: + postgresql: + service: postgresql + endpoint: postgresql services: - # The name of the service container. Must be unique within a project. - postgresql: - type: postgresql:{{% latest "postgresql" %}} + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` {{< /codetabs >}} @@ -307,29 +307,29 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - # PHP extensions. - runtime: - extensions: - - pdo_pgsql - - [...] - - # 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: - postgresql: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + + [...] + + # 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: + postgresql: services: - # The name of the service container. Must be unique within a project. - postgresql: - type: postgresql:{{% latest "postgresql" %}} + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` <---> @@ -340,39 +340,39 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - # PHP extensions. - runtime: - extensions: - - pdo_pgsql - - [...] - - # 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. - relationships: - postgresql: - service: postgresql - endpoint: postgresql + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + # PHP extensions. + runtime: + extensions: + - pdo_pgsql + + [...] + + # 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. + relationships: + postgresql: + service: postgresql + endpoint: postgresql services: - # The name of the service container. Must be unique within a project. - postgresql: - type: postgresql:{{% latest "postgresql" %}} + # The name of the service container. Must be unique within a project. + postgresql: + type: postgresql:{{% latest "postgresql" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `postgresql` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `postgresql` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). +From this, ``app`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. @@ -496,26 +496,26 @@ Consider the following illustrative example: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro - importer: - default_database: legacy - privileges: - legacy: rw + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro + importer: + default_database: legacy + privileges: + legacy: rw ``` This example creates a single PostgreSQL service named `postgresql`. The server has two databases, `main` and `legacy` with three endpoints created. @@ -530,49 +530,49 @@ Once these endpoints are defined, you need to expose them to your application as ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - - source: - root: "/" - - [...] - - # 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. - relationships: - database: - service: postgresql - endpoint: admin - reports: - service: postgresql - endpoint: reporter - imports: - service: postgresql - endpoint: importer + # The name of the app container. Must be unique within a project. + app: + + source: + root: "/" + + [...] + + # 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. + relationships: + database: + service: postgresql + endpoint: admin + reports: + service: postgresql + endpoint: reporter + imports: + service: postgresql + endpoint: importer services: - # The name of the service container. Must be unique within a project. - postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - - legacy - endpoints: - admin: - privileges: - main: admin - legacy: admin - reporter: - default_database: main - privileges: - main: ro - importer: - default_database: legacy - privileges: - legacy: rw + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + - legacy + endpoints: + admin: + privileges: + main: admin + legacy: admin + reporter: + default_database: main + privileges: + main: ro + importer: + default_database: legacy + privileges: + legacy: rw ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. @@ -582,49 +582,49 @@ A service configuration without the `configuration` block defined is equivalent ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - endpoints: - postgresql: - default_database: main - privileges: - main: admin + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + endpoints: + postgresql: + default_database: main + privileges: + main: admin ``` If you do not define `database` but `endpoints` are defined, then the single database `main` is created with the following assumed configuration: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - main - endpoints: + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - main + endpoints: ``` Alternatively, if you define multiple databases but no endpoints, a single user `main` is created with `admin` access to each of your databases, equivalent to the configuration below: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - databases: - - firstdb - - seconddb - - thirddb - endpoints: - main: - firstdb: admin - seconddb: admin - thirddb: admin + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + databases: + - firstdb + - seconddb + - thirddb + endpoints: + main: + firstdb: admin + seconddb: admin + thirddb: admin ``` ## Password generation @@ -661,13 +661,13 @@ To change the timezone for the current session, run `SET TIME ZONE {{< variable ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - postgresql: - type: "postgresql:{{% latest "postgresql" %}}" - configuration: - extensions: - - pg_trgm - - hstore + # The name of the service container. Must be unique within a project. + postgresql: + type: "postgresql:{{% latest "postgresql" %}}" + configuration: + extensions: + - pg_trgm + - hstore ``` In this case, you have `pg_trgm` installed, providing functions to determine the similarity of text based on trigram matching, and `hstore` providing a key-value store. diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index b55f8219de..a945662841 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -72,22 +72,22 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": "guest", - "scheme": "amqp", - "service": "rabbitmq", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.rabbitmq.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 5672, - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "rabbitmq.internal", - "rel": "rabbitmq", - "path": null, - "query": [], - "password": "ChangeMe", - "type": "rabbitmq:{{% latest "rabbitmq" %}}", - "public": false, - "host_mapped": false + "username": "guest", + "scheme": "amqp", + "service": "rabbitmq", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.rabbitmq.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 5672, + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "rabbitmq.internal", + "rel": "rabbitmq", + "path": null, + "query": [], + "password": "ChangeMe", + "type": "rabbitmq:{{% latest "rabbitmq" %}}", + "public": false, + "host_mapped": false } ``` @@ -111,9 +111,9 @@ To define the service, use the ``rabbitmq`` type: ```yaml {configFile="app"} services: - # The name of the service container. Must be unique within a project. - : - type: rabbitmq: + # The name of the service container. Must be unique within a project. + : + type: rabbitmq: ``` 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. @@ -130,14 +130,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -160,15 +160,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: rabbitmq + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: rabbitmq ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -193,18 +193,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - rabbitmq: + # The name of the app container. Must be unique within a project. + app: + # Relati: services: - # The name of the service container. Must be unique within a project. - rabbitmq: - type: rabbitmq:{{% latest "rabbitmq" %}} + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} ``` <---> @@ -215,19 +215,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - rabbitmq: - service: rabbitmq - endpoint: rabbitmq + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + rabbitmq: + service: rabbitmq + endpoint: rabbitmq services: - # The name of the service container. Must be unique within a project. - rabbitmq: - type: rabbitmq:{{% latest "rabbitmq" %}} + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} ``` {{< /codetabs >}} @@ -244,24 +244,24 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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: - rabbitmq: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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: + rabbitmq: services: - # The name of the service container. Must be unique within a project. - rabbitmq: - type: rabbitmq:{{% latest "rabbitmq" %}} + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} ``` <---> @@ -272,33 +272,33 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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. - relationships: - rabbitmq: - service: rabbitmq - endpoint: rabbitmq + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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. + relationships: + rabbitmq: + service: rabbitmq + endpoint: rabbitmq services: - # The name of the service container. Must be unique within a project. - rabbitmq: - type: rabbitmq:{{% latest "rabbitmq" %}} + # The name of the service container. Must be unique within a project. + rabbitmq: + type: rabbitmq:{{% latest "rabbitmq" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `rabbitmq` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `rabbitmq` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). +From this, ``app`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. @@ -378,13 +378,13 @@ To create virtual hosts, add them to your configuration as in the following exam ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - rabbitmq: - type: "rabbitmq:{{% latest "rabbitmq" %}}" - configuration: - vhosts: - - host1 - - host2 + # The name of the service container. Must be unique within a project. + rabbitmq: + type: "rabbitmq:{{% latest "rabbitmq" %}}" + configuration: + vhosts: + - host1 + - host2 ``` ## Upgrading diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index 171089b273..6192297c91 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -81,22 +81,22 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": null, - "scheme": "redis", - "service": "redis", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 6379, - "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "redis.internal", - "rel": "redis", - "path": null, - "query": [], - "password": null, - "type": "redis:{{% latest "redis" %}}", - "public": false, - "host_mapped": false + "username": null, + "scheme": "redis", + "service": "redis", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.redis.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 6379, + "cluster": "azertyuiopqsdf-main-7rqtwti", + "host": "redis.internal", + "rel": "redis", + "path": null, + "query": [], + "password": null, + "type": "redis:{{% latest "redis" %}}", + "public": false, + "host_mapped": false } ``` @@ -152,9 +152,9 @@ To define the service, use the `redis-persistent` endpoint: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - : - type: redis-persistent: + # The name of the service container. Must be unique within a project. + : + type: redis-persistent: ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -172,14 +172,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -198,15 +198,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: redis + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -231,18 +231,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - redis - # 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: - : + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - redis + # 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: + : ``` <---> @@ -253,19 +253,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # PHP extensions. - runtime: - extensions: - - redis - # 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. - relationships: - : - service: - endpoint: redis + # The name of the app container. Must be unique within a project. + : + # PHP extensions. + runtime: + extensions: + - redis + # 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. + relationships: + : + service: + endpoint: redis ``` {{< /codetabs >}} @@ -280,28 +280,28 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - - # 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: - redis: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # 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: + redis: services: # The name of the service container. Must be unique within a project. redis: - type: redis-persistent:{{% latest "redis" %}} + type: redis-persistent:{{% latest "redis" %}} ``` <---> @@ -312,29 +312,29 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - - # 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. - relationships: - redis: - service: redis - endpoint: redis + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # 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. + relationships: + redis: + service: redis + endpoint: redis services: - # The name of the service container. Must be unique within a project. - redis: - type: redis-persistent:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis-persistent:{{% latest "redis" %}} ``` {{< /codetabs >}} @@ -351,28 +351,28 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - # PHP extensions. - runtime: - extensions: - - redis - - [...] - - # 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: - redis: + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + # PHP extensions. + runtime: + extensions: + - redis + + [...] + + # 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: + redis: services: - # The name of the service container. Must be unique within a project. - redis: - type: redis-persistent:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis-persistent:{{% latest "redis" %}} ``` <---> @@ -382,29 +382,29 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - # PHP extensions. - runtime: - extensions: - - redis - - [...] - - # 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. - relationships: - redis: - service: redis - endpoint: redis + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + # PHP extensions. + runtime: + extensions: + - redis + + [...] + + # 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. + relationships: + redis: + service: redis + endpoint: redis services: - # The name of the service container. Must be unique within a project. - redis: - type: redis-persistent:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis-persistent:{{% latest "redis" %}} ``` {{< /codetabs >}} @@ -459,9 +459,9 @@ To define the service, use the `redis` endpoint: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - : - type: redis: + # The name of the service container. Must be unique within a project. + : + type: redis: ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -479,14 +479,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -505,15 +505,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: redis + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -538,28 +538,28 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - - # 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: - : + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # 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: + : services: - # The name of the service container. Must be unique within a project. - : - type: redis: + # The name of the service container. Must be unique within a project. + : + type: redis: ``` <---> @@ -570,29 +570,29 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - - # 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. - relationships: - : - service: - endpoint: redis + # The name of the app container. Must be unique within a project. + : + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # 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. + relationships: + : + service: + endpoint: redis services: - # The name of the service container. Must be unique within a project. - : - type: redis: + # The name of the service container. Must be unique within a project. + : + type: redis: ``` {{< /codetabs >}} @@ -607,28 +607,28 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - - # 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: - redis: + # The name of the app container. Must be unique within a project. + app: + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # 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: + redis: services: - # The name of the service container. Must be unique within a project. - redis: - type: redis:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} ``` <---> @@ -639,29 +639,29 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - - # 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. - relationships: - redis: - service: redis - endpoint: redis + # The name of the app container. Must be unique within a project. + app: + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + + # 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. + relationships: + redis: + service: redis + endpoint: redis services: - # The name of the service container. Must be unique within a project. - redis: - type: redis:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} ``` {{< /codetabs >}} @@ -678,27 +678,27 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - # 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: - redis: + # The name of the app container. Must be unique within a project. + app: + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + # 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: + redis: services: - # The name of the service container. Must be unique within a project. - redis: - type: redis:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} ``` <---> @@ -708,37 +708,37 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - source: - root: "myapp" - - [...] - - # PHP extensions. - runtime: - extensions: - - redis - # 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. - relationships: - redis: - service: redis - endpoint: redis + # The name of the app container. Must be unique within a project. + app: + source: + root: "myapp" + + [...] + + # PHP extensions. + runtime: + extensions: + - redis + # 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. + relationships: + redis: + service: redis + endpoint: redis services: - # The name of the service container. Must be unique within a project. - redis: - type: redis:{{% latest "redis" %}} + # The name of the service container. Must be unique within a project. + redis: + type: redis:{{% latest "redis" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). +From this, ``app`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. @@ -837,11 +837,11 @@ To customize those cache cleanups, set up an eviction policy such as the followi ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - redis: - type: "redis:{{% latest "redis" %}}" - configuration: - maxmemory_policy: allkeys-lfu + # The name of the service container. Must be unique within a project. + redis: + type: "redis:{{% latest "redis" %}}" + configuration: + maxmemory_policy: allkeys-lfu ``` The following table presents the possible values: @@ -913,36 +913,36 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - source: - root: "myapp" + # The name of the app container. Must be unique within a project. + app: + source: + root: "myapp" - type: "php:{{% latest "php" %}}" + type: "php:{{% latest "php" %}}" - # PHP extensions. - runtime: - extensions: - - redis + # PHP extensions. + runtime: + extensions: + - redis - relationships: - redissession: + relationships: + redissession: - variables: - php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" + variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" - web: - locations: - '/': - root: 'web' - passthru: '/index.php' + web: + locations: + '/': + root: 'web' + passthru: '/index.php' services: - # The name of the service container. Must be unique within a project. - redissession: - type: "redis-persistent:{{% latest "redis" %}}" + # The name of the service container. Must be unique within a project. + redissession: + type: "redis-persistent:{{% latest "redis" %}}" ``` <---> @@ -953,41 +953,41 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - source: - root: "myapp" - - type: "php:{{% latest "php" %}}" - - # PHP extensions. - runtime: - extensions: - - redis - - # 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. - relationships: - redissession: - service: redissession - endpoint: redis - - variables: - php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" - - web: - locations: - '/': - root: 'web' - passthru: '/index.php' + # The name of the app container. Must be unique within a project. + app: + source: + root: "myapp" + + type: "php:{{% latest "php" %}}" + + # PHP extensions. + runtime: + extensions: + - redis + + # 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. + relationships: + redissession: + service: redissession + endpoint: redis + + variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "$SESSIONSTORAGE_HOSTNAME" >}}:{{< variable "$SESSIONSTORAGE_PORT" >}}" + + web: + locations: + '/': + root: 'web' + passthru: '/index.php' services: - # The name of the service container. Must be unique within a project. - redissession: - type: "redis-persistent:{{% latest "redis" %}}" + # The name of the service container. Must be unique within a project. + redissession: + type: "redis-persistent:{{% latest "redis" %}}" ``` {{< /codetabs >}} diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index 681709faad..3947d0704b 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -70,22 +70,22 @@ The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtain ```json { - "username": null, - "scheme": "solr", - "service": "solr", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 8080, - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "solr.internal", - "rel": "solr", - "path": "solr\/collection1", - "query": [], - "password": null, - "type": "solr:{{% latest "solr" %}}", - "public": false, - "host_mapped": false + "username": null, + "scheme": "solr", + "service": "solr", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 8080, + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "solr.internal", + "rel": "solr", + "path": "solr\/collection1", + "query": [], + "password": null, + "type": "solr:{{% latest "solr" %}}", + "public": false, + "host_mapped": false } ``` @@ -128,14 +128,14 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - : - # 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: - : + # The name of the app container. Must be unique within a project. + : + # 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -158,15 +158,15 @@ title=Using explicit endpoints ```yaml {configFile="services"} applications: - # The name of the app container. Must be unique within a project. - : - # 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. - relationships: - : - service: - endpoint: solr + # The name of the app container. Must be unique within a project. + : + # 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. + relationships: + : + service: + endpoint: solr ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -191,18 +191,18 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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: - solr: + # The name of the app container. Must be unique within a project. + app: + # 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: + solr: services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} ``` <---> @@ -213,19 +213,19 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # 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. - relationships: - solr: - service: solr - endpoint: solr + # The name of the app container. Must be unique within a project. + app: + # 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. + relationships: + solr: + service: solr + endpoint: solr services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} ``` {{< /codetabs >}} @@ -243,24 +243,24 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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: - solr: + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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: + solr: services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} ``` <---> @@ -271,34 +271,34 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - # The location of the application's code. - source: - root: "myapp" - - [...] - - # 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. - relationships: - solr: - service: solr - endpoint: solr + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "myapp" + + [...] + + # 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. + relationships: + solr: + service: solr + endpoint: solr services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} ``` {{< /codetabs >}} -This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `solr` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +This configuration defines a single application (`app`), whose source code exists in the `/myapp` directory.
+`app` has access to the `solr` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). -From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). +From this, ``app`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). ```bash {location="myapp/.environment"} # Set environment variables for individual credentials. @@ -329,11 +329,11 @@ You must provide your own Solr configuration via a `core_config` key in your `{{ ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - solr: - type: "solr:4.10" - configuration: - core_config: !archive "{{< variable "DIRECTORY" >}}" + # The name of the service container. Must be unique within a project. + solr: + type: "solr:4.10" + configuration: + core_config: !archive "{{< variable "DIRECTORY" >}}" ``` {{< variable "DIRECTORY" >}} points to a directory in the Git repository, in or below the `{{< vendor/configdir >}}/` folder. This directory needs to contain everything that Solr needs to start a core. At the minimum, `solrconfig.xml` and `schema.xml`. @@ -342,11 +342,11 @@ For example, place them in `{{< vendor/configdir >}}/solr/conf/` such that the ` ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - solr: - type: "solr:4.10" - configuration: - core_config: !archive "solr/conf/" + # The name of the service container. Must be unique within a project. + solr: + type: "solr:4.10" + configuration: + core_config: !archive "solr/conf/" ``` ## Solr 6 and later @@ -355,20 +355,20 @@ For Solr 6 and later {{% vendor/name %}} supports multiple cores via different e ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} - configuration: - cores: - mainindex: - conf_dir: !archive "core1-conf" - extraindex: - conf_dir: !archive "core2-conf" - endpoints: - main: - core: mainindex - extra: - core: extraindex + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + cores: + mainindex: + conf_dir: !archive "core1-conf" + extraindex: + conf_dir: !archive "core2-conf" + endpoints: + main: + core: mainindex + extra: + core: extraindex ``` The above definition defines a single Solr {{% latest "solr" %}} server. That server has 2 cores defined: @@ -382,42 +382,42 @@ Each endpoint is then available in the relationships definition in `{{< vendor/c ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: + # The name of the app container. Must be unique within a project. + app: - type: "php:{{% latest "php" %}}" + type: "php:{{% latest "php" %}}" - source: - root: "myapp" + source: + root: "myapp" - [...] + [...] - # 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. - relationships: - solrsearch1: - service: solr - endpoint: main - solrsearch2: - service: solr - endpoint: extra + # 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. + relationships: + solrsearch1: + service: solr + endpoint: main + solrsearch2: + service: solr + endpoint: extra services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} - configuration: - cores: - mainindex: - conf_dir: !archive "core1-conf" - extraindex: - conf_dir: !archive "core2-conf" - endpoints: - main: - core: mainindex - extra: - core: extraindex + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + cores: + mainindex: + conf_dir: !archive "core1-conf" + extraindex: + conf_dir: !archive "core2-conf" + endpoints: + main: + core: mainindex + extra: + core: extraindex ``` That is, the application's environment would include a `solrsearch1` relationship that connects to the `main` endpoint, which is the `mainindex` core, and a `solrsearch2` relationship that connects to the `extra` endpoint, which is the `extraindex` core. @@ -426,22 +426,22 @@ The relationships array would then look something like the following: ```json { - "solrsearch1": [ - { - "path": "solr/mainindex", - "host": "248.0.65.197", - "scheme": "solr", - "port": 8080 - } - ], - "solrsearch2": [ - { - "path": "solr/extraindex", - "host": "248.0.65.197", - "scheme": "solr", - "port": 8080 - } - ] + "solrsearch1": [ + { + "path": "solr/mainindex", + "host": "248.0.65.197", + "scheme": "solr", + "port": 8080 + } + ], + "solrsearch2": [ + { + "path": "solr/extraindex", + "host": "248.0.65.197", + "scheme": "solr", + "port": 8080 + } + ] } ``` @@ -451,26 +451,26 @@ For even more customizability, it's also possible to define Solr configsets. For ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} - configuration: - configsets: - mainconfig: !archive "configsets/solr8" - cores: - english_index: - core_properties: | - configSet=mainconfig - schema=english/schema.xml - arabic_index: - core_properties: | - configSet=mainconfig - schema=arabic/schema.xml - endpoints: - english: - core: english_index - arabic: - core: arabic_index + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + configsets: + mainconfig: !archive "configsets/solr8" + cores: + english_index: + core_properties: | + configSet=mainconfig + schema=english/schema.xml + arabic_index: + core_properties: | + configSet=mainconfig + schema=arabic/schema.xml + endpoints: + english: + core: english_index + arabic: + core: arabic_index ``` In this example, `{{< vendor/configdir >}}/configsets/solr8` contains the configuration definition for multiple cores. There are then two cores created: @@ -490,16 +490,16 @@ If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:{{% latest "solr" %}} - configuration: - cores: - collection1: - conf_dir: !archive "example" - endpoints: - solr: - core: collection1 + # The name of the service container. Must be unique within a project. + solr: + type: solr:{{% latest "solr" %}} + configuration: + cores: + collection1: + conf_dir: !archive "example" + endpoints: + solr: + core: collection1 ``` The example configuration directory is equivalent to the [Solr example configuration set](https://github.com/apache/solr/tree/main/solr/server/solr/configsets/sample_techproducts_configs/conf). @@ -512,15 +512,15 @@ If you don't specify any configuration, the following default is used: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - solr: - type: solr:8.4 - configuration: - cores: - collection1: {} - endpoints: - solr: - core: collection1 + # The name of the service container. Must be unique within a project. + solr: + type: solr:8.4 + configuration: + cores: + collection1: {} + endpoints: + solr: + core: collection1 ``` The default configuration is based on an older version of the Drupal 8 Search API Solr module that is no longer in use. diff --git a/sites/upsun/src/add-services/varnish.md b/sites/upsun/src/add-services/varnish.md index 3cade24b6e..0e06deed13 100644 --- a/sites/upsun/src/add-services/varnish.md +++ b/sites/upsun/src/add-services/varnish.md @@ -38,15 +38,15 @@ To define the service, use the `varnish` type: ```yaml {configFile="services"} services: - # The name of the service container. Must be unique within a project. - : - type: varnish: - relationships: - : ':http' - configuration: - vcl: !include - type: string - path: config.vcl + # The name of the service container. Must be unique within a project. + : + type: varnish: + relationships: + : ':http' + configuration: + vcl: !include + type: string + path: config.vcl ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -64,22 +64,22 @@ The `path` defines the file relative to the `{{< vendor/configdir >}}` directory ```yaml {configFile="services"} applications: # The name of the app container. Must be unique within a project. - myapp: + app: ... services: - # The name of the service container. Must be unique within a project. - varnish: - type: varnish:{{% latest "varnish" %}} - relationships: - application: 'myapp:http' - configuration: - vcl: !include - type: string - path: config.vcl + # The name of the service container. Must be unique within a project. + varnish: + type: varnish:{{% latest "varnish" %}} + relationships: + application: 'app:http' + configuration: + vcl: !include + type: string + path: config.vcl ``` -Notice the `relationship` (`application`) defined for the service `varnish` granting access to the application container `myapp`. +Notice the `relationship` (`application`) defined for the service `varnish` granting access to the application container `app`. ### 2. Create a VCL template @@ -142,47 +142,47 @@ For example, you might have the following configuration for two apps: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. services: - varnish: - type: varnish:{{% latest "varnish" %}} - relationships: - blog: - service: blog - endpoint: http - main: - service: app - endpoint: http - configuration: - vcl: !include - type: string - path: config.vcl + varnish: + type: varnish:{{% latest "varnish" %}} + relationships: + blog: + service: blog + endpoint: http + main: + service: app + endpoint: http + configuration: + vcl: !include + type: string + path: config.vcl applications: - # The name of the app container. Must be unique within a project. - blog: - # The location of the application's code. - source: - root: "backends/blog" - # The type of the application to build. - type: "php:{{% latest "php" %}}" - - # The name of the app container. Must be unique within a project. - app: - # The location of the application's code. - source: - root: "backends/main" - # The type of the application to build. - type: "nodejs:{{% latest "php" %}}" + # The name of the app container. Must be unique within a project. + blog: + # The location of the application's code. + source: + root: "backends/blog" + # The type of the application to build. + type: "php:{{% latest "php" %}}" + + # The name of the app container. Must be unique within a project. + app: + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "php" %}}" ``` You could then define that all requests to `/blog/` go to the `blog` app and all other requests to the other app: ```bash {location="config.vcl" dir="true"} sub vcl_recv { - if (req.url ~ "^/blog/") { - set req.backend_hint = blog.backend(); - } else { - set req.backend_hint = main.backend(); - } + if (req.url ~ "^/blog/") { + set req.backend_hint = blog.backend(); + } else { + set req.backend_hint = main.backend(); + } } ``` @@ -195,11 +195,11 @@ To forward all incoming requests to Varnish rather than your app, you could have ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "varnish:http" - cache: - enabled: false + "https://{default}/": + type: upstream + upstream: "varnish:http" + cache: + enabled: false ``` Varnish forwards requests to your app based on the specified VCL template. @@ -319,41 +319,41 @@ Define [app configuration](/create-apps/app-reference/single-runtime-image.md) s ```yaml {configFile="apps"} applications: - # The name of the app container. Must be unique within a project. - stats-app: - # The location of the application's code. - source: - root: "stats" - # The type of the application to build. - type: "python:{{% latest "python" %}}" - # Unique relationship _to_ Varnish from 'stats-app', where no relationship - # is defined _from_ Varnish to the same app, to avoid circular relationships. - relationships: - varnishstats: - service: varnish - endpoint: http+stats - # The name of the app container. Must be unique within a project. - main-app: - # The location of the application's code. - source: - root: "backends/main" - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" + # The name of the app container. Must be unique within a project. + stats-app: + # The location of the application's code. + source: + root: "stats" + # The type of the application to build. + type: "python:{{% latest "python" %}}" + # Unique relationship _to_ Varnish from 'stats-app', where no relationship + # is defined _from_ Varnish to the same app, to avoid circular relationships. + relationships: + varnishstats: + service: varnish + endpoint: http+stats + # The name of the app container. Must be unique within a project. + main-app: + # The location of the application's code. + source: + root: "backends/main" + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" services: - # The name of the service container. Must be unique within a project. - varnish: - type: varnish:{{% latest "varnish" %}} - # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship - # is defined _to_ Varnish to the same app, to avoid circular relationships. - relationships: - main: - service: "main-app" - endpoint: "http - configuration: - vcl: !include - type: string - path: config.vcl + # The name of the service container. Must be unique within a project. + varnish: + type: varnish:{{% latest "varnish" %}} + # Unique relationship _from_ Varnish _to_ 'main-app', where no relationship + # is defined _to_ Varnish to the same app, to avoid circular relationships. + relationships: + main: + service: "main-app" + endpoint: "http + configuration: + vcl: !include + type: string + path: config.vcl ``` diff --git a/sites/upsun/src/add-services/vault.md b/sites/upsun/src/add-services/vault.md index 6b29ba1412..4c611a9b58 100644 --- a/sites/upsun/src/add-services/vault.md +++ b/sites/upsun/src/add-services/vault.md @@ -189,60 +189,60 @@ If you split the service into multiple endpoints, define multiple relationships. ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - relationships: - vault_secret: "vault-kms:manage_keys" + # The name of the app container. Must be unique within a project. + app: + relationships: + vault_secret: "vault-kms:manage_keys" services: - # The name of the service container. Must be unique within a project. - vault-kms: - type: vault-kms:1.12 - configuration: - endpoints: - manage_keys: - - policy: admin - key: vault-sign - type: sign - - policy: sign - key: vault-sign - type: sign - - policy: verify - key: vault-sign - type: sign + # The name of the service container. Must be unique within a project. + vault-kms: + type: vault-kms:1.12 + configuration: + endpoints: + manage_keys: + - policy: admin + key: vault-sign + type: sign + - policy: sign + key: vault-sign + type: sign + - policy: verify + key: vault-sign + type: sign ``` ## Multiple endpoints example ```yaml {configFile="app"} applications: - # The name of the app container. Must be unique within a project. - myapp: - relationships: - vault_manage: - service: vault-kms - endpoint: management - vault_sign: - service: vault-kms - endpoint: sign_and_verify + # The name of the app container. Must be unique within a project. + app: + relationships: + vault_manage: + service: vault-kms + endpoint: management + vault_sign: + service: vault-kms + endpoint: sign_and_verify services: - # The name of the service container. Must be unique within a project. - vault-kms: - type: vault-kms:1.12 - configuration: - endpoints: - management: - - policy: admin - key: admin-key - type: sign - sign_and_verify: - - policy: sign - key: signing-key - type: sign - - policy: verify - key: signing-key - type: sign + # The name of the service container. Must be unique within a project. + vault-kms: + type: vault-kms:1.12 + configuration: + endpoints: + management: + - policy: admin + key: admin-key + type: sign + sign_and_verify: + - policy: sign + key: signing-key + type: sign + - policy: verify + key: signing-key + type: sign ``` ## Use Vault KMS diff --git a/themes/psh-docs/layouts/partials/snippet.html b/themes/psh-docs/layouts/partials/snippet.html index 90fe56a56d..572d1f0a2c 100644 --- a/themes/psh-docs/layouts/partials/snippet.html +++ b/themes/psh-docs/layouts/partials/snippet.html @@ -147,11 +147,11 @@ {{- end -}} {{- if and (eq $placeholder "true") (not .Inner) -}} - {{- $prepend = printf "# %s# %s" $servicesKey "..." -}} + {{- $prepend = printf "# %s# %s" $servicesKey "..." -}} {{- else -}} - {{- $prepend = printf "%s %s\n %s:" $servicesKey $servNameComment $name -}} + {{- $prepend = printf "%s %s\n %s:" $servicesKey $servNameComment $name -}} {{- range split (trim .Inner "\n") "\n" -}} - {{- $content = printf "%s\n %s" $content . -}} + {{- $content = printf "%s\n %s" $content . -}} {{- end -}} {{- end -}} @@ -176,15 +176,15 @@ {{- end -}} {{- if and (eq $placeholder "true") (not .Inner) -}} - {{- $prepend = printf "# %s# %s" $routesKey "..." -}} + {{- $prepend = printf "# %s# %s" $routesKey "..." -}} {{- else -}} {{- $prepend = printf "%s" $routesKey -}} {{- if ne $redirect "false" -}} - {{- $prepend = printf "%s \"https://www.%s{default}/%s\":\n type: redirect\n to: \"https://%s{default}/%s\"\n" $prepend $subDom $subDir $subDom $subDir }} + {{- $prepend = printf "%s \"https://www.%s{default}/%s\":\n type: redirect\n to: \"https://%s{default}/%s\"\n" $prepend $subDom $subDir $subDom $subDir }} {{- end -}} - {{- $prepend = printf "%s \"https://%s{default}/%s\":\n type: upstream\n upstream: \"%s\"" $prepend $subDom $subDir $name }} + {{- $prepend = printf "%s \"https://%s{default}/%s\":\n type: upstream\n upstream: \"%s\"" $prepend $subDom $subDir $name }} {{- range split (trim .Inner "\n") "\n" -}} - {{- $content = printf "%s\n %s" $content . -}} + {{- $content = printf "%s\n %s" $content . -}} {{- end -}} {{- end -}} From 4ff0653c309f00dc337216197aa6f8db0592bc3c Mon Sep 17 00:00:00 2001 From: Florent Huck Date: Fri, 9 Aug 2024 10:38:53 +0200 Subject: [PATCH 16/22] P.sh remove promotion of .platform/applications.yaml --> .platform.app.yaml --- sites/platform/src/add-services/_index.md | 84 +++---- .../src/add-services/elasticsearch.md | 108 ++++---- sites/platform/src/add-services/gotenberg.md | 92 +++---- .../src/add-services/headless-chrome.md | 114 ++++----- sites/platform/src/add-services/influxdb.md | 116 ++++----- sites/platform/src/add-services/kafka.md | 94 +++---- sites/platform/src/add-services/memcached.md | 94 +++---- sites/platform/src/add-services/mongodb.md | 206 ++++++++-------- .../platform/src/add-services/mysql/_index.md | 232 +++++++++--------- .../add-services/mysql/mysql-replication.md | 30 +-- .../src/add-services/network-storage.md | 78 +++--- sites/platform/src/add-services/opensearch.md | 128 +++++----- sites/platform/src/add-services/postgresql.md | 179 +++++++------- sites/platform/src/add-services/rabbitmq.md | 72 +++--- sites/platform/src/add-services/redis.md | 223 ++++++++--------- sites/platform/src/add-services/solr.md | 146 ++++++----- sites/platform/src/add-services/varnish.md | 8 +- sites/platform/src/add-services/vault.md | 53 ++-- 18 files changed, 1003 insertions(+), 1054 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index fd0928d7ee..5dcdaa3060 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -107,15 +107,16 @@ The relationship follows this pattern: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # Other options... +```yaml {configFile="app"} +name: 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: - : +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -134,17 +135,16 @@ you can use [explicit endpoint configuration](/create-apps/app-reference/single- title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: +```yaml {configFile="app"} +# 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: + : + service: + endpoint: ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -167,14 +167,14 @@ An example relationship to connect to the databases given in the [example in ste title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # Other options... +```yaml {configFile="app"} +name: app +# Other options... - # Relationships enable an app container's access to a service. - relationships: - mariadb: - postgresql: +# Relationships enable an app container's access to a service. +relationships: + mariadb: + postgresql: ``` <---> @@ -183,22 +183,22 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -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 +```yaml {configFile="app"} +name: 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 >}} diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index c899191d79..06ea6d306c 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -92,22 +92,22 @@ Note that the information about the relationship can change when an app is redep ```json { - "username": null, - "scheme": "http", - "service": "elasticsearch", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 9200, - "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "elasticsearch.internal", - "rel": "elasticsearch", - "path": null, - "query": [], - "password": "ChangeMe", - "type": "elasticsearch:{{< latest "elasticsearch" >}}", - "public": false, - "host_mapped": false + "username": null, + "scheme": "http", + "service": "elasticsearch", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.elasticsearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 9200, + "cluster": "azertyuiopqsdf-main-7rqtwti", + "host": "elasticsearch.internal", + "rel": "elasticsearch", + "path": null, + "query": [], + "password": "ChangeMe", + "type": "elasticsearch:{{< latest "elasticsearch" >}}", + "public": false, + "host_mapped": false } ``` @@ -141,14 +141,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -169,17 +169,17 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: elasticsearch +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: elasticsearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -216,14 +216,14 @@ use the `elasticsearch-enterprise` type in the service definition. title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: +```yaml {configFile="app"} +name: app +# 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: ``` <---> @@ -232,17 +232,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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 +```yaml {configFile="app"} +name: app +# 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 >}} diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index f2bfba8e56..e99a91c14f 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -23,20 +23,20 @@ or by running `{{% vendor/cli %}} relationships`. ```json { - "host": "gotenberg.internal", - "hostname": "azertyuiopqsdfghjklm.gotenberg.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiopqsdf-main-7rqtwti", - "service": "gotenberg", - "rel": "http", - "scheme": "http", - "port": "3000", - "type": "gotenberg:8", - "instance_ips": [ - "123.456.78.90" - ], - "ip": "123.456.78.90", - "url": "http://gotenberg.internal:3000" - } + "host": "gotenberg.internal", + "hostname": "azertyuiopqsdfghjklm.gotenberg.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiopqsdf-main-7rqtwti", + "service": "gotenberg", + "rel": "http", + "scheme": "http", + "port": "3000", + "type": "gotenberg:8", + "instance_ips": [ + "123.456.78.90" + ], + "ip": "123.456.78.90", + "url": "http://gotenberg.internal:3000" +} ``` Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables) information @@ -74,11 +74,11 @@ To define the relationship, use the ``http`` endpoint: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # Relationships enable access from this app to a given service. - relationships: - : +```yaml {configFile="app"} +name: app +# Relationships enable access from this app to a given service. +relationships: + : ``` You can define ```` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -94,17 +94,17 @@ The application has access to the service via this relationship and its correspo title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: http +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -139,11 +139,11 @@ gotenberg: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # Relationships enable access from this app to a given service. - relationships: - gotenberg: +```yaml {configFile="app"} +name: app +# Relationships enable access from this app to a given service. +relationships: + gotenberg: ``` <---> @@ -152,17 +152,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - gotenberg: - service: gotenberg - endpoint: http +```yaml {configFile="app"} +name: app +# 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: + gotenberg: + service: gotenberg + endpoint: http ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index 504443550b..623d52a932 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -45,15 +45,15 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "service": "chrome-headless", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.chrome-headless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiop-main-7rqtwti", - "host": "chrome-headless.internal", - "rel": "http", - "scheme": "http", - "type": "chrome-headless:{{< latest "chrome-headless" >}}", - "port": 9222 + "service": "chrome-headless", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.chrome-headless.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiop-main-7rqtwti", + "host": "chrome-headless.internal", + "rel": "http", + "scheme": "http", + "type": "chrome-headless:{{< latest "chrome-headless" >}}", + "port": 9222 } ``` @@ -90,14 +90,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -118,17 +118,17 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: http +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: http ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -161,14 +161,14 @@ chrome-headless: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - chrome-headless: +```yaml {configFile="app"} +name: app +# 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: + chrome-headless: ``` <---> @@ -177,17 +177,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - chrome-headless: - service: chrome-headless - endpoint: http +```yaml {configFile="app"} +name: app +# 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: + chrome-headless: + service: chrome-headless + endpoint: http ``` {{< /codetabs >}} @@ -243,19 +243,19 @@ and use them to define the `browserURL` parameter of `puppeteer.connect()` withi ```js exports.getBrowser = async function (url) { - try { - // Connect to chrome-headless using pre-formatted puppeteer credentials - const formattedURL = config.formattedCredentials('chromeheadless', 'puppeteer'); - const browser = await puppeteer.connect({browserURL: formattedURL}); + try { + // Connect to chrome-headless using pre-formatted puppeteer credentials + const formattedURL = config.formattedCredentials('chromeheadless', 'puppeteer'); + const browser = await puppeteer.connect({browserURL: formattedURL}); - ... + ... - return browser + return browser - } catch (error) { - console.error({ error }, 'Something happened!'); - browser.close(); - } + } catch (error) { + console.error({ error }, 'Something happened!'); + browser.close(); + } }; ``` diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 559779b3cd..3aa9f4d102 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -122,14 +122,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -150,17 +150,17 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: influxdb +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: influxdb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -194,14 +194,14 @@ influxdb: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - influxdb: +```yaml {configFile="app"} +name: app +# 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: + influxdb: ``` <---> @@ -210,17 +210,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - influxdb: - service: - endpoint: influxdb +```yaml {configFile="app"} +name: app +# 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: + influxdb: + service: + endpoint: influxdb ``` {{< /codetabs >}} @@ -235,15 +235,15 @@ To use the configured service in your app, add a configuration file similar to t title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # The name of the app container. Must be unique within a project. -app: +name: app - [...] +[...] - # Relationships enable an app container's access to a service. - relationships: - influxdb: +# Relationships enable an app container's access to a service. +relationships: + influxdb: ``` <---> @@ -252,21 +252,21 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # The name of the app container. Must be unique within a project. -app: - - [...] - - # 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: - influxdb: - service: influxdb - endpoint: influxdb +name: app + +[...] + +# 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: + influxdb: + service: influxdb + endpoint: influxdb ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index dc0a3c8388..75d19a3428 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -41,15 +41,15 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "service": "kafka", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiop-main-7rqtwti", - "host": "kafka.internal", - "rel": "kafka", - "scheme": "kafka", - "type": "kafka:{{< latest "kafka" >}}", - "port": 9092 + "service": "kafka", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.kafka.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiop-main-7rqtwti", + "host": "kafka.internal", + "rel": "kafka", + "scheme": "kafka", + "type": "kafka:{{< latest "kafka" >}}", + "port": 9092 } ``` @@ -79,14 +79,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -107,17 +107,17 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: kafka +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: kafka ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -151,14 +151,14 @@ kafka: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - kafka: +```yaml {configFile="app"} +name: app +# 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: + kafka: ``` <---> @@ -167,17 +167,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - kafka: - service: kafka - endpoint: kafka +```yaml {configFile="app"} +name: app +# 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: + kafka: + service: kafka + endpoint: kafka ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index 49a8403e61..fab9866ea5 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -53,15 +53,15 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "service": "memcached", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "memcached.internal", - "rel": "memcached", - "scheme": "memcached", - "type": "memcached:{{% latest "memcached" %}}", - "port": 11211 + "service": "memcached", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.memcached.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "memcached.internal", + "rel": "memcached", + "scheme": "memcached", + "type": "memcached:{{% latest "memcached" %}}", + "port": 11211 } ``` @@ -91,14 +91,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -119,17 +119,17 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: memcached +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: memcached ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -162,14 +162,14 @@ memcached: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - memcached: +```yaml {configFile="app"} +name: app +# 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: + memcached: ``` <---> @@ -178,17 +178,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - memcached: - service: memcached - endpoint: memcached +```yaml {configFile="app"} +name: app +# 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: + memcached: + service: memcached + endpoint: memcached ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index 75698153b2..1d0ee23c52 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -107,21 +107,21 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "username": "main", - "scheme": "mongodb", - "service": "mongodb", - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "cluster": "azertyuiop-main-7rqtwti", - "host": "mongodb.internal", - "rel": "mongodb", - "query": { - "is_master": true - }, - "path": "main", - "password": null, - "type": "mongodb-enterprise:{{% latest "mongodb-enterprise" %}}", - "port": 27017 + "username": "main", + "scheme": "mongodb", + "service": "mongodb", + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.mongodb.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "cluster": "azertyuiop-main-7rqtwti", + "host": "mongodb.internal", + "rel": "mongodb", + "query": { + "is_master": true + }, + "path": "main", + "password": null, + "type": "mongodb-enterprise:{{% latest "mongodb-enterprise" %}}", + "port": 27017 } ``` @@ -153,14 +153,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -181,17 +181,17 @@ With the above definition, the application container now has access to the servi title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: mongodb +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -208,12 +208,12 @@ With the above definition, the application container now has access to the servi For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="apps"} -app: - # PHP extensions. - runtime: - extensions: - - mongodb +```yaml {configFile="app"} +name: app +# PHP extensions. +runtime: + extensions: + - mongodb ``` #### Example configuration @@ -235,14 +235,14 @@ mongodb-enterprise: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - mongodb-enterprise: +```yaml {configFile="app"} +name: app +# 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: + mongodb-enterprise: ``` <---> @@ -251,17 +251,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - mongodb-enterprise: - service: mongodb-enterprise - endpoint: mongodb +```yaml {configFile="app"} +name: app +# 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: + mongodb-enterprise: + service: mongodb-enterprise + endpoint: mongodb ``` {{< /codetabs >}} @@ -292,14 +292,14 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +name: app +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -320,17 +320,17 @@ With the above definition, the application container now has access to the servi title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: mongodb +```yaml {configFile="app"} +name: app +# 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: + : + service: + endpoint: mongodb ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -347,12 +347,12 @@ With the above definition, the application container now has access to the servi For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="apps"} -app: - # PHP extensions. - runtime: - extensions: - - mongodb +```yaml {configFile="app"} +name: app +# PHP extensions. +runtime: + extensions: + - mongodb ``` #### Example configuration @@ -374,14 +374,14 @@ mongodb: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - mongodb: +```yaml {configFile="app"} +name: app +# 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: + mongodb: ``` <---> @@ -390,17 +390,17 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - mongodb: - service: mongodb - endpoint: mongodb +```yaml {configFile="app"} +name: app +# 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: + mongodb: + service: mongodb + endpoint: mongodb ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 88cfae4316..546f0677ca 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -131,14 +131,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -159,17 +158,16 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: mysql +```yaml {configFile="app"} +# 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: + : + service: + endpoint: mysql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -203,14 +201,13 @@ mariadb: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - mariadb: +```yaml {configFile="app"} +# 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: + mariadb: ``` <---> @@ -219,17 +216,16 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - mariadb: - service: mariadb - endpoint: mysql +```yaml {configFile="app"} +# 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: + mariadb: + service: mariadb + endpoint: mysql ``` {{< /codetabs >}} @@ -253,14 +249,13 @@ oraclemysql: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - oraclemysql: +```yaml {configFile="app"} +# 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: + oraclemysql: ``` <---> @@ -269,17 +264,16 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - oraclemysql: - service: oraclemysql - endpoint: mysql +```yaml {configFile="app"} +# 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: + oraclemysql: + service: oraclemysql + endpoint: mysql ``` {{< /codetabs >}} @@ -495,12 +489,11 @@ make sure you do the following: This results in the following configuration: -```yaml {configFile="apps"} -app: - relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-replica +```yaml {configFile="app"} +relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-replica ``` For example, if you define a `mariadb` database as follows: @@ -526,24 +519,22 @@ To create a replica of the `mariadb` database and allow your app to connect to i through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - mariadb: - service: mariadb - endpoint: admin-replica +```yaml {configFile="app"} +relationships: + mariadb: + service: mariadb + endpoint: admin-replica ``` To create a replica of the `mariadb` database and allow your app to connect to it through the `reporter` endpoint with read-only permissions instead, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - mariadb: - service: mariadb - endpoint: reporter-replica +```yaml {configFile="app"} +relationships: + mariadb: + service: mariadb + endpoint: reporter-replica ``` ### Grant access to the main database and its replicas @@ -563,12 +554,11 @@ make sure you do the following: This results in the following configuration, which creates a replica on each of the secondary nodes: -```yaml {configFile="apps"} -app: - relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-all +```yaml {configFile="app"} +relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-all ``` For example, if you define a `mariadb` database as follows: @@ -577,41 +567,39 @@ For example, if you define a `mariadb` database as follows: mariadb: type: mariadb:{{% latest "mariadb" %}} disk: 2048 - configuration: - schemas: - - main - endpoints: - admin: - default_schema: main - privileges: - main: admin - reporter: - privileges: - main: ro + configuration: + schemas: + - main + endpoints: + admin: + default_schema: main + privileges: + main: admin + reporter: + privileges: + main: ro ``` To allow your app to connect to your main database and both its replicas through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - mariadb: - service: mariadb - endpoint: admin-all +```yaml {configFile="app"} +relationships: + mariadb: + service: mariadb + endpoint: admin-all ``` To allow your app to connect to your main database and both its replicas through the `reporter` endpoint with read-only permissions, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - mariadb: - service: mariadb - endpoint: reporter-all +```yaml {configFile="app"} +relationships: + mariadb: + service: mariadb + endpoint: reporter-all ``` ## Multiple databases @@ -682,24 +670,24 @@ mariadb: Expose these endpoints to your app as relationships in your [app configuration](../../create-apps/_index.md): -```yaml {configFile="apps"} -app: - - [...] - - # Relationships enable an app container's access to a service. - relationships: - # 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 - database: - service: mariadb - endpoint: admin - reports: - service: mariadb - endpoint: reporter - imports: - service: mariadb - endpoint: importer +```yaml {configFile="app"} +name: app + +[...] + +# Relationships enable an app container's access to a service. +relationships: + # 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 + database: + service: mariadb + endpoint: admin + reports: + service: mariadb + endpoint: reporter + imports: + service: mariadb + endpoint: importer ``` These relationships are then available in the [`{{< vendor/prefix >}}_RELATIONSHIPS` environment variable](#relationship-reference). diff --git a/sites/platform/src/add-services/mysql/mysql-replication.md b/sites/platform/src/add-services/mysql/mysql-replication.md index 9a5620de76..c2ec329ac6 100644 --- a/sites/platform/src/add-services/mysql/mysql-replication.md +++ b/sites/platform/src/add-services/mysql/mysql-replication.md @@ -43,21 +43,21 @@ This creates a `replicator` user, and grants read-only and table locking rights Even if you won't be accessing the replication endpoint from your application, you still need to expose it to an application as a relationship so that you can connect to it over SSH. Add a new relationship to your application container: -```yaml {configFile="apps"} -app: - - [...] - - # Relationships enable an app container's access to a service. - relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships - database: - service: "mariadb" - endpoint: "mysql" - replication: - service: "mariadb" - endpoint: "replicator" +```yaml {configFile="app"} +name: app + +[...] + +# Relationships enable an app container's access to a service. +relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + database: + service: "mariadb" + endpoint: "mysql" + replication: + service: "mariadb" + endpoint: "replicator" ``` ## Getting the Primary's Binary Log Co-ordinates diff --git a/sites/platform/src/add-services/network-storage.md b/sites/platform/src/add-services/network-storage.md index 15c494f46d..a517a77cd0 100644 --- a/sites/platform/src/add-services/network-storage.md +++ b/sites/platform/src/add-services/network-storage.md @@ -105,13 +105,13 @@ Back up your data before changing the service. To define the mount accessible by your application, use the following configuration: -```yaml {configFile="apps"} -app: - mounts: - : - source: service - service: - source_path: +```yaml {configFile="app"} +name: app +mounts: + : + source: service + service: + source_path: ``` - `` is the path to your mount within the app container (relative to the app’s root). @@ -134,13 +134,13 @@ network-storage: #### [App configuration](/create-apps/_index.md) -```yaml {configFile="apps"} -app: - mounts: - 'my/files': - source: service - service: network-storage - source_path: files +```yaml {configFile="app"} +name: app +mounts: + 'my/files': + source: service + service: network-storage + source_path: files ``` ## Multi-application usage @@ -342,12 +342,12 @@ However, the process is fundamentally "just" moving files around on disk, so it' Suppose you have this mount configuration: -```yaml {configFile="apps"} -app: - mounts: - web/uploads: - source: local - source_path: uploads +```yaml {configFile="app"} +name: app +mounts: + web/uploads: + source: local + source_path: uploads ``` And want to move that to a network storage mount. @@ -366,16 +366,15 @@ The following approximate steps do so with a minimum of service interruption. 2. Add a new mount (`new-uploads`) to the network storage service on a non-public directory. (Remember the `source_path` can be the same since they're on different storage services.) - ```yaml {configFile="apps"} - app: - mounts: - web/uploads: - source: local - source_path: uploads - new-uploads: - source: service - service: files - source_path: uploads + ```yaml {configFile="app"} + mounts: + web/uploads: + source: local + source_path: uploads + new-uploads: + source: service + service: files + source_path: uploads ``` 3. Deploy these changes. @@ -390,16 +389,15 @@ The following approximate steps do so with a minimum of service interruption. Point the `web/uploads` directory to the network mount instead. Commit and push the change, testing to make sure the network files are accessible. - ```yaml {configFile="apps"} - app: - mounts: - old-uploads: - source: local - source_path: uploads - web/uploads: - source: service - service: files - source_path: uploads + ```yaml {configFile="app"} + mounts: + old-uploads: + source: local + source_path: uploads + web/uploads: + source: service + service: files + source_path: uploads ``` 5. Clean up. diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 98e6a9175a..b3abc38200 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -78,22 +78,22 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "username": null, - "scheme": "http", - "service": "opensearch", - "fragment": null, - "ip": "169.254.99.100", - "hostname": "azertyuiopqsdfghjklm.opensearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 9200, - "cluster": "azertyuiopqsdf-main-7rqtwti", - "host": "opensearch.internal", - "rel": "opensearch", - "path": null, - "query": [], - "password": "ChangeMe", - "type": "opensearch:{{% latest "opensearch" %}}", - "public": false, - "host_mapped": false + "username": null, + "scheme": "http", + "service": "opensearch", + "fragment": null, + "ip": "169.254.99.100", + "hostname": "azertyuiopqsdfghjklm.opensearch.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 9200, + "cluster": "azertyuiopqsdf-main-7rqtwti", + "host": "opensearch.internal", + "rel": "opensearch", + "path": null, + "query": [], + "password": "ChangeMe", + "type": "opensearch:{{% latest "opensearch" %}}", + "public": false, + "host_mapped": false } ``` @@ -123,14 +123,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -151,17 +150,16 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: opensearch +```yaml {configFile="app"} +# 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: + : + service: + endpoint: opensearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -195,14 +193,13 @@ opensearch: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - opensearch: +```yaml {configFile="app"} +# 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: + opensearch: ``` <---> @@ -211,17 +208,16 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - opensearch: - service: opensearch - endpoint: opensearch +```yaml {configFile="app"} +# 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: + opensearch: + service: opensearch + endpoint: opensearch ``` {{< /codetabs >}} @@ -236,13 +232,13 @@ To use the configured service in your app, add a configuration file similar to t title=Using default endpoints +++ -```yaml {configFile="apps"} -app: +```yaml {configFile="app"} +name: app - [...] +[...] - relationships: - opensearch: +relationships: + opensearch: ``` <---> @@ -251,15 +247,15 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: +```yaml {configFile="app"} +name: app - [...] +[...] - relationships: - opensearch: - service: opensearch - endpoint: opensearch +relationships: + opensearch: + service: opensearch + endpoint: opensearch ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/postgresql.md b/sites/platform/src/add-services/postgresql.md index b6d396bff8..3f497cec7e 100644 --- a/sites/platform/src/add-services/postgresql.md +++ b/sites/platform/src/add-services/postgresql.md @@ -78,24 +78,24 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "username": "main", - "scheme": "pgsql", - "service": "postgresql", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 5432, - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "postgresql.internal", - "rel": "postgresql", - "path": "main", - "query": { - "is_master": true - }, - "password": "ChangeMe", - "type": "postgresql:{{% latest "postgresql" %}}", - "public": false, - "host_mapped": false + "username": "main", + "scheme": "pgsql", + "service": "postgresql", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.postgresql.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 5432, + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "postgresql.internal", + "rel": "postgresql", + "path": "main", + "query": { + "is_master": true + }, + "password": "ChangeMe", + "type": "postgresql:{{% latest "postgresql" %}}", + "public": false, + "host_mapped": false } ``` @@ -125,14 +125,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -153,17 +152,16 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: postgresql +```yaml {configFile="app"} +# 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: + : + service: + endpoint: postgresql ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -180,12 +178,11 @@ With the above definition, the application container now has [access to the serv For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="apps"} -app: - # PHP extensions. - runtime: - extensions: - - pdo_pgsql +```yaml {configFile="app"} +# PHP extensions. +runtime: + extensions: + - pdo_pgsql ``` ### Example configuration @@ -207,14 +204,13 @@ postgresql: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - postgresql: +```yaml {configFile="app"} +# 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: + postgresql: ``` <---> @@ -223,17 +219,16 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - postgresql: - service: postgresql - endpoint: postgresql +```yaml {configFile="app"} +# 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: + postgresql: + service: postgresql + endpoint: postgresql ``` {{< /codetabs >}} @@ -415,20 +410,19 @@ If a given endpoint has access to multiple databases you should also specify whi Once these endpoints are defined, you need to expose them to your application as a relationship. Continuing with the above example, your `relationships` in `{{< vendor/configfile "app" >}}` might look like: -```yaml {configFile="apps"} -app: - relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships - database: - service: postgresql - endpoint: admin - reports: - service: postgresql - endpoint: reporter - imports: - service: postgresql - endpoint: importer +```yaml {configFile="app"} +relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + database: + service: postgresql + endpoint: admin + reports: + service: postgresql + endpoint: reporter + imports: + service: postgresql + endpoint: importer ``` Each database is accessible to your application through the `database`, `reports`, and `imports` relationships. @@ -521,12 +515,11 @@ make sure you do the following: This results in the following configuration: -```yaml {configFile="apps"} -app: - relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-replica +```yaml {configFile="app"} +relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-replica ``` For example, if you define a `postgresql` database as follows: @@ -554,24 +547,22 @@ To create a replica of the `postgresql` database and allow your app to connect t through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - postgresql: - service: postgresql - endpoint: admin-replica +```yaml {configFile="app"} +relationships: + postgresql: + service: postgresql + endpoint: admin-replica ``` To create a replica of the `postgresql` database and allow your app to connect to it through the `reporter` endpoint with read-only permissions instead, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - postgresql: - service: postgresql - endpoint: reporter-replica +```yaml {configFile="app"} +relationships: + postgresql: + service: postgresql + endpoint: reporter-replica ``` ## Service timezone diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index a25c7a43ed..a974748c10 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -118,14 +118,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -146,17 +145,16 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: rabbitmq +```yaml {configFile="app"} +# 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: + : + service: + endpoint: rabbitmq ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -190,14 +188,13 @@ rabbitmq: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - rabbitmq: +```yaml {configFile="app"} +# 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: + rabbitmq: ``` <---> @@ -206,17 +203,16 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - rabbitmq: - service: rabbitmq - endpoint: rabbitmq +```yaml {configFile="app"} +# 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: + rabbitmq: + service: rabbitmq + endpoint: rabbitmq ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 6dd6f259f6..704391555a 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -164,14 +164,13 @@ To define the relationship, use the `redis` endpoint : title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -188,17 +187,16 @@ With the above definition, the application container now has access to the servi title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: redis +```yaml {configFile="app"} +# 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: + : + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -215,12 +213,11 @@ With the above definition, the application container now has [access to the serv For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="apps"} -app: - # PHP extensions. - runtime: - extensions: - - redis +```yaml {configFile="app"} +# PHP extensions. +runtime: + extensions: + - redis ``` ### Configuration example @@ -242,10 +239,9 @@ redis: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - relationships: - redis: +```yaml {configFile="app"} +relationships: + redis: ``` <---> @@ -254,12 +250,11 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - relationships: - redis: - service: redis - endpoint: redis +```yaml {configFile="app"} +relationships: + redis: + service: redis + endpoint: redis ``` {{< /codetabs >}} @@ -342,14 +337,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -366,17 +360,16 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : - service: - endpoint: redis +```yaml {configFile="app"} +# 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: + : + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -393,12 +386,11 @@ With the above definition, the application container now has [access to the serv For PHP, enable the [extension](/languages/php/extensions) for the service: -```yaml {configFile="apps"} -app: - # PHP extensions. - runtime: - extensions: - - redis +```yaml {configFile="app"} +# PHP extensions. +runtime: + extensions: + - redis ``` ### Configuration example @@ -420,10 +412,9 @@ redis: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - relationships: - redis: +```yaml {configFile="app"} +relationships: + redis: ``` <---> @@ -432,12 +423,11 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - relationships: - redis: - service: redis - endpoint: redis +```yaml {configFile="app"} +relationships: + redis: + service: redis + endpoint: redis ``` {{< /codetabs >}} @@ -561,12 +551,11 @@ make sure you do the following: This results in the following configuration: -```yaml {configFile="apps"} -app: - relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}}-replica +```yaml {configFile="app"} +relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}}-replica ``` For example, if you define a `redis-persistent` database as follows: @@ -594,24 +583,22 @@ To create a replica of the `redis-persistent` database and allow your app to con through the `admin` endpoint with admin permissions, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - redis-persistent: - service: redis-persistent - endpoint: admin-replica +```yaml {configFile="app"} +relationships: + redis-persistent: + service: redis-persistent + endpoint: admin-replica ``` To create a replica of the `redis-persistent` database and allow your app to connect to it through the `reporter` endpoint with read-only permissions instead, use the following configuration: -```yaml {configFile="apps"} -app: - relationships: - redis-persistent: - service: redis-persistent - endpoint: reporter-replica +```yaml {configFile="app"} +relationships: + redis-persistent: + service: redis-persistent + endpoint: reporter-replica ``` ## Relationship reference @@ -733,23 +720,23 @@ redissessions: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - type: "php:{{% latest "php" %}}" +```yaml {configFile="app"} +name: app +type: "php:{{% latest "php" %}}" - relationships: - redissessions: +relationships: + redissessions: - variables: - php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" +variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" - web: - locations: - '/': - root: 'web' - passthru: '/index.php' +web: + locations: + '/': + root: 'web' + passthru: '/index.php' ``` <---> @@ -758,25 +745,25 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - type: "php:{{% latest "php" %}}" +```yaml {configFile="app"} +name: app +type: "php:{{% latest "php" %}}" - relationships: - redissessions: - service: "redissessions" - endpoint: "redis" +relationships: + redissessions: + service: "redissessions" + endpoint: "redis" - variables: - php: - session.save_handler: redis - session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" +variables: + php: + session.save_handler: redis + session.save_path: "tcp://{{< variable "HOSTNAME" >}}:{{< variable "PORT" >}}" - web: - locations: - '/': - root: 'web' - passthru: '/index.php' +web: + locations: + '/': + root: 'web' + passthru: '/index.php' ``` {{< /codetabs >}} diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index 4451d7a7c6..356deb7740 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -73,22 +73,22 @@ So your apps should only rely on the `{{% vendor/prefix %}}_RELATIONSHIPS` envir ```json { - "username": null, - "scheme": "solr", - "service": "solr", - "fragment": null, - "ip": "123.456.78.90", - "hostname": "azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}}", - "port": 8080, - "cluster": "azertyuiopqsdf-main-afdwftq", - "host": "solr.internal", - "rel": "solr", - "path": "solr\/collection1", - "query": [], - "password": null, - "type": "solr:{{% latest "solr" %}}", - "public": false, - "host_mapped": false + "username": null, + "scheme": "solr", + "service": "solr", + "fragment": null, + "ip": "123.456.78.90", + "hostname": "azertyuiopqsdfghjklm.solr.service._.eu-1.{{< vendor/urlraw "hostname" >}}", + "port": 8080, + "cluster": "azertyuiopqsdf-main-afdwftq", + "host": "solr.internal", + "rel": "solr", + "path": "solr\/collection1", + "query": [], + "password": null, + "type": "solr:{{% latest "solr" %}}", + "public": false, + "host_mapped": false } ``` @@ -118,14 +118,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - : +```yaml {configFile="app"} +# 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: + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -146,16 +145,15 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app: - # Relationships enable access from this app to a given service. - # 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: - : - service: - endpoint: solr +```yaml {configFile="app"} +# Relationships enable access from this app to a given service. +# 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: + : + service: + endpoint: solr ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -189,14 +187,13 @@ solr: title=Using default endpoints +++ -```yaml {configFile="apps"} -app: - # 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: - solr: +```yaml {configFile="app"} +# 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: + solr: ``` <---> @@ -205,16 +202,15 @@ app: title=Using explicit endpoints +++ -```yaml {configFile="apps"} -app - # Relationships enable access from this app to a given service. - # 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: - solr: - service: solr - endpoint: solr +```yaml {configFile="app"} +# Relationships enable access from this app to a given service. +# 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: + solr: + service: solr + endpoint: solr ``` {{< /codetabs >}} @@ -324,16 +320,16 @@ It then defines two endpoints: `main` is connected to the `mainindex` core while Each endpoint is then available in the relationships definition in `{{< vendor/configfile "app" >}}`. For example, to allow an application to talk to both of the cores defined above its configuration should contain the following: -```yaml {configFile="apps"} -app: +```yaml {configFile="app"} +name: app - type: "php:{{% latest "php" %}}" +type: "php:{{% latest "php" %}}" - [...] +[...] - relationships: - solrsearch1: "solr:main" - solrsearch2: "solr:extra" +relationships: + solrsearch1: "solr:main" + solrsearch2: "solr:extra" ``` That is, the application's environment would include a `solrsearch1` relationship that connects to the `main` endpoint, which is the `mainindex` core, and a `solrsearch2` relationship that connects to the `extra` endpoint, which is the `extraindex` core. @@ -342,22 +338,22 @@ The relationships array would then look something like the following: ```json { - "solrsearch1": [ - { - "path": "solr/mainindex", - "host": "248.0.65.197", - "scheme": "solr", - "port": 8080 - } - ], - "solrsearch2": [ - { - "path": "solr/extraindex", - "host": "248.0.65.197", - "scheme": "solr", - "port": 8080 - } - ] + "solrsearch1": [ + { + "path": "solr/mainindex", + "host": "248.0.65.197", + "scheme": "solr", + "port": 8080 + } + ], + "solrsearch2": [ + { + "path": "solr/extraindex", + "host": "248.0.65.197", + "scheme": "solr", + "port": 8080 + } + ] } ``` diff --git a/sites/platform/src/add-services/varnish.md b/sites/platform/src/add-services/varnish.md index 5d33240347..42202f2396 100644 --- a/sites/platform/src/add-services/varnish.md +++ b/sites/platform/src/add-services/varnish.md @@ -38,10 +38,10 @@ The Varnish service sits between the router and all apps in the project. ``` mermaid graph LR - A(Request) -->B(Router) - B --> C{Varnish} - C -->D[App 1] - C -->E[App 2] + A(Request) -->B(Router) + B --> C{Varnish} + C -->D[App 1] + C -->E[App 2] ``` ## Usage example diff --git a/sites/platform/src/add-services/vault.md b/sites/platform/src/add-services/vault.md index 2d60da2cc6..048e31dd53 100644 --- a/sites/platform/src/add-services/vault.md +++ b/sites/platform/src/add-services/vault.md @@ -111,15 +111,14 @@ You can create multiple endpoints, such as to have key management separate from To define the relationship, use the following configuration: -```yaml {configFile="apps"} -app: - # 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. - relationships: - : - service: - endpoint: +```yaml {configFile="app"} +# 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. +relationships: + : + service: + endpoint: ``` You can define `` as you like, so long as it's unique between all defined services @@ -157,14 +156,13 @@ vault-kms: #### [App configuration](/create-apps) -```yaml {configFile="apps"} -app: - relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships - vault_secret: - service: "vault-kms" - endpoint: "manage_keys" +```yaml {configFile="app"} +relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + vault_secret: + service: "vault-kms" + endpoint: "manage_keys" ``` ### Multiple endpoints configuration @@ -193,17 +191,16 @@ vault-kms: #### [App configuration](/create-apps) -```yaml {configFile="apps"} -app: - relationships: - # Please note: Legacy definition of the relationship is still supported. - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships - vault_manage: - service: vault-kms - endpoint: management - vault_sign: - service: vault-kms - endpoint: sign_and_verify +```yaml {configFile="app"} +relationships: + # Please note: Legacy definition of the relationship is still supported. + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + vault_manage: + service: vault-kms + endpoint: management + vault_sign: + service: vault-kms + endpoint: sign_and_verify ``` ## Use Vault KMS From 9e08dc3fea871c0c278e1a10adca514dbc3e7ea7 Mon Sep 17 00:00:00 2001 From: flovntp Date: Wed, 4 Sep 2024 17:30:34 +0200 Subject: [PATCH 17/22] indentation of Yaml snippets with 2 spaces (#4145) * indentation of Yaml snippets with 2 spaces * indentation on Upsun from 4 to 2 spaces on YAML snippets * consistency in the file + small issue * change app to myapp on platform * change app to myapp on upsun --- sites/platform/src/add-services/_index.md | 8 +- .../src/add-services/elasticsearch.md | 8 +- sites/platform/src/add-services/gotenberg.md | 8 +- .../src/add-services/headless-chrome.md | 8 +- sites/platform/src/add-services/influxdb.md | 12 +- sites/platform/src/add-services/kafka.md | 8 +- sites/platform/src/add-services/memcached.md | 8 +- sites/platform/src/add-services/mongodb.md | 20 +- .../platform/src/add-services/mysql/_index.md | 2 +- .../add-services/mysql/mysql-replication.md | 2 +- .../src/add-services/network-storage.md | 10 +- sites/platform/src/add-services/opensearch.md | 4 +- sites/platform/src/add-services/redis.md | 4 +- sites/platform/src/add-services/solr.md | 2 +- .../platform/src/administration/cli/_index.md | 4 +- .../src/administration/cli/api-tokens.md | 30 +- sites/platform/src/create-apps/_index.md | 120 ++-- .../app-reference/composable-image.md | 296 +++++----- .../app-reference/single-runtime-image.md | 330 +++++------ .../src/create-apps/flexible-resources.md | 6 +- .../platform/src/create-apps/hooks/_index.md | 186 +++---- .../hooks/hooks-and-dependencies.md | 10 +- .../hooks/vary-hooks-by-environment.md | 14 +- .../multi-app/project-structure.md | 3 +- .../src/create-apps/multi-app/routes.md | 46 +- .../src/create-apps/runtime-operations.md | 82 +-- .../src/create-apps/source-operations.md | 132 ++--- sites/platform/src/create-apps/timezone.md | 4 +- .../src/create-apps/troubleshoot-mounts.md | 40 +- sites/platform/src/create-apps/upgrading.md | 249 ++++----- .../src/create-apps/web/custom-headers.md | 54 +- .../platform/src/create-apps/web/php-basic.md | 144 ++--- .../src/create-apps/web/rewrite-requests.md | 24 +- .../web/serve-different-directories.md | 34 +- sites/platform/src/create-apps/web/static.md | 116 ++-- sites/platform/src/create-apps/workers.md | 178 +++--- sites/platform/src/define-routes/_index.md | 140 ++--- sites/platform/src/define-routes/cache.md | 94 ++-- sites/platform/src/define-routes/https.md | 58 +- sites/platform/src/define-routes/proxy.md | 28 +- sites/platform/src/define-routes/redirects.md | 252 ++++----- sites/platform/src/define-routes/ssi.md | 30 +- sites/platform/src/development/local/ddev.md | 2 +- .../src/development/private-repository.md | 8 +- .../src/development/sanitize-db/mariadb.md | 36 +- .../sanitize-db/postgresql-symfony.md | 26 +- .../src/development/sanitize-db/postgresql.md | 8 +- sites/platform/src/development/submodules.md | 52 +- .../src/development/variables/_index.md | 8 +- .../development/variables/use-variables.md | 38 +- sites/platform/src/domains/cdn/_index.md | 22 +- .../src/get-started/add-data/merge.md | 10 +- .../src/guides/django/deploy/configure.md | 26 +- .../src/guides/drupal/elasticsearch.md | 32 +- sites/platform/src/guides/drupal/memcached.md | 34 +- sites/platform/src/guides/drupal/redis.md | 18 +- .../platform/src/guides/drupal/simplesaml.md | 28 +- sites/platform/src/guides/ibexa/fastly.md | 4 +- .../src/guides/laravel/deploy/octane.md | 22 +- .../src/guides/micronaut/deploy/customize.md | 16 +- .../platform/src/guides/micronaut/mongodb.md | 6 +- .../src/guides/quarkus/deploy/customize.md | 16 +- sites/platform/src/guides/quarkus/mongodb.md | 6 +- .../src/guides/spring/deploy/customize.md | 12 +- sites/platform/src/guides/spring/mongodb.md | 6 +- .../strapi/database-configuration/mongodb.md | 14 +- .../strapi/database-configuration/mysql.md | 14 +- .../database-configuration/postgresql.md | 10 +- .../src/guides/strapi/deploy/configure.md | 2 +- sites/platform/src/guides/symfony/crons.md | 24 +- .../guides/symfony/environment-variables.md | 12 +- sites/platform/src/guides/symfony/faq.md | 8 +- .../src/guides/symfony/integration.md | 102 ++-- sites/platform/src/guides/symfony/workers.md | 12 +- .../src/guides/typo3/deploy/deploy.md | 67 +-- .../src/guides/wordpress/deploy/next-steps.md | 6 +- sites/platform/src/guides/wordpress/redis.md | 44 +- .../integrate-observability/blackfire.md | 6 +- .../integrate-observability/new-relic/java.md | 54 +- .../new-relic/nodejs.md | 20 +- .../integrate-observability/new-relic/php.md | 6 +- .../integrate-observability/tideways.md | 6 +- .../src/integrations/activity/reference.md | 14 +- sites/platform/src/languages/dotnet.md | 46 +- sites/platform/src/languages/elixir.md | 49 +- sites/platform/src/languages/go.md | 34 +- sites/platform/src/languages/java/_index.md | 18 +- .../platform/src/languages/java/migration.md | 30 +- sites/platform/src/languages/lisp.md | 32 +- sites/platform/src/languages/nodejs/_index.md | 108 ++-- .../src/languages/nodejs/node-version.md | 184 ++++--- sites/platform/src/languages/php/_index.md | 46 +- .../platform/src/languages/php/extensions.md | 18 +- sites/platform/src/languages/php/fpm.md | 6 +- sites/platform/src/languages/php/redis.md | 16 +- sites/platform/src/languages/php/swoole.md | 20 +- sites/platform/src/languages/php/tuning.md | 16 +- sites/platform/src/languages/php/xdebug.md | 14 +- sites/platform/src/languages/python/_index.md | 54 +- .../src/languages/python/dependencies.md | 164 +++--- .../src/languages/python/python-version.md | 95 ++-- sites/platform/src/languages/python/server.md | 18 +- sites/platform/src/languages/ruby.md | 289 +++++----- sites/platform/src/languages/rust.md | 86 ++- .../learn/overview/yaml/platform-yaml-tags.md | 90 +-- .../src/learn/overview/yaml/what-is-yaml.md | 68 +-- .../src/learn/overview/yaml/yaml-structure.md | 4 +- .../src/learn/tutorials/dependency-updates.md | 128 ++--- .../platform/src/learn/tutorials/migrating.md | 28 +- .../tutorials/restrict-service-access.md | 70 +-- sites/platform/static/images/yaml/basic.svg | 10 +- sites/platform/static/images/yaml/mapping.svg | 28 +- sites/upsun/src/add-services/clickhouse.md | 8 +- sites/upsun/src/add-services/elasticsearch.md | 14 +- sites/upsun/src/add-services/gotenberg.md | 4 +- .../upsun/src/add-services/headless-chrome.md | 14 +- sites/upsun/src/add-services/influxdb.md | 14 +- sites/upsun/src/add-services/kafka.md | 4 +- sites/upsun/src/add-services/memcached.md | 12 +- sites/upsun/src/add-services/mongodb.md | 48 +- sites/upsun/src/add-services/mysql/_index.md | 20 +- .../add-services/mysql/mysql-replication.md | 2 +- .../upsun/src/add-services/network-storage.md | 6 +- sites/upsun/src/add-services/opensearch.md | 12 +- sites/upsun/src/add-services/postgresql.md | 16 +- sites/upsun/src/add-services/rabbitmq.md | 16 +- sites/upsun/src/add-services/redis.md | 18 +- sites/upsun/src/add-services/solr.md | 16 +- sites/upsun/src/add-services/varnish.md | 10 +- sites/upsun/src/add-services/vault.md | 4 +- sites/upsun/src/administration/cli/_index.md | 2 +- .../src/administration/cli/api-tokens.md | 50 +- sites/upsun/src/create-apps/_index.md | 252 ++++----- .../app-reference/composable-image.md | 207 ++++--- .../app-reference/single-runtime-image.md | 246 ++++----- sites/upsun/src/create-apps/hooks/_index.md | 327 ++++++----- .../hooks/hooks-and-dependencies.md | 18 +- .../hooks/vary-hooks-by-environment.md | 18 +- .../multi-app/project-structure.md | 8 +- .../create-apps/multi-app/relationships.md | 2 +- .../upsun/src/create-apps/multi-app/routes.md | 116 ++-- .../src/create-apps/runtime-operations.md | 114 ++-- .../src/create-apps/source-operations.md | 226 ++++---- sites/upsun/src/create-apps/timezone.md | 4 +- .../src/create-apps/troubleshoot-mounts.md | 54 +- .../src/create-apps/web/custom-headers.md | 102 ++-- sites/upsun/src/create-apps/web/php-basic.md | 192 +++---- .../src/create-apps/web/rewrite-requests.md | 40 +- .../web/serve-different-directories.md | 28 +- sites/upsun/src/create-apps/web/static.md | 165 +++--- sites/upsun/src/create-apps/workers.md | 252 ++++----- sites/upsun/src/define-routes/_index.md | 228 ++++---- sites/upsun/src/define-routes/cache.md | 116 ++-- sites/upsun/src/define-routes/https.md | 92 ++-- sites/upsun/src/define-routes/proxy.md | 42 +- sites/upsun/src/define-routes/redirects.md | 270 ++++----- sites/upsun/src/define-routes/ssi.md | 38 +- .../src/development/private-repository.md | 12 +- .../src/development/sanitize-db/mariadb.md | 22 +- .../sanitize-db/postgresql-symfony.md | 34 +- .../src/development/sanitize-db/postgresql.md | 8 +- sites/upsun/src/development/submodules.md | 56 +- .../upsun/src/development/variables/_index.md | 10 +- .../development/variables/use-variables.md | 60 +- sites/upsun/src/domains/cdn/_index.md | 24 +- .../src/get-started/here/configure/_index.md | 18 +- .../src/get-started/here/configure/nodejs.md | 20 +- .../src/get-started/here/set-resources.md | 4 +- sites/upsun/src/get-started/stacks/django.md | 100 ++-- .../stacks/express/add-database.md | 38 +- sites/upsun/src/get-started/stacks/flask.md | 198 +++---- .../src/get-started/stacks/laravel/crons.md | 55 +- .../stacks/laravel/environment-variables.md | 20 +- .../src/get-started/stacks/laravel/faq.md | 10 +- .../get-started/stacks/laravel/get-started.md | 24 +- .../stacks/laravel/laravel-horizon.md | 33 +- .../stacks/laravel/laravel-telescope.md | 22 +- .../get-started/stacks/laravel/setup-redis.md | 30 +- sites/upsun/src/get-started/stacks/nextjs.md | 24 +- .../get-started/stacks/strapi/add-database.md | 72 +-- .../src/get-started/stacks/symfony/crons.md | 34 +- .../stacks/symfony/environment-variables.md | 14 +- .../src/get-started/stacks/symfony/faq.md | 8 +- .../get-started/stacks/symfony/integration.md | 64 ++- .../src/get-started/stacks/symfony/workers.md | 10 +- .../upsun/src/get-started/stacks/wordpress.md | 212 ++++---- .../application-metrics/blackfire.md | 12 +- .../application-metrics/python.md | 6 +- .../logs/access-logs.md | 2 +- .../src/integrations/activity/reference.md | 4 +- sites/upsun/src/languages/dotnet.md | 78 +-- sites/upsun/src/languages/elixir.md | 103 ++-- sites/upsun/src/languages/go.md | 60 +- sites/upsun/src/languages/java/_index.md | 42 +- sites/upsun/src/languages/java/migration.md | 68 +-- sites/upsun/src/languages/lisp.md | 94 ++-- sites/upsun/src/languages/nodejs/_index.md | 178 +++--- .../src/languages/nodejs/node-version.md | 330 +++++------ sites/upsun/src/languages/php/_index.md | 219 ++++---- sites/upsun/src/languages/php/extensions.md | 30 +- sites/upsun/src/languages/php/fpm.md | 12 +- sites/upsun/src/languages/php/redis.md | 28 +- sites/upsun/src/languages/php/swoole.md | 26 +- sites/upsun/src/languages/php/tuning.md | 40 +- sites/upsun/src/languages/php/xdebug.md | 32 +- sites/upsun/src/languages/python/_index.md | 152 +++--- .../src/languages/python/dependencies.md | 174 +++--- .../src/languages/python/python-version.md | 108 ++-- sites/upsun/src/languages/python/server.md | 512 +++++++++--------- sites/upsun/src/languages/ruby.md | 462 ++++++++-------- sites/upsun/src/languages/rust.md | 68 +-- .../learn/overview/yaml/platform-yaml-tags.md | 99 ++-- .../src/learn/overview/yaml/what-is-yaml.md | 94 ++-- .../src/learn/overview/yaml/yaml-structure.md | 14 +- .../src/learn/tutorials/dependency-updates.md | 144 ++--- .../src/learn/tutorials/migrating/from-psh.md | 26 +- .../tutorials/restrict-service-access.md | 76 +-- .../src/manage-resources/adjust-resources.md | 32 +- themes/psh-docs/layouts/partials/snippet.html | 10 +- 219 files changed, 6720 insertions(+), 6732 deletions(-) diff --git a/sites/platform/src/add-services/_index.md b/sites/platform/src/add-services/_index.md index 5dcdaa3060..ede1c99fd8 100644 --- a/sites/platform/src/add-services/_index.md +++ b/sites/platform/src/add-services/_index.md @@ -108,7 +108,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # Other options... @@ -168,7 +168,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # Other options... # Relationships enable an app container's access to a service. @@ -184,7 +184,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # Other options... # Relationships enable access from this app to a given service. @@ -293,7 +293,7 @@ mariadb: host: mariadb.internal rel: mysql query: - is_master: true + is_master: true path: main password: '' type: 'mariadb:10.6' diff --git a/sites/platform/src/add-services/elasticsearch.md b/sites/platform/src/add-services/elasticsearch.md index 06ea6d306c..682a2dbbf8 100644 --- a/sites/platform/src/add-services/elasticsearch.md +++ b/sites/platform/src/add-services/elasticsearch.md @@ -142,7 +142,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -170,7 +170,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -217,7 +217,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -233,7 +233,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. diff --git a/sites/platform/src/add-services/gotenberg.md b/sites/platform/src/add-services/gotenberg.md index e99a91c14f..590153408a 100644 --- a/sites/platform/src/add-services/gotenberg.md +++ b/sites/platform/src/add-services/gotenberg.md @@ -75,7 +75,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # Relationships enable access from this app to a given service. relationships: : @@ -95,7 +95,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -140,7 +140,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # Relationships enable access from this app to a given service. relationships: gotenberg: @@ -153,7 +153,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. diff --git a/sites/platform/src/add-services/headless-chrome.md b/sites/platform/src/add-services/headless-chrome.md index 623d52a932..041d1ba7ce 100644 --- a/sites/platform/src/add-services/headless-chrome.md +++ b/sites/platform/src/add-services/headless-chrome.md @@ -91,7 +91,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -119,7 +119,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -162,7 +162,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -178,7 +178,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 3aa9f4d102..9f2de7d4e9 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -123,7 +123,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -151,7 +151,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -195,7 +195,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -211,7 +211,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -237,7 +237,7 @@ title=Using default endpoints ```yaml {configFile="app"} # The name of the app container. Must be unique within a project. -name: app +name: myapp [...] @@ -254,7 +254,7 @@ title=Using explicit endpoints ```yaml {configFile="app"} # The name of the app container. Must be unique within a project. -name: app +name: myapp [...] diff --git a/sites/platform/src/add-services/kafka.md b/sites/platform/src/add-services/kafka.md index 75d19a3428..b5d611adab 100644 --- a/sites/platform/src/add-services/kafka.md +++ b/sites/platform/src/add-services/kafka.md @@ -80,7 +80,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -108,7 +108,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -152,7 +152,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -168,7 +168,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. diff --git a/sites/platform/src/add-services/memcached.md b/sites/platform/src/add-services/memcached.md index fab9866ea5..bf5a2ca7d9 100644 --- a/sites/platform/src/add-services/memcached.md +++ b/sites/platform/src/add-services/memcached.md @@ -92,7 +92,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -120,7 +120,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -163,7 +163,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -179,7 +179,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. diff --git a/sites/platform/src/add-services/mongodb.md b/sites/platform/src/add-services/mongodb.md index 1d0ee23c52..41bf21caa7 100644 --- a/sites/platform/src/add-services/mongodb.md +++ b/sites/platform/src/add-services/mongodb.md @@ -154,7 +154,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -182,7 +182,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -209,7 +209,7 @@ With the above definition, the application container now has access to the servi For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} -name: app +name: myapp # PHP extensions. runtime: extensions: @@ -236,7 +236,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -252,7 +252,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -293,7 +293,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -321,7 +321,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -348,7 +348,7 @@ With the above definition, the application container now has access to the servi For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} -name: app +name: myapp # PHP extensions. runtime: extensions: @@ -375,7 +375,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. @@ -391,7 +391,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp # 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. diff --git a/sites/platform/src/add-services/mysql/_index.md b/sites/platform/src/add-services/mysql/_index.md index 546f0677ca..795e384f76 100644 --- a/sites/platform/src/add-services/mysql/_index.md +++ b/sites/platform/src/add-services/mysql/_index.md @@ -671,7 +671,7 @@ mariadb: Expose these endpoints to your app as relationships in your [app configuration](../../create-apps/_index.md): ```yaml {configFile="app"} -name: app +name: myapp [...] diff --git a/sites/platform/src/add-services/mysql/mysql-replication.md b/sites/platform/src/add-services/mysql/mysql-replication.md index c2ec329ac6..dbfb424b44 100644 --- a/sites/platform/src/add-services/mysql/mysql-replication.md +++ b/sites/platform/src/add-services/mysql/mysql-replication.md @@ -44,7 +44,7 @@ Even if you won't be accessing the replication endpoint from your application, y Add a new relationship to your application container: ```yaml {configFile="app"} -name: app +name: myapp [...] diff --git a/sites/platform/src/add-services/network-storage.md b/sites/platform/src/add-services/network-storage.md index a517a77cd0..54188421c2 100644 --- a/sites/platform/src/add-services/network-storage.md +++ b/sites/platform/src/add-services/network-storage.md @@ -106,7 +106,7 @@ Back up your data before changing the service. To define the mount accessible by your application, use the following configuration: ```yaml {configFile="app"} -name: app +name: myapp mounts: : source: service @@ -135,7 +135,7 @@ network-storage: #### [App configuration](/create-apps/_index.md) ```yaml {configFile="app"} -name: app +name: myapp mounts: 'my/files': source: service @@ -229,7 +229,7 @@ You can then use this service to define a `network_dir` network mount and a `lo to be used by a `web` instance and a `queue` worker instance: ```yaml {configFile="apps"} -app: +myapp: # The type of the application to build. type: "nodejs:20" @@ -280,7 +280,7 @@ For example, the following `{{< vendor/configfile "app" >}}` file (fragment) kee (This assumes a Network Storage service named `files` has also been defined in `{{< vendor/configfile "services" >}}`.) ```yaml {configFile="apps"} -app: +myapp: # The type of the application to build. type: "php:{{% latest "php" %}}" @@ -343,7 +343,7 @@ However, the process is fundamentally "just" moving files around on disk, so it' Suppose you have this mount configuration: ```yaml {configFile="app"} -name: app +name: myapp mounts: web/uploads: source: local diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index b3abc38200..0e2916eda4 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -233,7 +233,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp [...] @@ -248,7 +248,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp [...] diff --git a/sites/platform/src/add-services/redis.md b/sites/platform/src/add-services/redis.md index 704391555a..25e4ebbebf 100644 --- a/sites/platform/src/add-services/redis.md +++ b/sites/platform/src/add-services/redis.md @@ -721,7 +721,7 @@ title=Using default endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp type: "php:{{% latest "php" %}}" relationships: @@ -746,7 +746,7 @@ title=Using explicit endpoints +++ ```yaml {configFile="app"} -name: app +name: myapp type: "php:{{% latest "php" %}}" relationships: diff --git a/sites/platform/src/add-services/solr.md b/sites/platform/src/add-services/solr.md index 356deb7740..d1a95f6488 100644 --- a/sites/platform/src/add-services/solr.md +++ b/sites/platform/src/add-services/solr.md @@ -321,7 +321,7 @@ It then defines two endpoints: `main` is connected to the `mainindex` core while Each endpoint is then available in the relationships definition in `{{< vendor/configfile "app" >}}`. For example, to allow an application to talk to both of the cores defined above its configuration should contain the following: ```yaml {configFile="app"} -name: app +name: myapp type: "php:{{% latest "php" %}}" diff --git a/sites/platform/src/administration/cli/_index.md b/sites/platform/src/administration/cli/_index.md index b051e48778..5fe470f379 100644 --- a/sites/platform/src/administration/cli/_index.md +++ b/sites/platform/src/administration/cli/_index.md @@ -174,13 +174,13 @@ You might want to use the CLI in a script to automate repetitive tasks such as s In such cases, you want to customize the CLI to bypass any confirmation questions. You can set the answer to every question as `yes` using the `{{% vendor/prefix_cli %}}_CLI_NO_INTERACTION` environment variable. -For instance, to locally sync every mount point for your app named `app`, you could use this command: +For instance, to locally sync every mount point for your app named `myapp`, you could use this command: ```bash export PLATFORM_PROJECT=my-project; export PLATFORM_BRANCH=main; export {{% vendor/prefix_cli %}}_CLI_NO_INTERACTION=1; -{{% vendor/cli %}} mount:download --all --app app --target local-backup +{{% vendor/cli %}} mount:download --all --app myapp --target local-backup ``` ### Autocomplete commands diff --git a/sites/platform/src/administration/cli/api-tokens.md b/sites/platform/src/administration/cli/api-tokens.md index 1bd5d1f2d2..cd4214bb69 100644 --- a/sites/platform/src/administration/cli/api-tokens.md +++ b/sites/platform/src/administration/cli/api-tokens.md @@ -162,13 +162,13 @@ Then add a build hook to your app configuration to install the CLI as part of th ```yaml {configFile="app"} hooks: - build: | - set -e - echo "Installing {{% vendor/name %}} CLI" - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash + build: | + set -e + echo "Installing {{% vendor/name %}} CLI" + curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash - echo "Testing {{% vendor/name %}} CLI" - {{% vendor/cli %}} + echo "Testing {{% vendor/name %}} CLI" + {{% vendor/cli %}} ``` You can now call the CLI from within the shell on the app container or in a cron job. @@ -180,16 +180,16 @@ You can set up a cron job on a specific type of environment. For example, to run the `update` source operation on your production environment, use the following cron job: -```yaml +```yaml {configFile="app"} crons: - update: - spec: '0 0 * * *' - commands: - start: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - {{% vendor/cli %}} backup:create --yes --no-wait - {{% vendor/cli %}} source-operation:run update --no-wait --yes - fi + update: + spec: '0 0 * * *' + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + {{% vendor/cli %}} backup:create --yes --no-wait + {{% vendor/cli %}} source-operation:run update --no-wait --yes + fi ``` ## Use the CLI SSH certificate for non-CLI commands diff --git a/sites/platform/src/create-apps/_index.md b/sites/platform/src/create-apps/_index.md index 7a46b19b60..b9e2818539 100644 --- a/sites/platform/src/create-apps/_index.md +++ b/sites/platform/src/create-apps/_index.md @@ -32,7 +32,7 @@ The following example shows such a basic setup for Node.js: ```yaml {configFile="app"} # The app's name, which must be unique within the project. -name: 'app' +name: 'myapp' # The language and version for your app. type: 'nodejs:{{% latest "nodejs" %}}' @@ -42,18 +42,18 @@ disk: 2048 # The app's configuration when it's exposed to the web. web: - commands: - start: npm start - locations: - '/': - # The public directory relative to the app root. - root: 'public' - # Forward resources to the app. - passthru: true - # What files to use when serving a directory. - index: ["index.html"] - # Allow files even without specified rules. - allow: true + commands: + start: npm start + locations: + '/': + # The public directory relative to the app root. + root: 'public' + # Forward resources to the app. + passthru: true + # What files to use when serving a directory. + index: ["index.html"] + # Allow files even without specified rules. + allow: true ``` ## Use multiple apps @@ -130,31 +130,31 @@ title=Single-runtime image ```yaml {configFile="app"} # The app's name, which must be unique within the project. -name: 'app' +name: 'myapp' # The language and version for your app. type: 'php:{{% latest "php" %}}' # Global dependencies to be added and cached and then available as commands. dependencies: - php: - composer/composer: '^2' + php: + composer/composer: '^2' # Relationships enable an app container's access to a service or another app. -# The example below shows simplified configuration leveraging a default 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: - mysql: + mysql: # Scripts that are run as part of the build and deploy process. hooks: - # Build hooks can modify app files on disk but not access any services like databases. - build: ./build.sh - # Deploy hooks can access services but the file system is now read-only. - deploy: ./deploy.sh - # Post deploy hooks run when the app is accepting outside requests. - post_deploy: ./post_deploy.sh + # Build hooks can modify app files on disk but not access any services like databases. + build: ./build.sh + # Deploy hooks can access services but the file system is now read-only. + deploy: ./deploy.sh + # Post deploy hooks run when the app is accepting outside requests. + post_deploy: ./post_deploy.sh # The size of the app's persistent disk (in MB). disk: 2048 @@ -163,25 +163,25 @@ disk: 2048 # The key is the directory path relative to the application root. # In this case, `web-files` is just a unique name for the mount. mounts: - 'web/files': - source: local - source_path: 'web-files' + 'web/files': + source: local + source_path: 'web-files' # The app's configuration when it's exposed to the web. web: - locations: - '/': - # The app's public directory relative to its root. - root: 'public' - # A front controller to determine how to handle requests. - passthru: '/app.php' - # Allow uploaded files to be served, but don't run scripts. - # Missing files get sent to the front controller. - '/files': - root: 'web/files' - scripts: false - allow: true - passthru: '/app.php' + locations: + '/': + # The app's public directory relative to its root. + root: 'public' + # A front controller to determine how to handle requests. + passthru: '/app.php' + # Allow uploaded files to be served, but don't run scripts. + # Missing files get sent to the front controller. + '/files': + root: 'web/files' + scripts: false + allow: true + passthru: '/app.php' ``` <---> @@ -192,27 +192,27 @@ title=Composable image ```yaml {configFile="app"} # The app's name, which must be unique within the project. myapp: - # The list of packages you want installed (from the {{% vendor/name %}} collection - # of supported runtimes and/or from Nixpkgs). - # For more information, see the Composable image page in the App reference section. - stack: - - "php@8.3" - # The list of PHP extensions you want installed. - extensions: - - apcu - - ctype - - iconv - - mbstring - - pdo_pgsql - - sodium - - xsl + # The list of packages you want installed (from the {{% vendor/name %}} collection + # of supported runtimes and/or from Nixpkgs). + # For more information, see the Composable image page in the App reference section. + stack: + - "php@8.3" + # The list of PHP extensions you want installed. + extensions: + - apcu + - ctype + - iconv + - mbstring + - pdo_pgsql + - sodium + - xsl # Relationships enable an app container's access to a service or another app. -# The example below shows simplified configuration leveraging a default 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: - mysql: + mysql: # Scripts that are run as part of the build and deploy process. hooks: @@ -230,9 +230,9 @@ disk: 2048 # The key is the directory path relative to the application root. # In this case, `web-files` is just a unique name for the mount. mounts: - 'web/files': - source: local - source_path: 'web-files' + 'web/files': + source: local + source_path: 'web-files' # The app's configuration when it's exposed to the web. web: @@ -251,4 +251,4 @@ web: passthru: '/app.php' ``` -{{< /codetabs >}} \ No newline at end of file +{{< /codetabs >}} diff --git a/sites/platform/src/create-apps/app-reference/composable-image.md b/sites/platform/src/create-apps/app-reference/composable-image.md index af66c31b13..567b853860 100644 --- a/sites/platform/src/create-apps/app-reference/composable-image.md +++ b/sites/platform/src/create-apps/app-reference/composable-image.md @@ -68,10 +68,10 @@ Define them as a YAML array as follows: ```yaml {configFile="apps"} myapp: - stack: [ "@" ] - # OR - stack: - - "@" + stack: [ "@" ] + # OR + stack: + - "@" ``` To add a language to your stack, use the `@` format.
@@ -136,11 +136,11 @@ To do so, use the following configuration: ```yaml {configFile="apps"} myapp: - stack: [ "php@{{% latest php %}}", "facedetect" ] - # OR - stack: - - "php@{{% latest php %}}" - - "facedetect" + stack: [ "php@{{% latest php %}}", "facedetect" ] + # OR + stack: + - "php@{{% latest php %}}" + - "facedetect" ``` ### PHP extensions and Python packages @@ -168,17 +168,17 @@ For instance: ```yaml {configFile="apps"} myapp: - source: - root: "/" - stack: - - "php@{{% latest "php" %}}": - extensions: - - apcu - - sodium - - xsl - - pdo_sqlite - disabled_extensions: - - gd + source: + root: "/" + stack: + - "php@{{% latest "php" %}}": + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite + disabled_extensions: + - gd ``` {{% note %}} @@ -204,9 +204,9 @@ use the following configuration: ```yaml {configFile="apps"} myapp: - stack: - - "python@3.12" - - "python312Packages.yq" # python package specific + stack: + - "python@3.12" + - "python312Packages.yq" # python package specific ``` Alternatively, if you need to include configuration options for your extensions, use either your ``php.ini`` file or [environment variables](/development/variables/set-variables.md). @@ -217,16 +217,16 @@ Here is a full composable image configuration example. Note the use of the `}} New syntax (default and explicit endpoints) described below is supported by most, but not all, image types -(`Relationship 'SERVICE_NAME' of application 'app' ... targets a service without a valid default endpoint configuration.`). +(`Relationship 'SERVICE_NAME' of application 'myapp' ... targets a service without a valid default endpoint configuration.`). This syntax is currently being rolled out for all images. If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. @@ -415,7 +415,7 @@ Use the following configuration: ```yaml {configFile="app"} relationships: - {{% variable "SERVICE_NAME" %}}: + {{% variable "SERVICE_NAME" %}}: ``` The `SERVICE_NAME` is the name of the service as defined in its [configuration](/add-services/_index.md). @@ -426,7 +426,7 @@ For example, if you define the following configuration: ```yaml {configFile="app"} relationships: - mariadb: + mariadb: ``` {{% vendor/name %}} looks for a service named `mariadb` in your `{{% vendor/configfile "services" %}}` file, @@ -436,18 +436,18 @@ For reference, the equivalent configuration using explicit endpoints would be th ```yaml {configFile="app"} relationships: - mariadb: - service: mariadb - endpoint: mysql + mariadb: + service: mariadb + endpoint: mysql ``` You can define any number of relationships in this way: ```yaml {configFile="app"} relationships: - mariadb: - redis: - elasticsearch: + mariadb: + redis: + elasticsearch: ``` {{< note title="Tip" theme="info" >}} @@ -462,14 +462,14 @@ where ```yaml {configFile="services"} {{< variable "SERVICE_NAME_A" >}}: - type: mariadb:{{% latest "mariadb" %}} - disk: 256 + type: mariadb:{{% latest "mariadb" %}} + disk: 256 {{< variable "SERVICE_NAME_B" >}}: - type: redis:{{% latest "redis" %}} - disk: 256 + type: redis:{{% latest "redis" %}} + disk: 256 {{< variable "SERVICE_NAME_C" >}}: - type: elasticsearch:{{% latest "elasticsearch" %}} - disk: 256 + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 256 ``` {{< /note >}} @@ -484,9 +484,9 @@ Use the following configuration: ```yaml {configFile="app"} relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}} + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}} ``` - `RELATIONSHIP_NAME` is the name you want to give to the relationship. @@ -498,9 +498,9 @@ use the following configuration: ```yaml {configFile="app"} relationships: - database: # The name of the relationship. - service: mariadb - endpoint: db1 + database: # The name of the relationship. + service: mariadb + endpoint: db1 ``` For more information on how to handle multiple databases, multiple cores, @@ -518,16 +518,16 @@ see each service's dedicated page: ```yaml {configFile="app"} relationships: - database1: - service: mariadb - endpoint: admin - database2: - service: mariadb - endpoint: legacy - cache: - service: redis - search: - service: elasticsearch + database1: + service: mariadb + endpoint: admin + database2: + service: mariadb + endpoint: legacy + cache: + service: redis + search: + service: elasticsearch ``` {{< /codetabs >}} @@ -536,16 +536,16 @@ relationships: The following legacy syntax for specifying relationships is still supported by {{% vendor/name %}}: -```yaml +```yaml {configFile="app"} relationships: - : ":" + : ":" ``` For example: -```yaml +```yaml {configFile="app"} relationships: - database: "mariadb:mysql" + database: "mariadb:mysql" ``` Feel free to use this until the default and explicit endpoint syntax is supported on all images. @@ -601,9 +601,9 @@ To define a mount, use the following configuration: ```yaml {configFile="app"} mounts: - '{{< variable "MOUNT_PATH" >}}': - source: {{< variable "MOUNT_TYPE" >}} - source_path: {{< variable "SOURCE_PATH_LOCATION" >}} + '{{< variable "MOUNT_PATH" >}}': + source: {{< variable "MOUNT_TYPE" >}} + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} ``` {{< variable "MOUNT_PATH" >}} is the path to your mount **within the app container** (relative to the app's root). @@ -629,21 +629,21 @@ The files still exist on disk until manually removed ```yaml {configFile="app"} mounts: - 'web/uploads': - source: local - source_path: uploads - '/.tmp_platformsh': - source: tmp - source_path: files/.tmp_platformsh - '/build': - source: local - source_path: files/build - '/.cache': - source: tmp - source_path: files/.cache - '/node_modules/.cache': - source: tmp - source_path: files/node_modules/.cache + 'web/uploads': + source: local + source_path: uploads + '/.tmp_platformsh': + source: tmp + source_path: files/.tmp_platformsh + '/build': + source: local + source_path: files/build + '/.cache': + source: tmp + source_path: files/.cache + '/node_modules/.cache': + source: tmp + source_path: files/node_modules/.cache ``` For examples of how to set up a `service` mount, see the dedicated [Network Storage page](/add-services/network-storage.md). @@ -656,8 +656,8 @@ Say you have a `/my/cache/` mount with an undefined `source_path`: ```yaml {configFile="app"} mounts: - '/my/cache/': - source: tmp + '/my/cache/': + source: tmp ``` If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. @@ -666,9 +666,9 @@ To ensure continuity, you need to explicitly define the `source_path` as the pre ```yaml {configFile="app"} mounts: - '/cache/files/': - source: tmp - source_path: my/cache + '/cache/files/': + source: tmp + source_path: my/cache ``` The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing files in that directory. @@ -678,9 +678,9 @@ The `/cache/files/` mount will point to the original `/my/cache/` directory, mai The locations of mounts as they are visible to application containers can overlap somewhat. For example: -```yaml +```yaml {configFile="apps"} applications: - my_app: + myapp: # ... mounts: 'var/cache_a': @@ -700,9 +700,9 @@ Each mount is restricted to a subfolder within `var`, and all is well. The following, however, is not allowed and will result in a failure: -```yaml +```yaml {configFile="apps"} applications: - my_app: + myapp: # ... mounts: 'var/': @@ -743,8 +743,8 @@ Example: ```yaml {configFile="app"} web: - commands: - start: 'uwsgi --ini conf/server.ini' + commands: + start: 'uwsgi --ini conf/server.ini' ``` This command runs every time your app is restarted, regardless of whether or not new code is deployed. @@ -782,9 +782,9 @@ The following example is the default on non-PHP containers: ```yaml {configFile="app"} web: - upstream: - socket_family: tcp - protocol: http + upstream: + socket_family: tcp + protocol: http ``` #### Where to listen @@ -834,17 +834,17 @@ This is overridden by a rule that explicitly allows common image file formats. ```yaml {configFile="app"} web: - locations: - '/': - # Handle dynamic requests - root: 'public' - passthru: '/index.php' - # Disallow static files - allow: false - rules: - # Allow common image files only. - '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': - allow: true + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/index.php' + # Disallow static files + allow: false + rules: + # Allow common image files only. + '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': + allow: true ``` #### Request buffering @@ -861,12 +861,12 @@ The default configuration would look like this: ```yaml {configFile="app"} web: - locations: - '/': - passthru: true - request_buffering: - enabled: true - max_request_size: 250m + locations: + '/': + passthru: true + request_buffering: + enabled: true + max_request_size: 250m ``` ## Workers @@ -891,11 +891,11 @@ A worker named `queue` that was small and had a different start command could lo ```yaml {configFile="app"} workers: - queue: - size: S - commands: - start: | - ./worker.sh + queue: + size: S + commands: + start: | + ./worker.sh ``` For resource allocation, using workers in your project requires a [{{< partial "plans/multiapp-plan-name" >}} plan or larger](https://platform.sh/pricing/). @@ -914,7 +914,7 @@ can access the deployed environment via SSH: ```yaml {configFile="app"} access: - ssh: admin + ssh: admin ``` ## Variables @@ -938,10 +938,10 @@ The following example sets two variables: ```yaml {configFile="app"} variables: - env: - AUTHOR: 'Juan' - d8config: - "system.site:name": 'My site rocks' + env: + AUTHOR: 'Juan' + d8config: + "system.site:name": 'My site rocks' ``` You can also define and access more [complex values](/development/variables/use-variables.md#access-complex-values). @@ -968,8 +968,8 @@ The default settings would look like this: ```yaml {configFile="app"} firewall: - outbound: - - ips: [ "0.0.0.0/0" ] + outbound: + - ips: [ "0.0.0.0/0" ] ``` ### Support for rules @@ -987,10 +987,10 @@ and requests to 1.2.3.4 on either port 80 or 443 are allowed: ```yaml {configFile="app"} firewall: - outbound: - - ips: [ "1.2.3.4/32" ] - ports: [ 443 ] - - ports: [ 80 ] + outbound: + - ips: [ "1.2.3.4/32" ] + ports: [ 443 ] + - ports: [ 80 ] ``` ### Outbound traffic to CDNs @@ -1013,13 +1013,13 @@ An example rule filtering by domain: ```yaml {configFile="app"} firewall: - outbound: - - protocol: tcp - domains: ["api.stripe.com", "api.twilio.com"] - ports: [80, 443] - - protocol: tcp - ips: ["1.2.3.4/29","2.3.4.5"] - ports: [22] + outbound: + - protocol: tcp + domains: ["api.stripe.com", "api.twilio.com"] + ports: [80, 443] + - protocol: tcp + ips: ["1.2.3.4/29","2.3.4.5"] + ports: [22] ``` #### Determine which domains to allow @@ -1150,12 +1150,12 @@ and update your existing cron jobs to ensure continuity. ```yaml {configFile="app"} crons: - mycommand: - spec: 'H * * * *' - commands: - start: sleep 60 && echo sleep-60-finished && date - stop: killall sleep - shutdown_timeout: 18 + mycommand: + spec: 'H * * * *' + commands: + start: sleep 60 && echo sleep-60-finished && date + stop: killall sleep + shutdown_timeout: 18 ``` In this example configuration, the [cron specification](#crons) uses the `H` syntax. diff --git a/sites/platform/src/create-apps/app-reference/single-runtime-image.md b/sites/platform/src/create-apps/app-reference/single-runtime-image.md index ad95cb0b10..06c981b1cf 100644 --- a/sites/platform/src/create-apps/app-reference/single-runtime-image.md +++ b/sites/platform/src/create-apps/app-reference/single-runtime-image.md @@ -216,7 +216,7 @@ For more information, see how to [define relationships between your apps](/creat {{< note title="Availability" theme="info">}} New syntax (default and explicit endpoints) described below is supported by most, but not all, image types -(`Relationship 'SERVICE_NAME' of application 'app' ... targets a service without a valid default endpoint configuration.`). +(`Relationship 'SERVICE_NAME' of application 'myapp' ... targets a service without a valid default endpoint configuration.`). This syntax is currently being rolled out for all images. If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. @@ -234,7 +234,7 @@ Use the following configuration: ```yaml {configFile="app"} relationships: - {{% variable "SERVICE_NAME" %}}: + {{% variable "SERVICE_NAME" %}}: ``` The `SERVICE_NAME` is the name of the service as defined in its [configuration](/add-services/_index.md). @@ -245,7 +245,7 @@ For example, if you define the following configuration: ```yaml {configFile="app"} relationships: - mariadb: + mariadb: ``` {{% vendor/name %}} looks for a service named `mariadb` in your `{{% vendor/configfile "services" %}}` file, @@ -255,18 +255,18 @@ For reference, the equivalent configuration using explicit endpoints would be th ```yaml {configFile="app"} relationships: - mariadb: - service: mariadb - endpoint: mysql + mariadb: + service: mariadb + endpoint: mysql ``` You can define any number of relationships in this way: ```yaml {configFile="app"} relationships: - mariadb: - redis: - elasticsearch: + mariadb: + redis: + elasticsearch: ``` {{< note title="Tip" theme="info" >}} @@ -281,14 +281,14 @@ where ```yaml {configFile="services"} {{< variable "SERVICE_NAME_A" >}}: - type: mariadb:{{% latest "mariadb" %}} - disk: 256 + type: mariadb:{{% latest "mariadb" %}} + disk: 256 {{< variable "SERVICE_NAME_B" >}}: - type: redis:{{% latest "redis" %}} - disk: 256 + type: redis:{{% latest "redis" %}} + disk: 256 {{< variable "SERVICE_NAME_C" >}}: - type: elasticsearch:{{% latest "elasticsearch" %}} - disk: 256 + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 256 ``` {{< /note >}} @@ -303,9 +303,9 @@ Use the following configuration: ```yaml {configFile="app"} relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}} + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}} ``` - `RELATIONSHIP_NAME` is the name you want to give to the relationship. @@ -317,9 +317,9 @@ use the following configuration: ```yaml {configFile="app"} relationships: - database: # The name of the relationship. - service: mariadb - endpoint: db1 + database: # The name of the relationship. + service: mariadb + endpoint: db1 ``` For more information on how to handle multiple databases, multiple cores, @@ -337,16 +337,16 @@ see each service's dedicated page: ```yaml {configFile="app"} relationships: - database1: - service: mariadb - endpoint: admin - database2: - service: mariadb - endpoint: legacy - cache: - service: redis - search: - service: elasticsearch + database1: + service: mariadb + endpoint: admin + database2: + service: mariadb + endpoint: legacy + cache: + service: redis + search: + service: elasticsearch ``` {{< /codetabs >}} @@ -355,16 +355,16 @@ relationships: The following legacy syntax for specifying relationships is still supported by {{% vendor/name %}}: -```yaml +```yaml {configFile="app"} relationships: - : ":" + : ":" ``` For example: -```yaml +```yaml {configFile="app"} relationships: - database: "mariadb:mysql" + database: "mariadb:mysql" ``` Feel free to use this until the default and explicit endpoint syntax is supported on all images. @@ -420,9 +420,9 @@ To define a mount, use the following configuration: ```yaml {configFile="app"} mounts: - '{{< variable "MOUNT_PATH" >}}': - source: {{< variable "MOUNT_TYPE" >}} - source_path: {{< variable "SOURCE_PATH_LOCATION" >}} + '{{< variable "MOUNT_PATH" >}}': + source: {{< variable "MOUNT_TYPE" >}} + source_path: {{< variable "SOURCE_PATH_LOCATION" >}} ``` {{< variable "MOUNT_PATH" >}} is the path to your mount **within the app container** (relative to the app's root). @@ -448,21 +448,21 @@ The files still exist on disk until manually removed ```yaml {configFile="app"} mounts: - 'web/uploads': - source: local - source_path: uploads - '/.tmp_platformsh': - source: tmp - source_path: files/.tmp_platformsh - '/build': - source: local - source_path: files/build - '/.cache': - source: tmp - source_path: files/.cache - '/node_modules/.cache': - source: tmp - source_path: files/node_modules/.cache + 'web/uploads': + source: local + source_path: uploads + '/.tmp_platformsh': + source: tmp + source_path: files/.tmp_platformsh + '/build': + source: local + source_path: files/build + '/.cache': + source: tmp + source_path: files/.cache + '/node_modules/.cache': + source: tmp + source_path: files/node_modules/.cache ``` For examples of how to set up a `service` mount, see the dedicated [Network Storage page](/add-services/network-storage.md). @@ -475,8 +475,8 @@ Say you have a `/my/cache/` mount with an undefined `source_path`: ```yaml {configFile="app"} mounts: - '/my/cache/': - source: tmp + '/my/cache/': + source: tmp ``` If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. @@ -485,9 +485,9 @@ To ensure continuity, you need to explicitly define the `source_path` as the pre ```yaml {configFile="app"} mounts: - '/cache/files/': - source: tmp - source_path: my/cache + '/cache/files/': + source: tmp + source_path: my/cache ``` The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing files in that directory. @@ -497,9 +497,9 @@ The `/cache/files/` mount will point to the original `/my/cache/` directory, mai The locations of mounts as they are visible to application containers can overlap somewhat. For example: -```yaml +```yaml {configFile="apps"} applications: - my_app: + myapp: # ... mounts: 'var/cache_a': @@ -519,9 +519,9 @@ Each mount is restricted to a subfolder within `var`, and all is well. The following, however, is not allowed and will result in a failure: -```yaml +```yaml {configFile="apps"} applications: - my_app: + myapp: # ... mounts: 'var/': @@ -564,8 +564,8 @@ Example: ```yaml {configFile="app"} web: - commands: - start: 'uwsgi --ini conf/server.ini' + commands: + start: 'uwsgi --ini conf/server.ini' ``` This command runs every time your app is restarted, regardless of whether or not new code is deployed. @@ -603,9 +603,9 @@ The following example is the default on non-PHP containers: ```yaml {configFile="app"} web: - upstream: - socket_family: tcp - protocol: http + upstream: + socket_family: tcp + protocol: http ``` #### Where to listen @@ -654,17 +654,17 @@ This is overridden by a rule that explicitly allows common image file formats. ```yaml {configFile="app"} web: - locations: - '/': - # Handle dynamic requests - root: 'public' - passthru: '/index.php' - # Disallow static files - allow: false - rules: - # Allow common image files only. - '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': - allow: true + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/index.php' + # Disallow static files + allow: false + rules: + # Allow common image files only. + '\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$': + allow: true ``` #### Request buffering @@ -680,12 +680,12 @@ The default configuration would look like this: ```yaml {configFile="app"} web: - locations: - '/': - passthru: true - request_buffering: - enabled: true - max_request_size: 250m + locations: + '/': + passthru: true + request_buffering: + enabled: true + max_request_size: 250m ``` ## Workers @@ -710,11 +710,11 @@ A worker named `queue` that was small and had a different start command could lo ```yaml {configFile="app"} workers: - queue: - size: S - commands: - start: | - ./worker.sh + queue: + size: S + commands: + start: | + ./worker.sh ``` For resource allocation, using workers in your project requires a [{{< partial "plans/multiapp-plan-name" >}} plan or larger](https://platform.sh/pricing/). @@ -732,7 +732,7 @@ can access the deployed environment via SSH: ```yaml {configFile="app"} access: - ssh: admin + ssh: admin ``` ## Variables @@ -754,10 +754,10 @@ The following example sets two variables: ```yaml {configFile="app"} variables: - env: - AUTHOR: 'Juan' - d8config: - "system.site:name": 'My site rocks' + env: + AUTHOR: 'Juan' + d8config: + "system.site:name": 'My site rocks' ``` You can also define and access more [complex values](/development/variables/use-variables.md#access-complex-values). @@ -783,8 +783,8 @@ The default settings would look like this: ```yaml {configFile="app"} firewall: - outbound: - - ips: ["0.0.0.0/0"] + outbound: + - ips: ["0.0.0.0/0"] ``` ### Support for rules @@ -802,10 +802,10 @@ and requests to 1.2.3.4 on either port 80 or 443 are allowed: ```yaml {configFile="app"} firewall: - outbound: - - ips: ["1.2.3.4/32"] - ports: [443] - - ports: [80] + outbound: + - ips: ["1.2.3.4/32"] + ports: [443] + - ports: [80] ``` ### Outbound traffic to CDNs @@ -828,13 +828,13 @@ An example rule filtering by domain: ```yaml {configFile="app"} firewall: - outbound: - - protocol: tcp - domains: ["api.stripe.com", "api.twilio.com"] - ports: [80, 443] - - protocol: tcp - ips: ["1.2.3.4/29","2.3.4.5"] - ports: [22] + outbound: + - protocol: tcp + domains: ["api.stripe.com", "api.twilio.com"] + ports: [80, 443] + - protocol: tcp + ips: ["1.2.3.4/29","2.3.4.5"] + ports: [22] ``` #### Determine which domains to allow @@ -875,7 +875,7 @@ In all languages, you can also specify a flavor of `none` to take no action at a ```yaml {configFile="app"} build: - flavor: none + flavor: none ``` ## Dependencies @@ -899,18 +899,18 @@ An example of dependencies in multiple languages: ```yaml {configFile="app"} dependencies: - php: # Specify one Composer package per line. - drush/drush: '8.0.0' - composer/composer: '^2' - python2: # Specify one Python 2 package per line. - behave: '*' - requests: '*' - python3: # Specify one Python 3 package per line. - numpy: '*' - ruby: # Specify one Bundler package per line. - sass: '3.4.7' - nodejs: # Specify one NPM package per line. - pm2: '^4.5.0' + php: # Specify one Composer package per line. + drush/drush: '8.0.0' + composer/composer: '^2' + python2: # Specify one Python 2 package per line. + behave: '*' + requests: '*' + python3: # Specify one Python 3 package per line. + numpy: '*' + ruby: # Specify one Bundler package per line. + sass: '3.4.7' + nodejs: # Specify one NPM package per line. + pm2: '^4.5.0' ``` ## Hooks @@ -1020,12 +1020,12 @@ and update your existing cron jobs to ensure continuity. ```yaml {configFile="app"} crons: - mycommand: - spec: 'H * * * *' - commands: - start: sleep 60 && echo sleep-60-finished && date - stop: killall sleep - shutdown_timeout: 18 + mycommand: + spec: 'H * * * *' + commands: + start: sleep 60 && echo sleep-60-finished && date + stop: killall sleep + shutdown_timeout: 18 ``` In this example configuration, the [cron specification](#crons) uses the `H` syntax. @@ -1045,17 +1045,17 @@ title=Drupal {{< snippet name="myapp" config="app" root="/" >}} type: 'php:{{% latest "php" %}}' crons: - # Run Drupal's cron tasks every 19 minutes. - drupal: - spec: '*/19 * * * *' - commands: - start: 'cd web ; drush core-cron' - # But also run pending queue tasks every 7 minutes. - # Use an odd number to avoid running at the same time as the `drupal` cron. - drush-queue: - spec: '*/7 * * * *' - commands: - start: 'cd web ; drush queue-run aggregator_feeds' + # Run Drupal's cron tasks every 19 minutes. + drupal: + spec: '*/19 * * * *' + commands: + start: 'cd web ; drush core-cron' + # But also run pending queue tasks every 7 minutes. + # Use an odd number to avoid running at the same time as the `drupal` cron. + drush-queue: + spec: '*/7 * * * *' + commands: + start: 'cd web ; drush queue-run aggregator_feeds' {{< /snippet >}} ``` @@ -1069,11 +1069,11 @@ title=Ruby on Rails {{< snippet name="myapp" config="app" root="/" >}} type: 'ruby:{{% latest "ruby" %}}' crons: - # Execute a rake script every 19 minutes. - ruby: - spec: '*/19 * * * *' - commands: - start: 'bundle exec rake some:task' + # Execute a rake script every 19 minutes. + ruby: + spec: '*/19 * * * *' + commands: + start: 'bundle exec rake some:task' {{< /snippet >}} ``` @@ -1087,11 +1087,11 @@ title=Laravel {{< snippet name="myapp" config="app" root="/" >}} type: 'php:{{% latest "php" %}}' crons: - # Run Laravel's scheduler every 5 minutes. - scheduler: - spec: '*/5 * * * *' - commands: - start: 'php artisan schedule:run' + # Run Laravel's scheduler every 5 minutes. + scheduler: + spec: '*/5 * * * *' + commands: + start: 'php artisan schedule:run' {{< /snippet >}} ``` @@ -1105,15 +1105,15 @@ title=Symfony {{< snippet name="myapp" config="app" root="/" >}} type: 'php:{{% latest "php" %}}' crons: - # Take a backup of the environment every day at 5:00 AM. - snapshot: - spec: 0 5 * * * - commands: - start: | - # Only run for the production environment, aka main branch - if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then - croncape symfony ... - fi + # Take a backup of the environment every day at 5:00 AM. + snapshot: + spec: 0 5 * * * + commands: + start: | + # Only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + croncape symfony ... + fi {{< /snippet >}} ``` @@ -1233,21 +1233,21 @@ You can enable [PHP extensions](/languages/php/extensions.md) just with a list o ```yaml {configFile="app"} runtime: - extensions: - - geoip - - tidy + extensions: + - geoip + - tidy ``` Alternatively, if you need to include configuration options, use a dictionary for that extension: ```yaml {configFile="app"} runtime: - extensions: - - geoip - - name: blackfire - configuration: - server_id: foo - server_token: bar + extensions: + - geoip + - name: blackfire + configuration: + server_id: foo + server_token: bar ``` In this case, the `name` property is required. diff --git a/sites/platform/src/create-apps/flexible-resources.md b/sites/platform/src/create-apps/flexible-resources.md index da97822a30..bace862a19 100644 --- a/sites/platform/src/create-apps/flexible-resources.md +++ b/sites/platform/src/create-apps/flexible-resources.md @@ -39,9 +39,9 @@ When the `resources` key is set, the CPU sizes come from the following table: So you might have the `resources` set as follows: ```yaml {configFile="app"} -resources: - base_memory: 128 - memory_ratio: 180 +resources: + base_memory: 128 + memory_ratio: 180 ``` If your app is set with a `size` of `S`, it gets 218 MB of memory: `128 + (0.5 * 180) = 218`. diff --git a/sites/platform/src/create-apps/hooks/_index.md b/sites/platform/src/create-apps/hooks/_index.md index 88d4d77f25..448cc52518 100644 --- a/sites/platform/src/create-apps/hooks/_index.md +++ b/sites/platform/src/create-apps/hooks/_index.md @@ -38,8 +38,8 @@ Create your `build` hook to install them all: ```yaml {configfile="app" dir="client" } hooks: - build: | - set -e + build: | + set -e ``` The hook has two parts so far: @@ -56,9 +56,9 @@ Create your `build` hook to install them all: ```yaml {configfile="app" dir="client"} hooks: - build: | - set -e - yarn --frozen-lockfile + build: | + set -e + yarn --frozen-lockfile ``` This installs all the dependencies for the main app. @@ -73,23 +73,23 @@ Create your `build` hook to install them all: ```yaml {configfile="app" dir="client"} hooks: - build: | - set -e - yarn --frozen-lockfile + build: | + set -e + yarn --frozen-lockfile - cd platformsh-scripts/test + cd platformsh-scripts/test ``` 5. Install the dependencies for the testing script: ```yaml {configfile="app" dir="client"} hooks: - build: | - set -e - yarn --frozen-lockfile + build: | + set -e + yarn --frozen-lockfile - cd platformsh-scripts/test - yarn --frozen-lockfile + cd platformsh-scripts/test + yarn --frozen-lockfile ``` Now all your Next.js dependencies are installed. @@ -124,18 +124,18 @@ All of this configuration and preparation can be handled in a bash script. ```yaml {configfile="app" dir="api"} mounts: - /.drush: - source: storage - source_path: 'drush' + /.drush: + source: storage + source_path: 'drush' ``` 4. Add a `deploy` hook that runs the preparation script: ```yaml {configfile="app" dir="api"} hooks: - deploy: !include - type: string - path: platformsh-scripts/hooks.deploy.sh + deploy: !include + type: string + path: platformsh-scripts/hooks.deploy.sh ``` This `!include` syntax tells the hook to process the script as if it were included in the YAML file directly. @@ -161,9 +161,9 @@ So you don't have to rebuild Drupal but you still get fresh content. ```yaml {configfile="app" dir="client"} relationships: - api: - service: 'api' - endpoint: 'http' + api: + service: 'api' + endpoint: 'http' ``` 2. Set [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). @@ -172,28 +172,28 @@ So you don't have to rebuild Drupal but you still get fresh content. ```yaml {configfile="app" dir="client"} mounts: - /.cache: - source: local - source_path: 'cache' - /.next: - source: local - source_path: 'next' - /.pm2: - source: local - source_path: 'pm2' - deploy: - source: service - service: files - source_path: deploy + /.cache: + source: local + source_path: 'cache' + /.next: + source: local + source_path: 'next' + /.pm2: + source: local + source_path: 'pm2' + deploy: + source: service + service: files + source_path: deploy ``` 3. Add a `post_deploy` hook that first tests the connection between the apps: ```yaml {configfile="app" dir="client"} hooks: - post_deploy: | - . deploy/platformsh.environment - cd platformsh-scripts/test && yarn debug + post_deploy: | + . deploy/platformsh.environment + cd platformsh-scripts/test && yarn debug ``` Note that you could add `set -e` here, but even if the job fails, the build/deployment itself can still be counted as successful. @@ -202,11 +202,11 @@ So you don't have to rebuild Drupal but you still get fresh content. ```yaml {configfile="app" dir="client"} hooks: - post_deploy: | - . deploy/platformsh.environment - cd platformsh-scripts/test && yarn debug + post_deploy: | + . deploy/platformsh.environment + cd platformsh-scripts/test && yarn debug - cd $PLATFORM_APP_DIR && yarn build + cd $PLATFORM_APP_DIR && yarn build ``` The `$PLATFORM_APP_DIR` variable represents the app root and can always get you back there. @@ -228,39 +228,39 @@ name: 'drupal' type: 'php:8.1' dependencies: - php: - composer/composer: '^2' + php: + composer/composer: '^2' # The relationships of the app with services or other apps. relationships: - database: - service: 'db' - endpoint: 'mysql' - redis: - service: 'cache' - endpoint: 'redis' + database: + service: 'db' + endpoint: 'mysql' + redis: + service: 'cache' + endpoint: 'redis' # The hooks executed at various points in the lifecycle of the app. hooks: - deploy: !include - type: string - path: platformsh-scripts/hooks.deploy.sh + deploy: !include + type: string + path: platformsh-scripts/hooks.deploy.sh # The size of the persistent disk of the app (in MB). disk: 2048 # The 'mounts' describe writable, persistent filesystem mounts in the app. mounts: - /.drush: - source: local - source_path: 'drush' - /drush-backups: - source: local - source_path: 'drush-backups' - deploy: - source: service - service: files - source_path: deploy + /.drush: + source: local + source_path: 'drush' + /drush-backups: + source: local + source_path: 'drush-backups' + deploy: + source: service + service: files + source_path: deploy ``` ### Next.js @@ -273,48 +273,48 @@ name: 'nextjs' type: 'nodejs:14' dependencies: - nodejs: - yarn: "1.22.17" - pm2: "5.2.0" + nodejs: + yarn: "1.22.17" + pm2: "5.2.0" build: - flavor: none + flavor: none relationships: - api: - service: 'api' - endpoint: 'http' + api: + service: 'api' + endpoint: 'http' # The hooks that are triggered when the package is deployed. hooks: - build: | - set -e - yarn --frozen-lockfile # Install dependencies for the main app + build: | + set -e + yarn --frozen-lockfile # Install dependencies for the main app - cd platformsh-scripts/test - yarn --frozen-lockfile # Install dependencies for the testing script + cd platformsh-scripts/test + yarn --frozen-lockfile # Install dependencies for the testing script # Next.js's build is delayed to the post_deploy hook, when Drupal is available for requests. - post_deploy: | - . deploy/platformsh.environment - cd platformsh-scripts/test && yarn debug + post_deploy: | + . deploy/platformsh.environment + cd platformsh-scripts/test && yarn debug - cd $PLATFORM_APP_DIR && yarn build + cd $PLATFORM_APP_DIR && yarn build # The size of the persistent disk of the app (in MB). disk: 512 mounts: - /.cache: - source: local - source_path: 'cache' - /.next: - source: local - source_path: 'next' - /.pm2: - source: local - source_path: 'pm2' - deploy: - source: service - service: files - source_path: deploy + /.cache: + source: local + source_path: 'cache' + /.next: + source: local + source_path: 'next' + /.pm2: + source: local + source_path: 'pm2' + deploy: + source: service + service: files + source_path: deploy ``` diff --git a/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md b/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md index d67cc8138e..9bd52c6d93 100644 --- a/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md +++ b/sites/platform/src/create-apps/hooks/hooks-and-dependencies.md @@ -23,11 +23,11 @@ Set your app configuration to have Sass available globally and use it: ```yaml {configFile="app"} # Ensure sass is available globally dependencies: - nodejs: - sass: "^1.47.0" + nodejs: + sass: "^1.47.0" hooks: - # Run the script defined in package.json - build: | - npm run build-css + # Run the script defined in package.json + build: | + npm run build-css ``` diff --git a/sites/platform/src/create-apps/hooks/vary-hooks-by-environment.md b/sites/platform/src/create-apps/hooks/vary-hooks-by-environment.md index 59ec885888..e7f9d6da07 100644 --- a/sites/platform/src/create-apps/hooks/vary-hooks-by-environment.md +++ b/sites/platform/src/create-apps/hooks/vary-hooks-by-environment.md @@ -14,11 +14,11 @@ Check the `PLATFORM_ENVIRONMENT_TYPE` variable to see if it's in a production en ```yaml {configFile="app"} hooks: - deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - # Run commands only when deploying to production - else - # Run commands only when deploying to development or staging environments - fi - # Commands to run regardless of the environment + deploy: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + # Run commands only when deploying to production + else + # Run commands only when deploying to development or staging environments + fi + # Commands to run regardless of the environment ``` diff --git a/sites/platform/src/create-apps/multi-app/project-structure.md b/sites/platform/src/create-apps/multi-app/project-structure.md index 0bc908ef33..c7e84e5003 100644 --- a/sites/platform/src/create-apps/multi-app/project-structure.md +++ b/sites/platform/src/create-apps/multi-app/project-structure.md @@ -313,7 +313,8 @@ from the [unified app configuration](#unified-app-configuration) example project you could add the following configuration: ```yaml {configFile="apps"} -source: +admin: + source: root: admin ``` diff --git a/sites/platform/src/create-apps/multi-app/routes.md b/sites/platform/src/create-apps/multi-app/routes.md index 9c1e8d441e..c899d42bd7 100644 --- a/sites/platform/src/create-apps/multi-app/routes.md +++ b/sites/platform/src/create-apps/multi-app/routes.md @@ -22,22 +22,22 @@ In this project, you have a CMS app, two frontend apps (one using Symfony and an and a Mercure Rocks server app, defined as follows: ```yaml {configFile="apps"} -- name: admin +admin: type: nodejs:16 source: root: admin ... -- name: api +api: type: php:8.2 source: root: api ... -- name: gatsby +gatsby: type: nodejs:18 source: root: gatsby ... -- name: mercure +mercure: type: golang:1.18 source: root: mercure/.config @@ -63,11 +63,11 @@ You could define routes for your apps as follows: ```yaml {configFile="routes"} "https://mercure.{default}/": - type: upstream - upstream: "mercure:http" + type: upstream + upstream: "mercure:http" "https://{default}/": - type: upstream - upstream: "api:http" + type: upstream + upstream: "api:http" ``` So if your default domain is `example.com`, that means: @@ -88,8 +88,8 @@ Alternatively, you could define your routes as follows: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "api:http" + type: upstream + upstream: "api:http" "https://{default}/admin": type: upstream upstream: "admin:http" @@ -98,19 +98,19 @@ Alternatively, you could define your routes as follows: Then you would need to configure each app's `web.locations` property to match these paths: ```yaml {configFile="apps"} -- name: api - type: php:8.2 - source: - root: api - ... - web: - locations: - "/": - passthru: "/index.php" - root: "public" - index: - - index.php -- name: admin +api: + type: php:8.2 + source: + root: api + ... + web: + locations: + "/": + passthru: "/index.php" + root: "public" + index: + - index.php +admin: type: nodejs:16 source: root: admin diff --git a/sites/platform/src/create-apps/runtime-operations.md b/sites/platform/src/create-apps/runtime-operations.md index 861776a4d2..ef8dd3cf22 100644 --- a/sites/platform/src/create-apps/runtime-operations.md +++ b/sites/platform/src/create-apps/runtime-operations.md @@ -42,10 +42,10 @@ you could define an operation like the following: ```yaml {configFile="app"} operations: - clear-rebuild: - role: admin - commands: - start: drush cache:rebuild + clear-rebuild: + role: admin + commands: + start: drush cache:rebuild ``` The name of the runtime operation in this case is `clear-rebuild`. @@ -136,10 +136,10 @@ define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - gatsby-build: - role: viewer - commands: - start: gatsby build + gatsby-build: + role: viewer + commands: + start: gatsby build {{< /snippet >}} ``` @@ -161,13 +161,13 @@ define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - next-build: - role: admin - commands: - # All below are valid, depending on your setup - start: next build - # start: npx next build - # start: npm run build + next-build: + role: admin + commands: + # All below are valid, depending on your setup + start: next build + # start: npx next build + # start: npm run build {{< /snippet >}} ``` @@ -194,13 +194,13 @@ To ping your Node.js app, define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - pm2-ping: - role: admin - commands: - start: | - # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT - APP=$(cat package.json | jq -r '.name') - pm2 ping $APP + pm2-ping: + role: admin + commands: + start: | + # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT + APP=$(cat package.json | jq -r '.name') + pm2 ping $APP {{< /snippet >}} ``` @@ -221,13 +221,13 @@ To reload your Node.js app, define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - pm2-reload: - role: admin - commands: - start: | - # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT - APP=$(cat package.json | jq -r '.name') - pm2 reload $APP + pm2-reload: + role: admin + commands: + start: | + # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT + APP=$(cat package.json | jq -r '.name') + pm2 reload $APP {{< /snippet >}} ``` To trigger your runtime operation, run a command similar to the following: @@ -247,13 +247,13 @@ To restart your Node.js app, define a runtime operation similar to the following {{< snippet name="myapp" config="app" root="myapp" >}} operations: - pm2-restart: - role: admin - commands: - start: | - # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT - APP=$(cat package.json | jq -r '.name') - pm2 restart $APP + pm2-restart: + role: admin + commands: + start: | + # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT + APP=$(cat package.json | jq -r '.name') + pm2 restart $APP {{< /snippet >}} ``` @@ -271,15 +271,15 @@ On a Django project, you can [define custom `django-admin` commands](https://doc To do so, define a runtime operation similar to the following: ```yaml {configFile="app"} -name: app +name: myapp type: python:{{% latest "python" %}} operations: - manual-migration: - role: admin - commands: - start: python manage.py manual_migration + manual-migration: + role: admin + commands: + start: python manage.py manual_migration ``` To trigger your runtime operation, run a command similar to the following: diff --git a/sites/platform/src/create-apps/source-operations.md b/sites/platform/src/create-apps/source-operations.md index ededb41b64..4969779fe9 100644 --- a/sites/platform/src/create-apps/source-operations.md +++ b/sites/platform/src/create-apps/source-operations.md @@ -58,21 +58,21 @@ The syntax is similar to the following: ```yaml {configFile="app"} source: - operations: - {{< variable "SOURCE_OPERATION_NAME" >}}: - command: {{< variable "COMMAND" >}} + operations: + {{< variable "SOURCE_OPERATION_NAME" >}}: + command: {{< variable "COMMAND" >}} ``` For example, to update a file from a remote location, you could define an operation like this: ```yaml {configFile="app"} source: - operations: - update-file: - command: | - set -e - curl -O https://example.com/myfile.txt - git add myfile.txt - git commit -m "Update remote file" + operations: + update-file: + command: | + set -e + curl -O https://example.com/myfile.txt + git add myfile.txt + git commit -m "Update remote file" ``` The name of the source operation in this case is `update-file`. @@ -126,13 +126,13 @@ to pass to a source operation similar to the following: ```yaml {configFile="app"} source: - operations: - update-file: - command: | - set -e - curl -O https://example.com/$FILE - git add $FILE - git commit -m "Update remote file" + operations: + update-file: + command: | + set -e + curl -O https://example.com/$FILE + git add $FILE + git commit -m "Update remote file" ``` Follow these steps to run the source operation: @@ -236,13 +236,13 @@ Make sure you carefully check your [user access on this project](../administrati ```yaml {configFile="app"} hooks: - build: | - set -e - echo "Installing {{% vendor/name %}} CLI" - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash + build: | + set -e + echo "Installing {{% vendor/name %}} CLI" + curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash - echo "Testing {{% vendor/name %}} CLI" - {{% vendor/cli %}} + echo "Testing {{% vendor/name %}} CLI" + {{% vendor/cli %}} ``` 3. Then, to configure a cron job to automatically run a source operation once a day, @@ -250,14 +250,14 @@ hooks: ```yaml {configFile="app"} crons: - update: - # Run the code below every day at midnight. - spec: '0 0 * * *' - commands: - start: | - set -e - {{% vendor/cli %}} sync -e development code data --no-wait --yes - {{% vendor/cli %}} source-operation:run update-file --no-wait --yes + update: + # Run the code below every day at midnight. + spec: '0 0 * * *' + commands: + start: | + set -e + {{% vendor/cli %}} sync -e development code data --no-wait --yes + {{% vendor/cli %}} source-operation:run update-file --no-wait --yes ``` The example above synchronizes the `development` environment with its parent @@ -287,13 +287,13 @@ The following source operation syncronizes your branch with an upstream Git repo ```yaml {configFile="app"} source: - operations: - upstream-update: - command: | - set -e - git remote add upstream $UPSTREAM_REMOTE - git fetch --all - git merge upstream/main + operations: + upstream-update: + command: | + set -e + git remote add upstream $UPSTREAM_REMOTE + git fetch --all + git merge upstream/main ``` 3. Now every time you run the `upstream-update` operation on a given branch, @@ -312,10 +312,10 @@ and you need to quickly revert to the previous state. ```yaml {configFile="app"} source: - operations: - revert: - command: | - git reset --hard HEAD~ + operations: + revert: + command: | + git reset --hard HEAD~ ``` Now every time you run the `revert` operation on a given branch, @@ -327,13 +327,13 @@ The following source operation uses Composer to update Drupal Core: ```yaml {configFile="app"} source: - operations: - update-drupal-core: - command: | - set -e - composer update drupal/core --with-dependencies - git add composer.lock - git commit -m "Automated Drupal Core update." + operations: + update-drupal-core: + command: | + set -e + composer update drupal/core --with-dependencies + git add composer.lock + git commit -m "Automated Drupal Core update." ``` `--with-dependencies` is used to also update Drupal Core dependencies. @@ -349,13 +349,13 @@ or [overriding it](#use-variables-in-your-source-operations) when running the so ```yaml {configFile="app"} source: - operations: - download-drupal-extension: - command: | - set -e - composer require $EXTENSION - git add composer.json - git commit -am "Automated install of: $EXTENSION via Composer." + operations: + download-drupal-extension: + command: | + set -e + composer require $EXTENSION + git add composer.json + git commit -am "Automated install of: $EXTENSION via Composer." ``` Now every time you run the `download-drupal-extension` operation, it downloads the defined extension. @@ -370,16 +370,16 @@ The following source operation updates all Git submodules recursively: ```yaml {configFile="app"} source: - operations: - rebuild: - command: | - set -e - git submodule update --init --recursive - git submodule update --remote --checkout - SHA=$(git submodule | awk -F' ' '{print $1}' | sed -s 's/+//g') - echo -n "$SHA" > .sha - git add uppler .sha - git commit -m "Updating submodule to commit '$SHA'" + operations: + rebuild: + command: | + set -e + git submodule update --init --recursive + git submodule update --remote --checkout + SHA=$(git submodule | awk -F' ' '{print $1}' | sed -s 's/+//g') + echo -n "$SHA" > .sha + git add uppler .sha + git commit -m "Updating submodule to commit '$SHA'" ``` Now every time you run the `rebuild` operation, it updates the Git submodules. diff --git a/sites/platform/src/create-apps/timezone.md b/sites/platform/src/create-apps/timezone.md index c28e00b2cc..b1bfab5a3e 100644 --- a/sites/platform/src/create-apps/timezone.md +++ b/sites/platform/src/create-apps/timezone.md @@ -42,8 +42,8 @@ Add the following to your app configuration: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} variables: - php: - "date.timezone": "Europe/Paris" + php: + "date.timezone": "Europe/Paris" {{< /snippet >}} ``` diff --git a/sites/platform/src/create-apps/troubleshoot-mounts.md b/sites/platform/src/create-apps/troubleshoot-mounts.md index 14bee28547..41932f841d 100644 --- a/sites/platform/src/create-apps/troubleshoot-mounts.md +++ b/sites/platform/src/create-apps/troubleshoot-mounts.md @@ -48,12 +48,12 @@ This example defines two mounts, one named `private` and one `upload`: ```yaml {configFile="app"} mounts: - 'private': - source: local - source_path: private - 'uploads': - source: local - source_path: uploads + 'private': + source: local + source_path: private + 'uploads': + source: local + source_path: uploads ``` With only this definition, their behavior is the same. @@ -61,17 +61,17 @@ To make `uploads` accessible, define a location with different rules as in the f ```yaml {configFile="app"} web: - locations: - '/': - # Handle dynamic requests - root: 'public' - passthru: '/app.php' - # Allow uploaded files to be served, but don't run scripts. - '/uploads': - root: 'uploads' - expires: 300s - scripts: false - allow: true + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/app.php' + # Allow uploaded files to be served, but don't run scripts. + '/uploads': + root: 'uploads' + expires: 300s + scripts: false + allow: true ``` ## Mounts starting with a dot ignored @@ -82,9 +82,9 @@ To mount a directory starting with a dot, put a `/` at the start of its definiti ```yaml {configFile="app"} mounts: - '/.myhiddenfolder': - source: local - source_path: 'myhiddenfolder' + '/.myhiddenfolder': + source: local + source_path: 'myhiddenfolder' ``` ## Disk space issues diff --git a/sites/platform/src/create-apps/upgrading.md b/sites/platform/src/create-apps/upgrading.md index 34594edc7c..52ca84f7a3 100644 --- a/sites/platform/src/create-apps/upgrading.md +++ b/sites/platform/src/create-apps/upgrading.md @@ -8,21 +8,21 @@ weight: 12 * The cron `cmd` syntax is now deprecated in favor of `commands`. Previous cron job definitions looked like this: - ```yaml + ```yaml {configFile="app"} crons: - sendemails: - spec: '*/7 * * * *' - cmd: cd public && send-pending-emails.sh + sendemails: + spec: '*/7 * * * *' + cmd: cd public && send-pending-emails.sh ``` They should now be written like this: - ```yaml + ```yaml {configFile="app"} crons: - sendemails: - spec: '*/7 * * * *' - commands: - start: cd public && send-pending-emails.sh + sendemails: + spec: '*/7 * * * *' + commands: + start: cd public && send-pending-emails.sh ``` The new syntax offers greater flexibility and configuration. @@ -37,46 +37,46 @@ weight: 12 * The `!archive` tag in YAML files is now deprecated in favor of the more generic [`!include`](/learn/overview/yaml/_index.md). For example, the following `{{< vendor/configfile "services" >}}` snippet: - ```yaml + ```yaml {configFile="services"} mysearch: - type: solr:6.3 - disk: 1024 - configuration: - core_config: !archive "myconfdir" + type: solr:6.3 + disk: 1024 + configuration: + core_config: !archive "myconfdir" ``` Can now be written as: - ```yaml + ```yaml {configFile="services"} mysearch: - type: solr:6.3 - disk: 1024 - configuration: - core_config: !include - type: archive - path: "myconfdir" + type: solr:6.3 + disk: 1024 + configuration: + core_config: !include + type: archive + path: "myconfdir" ``` * The syntax for the `mounts` key in `{{< vendor/configfile "app" >}}` has changed. Rather than a parsed string, the value of each mount is a [multi-key definition](/create-apps/app-reference/single-runtime-image.md#mounts). That is, the following example: - ```yaml + ```yaml {configFile="app"} mounts: - "tmp": "shared:files/tmp" - "logs": "shared:files/logs" + "tmp": "shared:files/tmp" + "logs": "shared:files/logs" ``` Can now be written as: - ```yaml + ```yaml {configFile="app"} mounts: - tmp: - source: local - source_path: tmp - logs: - source: local - source_path: logs + tmp: + source: local + source_path: tmp + logs: + source: local + source_path: logs ``` @@ -96,29 +96,29 @@ To ensure consistent behaviour that doesn't depend on which browser the client is using, the new default behaviour is to set these headers to values that disable client-side caching. This change only affects static files served directly by the web server. Responses served from `passthru` URLs continue to use -whatever caching headers were set by the application.. +whatever caching headers were set by the application. To enable caching on your static files, make sure you include an `expires` key in your [web configuration](/create-apps/app-reference/single-runtime-image.md), as shown below: -```yaml +```yaml {configFile="app"} web: - locations: - "/": - root: "public" - passthru: "/index.php" - index: - - index.php - expires: 300 - scripts: true - allow: true - rules: - \.mp4$: - allow: false - expires: -1 - "/sites/default/files": - expires: 300 - passthru: true - allow: true + locations: + "/": + root: "public" + passthru: "/index.php" + index: + - index.php + expires: 300 + scripts: true + allow: true + rules: + \.mp4$: + allow: false + expires: -1 + "/sites/default/files": + expires: 300 + passthru: true + allow: true ``` ## Changes in version 2016.4 @@ -134,60 +134,60 @@ The previous default files, for reference, are: ### Application -```yaml +```yaml {configFile="app"} name: php type: "php:5.4" build: - flavor: "drupal" + flavor: "drupal" access: - ssh: contributor + ssh: contributor relationships: - database: "mysql:mysql" - solr: "solr:solr" - redis: "redis:redis" + database: "mysql:mysql" + solr: "solr:solr" + redis: "redis:redis" web: - document_root: "/" - passthru: "/index.php" + document_root: "/" + passthru: "/index.php" disk: 2048 mounts: - "public/sites/default/files": "shared:files/files" - "tmp": "shared:files/tmp" - "private": "shared:files/private" + "public/sites/default/files": "shared:files/files" + "tmp": "shared:files/tmp" + "private": "shared:files/private" crons: - drupal: - spec: "*/20 * * * *" - cmd: "cd public ; drush core-cron" + drupal: + spec: "*/20 * * * *" + cmd: "cd public ; drush core-cron" ``` ### Routes -```yaml - "http://{default}/": - type: upstream - upstream: "php:http" - cache: - enabled: true - ssi: - enabled: false - - "http://www.{default}/": - type: redirect - to: "http://{default}/" +```yaml {configFile="routes"} +"http://{default}/": + type: upstream + upstream: "php:http" + cache: + enabled: true + ssi: + enabled: false + +"http://www.{default}/": + type: redirect + to: "http://{default}/" ``` ### Services -```yaml - mysql: - type: mysql:5.5 - disk: 2048 +```yaml {configFile="services"} +mysql: + type: mysql:5.5 + disk: 2048 - redis: - type: redis:2.8 +redis: + type: redis:2.8 - solr: - type: solr:3.6 - disk: 1024 +solr: + type: solr:3.6 + disk: 1024 ``` ## Changes in version 2016.3 @@ -201,54 +201,55 @@ If you are using Drupal, move all of your Drupal files into "public/" in the Git Old format: -```yaml +```yaml {configFile="app"} web: - document_root: "/" - passthru: "/index.php" - index_files: - - "index.php" - expires: 300 - whitelist: - - \.html$ + document_root: "/" + passthru: "/index.php" + index_files: + - "index.php" + expires: 300 + whitelist: + - \.html$ ``` New format: -```yaml +```yaml {configFile="app"} web: - locations: - "/": - root: "public" - passthru: "/index.php" - index: - - index.php - expires: 300 - scripts: true - allow: true - rules: - \.mp4$: - allow: false - expires: -1 - "/sites/default/files": - expires: 300 - passthru: true - allow: true + locations: + "/": + root: "public" + passthru: "/index.php" + index: + - index.php + expires: 300 + scripts: true + allow: true + rules: + \.mp4$: + allow: false + expires: -1 + "/sites/default/files": + expires: 300 + passthru: true + allow: true ``` ### Backward compatibility We generally try to keep backward compatibility with previous configuration formats. Here is what happens if you don't upgrade your configuration: -```yaml -# The following parameters are automatically moved as a "/" block in the -# "locations" object, and are invalid if there is a valid "locations" block. -document_root: "/public" # Converted to [locations][/][root] -passthru: "/index.php" # Converted to [locations][/][passthru] -index_files: - - index.php # Converted to [locations][/][index] -whitelist: [ ] # Converted to [locations][/][rules] -blacklist: [ ] # Converted to [locations][/][rules] -expires: 3d # Converted to [locations][/][expires] +```yaml {configFile="app"} +web: + # The following parameters are automatically moved as a "/" block in the + # "locations" object, and are invalid if there is a valid "locations" block. + document_root: "/public" # Converted to [locations][/][root] + passthru: "/index.php" # Converted to [locations][/][passthru] + index_files: + - index.php # Converted to [locations][/][index] + whitelist: [ ] # Converted to [locations][/][rules] + blacklist: [ ] # Converted to [locations][/][rules] + expires: 3d # Converted to [locations][/][expires] ``` ## Changes in version 2015.7 @@ -257,17 +258,17 @@ The `{{< vendor/configfile "app" >}}` configuration file now allows for a much c The old format had a single string to identify the `toolstack` you use: -```yaml +```yaml {configFile="app"} toolstack: "php:drupal" ``` The new syntax allows to separate the concerns of what language you are running and the build process that is going to happen on deployment: -```yaml +```yaml {configFile="app"} type: php build: - flavor: drupal + flavor: drupal ``` Currently we only support `php` in the 'type' key. Current supported build flavors are `drupal`, `composer` and `symfony`. diff --git a/sites/platform/src/create-apps/web/custom-headers.md b/sites/platform/src/create-apps/web/custom-headers.md index d188699e5c..4ab8701425 100644 --- a/sites/platform/src/create-apps/web/custom-headers.md +++ b/sites/platform/src/create-apps/web/custom-headers.md @@ -18,12 +18,12 @@ Start by defining a header for files in general: ```yaml {configFile="app"} web: - locations: - "/": - ... - # Apply rules to all static files (dynamic files get rules from your app) - headers: - X-Frame-Options: SAMEORIGIN + locations: + "/": + ... + # Apply rules to all static files (dynamic files get rules from your app) + headers: + X-Frame-Options: SAMEORIGIN ``` This sets the `X-Frame-Options` header to `SAMEORIGIN` for all static files. @@ -33,13 +33,13 @@ Now set up an exception for MP3 files using a [rule](/create-apps/app-reference/ ```yaml {configFile="app"} web: - locations: - "/": - ... - rules: - \.mp3$: - headers: - Content-Type: audio/mpeg + locations: + "/": + ... + rules: + \.mp3$: + headers: + Content-Type: audio/mpeg ``` This rule sets an explicit content type for files that end in `.mp3`. @@ -50,14 +50,14 @@ Now set a rule for MP4 files. ```yaml {configFile="app"} web: - locations: - "/": - ... - rules: - \.mp4$: - headers: - X-Frame-Options: SAMEORIGIN - Content-Type: video/mp4 + locations: + "/": + ... + rules: + \.mp4$: + headers: + X-Frame-Options: SAMEORIGIN + Content-Type: video/mp4 ``` This rule sets an explicit content type for files that end in `.mp4`. @@ -77,12 +77,12 @@ You can do so for specific origins or for all origins with a wildcard. ```yaml {configFile="app"} web: - locations: - "/": - ... - # Apply rules to all static files (dynamic files get rules from your app) - headers: - Access-Control-Allow-Origin: "*" + locations: + "/": + ... + # Apply rules to all static files (dynamic files get rules from your app) + headers: + Access-Control-Allow-Origin: "*" ``` If you use the wildcard value, the headers are modified for each request in the following ways: diff --git a/sites/platform/src/create-apps/web/php-basic.md b/sites/platform/src/create-apps/web/php-basic.md index 3479c71ce8..ffe78d2fc9 100644 --- a/sites/platform/src/create-apps/web/php-basic.md +++ b/sites/platform/src/create-apps/web/php-basic.md @@ -13,9 +13,9 @@ Start by defining your document root (where all your publicly visible pages are) ```yaml {configFile="app"} web: - locations: - '/': - root: 'public' + locations: + '/': + root: 'public' ``` ## Define a front controller @@ -24,12 +24,12 @@ Define where all requests that don't match a file in the document root are sent. ```yaml {configFile="app"} web: - locations: - '/': - root: 'public' - passthru: '/index.php' - index: - - index.php + locations: + '/': + root: 'public' + passthru: '/index.php' + index: + - index.php ``` In this case, `/index.php` acts as a front controller and handles dynamic requests. @@ -39,13 +39,13 @@ and responses aren't cached. ```yaml {configFile="app"} web: - locations: - '/': - ... - scripts: true - # No caching for static files. - # (Dynamic pages use whatever cache headers are generated by the program.) - expires: -1 + locations: + '/': + #... + scripts: true + # No caching for static files. + # (Dynamic pages use whatever cache headers are generated by the program.) + expires: -1 ``` ## Define rules @@ -55,15 +55,15 @@ For example, you might want to allow all kinds of files except mp4 files. ```yaml {configFile="app"} web: - locations: - '/': - ... - # Allow all file types generally - allow: true - rules: - # Disallow .mp4 files specifically. - \.mp4$: - allow: false + locations: + '/': + ... + # Allow all file types generally + allow: true + rules: + # Disallow .mp4 files specifically. + \.mp4$: + allow: false ``` ## Set different rules for specific locations @@ -74,57 +74,57 @@ You could define a specific cache time for them and limit them to only static im ```yaml {configFile="app"} web: - locations: - '/': - ... - # Set a 5 min expiration time for static files in this location. - # Missing files are sent to front controller - # through the '/' location above. - '/images': - expires: 300 - passthru: true - # Do not execute PHP scripts from this location and do not - # deliver their source code (for enhanced security). - scripts: false - allow: false - rules: - # Only allow static image files in this location - '\.(jpe?g|png|gif|svgz?|ico|bmp)$': - allow: true + locations: + '/': + #... + # Set a 5 min expiration time for static files in this location. + # Missing files are sent to front controller + # through the '/' location above. + '/images': + expires: 300 + passthru: true + # Do not execute PHP scripts from this location and do not + # deliver their source code (for enhanced security). + scripts: false + allow: false + rules: + # Only allow static image files in this location + '\.(jpe?g|png|gif|svgz?|ico|bmp)$': + allow: true ``` ## Complete example ```yaml {configFile="app"} web: - locations: - '/': - root: 'public' - passthru: '/index.php' - index: - - index.php - scripts: true - # No caching for static files. - # (Dynamic pages use whatever cache headers are generated by the program.) - expires: -1 - # Allow all file types generally - allow: true - rules: - # Disallow .mp4 files specifically. - \.mp4$: - allow: false - # Set a 5 min expiration time for static files in this location. - # Missing files are sent to front controller - # through the '/' location above. - '/images': - expires: 300 - passthru: true - # Do not execute PHP scripts from this location and do not - # deliver their source code (for enhanced security). - scripts: false - allow: false - rules: - # Only allow static image files in this location - '\.(jpe?g|png|gif|svgz?|ico|bmp)$': - allow: true + locations: + '/': + root: 'public' + passthru: '/index.php' + index: + - index.php + scripts: true + # No caching for static files. + # (Dynamic pages use whatever cache headers are generated by the program.) + expires: -1 + # Allow all file types generally + allow: true + rules: + # Disallow .mp4 files specifically. + \.mp4$: + allow: false + # Set a 5 min expiration time for static files in this location. + # Missing files are sent to front controller + # through the '/' location above. + '/images': + expires: 300 + passthru: true + # Do not execute PHP scripts from this location and do not + # deliver their source code (for enhanced security). + scripts: false + allow: false + rules: + # Only allow static image files in this location + '\.(jpe?g|png|gif|svgz?|ico|bmp)$': + allow: true ``` diff --git a/sites/platform/src/create-apps/web/rewrite-requests.md b/sites/platform/src/create-apps/web/rewrite-requests.md index 8a0afbe339..33b73bf3a4 100644 --- a/sites/platform/src/create-apps/web/rewrite-requests.md +++ b/sites/platform/src/create-apps/web/rewrite-requests.md @@ -14,12 +14,12 @@ If so, add a [rule](/create-apps/app-reference/single-runtime-image.md#rules) si ```yaml {configFile="app"} web: - locations: - '/': - ... - rules: - '^/(?[^/]+)/(?[^/]+)/$': - passthru: '/?category=$category&product=$product' + locations: + '/': + ... + rules: + '^/(?[^/]+)/(?[^/]+)/$': + passthru: '/?category=$category&product=$product' ``` Or you might organize your images by file type, but don't want to expose the organization externally. @@ -27,12 +27,12 @@ You could rewrite requests to do that behind the scenes: ```yaml {configFile="app"} web: - locations: - '/': - ... - rules: - '^/img/(?.*)\.(?.*)$': - passthru: '/$type/$name.$type' + locations: + '/': + ... + rules: + '^/img/(?.*)\.(?.*)$': + passthru: '/$type/$name.$type' ``` Now a request to `/img/image.png` returns the file found at `/png/image.png`. diff --git a/sites/platform/src/create-apps/web/serve-different-directories.md b/sites/platform/src/create-apps/web/serve-different-directories.md index bccc21dc76..2516544798 100644 --- a/sites/platform/src/create-apps/web/serve-different-directories.md +++ b/sites/platform/src/create-apps/web/serve-different-directories.md @@ -11,14 +11,14 @@ For example, in Git you might have a folder for your app and another folder that Your entire Git repository might look like the following: ```text -{{% vendor/configdir %}} - {{< vendor/configfile "routes" "strip" >}} - {{< vendor/configfile "services" "strip" >}} - {{< vendor/configfile "apps" "strip" >}} +{{% vendor/configdir %}}/ + {{< vendor/configfile "routes" "strip" >}} + {{< vendor/configfile "services" "strip" >}} + {{< vendor/configfile "apps" "strip" >}} application/ - [app-code-files] + [app-code-files] docs-src/ - [docs-code-files] + [docs-code-files] ``` And your build process might build the documentation with an output folder such as `docs-public`. @@ -27,18 +27,18 @@ If so, you can serve all requests by your app code except for those that start w which you serve with your generated docs. Use a [`web` configuration](/create-apps/app-reference/single-runtime-image.md#web) similar to the following: -```yaml {configfile="apps"} +```yaml {configfile="app"} web: - locations: - '/': - passthru: true - '/docs': - root: 'docs-public' - index: - - "index.html" - expires: 24h - scripts: false - allow: true + locations: + '/': + passthru: true + '/docs': + root: 'docs-public' + index: + - "index.html" + expires: 24h + scripts: false + allow: true ``` This way, your app can safely coexist with static files as if it were a single site hierarchy. diff --git a/sites/platform/src/create-apps/web/static.md b/sites/platform/src/create-apps/web/static.md index 9dfb5b5426..52dc77ebcc 100644 --- a/sites/platform/src/create-apps/web/static.md +++ b/sites/platform/src/create-apps/web/static.md @@ -21,21 +21,21 @@ To successfully serve a static site using {{% vendor/name %}}, you need to set up a minimal app configuration similar to the following: ```yaml {configFile="app"} -app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - - # The web key configures the web server running in front of your app. - web: - locations: - /: - # Static site generators usually output built static files to a specific directory. - # Define this directory (must be an actual directory inside the root directory of your app) - # as the root for your static site. - root: "public" - # Files to consider when serving a request for a directory. - index: - - index.html +name: myapp +# The type of the application to build. +type: "nodejs:{{% latest "nodejs" %}}" + +# The web key configures the web server running in front of your app. +web: + locations: + /: + # Static site generators usually output built static files to a specific directory. + # Define this directory (must be an actual directory inside the root directory of your app) + # as the root for your static site. + root: "public" + # Files to consider when serving a request for a directory. + index: + - index.html ``` See more information on the required minimal settings: @@ -55,11 +55,11 @@ use the following configuration: ```yaml {configFile="app"} web: - locations: - '/': - ... - scripts: false - allow: true + locations: + '/': + # ... + scripts: false + allow: true ``` See more information on [`locations` properties](/create-apps/app-reference/single-runtime-image.md#locations). @@ -74,27 +74,27 @@ To do so, use a configuration similar to the following: ```yaml {configFile="app"} web: - locations: - '/': - ... - expires: 24h - rules: - \.(css|js|gif|jpe?g|png|svg)$: - expires: 4w + locations: + '/': + # ... + expires: 24h + rules: + \.(css|js|gif|jpe?g|png|svg)$: + expires: 4w ``` You can also set a `Cache-Control` header in your rules. ```yaml {configFile="app"} web: - locations: - '/': - ... - expires: 24h - rules: - \.(css|js|gif|jpe?g|png|svg)$: - headers: - Cache-Control: "public, max-age=2419200, immutable" - + locations: + '/': + # ... + expires: 24h + rules: + \.(css|js|gif|jpe?g|png|svg)$: + headers: + Cache-Control: "public, max-age=2419200, immutable" +``` If `expires` and a `Cache-Control` header are set, the rule ignores the `expires` and sets only the `Cache-Control` header. For this reason, make sure to add a `max-age` value, in seconds, for the `Cache-Control` header. @@ -106,8 +106,8 @@ use the following configuration: ```yaml {configFile="app"} web: - commands: - start: sleep infinity + commands: + start: sleep infinity ``` @@ -117,28 +117,28 @@ such as a [script to handle 404 errors](https://community.platform.sh/t/custom-4 ## Complete example configuration ```yaml {configFile="app"} -name: app +name: myapp type: 'python:3.11' web: - locations: - '/': - # The public directory of the application relative to its root - root: 'public' - # The files to look for when serving a directory - index: - - 'index.html' - # Disable server-side scripts - scripts: false - allow: true - # Set caching policy - expires: 24h - rules: - \.(css|js|gif|jpe?g|png|svg)$: - expires: 4w - - commands: - # Run a no-op process that uses no CPU resources since this is a static site - start: sleep infinity + locations: + '/': + # The public directory of the application relative to its root + root: 'public' + # The files to look for when serving a directory + index: + - 'index.html' + # Disable server-side scripts + scripts: false + allow: true + # Set caching policy + expires: 24h + rules: + \.(css|js|gif|jpe?g|png|svg)$: + expires: 4w + + commands: + # Run a no-op process that uses no CPU resources since this is a static site + start: sleep infinity ``` diff --git a/sites/platform/src/create-apps/workers.md b/sites/platform/src/create-apps/workers.md index c461b04e73..9c6a2e34e8 100644 --- a/sites/platform/src/create-apps/workers.md +++ b/sites/platform/src/create-apps/workers.md @@ -85,51 +85,51 @@ are inherited by every worker, unless overridden explicitly. That means, for example, that the following two `{{< vendor/configfile "app" >}}` definitions produce identical workers. ```yaml {configFile="app"} -name: app +name: myapp type: python:{{% latest "python" %}} disk: 256 mounts: - test: - source: local - source_path: test + test: + source: local + source_path: test relationships: - mysql: + mysql: workers: - queue: - commands: - start: | - python queue-worker.py - mail: - commands: - start: | - python mail-worker.py + queue: + commands: + start: | + python queue-worker.py + mail: + commands: + start: | + python mail-worker.py ``` ```yaml {configFile="app"} -name: app +name: myapp type: python:{{% latest "python" %}} workers: - queue: - commands: - start: | - python queue-worker.py - disk: 256 - mounts: - test: - source: local - source_path: test - relationships: - mysql: - mail: - commands: - start: | - python mail-worker.py - disk: 256 - mounts: - test: - source: local - source_path: test - relationships: - mysql: + queue: + commands: + start: | + python queue-worker.py + disk: 256 + mounts: + test: + source: local + source_path: test + relationships: + mysql: + mail: + commands: + start: | + python mail-worker.py + disk: 256 + mounts: + test: + source: local + source_path: test + relationships: + mysql: ``` In both cases, there are two worker instances named `queue` and `mail`. @@ -147,71 +147,71 @@ For example, consider the following configuration: ```yaml {configFile="services"} mysql: - type: "mariadb:{{% latest "mariadb" %}}" - disk: 2048 + type: "mariadb:{{% latest "mariadb" %}}" + disk: 2048 rabbitmq: - type: rabbitmq:{{% latest "rabbitmq" %}} - disk: 512 + type: rabbitmq:{{% latest "rabbitmq" %}} + disk: 512 ``` ```yaml {configFile="app"} -name: app +name: myapp type: "python:{{% latest "python" %}}" disk: 2048 hooks: - build: | - pip install -r requirements.txt - pip install -e . - pip install gunicorn + build: | + pip install -r requirements.txt + pip install -e . + pip install gunicorn relationships: - mysql: - rabbitmq: + mysql: + rabbitmq: variables: - env: - type: 'none' + env: + type: 'none' web: + commands: + start: "gunicorn -b $PORT project.wsgi:application" + variables: + env: + type: 'web' + mounts: + uploads: + source: local + source_path: uploads + locations: + "/": + root: "" + passthru: true + allow: false + "/static": + root: "static/" + allow: true +workers: + queue: + size: 'M' commands: - start: "gunicorn -b $PORT project.wsgi:application" + start: | + python queue-worker.py variables: - env: - type: 'web' + env: + type: 'worker' + disk: 512 mounts: - uploads: - source: local - source_path: uploads - locations: - "/": - root: "" - passthru: true - allow: false - "/static": - root: "static/" - allow: true -workers: - queue: - size: 'M' - commands: - start: | - python queue-worker.py - variables: - env: - type: 'worker' - disk: 512 - mounts: - scratch: - source: local - source_path: scratch - mail: - size: 'S' - commands: - start: | - python mail-worker.py - variables: - env: - type: 'worker' - disk: 256 - mounts: {} - relationships: - rabbitmq: + scratch: + source: local + source_path: scratch + mail: + size: 'S' + commands: + start: | + python mail-worker.py + variables: + env: + type: 'worker' + disk: 256 + mounts: {} + relationships: + rabbitmq: ``` There's a lot going on here, but it's all reasonably straightforward. diff --git a/sites/platform/src/define-routes/_index.md b/sites/platform/src/define-routes/_index.md index c2a6ecce07..975d7f4be7 100644 --- a/sites/platform/src/define-routes/_index.md +++ b/sites/platform/src/define-routes/_index.md @@ -25,13 +25,13 @@ These examples show how to define routes. ### Default route definition If you don't include a file defining routes, a single default route is deployed. -If you have one app to direct traffic to and its name is `app`, +If you have one app to direct traffic to and its name is `myapp`, this is equivalent to the following: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: app:http + type: upstream + upstream: myapp:http ``` All traffic to your domain (say, `https://example.com`) is sent to your app. @@ -41,19 +41,19 @@ It affects your [default domain](#default). ### Basic redirect definition In a basic situation, you have one app to direct traffic to. -Say its name is `app`. +Say its name is `myapp`. And say you want to redirect requests from `https://www.example.com` to `https://example.com`. Define your routes like this: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" "https://www.{default}/": - type: redirect - to: "https://{default}/" + type: redirect + to: "https://{default}/" ``` This affects your [default domain](#default). @@ -72,16 +72,16 @@ The specifics of configuring the Router container for multiple applications is e ## Trailing slashes All defined routes have at least a slash in the path. -So you might define routes for 2 apps named `app` and `api` as follows: +So you might define routes for 2 apps named `myapp` and `api` as follows: ```yaml {configFile="routes"} "https://{default}": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" "https://subdomain.example.com": - type: upstream - upstream: "api:http" + type: upstream + upstream: "api:http" ``` Both of these routes would be resolved with trailing slashes. @@ -95,7 +95,7 @@ you see the following resolved routes (assuming `example.com` is your default do "id": null, "attributes": {}, "type": "upstream", - "upstream": "app", + "upstream": "myapp", "original_url": "https://{default}" }, "https://subdomain.example.com/": { @@ -119,7 +119,7 @@ Each route in your configuration file is defined in one of two ways: The available placeholders are `{default}` and `{all}`. They stand in for the [custom domains](../domains/steps/_index.md) you've defined in your project. -These domains can be top-level domains (`example.com`) or subdomains (`app.example.com`). +These domains can be top-level domains (`example.com`) or subdomains (`myapp.example.com`). ### `{default}` @@ -131,16 +131,16 @@ You can use the `{default}` placeholder: ```yaml {configFile="routes"} "https://{default}/blog": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" ``` And you can use an absolute URL: ```yaml {configFile="routes"} "https://example.com/blog": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" ``` In both cases, the URLs for your Production environment are the same. @@ -168,8 +168,8 @@ If you used the `{default}` placeholder: ```yaml {configFile="routes"} "https://{default}/blog": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" ``` The generated URL for the `feature` environment was: @@ -182,8 +182,8 @@ If you used an absolute URL: ```yaml {configFile="routes"} "https://example.com/blog": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" ``` The generated URL for the `feature` environment was: @@ -204,12 +204,12 @@ You can then define the following routes: ```yaml {configFile="routes"} "https://{all}/": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" "https://www.{all}/": - type: redirect - to: "https://{all}/" + type: redirect + to: "https://{all}/" ``` The first route means you're serving the same content at multiple domains: @@ -227,12 +227,12 @@ Say you have two apps named `app1` and `app2` and define two routes like this: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app1:http" + type: upstream + upstream: "app1:http" "https://{all}/": - type: upstream - upstream: "app2:http" + type: upstream + upstream: "app2:http" ``` Requests to your default domain are served by `app1`. @@ -286,13 +286,13 @@ You can define your routes like this: ```yaml {configFile="routes"} "https://site1.{default}/": - type: upstream - upstream: 'app1:http' + type: upstream + upstream: 'app1:http' "https://site2.{default}/": - type: upstream - id: 'the-second' - upstream: 'app2:http' + type: upstream + id: 'the-second' + upstream: 'app2:http' ``` To see the generated routes on your `feature` environment, run: @@ -353,24 +353,24 @@ So you can define a route like this: ```yaml {configFile="routes"} "http://{default}/": - type: upstream - upstream: "app:http" - attributes: - "foo": "bar" + type: upstream + upstream: "myapp:http" + attributes: + "foo": "bar" ``` The attributes appear in the routes data like so: ```json "https://feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { - "primary": true, - "id": null, - "attributes": { - "foo": "bar" - }, - "type": "upstream", - "upstream": "app", - "original_url": "https://{default}/" + "primary": true, + "id": null, + "attributes": { + "foo": "bar" + }, + "type": "upstream", + "upstream": "myapp", + "original_url": "https://{default}/" } ``` @@ -429,10 +429,10 @@ Routes on the project Example (abcdef123456), environment main (type: production +---------------------------+----------+---------------------------+ | Route | Type | To | +---------------------------+----------+---------------------------+ -| https://app.{default}/ | upstream | app:http | -| https://app.{default}/api | upstream | api:http | -| http://app.{default}/ | redirect | https://app.{default}/ | -| http://app.{default}/api | redirect | https://app.{default}/api | +| https://www.{default}/ | upstream | myapp:http | +| https://www.{default}/api | upstream | api:http | +| http://www.{default}/ | redirect | https://www.{default}/ | +| http://www.{default}/api | redirect | https://www.{default}/api | +-----------------------+----------+-------------------------------+ To view a single route, run: {{% vendor/cli %}} route:get @@ -449,34 +449,34 @@ which is a requirement for the router caching. ```yaml {configFile="routes"} "https://{default}/ws": - type: upstream - upstream: "app:http" - cache: - enabled: false + type: upstream + upstream: "myapp:http" + cache: + enabled: false # Below HTTP config may not be necessary for every Websocket client. # It is required for some, as only defining an HTTPS config may trigger an automatic redirect to HTTP. "http://{default}/ws": - type: upstream - upstream: "app:http" - cache: - enabled: false + type: upstream + upstream: "myapp:http" + cache: + enabled: false ``` 2. [Disable request buffering](../create-apps/app-reference/single-runtime-image.md#locations) in your app configuration. ```yaml {configFile="app"} web: - commands: - start: /app/.linuxbrew/bin/websocketd --port=$PORT ./wsmanager.sh - upstream: - socket_family: tcp - protocol: http - locations: - '/': - passthru: true - request_buffering: - enabled: false + commands: + start: /app/.linuxbrew/bin/websocketd --port=$PORT ./wsmanager.sh + upstream: + socket_family: tcp + protocol: http + locations: + '/': + passthru: true + request_buffering: + enabled: false ``` ## `.htaccess` files diff --git a/sites/platform/src/define-routes/cache.md b/sites/platform/src/define-routes/cache.md index 4f1ff797d8..4306167201 100644 --- a/sites/platform/src/define-routes/cache.md +++ b/sites/platform/src/define-routes/cache.md @@ -32,13 +32,13 @@ To configure the HTTP cache, add a `cache` key to your route. You may like to st ```yaml {configFile="routes"} https://{default}/: - type: upstream - upstream: app:http - cache: - enabled: true - default_ttl: 0 - cookies: ['*'] - headers: ['Accept', 'Accept-Language'] + type: upstream + upstream: myapp:http + cache: + enabled: true + default_ttl: 0 + cookies: ['*'] + headers: ['Accept', 'Accept-Language'] ``` ## Example @@ -49,13 +49,13 @@ The presence of any cookie in the request disables caching of that response. ```yaml {configFile="routes"} https://{default}/: - type: upstream - upstream: app:http - cache: - enabled: true - headers: ['Accept', 'Accept-Language', 'X-Language-Locale'] - cookies: ['*'] - default_ttl: 60 + type: upstream + upstream: myapp:http + cache: + enabled: true + headers: ['Accept', 'Accept-Language', 'X-Language-Locale'] + cookies: ['*'] + default_ttl: 60 ``` ## How it works @@ -70,11 +70,11 @@ The default value for these keys are the following: ```yaml {configFile="routes"} https://{default}/: - # ... - cache: - enabled: true - cookies: ['*'] - headers: ['Accept', 'Accept-Language'] + # ... + cache: + enabled: true + cookies: ['*'] + headers: ['Accept', 'Accept-Language'] ``` ### Duration @@ -119,10 +119,10 @@ For example, if the `headers` key is the following, {{% vendor/name %}} caches a ```yaml {configFile="routes"} https://{default}/: - # ... - cache: - enabled: true - headers: ["Accept"] + # ... + cache: + enabled: true + headers: ["Accept"] ``` {{< note title="none">}} @@ -164,10 +164,10 @@ Other cookies are ignored. ```yaml {configFile="routes"} https://{default}/: - # ... - cache: - enabled: true - cookies: ["foo"] + # ... + cache: + enabled: true + cookies: ["foo"] ``` #### Example with a regular expression @@ -178,10 +178,10 @@ For example: ```yaml {configFile="routes"} https://{default}/: - # ... - cache: - enabled: true - cookies: ['/^SS?ESS/'] + # ... + cache: + enabled: true + cookies: ['/^SS?ESS/'] ``` This configuration causes all cookies beginning with `SESS` or `SSESS` to be part of the cache key, as a single value. @@ -222,22 +222,22 @@ If you need fine-grained caching, you can set up caching rules for several route ```yaml {configFile="routes"} https://{default}/: - type: upstream - upstream: app:http - cache: - enabled: true + type: upstream + upstream: myapp:http + cache: + enabled: true https://{default}/foo/: - type: upstream - upstream: app:http - cache: - enabled: false + type: upstream + upstream: myapp:http + cache: + enabled: false https://{default}/foo/bar/: - type: upstream - upstream: app:http - cache: - enabled: true + type: upstream + upstream: myapp:http + cache: + enabled: true ``` With this configuration, the following routes are cached: @@ -262,10 +262,10 @@ This is a case of allowing only a subset of cookies to invalidate the cache. ```yaml {configFile="routes"} https://{default}/: -# ... - cache: - enabled: true - cookies: ["MYCOOKIE"] + # ... + cache: + enabled: true + cookies: ["MYCOOKIE"] ``` ### Cache HTTP and HTTPS separately using the `Vary` header diff --git a/sites/platform/src/define-routes/https.md b/sites/platform/src/define-routes/https.md index c2d3a9f1d4..50c5b12583 100644 --- a/sites/platform/src/define-routes/https.md +++ b/sites/platform/src/define-routes/https.md @@ -30,7 +30,7 @@ configure your own [third-party TLS certificates](../domains/steps/tls.md). ### Let's Encrypt limitations When you use the Let's Encrypt [TLS certificates](#tls-certificates) provided by {{% vendor/name %}}, -the following limitations apply. +the following limitations apply. {{% lets_encrypt_limitations %}} @@ -52,12 +52,12 @@ To enable HTTPS, add a routing configuration similar to the following: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" "https://www.{default}/": - type: redirect - to: "https://{default}/" + type: redirect + to: "https://{default}/" ``` All traffic to your domain is then sent to your app. @@ -79,7 +79,7 @@ enforce TLS 1.3 using the `min_version` setting: ```yaml {configFile="routes"} tls: - min_version: TLSv1.3 + min_version: TLSv1.3 ``` Note that TLS versions older than 1.2 are deprecated and are rejected by default. @@ -91,10 +91,10 @@ To enable HSTS, use `strict_transport_security` in a configuration similar to th ```yaml {configFile="routes"} tls: - strict_transport_security: - enabled: true - include_subdomains: true - preload: true + strict_transport_security: + enabled: true + include_subdomains: true + preload: true ``` The following table presents the possible properties for `strict_transport_security`: @@ -119,7 +119,7 @@ To do so, enable mTLS by adding the following configuration: ```yaml {configFile="routes"} tls: - client_authentication: "require" + client_authentication: "require" ``` By default, all valid TLS certificates issued by a legitimate certificate authority are accepted. @@ -129,14 +129,14 @@ To do so, add a configuration similar to the following: ```yaml {configFile="routes"} tls: - client_authentication: "require" - client_certificate_authorities: - - !include - type: string - path: root-ca1.crt - - !include - type: string - path: root-ca2.crt + client_authentication: "require" + client_certificate_authorities: + - !include + type: string + path: root-ca1.crt + - !include + type: string + path: root-ca2.crt ``` In this case, the certificate files are resolved relative to the `{{< vendor/configdir >}}` directory. @@ -144,14 +144,14 @@ Alternatively, you can specify the certificates inline in the file: ```yaml {configFile="routes"} tls: - client_authentication: "require" - client_certificate_authorities: - - | - -----BEGIN CERTIFICATE----- - ### Several lines of characters here ### - -----END CERTIFICATE----- - - | - -----BEGIN CERTIFICATE----- - ### Several lines of different characters here ### - -----END CERTIFICATE----- + client_authentication: "require" + client_certificate_authorities: + - | + -----BEGIN CERTIFICATE----- + ### Several lines of characters here ### + -----END CERTIFICATE----- + - | + -----BEGIN CERTIFICATE----- + ### Several lines of different characters here ### + -----END CERTIFICATE----- ``` diff --git a/sites/platform/src/define-routes/proxy.md b/sites/platform/src/define-routes/proxy.md index 678a324ddd..69f4cca367 100644 --- a/sites/platform/src/define-routes/proxy.md +++ b/sites/platform/src/define-routes/proxy.md @@ -18,8 +18,8 @@ You can define an external proxy on your {{% vendor/name %}} project by defining ```yaml {configFile="routes"} https://{default}/foo: - type: proxy - to: https://www.example.com + type: proxy + to: https://www.example.com ``` This route passes requests for `https://{default}/foo/index.html` to `https://www.example.com/foo/index.html`. @@ -28,8 +28,8 @@ You can also define a proxy route to an URL composed of an IP address and a port ```yaml {configFile="routes"} https://{default}/foo: - type: proxy - to: https://192.0.2.0:8000 + type: proxy + to: https://192.0.2.0:8000 ``` {{< note >}} @@ -45,8 +45,8 @@ add a trailing slash `/` to the `to` definition. ```yaml {configFile="routes"} https://{default}/foo: - type: proxy - to: https://www.example.com/ + type: proxy + to: https://www.example.com/ ``` The trailing slash makes the proxy route interpret the location as having a different path. @@ -57,8 +57,8 @@ For example: ```yaml {configFile="routes"} https://{default}/foo: - type: proxy - to: https://www.example.com/bar + type: proxy + to: https://www.example.com/bar ``` This route passes requests for `https://{default}/foo/index.html` to `https://www.example.com/bar/index.html`. @@ -78,16 +78,16 @@ Each app handles a different language. ```yaml {configFile="routes"} https://{default}/en: - type: proxy - to: https://en.example.com/ + type: proxy + to: https://en.example.com/ https://{default}/jp: - type: proxy - to: https://jp.example.com/ + type: proxy + to: https://jp.example.com/ https://{default}/pt: - type: proxy - to: https://pt.example.com/ + type: proxy + to: https://pt.example.com/ ``` The apps behind the proxy need to ensure links to assets are shown to the target domain. diff --git a/sites/platform/src/define-routes/redirects.md b/sites/platform/src/define-routes/redirects.md index c63977e80c..166cde8724 100644 --- a/sites/platform/src/define-routes/redirects.md +++ b/sites/platform/src/define-routes/redirects.md @@ -7,32 +7,32 @@ description: | {{% description %}} You can manage redirection rules on your {{% vendor/name %}} projects in two different ways, which we describe here. If neither of these options satisfy your redirection needs, you can still implement redirects directly from within your application, which if implemented with the appropriate caching headers would be almost as efficient as using the configuration options provided by {{% vendor/name %}}. - + ## Whole-route redirects Using whole-route redirects, you can define very basic routes in your [`{{< vendor/configfile "routes" >}}`](./_index.md) file whose sole purpose is to redirect. A typical use case for this type of route is adding or removing a `www.` prefix to your domain, as the following example shows: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: redirect - to: https://www.{default}/ + type: redirect + to: https://www.{default}/ ``` ## Partial redirects In the [`{{< vendor/configfile "routes" >}}`](./_index.md) file you can also add partial redirect rules to existing routes: -```yaml +```yaml {configFile="routes"} https://{default}/: - # ... - redirects: - expires: 1d - paths: - '/from': - to: 'https://example.com/' - '^/foo/(.*)/bar': - to: 'https://example.com/$1' - regexp: true + # ... + redirects: + expires: 1d + paths: + '/from': + to: 'https://example.com/' + '^/foo/(.*)/bar': + to: 'https://example.com/$1' + regexp: true ``` This format is richer and works with any type of route, including routes served directly by the application. @@ -73,15 +73,15 @@ Consider this `regexp` redirect: ```yaml '^/from(/.*|)$': - regexp: true - to: https://example.com/to$1 + regexp: true + to: https://example.com/to$1 ``` It achieves the same result as this basic redirect: ```yaml '/from': - to: https://example.com/to + to: https://example.com/to ``` <---> @@ -93,16 +93,16 @@ title= `prefix` Consider this redirect using `prefix`: ```yaml '/from': - to: https//example.com/to - prefix: false + to: https//example.com/to + prefix: false ``` It achieves the same result as this `regexp` redirect: ```yaml '^/from$': - regexp: true - to: https://example.com/to + regexp: true + to: https://example.com/to ``` <---> @@ -142,15 +142,15 @@ You can use regular expressions to configure your redirects. In the following example, a request to `https://example.com/foo/a/b/c/bar` redirects to `https://example.com/a/b/c`: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '^/foo/(.*)/bar': - to: 'https://example.com/$1' - regexp: true + type: upstream + # ... + redirects: + paths: + '^/foo/(.*)/bar': + to: 'https://example.com/$1' + regexp: true ``` The following special arguments in the `to` statement are available when `regexp` is set to `true`: @@ -175,55 +175,27 @@ Likewise, if you're using `prefix` and `append_suffix`, you can't also use `rege When set to `true`, which is their default value, `prefix` and `append_suffix` are equivalent. For example: -{{< version/specific >}} - -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - prefix: true + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + prefix: true ``` -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - append_suffix: true + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + append_suffix: true ``` -<---> - -```yaml -routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - prefix: true -``` -```yaml -routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - append_suffix: true -``` -{{< /version/specific >}} - With both configurations: - `/from` redirects to `/to` @@ -232,30 +204,30 @@ With both configurations: However, when set to `false`, `prefix` and `append_suffix` behave differently. For example, with the following configuration: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - prefix: true + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + prefix: true ``` A request to `/from/` redirects to `/to/some/path`, but a request to `/from/some/path` does not. And with the following configuration: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - append_suffix: false + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + append_suffix: false ``` A request to `/from/some/path` (and any path after `/from`) redirects to just `/to`. @@ -264,17 +236,17 @@ A request to `/from/some/path` (and any path after `/from`) redirects to just `/ To set a specific HTTP status code for your redirect, use the `codes` key: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://example.com/' - code: 308 - '/here': - to: 'https://example.com/there' + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://example.com/' + code: 308 + '/here': + to: 'https://example.com/there' ``` In this example, redirects from `/from` use a `308` HTTP status code, @@ -292,17 +264,17 @@ To do so, use the `expires` key under the `redirects` key. In the following example, all redirects are cached for two weeks: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - expires: 2w - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' + type: upstream + # ... + redirects: + expires: 2w + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' ``` If you want to set a different expiration time for a specific redirect, @@ -315,18 +287,18 @@ In the following example: - The second redirect ignores the default expiration time set on all redirects, and is cached for three days instead -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - expires: 2w - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' - expires: 3d + type: upstream + # ... + redirects: + expires: 2w + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' + expires: 3d ``` {{% note %}} @@ -341,17 +313,17 @@ you may have set on all your redirects (under the `redirects` key). To disable caching on all your redirects, set the `expires` key to `0` under the `redirects` key: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - expires: 0 - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' + type: upstream + # ... + redirects: + expires: 0 + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' ``` To disable caching on a specific redirect only, @@ -359,17 +331,17 @@ set the `expires` key to `0` under the relevant path in the `paths` section. In the following example, caching is disabled on the second redirect only: -```yaml +```yaml {configFile="routes"} https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' - expires: 0 + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' + expires: 0 ``` ## Other redirects diff --git a/sites/platform/src/define-routes/ssi.md b/sites/platform/src/define-routes/ssi.md index 582dbfd6d0..7dc38bae49 100644 --- a/sites/platform/src/define-routes/ssi.md +++ b/sites/platform/src/define-routes/ssi.md @@ -14,10 +14,10 @@ Start by enabling SSI: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" - ssi: - enabled: true + type: upstream + upstream: "myapp:http" + ssi: + enabled: true ``` Then create a file you want to include elsewhere: @@ -53,18 +53,18 @@ For example, you can activate SSI on one route with cache disabled and enable ca ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" - ssi: - enabled: true - cache: - enabled: false + type: upstream + upstream: "myapp:http" + ssi: + enabled: true + cache: + enabled: false "https://{default}/cache": - type: upstream - upstream: "app:http" - cache: - enabled: true + type: upstream + upstream: "myapp:http" + cache: + enabled: true ``` Then create a page that displays the current date and time and is cached for 60 seconds @@ -76,7 +76,7 @@ header("Cache-Control: max-age=60"); echo date(DATE_RFC2822); ``` -Then you could have a page with dynamic content that includes this file: +Then you could have a page with dynamic content that includes this file: ```php {location="index.php"} }}: {{< variable "VALUE" >}} + - {{< variable "VARIABLE_NAME" >}}: {{< variable "VALUE" >}} ``` To apply your changes, run the following command: diff --git a/sites/platform/src/development/private-repository.md b/sites/platform/src/development/private-repository.md index a007a236c5..3f04cea8ac 100644 --- a/sites/platform/src/development/private-repository.md +++ b/sites/platform/src/development/private-repository.md @@ -23,7 +23,7 @@ add the project's public SSH key to your Git repository's deploy keys. ## 2. Add the key to your repository in your Git provider -* [GitHub deploy key](https://docs.github.com/en/developers/overview/managing-deploy-keys#deploy-keys) +* [GitHub deploy key](https://docs.github.com/en/developers/overview/managing-deploy-keys#deploy-keys) * [GitLab deploy key](https://docs.gitlab.com/ee/user/project/deploy_keys/#grant-project-access-to-a-public-deploy-key) * [Bitbucket access key](https://support.atlassian.com/bitbucket-cloud/docs/configure-repository-settings/) @@ -37,9 +37,9 @@ For example, you can clone a repository in your [`build` hook](../create-apps/ho ```yaml {configFile="app"} hooks: - build: | - set -e - git clone git@bitbucket.org:username/module.git + build: | + set -e + git clone git@bitbucket.org:username/module.git ``` You can also use [private repositories as submodules](./submodules.md#use-private-git-repositories). diff --git a/sites/platform/src/development/sanitize-db/mariadb.md b/sites/platform/src/development/sanitize-db/mariadb.md index b09a6c5b74..aec35855b7 100644 --- a/sites/platform/src/development/sanitize-db/mariadb.md +++ b/sites/platform/src/development/sanitize-db/mariadb.md @@ -27,17 +27,17 @@ for preview environments: ```yaml {configFile="app"} hooks: - deploy: | + deploy: | - # ... + # ... - cd /app/public - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - # Do whatever you want on the production site. - else - drush -y sql:sanitize - fi - drush -y updatedb + cd /app/public + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + # Do whatever you want on the production site. + else + drush -y sql:sanitize + fi + drush -y updatedb ``` More options are available. @@ -48,17 +48,17 @@ use [Drush state](https://www.drush.org/latest/commands/state_set/) as in the fo ```yaml {configFile="app"} hooks: - deploy: | + deploy: | - # ... + # ... - cd /app/public - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ] || [ "$(drush state:get --format=string mymodule.sanitized)" != yes ]; then - # Do whatever you want on the production site. - else - drush -y sql:sanitize - drush state:set --input-format=string mymodule.sanitized yes - fi + cd /app/public + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ] || [ "$(drush state:get --format=string mymodule.sanitized)" != yes ]; then + # Do whatever you want on the production site. + else + drush -y sql:sanitize + drush state:set --input-format=string mymodule.sanitized yes + fi ``` {{< /codetabs >}} diff --git a/sites/platform/src/development/sanitize-db/postgresql-symfony.md b/sites/platform/src/development/sanitize-db/postgresql-symfony.md index 55c79c719b..9a4f7b860a 100644 --- a/sites/platform/src/development/sanitize-db/postgresql-symfony.md +++ b/sites/platform/src/development/sanitize-db/postgresql-symfony.md @@ -94,25 +94,25 @@ Set up a script by following these steps: ```yaml {configFile="app"} hooks: - build: ... - deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ]; then - # The sanitization of the database should happen here (since it's non-production) - php bin/console app:sanitize-data - fi + build: ... + deploy: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ]; then + # The sanitization of the database should happen here (since it's non-production) + php bin/console app:sanitize-data + fi ``` To sanitize only on the initial deploy and not all future deploys, on sanitization create a file on a mount. Then add a check for the file as in the following example: ```yaml {configFile="app"} hooks: - build: ... - deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ] && [ ! -f MOUNT_PATH/is_sanitized ]; then - # The sanitization of the database should happen here (since it's non-production) - php bin/console app:sanitize-data - touch MOUNT_PATH/is_sanitized - fi + build: ... + deploy: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ] && [ ! -f MOUNT_PATH/is_sanitized ]; then + # The sanitization of the database should happen here (since it's non-production) + php bin/console app:sanitize-data + touch MOUNT_PATH/is_sanitized + fi ``` 3. Commit your changes by running the following command: diff --git a/sites/platform/src/development/sanitize-db/postgresql.md b/sites/platform/src/development/sanitize-db/postgresql.md index 75c849cd6e..fe34967288 100644 --- a/sites/platform/src/development/sanitize-db/postgresql.md +++ b/sites/platform/src/development/sanitize-db/postgresql.md @@ -80,10 +80,10 @@ Set up a script by following these steps: ```yaml {configFile="app"} hooks: - build: ... - deploy: | - python manage.py migrate - bash sanitize.sh + build: ... + deploy: | + python manage.py migrate + bash sanitize.sh ``` 5. Commit your changes by running the following command: diff --git a/sites/platform/src/development/submodules.md b/sites/platform/src/development/submodules.md index 8f4055a19b..85a0950f82 100644 --- a/sites/platform/src/development/submodules.md +++ b/sites/platform/src/development/submodules.md @@ -117,16 +117,16 @@ To do so, follow these steps: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="false" >}} source: - operations: - rebuild: - command: | - set -e - git submodule update --init --recursive - git submodule update --remote --checkout - git add admin api gatsby mercure - if ! git diff-index --quiet HEAD; then - git commit -m "Updating submodules admin, api, gatsby and mercure" - fi + operations: + rebuild: + command: | + set -e + git submodule update --init --recursive + git submodule update --remote --checkout + git add admin api gatsby mercure + if ! git diff-index --quiet HEAD; then + git commit -m "Updating submodules admin, api, gatsby and mercure" + fi {{< /snippet >}} ``` @@ -145,23 +145,23 @@ type: 'nodejs:{{% latest "nodejs" %}}' # The web key configures the web server running in front of your app. web: # Commands are run once after deployment to start the application process. - commands: - # The command to launch your app. If it terminates, it’s restarted immediately. - # As this app will handle source operation only, no need to keep it alive (sleep) - start: | - sleep infinity + commands: + # The command to launch your app. If it terminates, it’s restarted immediately. + # As this app will handle source operation only, no need to keep it alive (sleep) + start: | + sleep infinity source: - operations: - update-submodules: - command: | - set -e - git submodule update --init --recursive - git submodule update --remote --checkout - git add . - if ! git diff-index --quiet HEAD; then - git commit -m "Updating submodules" - fi - # "git push" is automatic at the end of this command + operations: + update-submodules: + command: | + set -e + git submodule update --init --recursive + git submodule update --remote --checkout + git add . + if ! git diff-index --quiet HEAD; then + git commit -m "Updating submodules" + fi + # "git push" is automatic at the end of this command {{< /snippet >}} ``` diff --git a/sites/platform/src/development/variables/_index.md b/sites/platform/src/development/variables/_index.md index 89ea5d990f..a615a455be 100644 --- a/sites/platform/src/development/variables/_index.md +++ b/sites/platform/src/development/variables/_index.md @@ -183,10 +183,10 @@ For example, to change the PHP memory limit for all environments, use the follow ```yaml {configFile="app"} applications: - {{< variable "APP_NAME" >}}: - variables: - php: - memory_limit: "256M" + {{< variable "APP_NAME" >}}: + variables: + php: + memory_limit: "256M" ``` ### Framework-specific variables diff --git a/sites/platform/src/development/variables/use-variables.md b/sites/platform/src/development/variables/use-variables.md index 9bae44bc6a..cae1569abb 100644 --- a/sites/platform/src/development/variables/use-variables.md +++ b/sites/platform/src/development/variables/use-variables.md @@ -175,20 +175,20 @@ The following example shows nested structures in an [app configuration](/create- ```yaml {configFile="app"} variables: - env: - BASIC: "a string" - INGREDIENTS: - - 'peanut butter' - - 'jelly' - QUANTITIES: - "milk": "1 liter" - "cookies": "1 kg" - stuff: - STEPS: ['one', 'two', 'three'] - COLORS: - red: '#FF0000' - green: '#00FF00' - blue: '#0000FF' + env: + BASIC: "a string" + INGREDIENTS: + - 'peanut butter' + - 'jelly' + QUANTITIES: + "milk": "1 liter" + "cookies": "1 kg" + stuff: + STEPS: ['one', 'two', 'three'] + COLORS: + red: '#FF0000' + green: '#00FF00' + blue: '#0000FF' ``` You can access these nested variables as follows: @@ -427,9 +427,9 @@ The following example shows the process, though you have to modify it to fit you ```yaml {configFile="app"} mounts: - /config: - source: local - source_path: config + /config: + source: local + source_path: config ``` 2. Create a symbolic link from the config file the application wants to a location in that mount: @@ -462,8 +462,8 @@ The following example shows the process, though you have to modify it to fit you ```yaml {configFile="app"} hooks: - deploy: | - bash export-config.sh + deploy: | + bash export-config.sh ``` Now, when your app starts and attempts to parse `db.yaml`, the symbolic link redirects it to `config/db.yaml`. diff --git a/sites/platform/src/domains/cdn/_index.md b/sites/platform/src/domains/cdn/_index.md index d80ba70210..67288e272c 100644 --- a/sites/platform/src/domains/cdn/_index.md +++ b/sites/platform/src/domains/cdn/_index.md @@ -57,11 +57,11 @@ To disable it, change your cache configuration for the routes behind a CDN to th ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" - cache: - # Disable the HTTP cache on this route. It's handled by the CDN instead. - enabled: false + type: upstream + upstream: "myapp:http" + cache: + # Disable the HTTP cache on this route. It's handled by the CDN instead. + enabled: false ``` ## Configure your CDN to support high SLA @@ -107,12 +107,12 @@ To enable mTLS, follow these steps: ```yaml {configFile="routes"} "https://{default}": - tls: - client_authentication: "require" - client_certificate_authorities: - - !include - type: string - path: cdn.crt + tls: + client_authentication: "require" + client_certificate_authorities: + - !include + type: string + path: cdn.crt ``` The procedure can vary depending on your CDN. diff --git a/sites/platform/src/get-started/add-data/merge.md b/sites/platform/src/get-started/add-data/merge.md index cba2ea40aa..a28f4f6906 100644 --- a/sites/platform/src/get-started/add-data/merge.md +++ b/sites/platform/src/get-started/add-data/merge.md @@ -28,8 +28,8 @@ Add a database service (or choose [another service](../../add-services/_index.md ```yaml {configFile="services"} db: - type: mariadb:10.5 - disk: 1024 + type: mariadb:10.5 + disk: 1024 ``` Note that `db` is the name of the service. @@ -39,9 +39,9 @@ Add a database service (or choose [another service](../../add-services/_index.md ```yaml {configFile="app"} relationships: - database: - service: "db" - endpoint: "mysql" + database: + service: "db" + endpoint: "mysql" ``` This relationship is where connections are made. diff --git a/sites/platform/src/guides/django/deploy/configure.md b/sites/platform/src/guides/django/deploy/configure.md index 1565d55d5a..36ff65688a 100644 --- a/sites/platform/src/guides/django/deploy/configure.md +++ b/sites/platform/src/guides/django/deploy/configure.md @@ -49,10 +49,10 @@ title=Pip ```yaml {configFile="app"} web: - upstream: - socket_family: unix - commands: - start: "gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" + upstream: + socket_family: unix + commands: + start: "gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" ``` <---> @@ -62,10 +62,10 @@ title=Pipenv ```yaml {configFile="app"} web: - upstream: - socket_family: unix - commands: - start: "pipenv run gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" + upstream: + socket_family: unix + commands: + start: "pipenv run gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" ``` <---> @@ -75,10 +75,10 @@ title=Poetry ```yaml {configFile="app"} web: - upstream: - socket_family: unix - commands: - start: "poetry run gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" + upstream: + socket_family: unix + commands: + start: "poetry run gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" ``` {{< /codetabs >}} @@ -99,4 +99,4 @@ Below is an example configuration to make [PostgreSQL](../../../add-services/pos {{% guides/config-routes template="django4" name="Django" %}} -{{< guide-buttons previous="Back" next="Customize Django" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Customize Django" >}} diff --git a/sites/platform/src/guides/drupal/elasticsearch.md b/sites/platform/src/guides/drupal/elasticsearch.md index f3b05c764f..7cac43129b 100644 --- a/sites/platform/src/guides/drupal/elasticsearch.md +++ b/sites/platform/src/guides/drupal/elasticsearch.md @@ -17,8 +17,8 @@ To define the service, use the `elasticsearch`: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: elasticsearch: - disk: 256 + type: elasticsearch: + disk: 256 ``` If you’re using a [premium version](add-services/elasticsearch.md#supported-versions), use the `elasticsearch-enterprise` type instead. @@ -36,13 +36,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -63,16 +63,16 @@ With the above definition, the application container now has [access to the serv title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : - service: - endpoint: elasticsearch + : + service: + endpoint: elasticsearch ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -94,8 +94,8 @@ With the above definition, the application container now has [access to the serv ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. elasticsearch: - type: elasticsearch:{{% latest "elasticsearch" %}} - disk: 256 + type: elasticsearch:{{% latest "elasticsearch" %}} + disk: 256 ``` If you're using a [premium version](add-services/elasticsearch.md#supported-versions), @@ -109,13 +109,13 @@ use the `elasticsearch-enterprise` type in the service definition. title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: ``` <---> @@ -124,16 +124,16 @@ relationships: title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : - service: elasticsearch - endpoint: elasticsearch + : + service: elasticsearch + endpoint: elasticsearch ``` {{< /codetabs >}} diff --git a/sites/platform/src/guides/drupal/memcached.md b/sites/platform/src/guides/drupal/memcached.md index fe4e1e10d6..0e8c0d6cb5 100644 --- a/sites/platform/src/guides/drupal/memcached.md +++ b/sites/platform/src/guides/drupal/memcached.md @@ -21,8 +21,8 @@ To define the service, use the `memcached`: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: memcached: - disk: 256 + type: memcached: + disk: 256 ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -38,13 +38,13 @@ To define the relationship, use the following configuration: title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : + : ``` You can define `` as you like, so long as it's unique between all defined services @@ -65,16 +65,16 @@ With the above definition, the application container now has access to the servi title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : - service: - endpoint: memcached + : + service: + endpoint: memcached ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -94,8 +94,8 @@ For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} # PHP extensions. runtime: - extensions: - - memcached + extensions: + - memcached ``` ### Example configuration @@ -105,7 +105,7 @@ runtime: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. memcached: - type: memcached:{{% latest "memcached" %}} + type: memcached:{{% latest "memcached" %}} ``` #### [App configuration](/create-apps) @@ -116,13 +116,13 @@ memcached: title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - memcached: + memcached: ``` <---> @@ -131,16 +131,16 @@ relationships: title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - memcached: - service: memcached - endpoint: memcached + memcached: + service: memcached + endpoint: memcached ``` {{< /codetabs >}} diff --git a/sites/platform/src/guides/drupal/redis.md b/sites/platform/src/guides/drupal/redis.md index 358301ef62..c6ea5d4bc3 100644 --- a/sites/platform/src/guides/drupal/redis.md +++ b/sites/platform/src/guides/drupal/redis.md @@ -48,7 +48,7 @@ To define the service, use the `redis-persistent` endpoint: ```yaml {configFile="services"} # The name of the service container. Must be unique within a project. : - type: redis-persistent: + type: redis-persistent: ``` Note that changing the name of the service replaces it with a brand new service and all existing data is lost. @@ -64,13 +64,13 @@ To define the relationship, use the `redis` endpoint : title=Using default endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : + : ``` You can define `` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration. @@ -87,16 +87,16 @@ With the above definition, the application container now has access to the servi title=Using explicit endpoints +++ -```yaml {configFile="apps"} +```yaml {configFile="app"} # 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: - : - service: - endpoint: redis + : + service: + endpoint: redis ``` You can define ```` and ```` as you like, so long as it's unique between all defined services and relationships @@ -116,8 +116,8 @@ For PHP, enable the [extension](/languages/php/extensions) for the service: ```yaml {configFile="app"} # PHP extensions. runtime: - extensions: - - redis + extensions: + - redis ``` ### 3. Add the Drupal module diff --git a/sites/platform/src/guides/drupal/simplesaml.md b/sites/platform/src/guides/drupal/simplesaml.md index 73503c4be5..aacbe892a8 100644 --- a/sites/platform/src/guides/drupal/simplesaml.md +++ b/sites/platform/src/guides/drupal/simplesaml.md @@ -33,11 +33,11 @@ It should end up looking approximately like this: ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" - cache: - enabled: true - cookies: ['/^SS?ESS/', '/^Drupal.visitor/', 'SimpleSAMLSessionID', 'SimpleSAMLAuthToken'] + type: upstream + upstream: "myapp:http" + cache: + enabled: true + cookies: ['/^SS?ESS/', '/^Drupal.visitor/', 'SimpleSAMLSessionID', 'SimpleSAMLAuthToken'] ``` Commit this change to the Git repository. @@ -50,13 +50,13 @@ Add the following block to the `web.locations` section of `{{< vendor/configfile ```yaml {configFile="app"} web: - locations: - '/simplesaml': - root: 'vendor/simplesamlphp/simplesamlphp/www' - allow: true - scripts: true - index: - - index.php + locations: + '/simplesaml': + root: 'vendor/simplesamlphp/simplesamlphp/www' + allow: true + scripts: true + index: + - index.php ``` That will map all requests to `example.com/simplesaml/` to the `vendor/simplesamlphp/www` directory, allowing static files there to be served, PHP scripts to execute, and defaulting to index.php. @@ -79,8 +79,8 @@ The simplest way to set that is to add the following block to your `{{< vendor/c ```yaml {configFile="app"} variables: - env: - SIMPLESAMLPHP_CONFIG_DIR: /app/simplesamlphp/config + env: + SIMPLESAMLPHP_CONFIG_DIR: /app/simplesamlphp/config ``` Commit the whole `simplesamplphp` directory and `{{< vendor/configfile "app" >}}` to Git. diff --git a/sites/platform/src/guides/ibexa/fastly.md b/sites/platform/src/guides/ibexa/fastly.md index 0c4f9ae97b..683ed7003a 100644 --- a/sites/platform/src/guides/ibexa/fastly.md +++ b/sites/platform/src/guides/ibexa/fastly.md @@ -16,13 +16,13 @@ To use Fastly, Varnish must be disabled: - Remove environment variable `TRUSTED_PROXIES: "REMOTE_ADDR"` in [`{{< vendor/configfile "app" >}}](https://github.com/ezsystems/ezplatform/blob/master/.platform.app.yaml) - Remove the Varnish service in [`{{< vendor/configfile "services" >}}`](https://github.com/ezsystems/ezplatform/blob/master/.platform/services.yaml) - In [`{{< vendor/configfile "routes" >}}`](https://github.com/ezsystems/ezplatform/blob/master/.platform/routes.yaml), - change routes to use `app` instead of the `varnish` service you removed in previous step: + change routes to use `myapp` instead of the `varnish` service you removed in previous step: ```diff "https://{default}/": type: upstream - upstream: "varnish:http" -+ upstream: "app:http" ++ upstream: "myapp:http" ``` ## Setting up Ibexa DXP to use Fastly diff --git a/sites/platform/src/guides/laravel/deploy/octane.md b/sites/platform/src/guides/laravel/deploy/octane.md index a6aadc876a..55e93aa5ff 100644 --- a/sites/platform/src/guides/laravel/deploy/octane.md +++ b/sites/platform/src/guides/laravel/deploy/octane.md @@ -32,16 +32,16 @@ Octane should listen on a TCP socket. ```yaml {configFile="app"} web: - upstream: - socket_family: tcp - protocol: http - commands: - start: php artisan octane:start --server=swoole --host=0.0.0.0 --port=$PORT - locations: - "/": - passthru: true - scripts: false - allow: false + upstream: + socket_family: tcp + protocol: http + commands: + start: php artisan octane:start --server=swoole --host=0.0.0.0 --port=$PORT + locations: + "/": + passthru: true + scripts: false + allow: false ``` -{{< guide-buttons previous="Back" next="Deploy" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Deploy" >}} diff --git a/sites/platform/src/guides/micronaut/deploy/customize.md b/sites/platform/src/guides/micronaut/deploy/customize.md index c3cbc5b458..dcaf8339ed 100644 --- a/sites/platform/src/guides/micronaut/deploy/customize.md +++ b/sites/platform/src/guides/micronaut/deploy/customize.md @@ -30,28 +30,28 @@ compile group: 'sh.platform', name: 'config', version: '2.2.2' ## `.environment` -The `{{< vendor/configfile "app" >}}` file on the [previous page](/guides/micronaut/deploy/configure.md#configure-apps-in-platformappyaml) has been pulled directly from the [Micronaut template](https://github.com/platformsh-templates/micronaut/blob/master/.platform.app.yaml). It is sufficient to deploy Micronaut on it's own, but since Micronaut makes it possible to overwrite configurations without impacting the application itself, you might elect to rely more heavily on environment variables in it's place. +The `{{< vendor/configfile "app" >}}` file on the [previous page](/guides/micronaut/deploy/configure.md#configure-apps-in-platformappyaml) has been pulled directly from the [Micronaut template](https://github.com/platformsh-templates/micronaut/blob/master/.platform.app.yaml). It is sufficient to deploy Micronaut on it's own, but since Micronaut makes it possible to overwrite configurations without impacting the application itself, you might elect to rely more heavily on environment variables in it's place. Consider this simplified `{{< vendor/configfile "app" >}}` file: -```yaml -name: app +```yaml {configFile="app"} +name: myapp type: "java:11" disk: 1024 hooks: - build: mvn clean package - + build: mvn clean package + web: - commands: - start: java -jar $JAVA_OPTS $CREDENTIAL target/file.jar + commands: + start: java -jar $JAVA_OPTS $CREDENTIAL target/file.jar ``` On {{% vendor/name %}}, we can set the environment variable `JAVA_OPTS` by committing a `.environment` file to the repository's root. {{% vendor/name %}} runs `source .environment` in the application root when a project starts, and when logging into the environment over SSH. That gives you a place to do extra environment variable setup before the application runs, including modifying the system `$PATH` and other shell level customizations. -It allows us to define `JAVA_OPTS` when running on {{% vendor/name %}}, but otherwise not be used during local development testing. +It allows us to define `JAVA_OPTS` when running on {{% vendor/name %}}, but otherwise not be used during local development testing. ```shell # .environment diff --git a/sites/platform/src/guides/micronaut/mongodb.md b/sites/platform/src/guides/micronaut/mongodb.md index f6f8fd07c6..1bb4b8b5fc 100644 --- a/sites/platform/src/guides/micronaut/mongodb.md +++ b/sites/platform/src/guides/micronaut/mongodb.md @@ -17,10 +17,10 @@ This guide only covers the *addition* of a MongoDB service configuration to an e In your [service configuration](../../add-services/_index.md), include MongoDB with a [valid supported version](../../add-services/mongodb.md): -```yaml +```yaml {configFile="services"} dbmongo: - type: mongodb:3.6 - disk: 512 + type: mongodb:3.6 + disk: 512 ``` ## 2. Grant access to MongoDb through a relationship diff --git a/sites/platform/src/guides/quarkus/deploy/customize.md b/sites/platform/src/guides/quarkus/deploy/customize.md index bac3a122b5..5068276323 100644 --- a/sites/platform/src/guides/quarkus/deploy/customize.md +++ b/sites/platform/src/guides/quarkus/deploy/customize.md @@ -30,28 +30,28 @@ compile group: 'sh.platform', name: 'config', version: '2.2.2' ## `.environment` -The `{{< vendor/configfile "app" >}}` file on the [previous page](/guides/quarkus/deploy/configure.md#configure-apps-in-platformappyaml) has been pulled directly from the [Quarkus template](https://github.com/platformsh-templates/quarkus/blob/master/.platform.app.yaml). It is sufficient to deploy Quarkus on it's own, but since [Eclipse MicroProfile](https://github.com/eclipse/microprofile-config) makes it possible to overwrite configurations without impacting the application itself, you might elect to rely more heavily on environment variables in it's place. +The `{{< vendor/configfile "app" >}}` file on the [previous page](/guides/quarkus/deploy/configure.md#configure-apps-in-platformappyaml) has been pulled directly from the [Quarkus template](https://github.com/platformsh-templates/quarkus/blob/master/.platform.app.yaml). It is sufficient to deploy Quarkus on it's own, but since [Eclipse MicroProfile](https://github.com/eclipse/microprofile-config) makes it possible to overwrite configurations without impacting the application itself, you might elect to rely more heavily on environment variables in it's place. Consider this simplified `{{< vendor/configfile "app" >}}l` file: -```yaml -name: app +```yaml {configFile="app"} +name: myapp type: "java:11" disk: 1024 hooks: - build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true - + build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true + web: - commands: - start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT target/file.jar + commands: + start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT target/file.jar ``` On {{% vendor/name %}}, we can set the environment variable `JAVA_OPTS` by committing a `.environment` file to the repository's root. {{% vendor/name %}} runs `source .environment` in the application root when a project starts, and when logging into the environment over SSH. That gives you a place to do extra environment variable setup before the application runs, including modifying the system `$PATH` and other shell level customizations. -It allows us to define `JAVA_OPTS` when running on {{% vendor/name %}}, but otherwise not be used during local development testing. +It allows us to define `JAVA_OPTS` when running on {{% vendor/name %}}, but otherwise not be used during local development testing. ```shell # .environment diff --git a/sites/platform/src/guides/quarkus/mongodb.md b/sites/platform/src/guides/quarkus/mongodb.md index 93b7dc0d89..cf869f8343 100644 --- a/sites/platform/src/guides/quarkus/mongodb.md +++ b/sites/platform/src/guides/quarkus/mongodb.md @@ -19,10 +19,10 @@ This guide only covers the *addition* of a MongoDB service configuration to an e In your [service configuration](../../add-services/_index.md), include MongoDB with a [valid supported version](../../add-services/mongodb.md): -```yaml +```yaml {configFile="services"} dbmongo: - type: mongodb:3.6 - disk: 512 + type: mongodb:3.6 + disk: 512 ``` ## 2. Grant access to MongoDb through a relationship diff --git a/sites/platform/src/guides/spring/deploy/customize.md b/sites/platform/src/guides/spring/deploy/customize.md index 1e80f26772..a2efd10d85 100644 --- a/sites/platform/src/guides/spring/deploy/customize.md +++ b/sites/platform/src/guides/spring/deploy/customize.md @@ -38,20 +38,20 @@ you might elect to rely more heavily on environment variables in its place. Consider this simplified `{{< vendor/configfile "app" >}}` file: -```yaml -name: app +```yaml {configFile="app"} +name: myapp type: "java:11" disk: 1024 hooks: - build: mvn clean package + build: mvn clean package web: - commands: - start: java -jar $JAVA_OPTS target/file.jar --server.port=$PORT + commands: + start: java -jar $JAVA_OPTS target/file.jar --server.port=$PORT ``` On {{% vendor/name %}}, we can set the environment variable `JAVA_OPTS` by committing a `.environment` file to the repository's root. {{% vendor/name %}} runs `source .environment` in the application root when a project starts, and when logging into the environment over SSH. That gives you a place to do extra environment variable setup prior to the application running, including modifying the system `$PATH` and other shell level customizations. -It allows us to define `JAVA_OPTS` when running on {{% vendor/name %}}, but otherwise not be used during local development testing. +It allows us to define `JAVA_OPTS` when running on {{% vendor/name %}}, but otherwise not be used during local development testing. ```shell # .environment diff --git a/sites/platform/src/guides/spring/mongodb.md b/sites/platform/src/guides/spring/mongodb.md index b327de963f..67796b2c27 100644 --- a/sites/platform/src/guides/spring/mongodb.md +++ b/sites/platform/src/guides/spring/mongodb.md @@ -17,10 +17,10 @@ This guide only covers the *addition* of a MongoDB service configuration to an e In your [service configuration](../../add-services/_index.md), include MongoDB with a [valid supported version](../../add-services/mongodb.md): -```yaml +```yaml {configFile="services"} dbmongo: - type: mongodb:3.6 - disk: 512 + type: mongodb:3.6 + disk: 512 ``` ## 2. Grant access to MongoDb through a relationship diff --git a/sites/platform/src/guides/strapi/database-configuration/mongodb.md b/sites/platform/src/guides/strapi/database-configuration/mongodb.md index e1fe2a1a84..bacf6b31e5 100644 --- a/sites/platform/src/guides/strapi/database-configuration/mongodb.md +++ b/sites/platform/src/guides/strapi/database-configuration/mongodb.md @@ -18,21 +18,21 @@ To use MongoDB with a Strapi v3 application on {{% vendor/name %}}, follow these 1. Replace the PostgreSQL configuration in your `{{< vendor/configfile "services" >}}` file with the following: - ```yaml + ```yaml {configFile="services"} mongodb: - type: mongodb:3.6 - disk: 512 + type: mongodb:3.6 + disk: 512 ``` **_Note that the minimum disk size for MongoDB is 512MB._** 1. In your `{{< vendor/configfile "app" >}}` file, replace the relationship name to match the MongoDB database you added: - ```yaml + ```yaml {configFile="app"} relationships: - mongodatabase: - service: "mongodb" - endpoint: "mongodb" + mongodatabase: + service: "mongodb" + endpoint: "mongodb" ``` 1. In the `config` folder, locate the `database.js` file, and replace its content with the following: diff --git a/sites/platform/src/guides/strapi/database-configuration/mysql.md b/sites/platform/src/guides/strapi/database-configuration/mysql.md index ba5298ae77..e6012e6a27 100644 --- a/sites/platform/src/guides/strapi/database-configuration/mysql.md +++ b/sites/platform/src/guides/strapi/database-configuration/mysql.md @@ -19,21 +19,21 @@ To configure a MySQL database for Strapi on {{% vendor/name %}}, follow these st 2. Replace the PostgreSQL configuration in your `{{< vendor/configfile "services" >}}` file with the following: - ```yaml + ```yaml {configFile="services"} mysql: - type: oracle-mysql:8.0 - disk: 256 + type: oracle-mysql:8.0 + disk: 256 ``` **_Note that the minimum disk size for MySQL/Oracle MySQL is 256MB._** 3. In your `{{< vendor/configfile "app" >}}` file, replace the relationship name to match the MySQL database you added: - ```yaml + ```yaml {configFile="app"} relationships: - mysqldatabase: - service: "mysql" - endpoint: "mysql" + mysqldatabase: + service: "mysql" + endpoint: "mysql" ``` 4. In the `config` folder, locate the `database.js` file, and replace its content with the following: diff --git a/sites/platform/src/guides/strapi/database-configuration/postgresql.md b/sites/platform/src/guides/strapi/database-configuration/postgresql.md index f4bcb68d12..41496cd488 100644 --- a/sites/platform/src/guides/strapi/database-configuration/postgresql.md +++ b/sites/platform/src/guides/strapi/database-configuration/postgresql.md @@ -17,17 +17,17 @@ To configure a PostgreSQL database for Strapi on {{% vendor/name %}}, follow the 1. In your `{{< vendor/configfile "services" >}}` file, add the following: - ```yaml + ```yaml {configFile="services"} postgres: - type: postgresql:13 - disk: 512 + type: postgresql:13 + disk: 512 ``` 1. In your `{{< vendor/configfile "app" >}}` file, replace the relationship name to match the PostgreSQL database you added: - ```yaml + ```yaml {configFile="app"} relationships: - postgresdatabase: "postgres:postgresql" + postgresdatabase: "postgres:postgresql" ``` 1. In the `config` folder, locate the `database.js` file, and replace its content with the following: diff --git a/sites/platform/src/guides/strapi/deploy/configure.md b/sites/platform/src/guides/strapi/deploy/configure.md index bca7423409..b7a60f923e 100644 --- a/sites/platform/src/guides/strapi/deploy/configure.md +++ b/sites/platform/src/guides/strapi/deploy/configure.md @@ -45,7 +45,7 @@ To use another service, replace `postgresql:12` in the example below with the na {{% /guides/config-service %}} -```yaml +```yaml {configFile="services"} # The services of the project. # Each service listed is deployed diff --git a/sites/platform/src/guides/symfony/crons.md b/sites/platform/src/guides/symfony/crons.md index 436538cf6a..6b599a90ea 100644 --- a/sites/platform/src/guides/symfony/crons.md +++ b/sites/platform/src/guides/symfony/crons.md @@ -10,10 +10,10 @@ To set up a cron job, add a configuration similar to the following: ```yaml {configFile="app"} crons: - snapshot: - spec: 0 5 * * * - commands: | - croncape symfony ... + snapshot: + spec: 0 5 * * * + commands: | + croncape symfony ... ``` To run a command in a cron hook for specific environment types, @@ -21,13 +21,13 @@ use the `PLATFORM_ENVIRONMENT_TYPE` environment variable: ```yaml {configFile="app"} crons: - snapshot: - spec: 0 5 * * * - commands: | - # only run for the production environment, aka main branch - if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then - croncape symfony ... - fi + snapshot: + spec: 0 5 * * * + commands: | + # only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + croncape symfony ... + fi ``` ## Use croncape @@ -58,7 +58,7 @@ To use a custom SMTP and/or custom sender address, follow these steps: 3. To disable the provided SMTP service, run `symfony cloud:env:info enable_smtp false`. {{% note theme="info" %}} -To use `croncape`, SMTP must be enabled on the environment, where the [`PLATFORM_SMTP_HOST`](/development/variables/use-variables#use-provided-variables) environment variable is accessible. +To use `croncape`, SMTP must be enabled on the environment, where the [`PLATFORM_SMTP_HOST`](/development/variables/use-variables#use-provided-variables) environment variable is accessible. This variable is available, and SMTP enabled, by default on all production environments. This is not the case for preview (non-production) environments, where it must be enabled with the command `symfony cloud:env:info enable_smtp true`. diff --git a/sites/platform/src/guides/symfony/environment-variables.md b/sites/platform/src/guides/symfony/environment-variables.md index 22848362be..3399495a75 100644 --- a/sites/platform/src/guides/symfony/environment-variables.md +++ b/sites/platform/src/guides/symfony/environment-variables.md @@ -27,7 +27,7 @@ about the app and its infrastructure. The Symfony integration exposes more environment variables: -- `APP_ENV` is set to `prod` by default. +- `APP_ENV` is set to `prod` by default. You can manually override this value for a preview environment by setting the `SYMFONY_ENV` environment variable to `dev`, and remove it when done. @@ -41,7 +41,7 @@ The Symfony integration exposes more environment variables: - `MAILFROM` is set to a random value. This value is used as a `From` header when using [croncape](./crons#use-croncape). -- `SYMFONY_IS_WORKER` is set to `1` when the container is running in the context of a worker +- `SYMFONY_IS_WORKER` is set to `1` when the container is running in the context of a worker (instead of the main application container). - `SYMFONY_CACHE_DIR` (only available during the build hook execution): @@ -103,9 +103,9 @@ For example, if you have the following [relationships](/create-apps/app-referenc ```yaml relationships: - database: - service: securitydb - endpoint: postgresql + database: + service: securitydb + endpoint: postgresql ``` The environment variables for the database service is prefixed by `DATABASE_` @@ -284,4 +284,4 @@ The [Apache Kafka](/add-services/kafka) configuration is exposed via the followi - `KAFKA_PORT` - `KAFKA_IP` -{{< guide-buttons previous="Back" next="Workers" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Workers" >}} diff --git a/sites/platform/src/guides/symfony/faq.md b/sites/platform/src/guides/symfony/faq.md index d4a530eed4..6d7fb7b773 100644 --- a/sites/platform/src/guides/symfony/faq.md +++ b/sites/platform/src/guides/symfony/faq.md @@ -23,18 +23,18 @@ Note that the environment variables are available in the deploy hook. ## How can I access my application logs? -To display the application log file (`app` file), run the following command: +To display the application log file (`/var/log/app.log` file), run the following command: ```bash symfony log app --tail ``` -All the log messages generated by your app are sent to this `app` file. +All the log messages generated by your app are sent to this `app.log` file. This includes language errors such as PHP errors, warnings, notices, as well as uncaught exceptions. The file also contains your application logs if you log on `stderr`. -Note that {{% vendor/name %}} manages the `app` file for you. +Note that {{% vendor/name %}} manages the `app.log` file for you. This is to prevent disks from getting filled and using very fast local drives instead of slower network disks. Make sure your apps always output their logs to `stderr`. @@ -114,4 +114,4 @@ If you've already created a custom homepage, make sure you perform the following ## Other issues -For other issues unrelated to Symfony, see [Troubleshoot development](/development/troubleshoot.html). \ No newline at end of file +For other issues unrelated to Symfony, see [Troubleshoot development](/development/troubleshoot.html). diff --git a/sites/platform/src/guides/symfony/integration.md b/sites/platform/src/guides/symfony/integration.md index 8e02fcb315..c01bb8ad1a 100644 --- a/sites/platform/src/guides/symfony/integration.md +++ b/sites/platform/src/guides/symfony/integration.md @@ -21,12 +21,12 @@ integration, enable it by adding the following configuration: ```yaml {configFile="app"} hooks: - build: | - set -x -e + build: | + set -x -e - curl -fs https://get.symfony.com/cloud/configurator | bash + curl -fs https://get.symfony.com/cloud/configurator | bash - # ... + # ... ``` The **configurator** enables the following integration: @@ -65,17 +65,17 @@ Here's the default `hooks` section optimized for Symfony projects: ```yaml {configFile="app"} hooks: - build: | - set -x -e + build: | + set -x -e - curl -s https://get.symfony.com/cloud/configurator | bash + curl -s https://get.symfony.com/cloud/configurator | bash - symfony-build + symfony-build - deploy: | - set -x -e + deploy: | + set -x -e - symfony-deploy + symfony-deploy ``` {{< note title="Warning" >}} @@ -96,12 +96,12 @@ During the `deploy` or `post_deploy` hooks, you can execute actions for a specif To do so, in your `{{< vendor/configfile "app" >}}`file, use the `PLATFORM_ENVIRONMENT_TYPE` [environment variable](../../development/variables/_index.md)) in a condition: -```yaml +```yaml {configFile="app"} hooks: - deploy: | - if [ "PLATFORM_ENVIRONMENT_TYPE" != "production" ]; then - symfony console app:dev:anonymize - fi + deploy: | + if [ "PLATFORM_ENVIRONMENT_TYPE" != "production" ]; then + symfony console app:dev:anonymize + fi ``` {{< /note >}} @@ -125,12 +125,12 @@ To override the flags used by Composer, use the `$COMPOSER_FLAGS` environment va ```yaml {configFile="app"} hooks: - build: | - set -x -e + build: | + set -x -e - curl -s https://get.symfony.com/cloud/configurator | bash + curl -s https://get.symfony.com/cloud/configurator | bash - COMPOSER_FLAGS="--ignore-platform-reqs" symfony-build + COMPOSER_FLAGS="--ignore-platform-reqs" symfony-build ``` When installing dependencies, the script automatically detects if the app is using npm or Yarn. @@ -141,7 +141,7 @@ set `NO_NPM` or `NO_YARN` to `1` depending on your package manager. To customize Node/npm/Yarn behaviors, prefix the `symfony-build` script with the following environment variables: -- ``NODE_VERSION``: to pinpoint the Node version that nvm is going to install. +- ``NODE_VERSION``: to pinpoint the Node version that nvm is going to install. The default value is ``--lts``. - ``YARN_FLAGS``: flags to pass to ``yarn install``. There is no default value. @@ -174,14 +174,14 @@ but before [symfony-build](#symfony-build): ```yaml {configFile="app"} hooks: - build: | - set -x -e + build: | + set -x -e - curl -s https://get.symfony.com/cloud/configurator | bash + curl -s https://get.symfony.com/cloud/configurator | bash - php-ext-install redis 5.3.2 + php-ext-install redis 5.3.2 - symfony-build + symfony-build ``` When installing [PECL](https://pecl.php.net/) PHP extensions, you can configure @@ -189,8 +189,8 @@ them directly as *variables* instead: ```yaml {configFile="app"} variables: - php-ext: - redis: 5.3.2 + php-ext: + redis: 5.3.2 ``` {{< note >}} @@ -207,19 +207,19 @@ use the following configuration: ```yaml {configFile="app"} hooks: - build: | - set -x -e + build: | + set -x -e - curl -s https://get.symfony.com/cloud/configurator | bash + curl -s https://get.symfony.com/cloud/configurator | bash - symfony-build + symfony-build - # Setup everything to use the Node installation - unset NPM_CONFIG_PREFIX - export NVM_DIR=${PLATFORM_APP_DIR}/.nvm - set +x && . "${NVM_DIR}/nvm.sh" use --lts && set -x - # Starting from here, everything is setup to use the same Node - yarn encore dev + # Setup everything to use the Node installation + unset NPM_CONFIG_PREFIX + export NVM_DIR=${PLATFORM_APP_DIR}/.nvm + set +x && . "${NVM_DIR}/nvm.sh" use --lts && set -x + # Starting from here, everything is setup to use the same Node + yarn encore dev ``` If you want to use two different Node versions, @@ -227,24 +227,24 @@ use the following configuration instead: ```yaml {configFile="app"} hooks: - build: | - set -x -e + build: | + set -x -e - curl -s https://get.symfony.com/cloud/configurator | bash + curl -s https://get.symfony.com/cloud/configurator | bash - symfony-build + symfony-build - cd web/js_app - unset NPM_CONFIG_PREFIX - export NVM_DIR=${PLATFORM_APP_DIR}/.nvm + cd web/js_app + unset NPM_CONFIG_PREFIX + export NVM_DIR=${PLATFORM_APP_DIR}/.nvm - NODE_VERSION=8 yarn-install + NODE_VERSION=8 yarn-install - # Setup everything to use the Node installation - set +x && . "${NVM_DIR}/nvm.sh" use 8 && set -x + # Setup everything to use the Node installation + set +x && . "${NVM_DIR}/nvm.sh" use 8 && set -x - # Starting from here, everything is setup to use Node 8 - yarn build --environment=prod + # Starting from here, everything is setup to use Node 8 + yarn build --environment=prod ``` -{{< guide-buttons previous="Back" next="Environment variables" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Environment variables" >}} diff --git a/sites/platform/src/guides/symfony/workers.md b/sites/platform/src/guides/symfony/workers.md index 8ab261a5fb..c177b2cda7 100644 --- a/sites/platform/src/guides/symfony/workers.md +++ b/sites/platform/src/guides/symfony/workers.md @@ -6,23 +6,23 @@ description: | --- Workers (or consumers) are a great way to off-load processing in the background -to make an app as fast as possible. +to make an app as fast as possible. You can implement workers in Symfony smoothly thanks to the [Messenger component](https://symfony.com/doc/current/components/messenger.html). To deploy a worker, add an entry under the ``workers`` section [in your app configuration](../../create-apps/_index.md): ```yaml {configFile="app"} workers: - mails: - commands: - start: symfony console messenger:consume --time-limit=60 --memory-limit=128M + mails: + commands: + start: symfony console messenger:consume --time-limit=60 --memory-limit=128M ``` Note that the `symfony` binary is available when you use the [Symfony integration](./integration) in your {{% vendor/name %}} app configuration. On {{% vendor/name %}}, worker containers run the exact same code as the web container. -The container image is built only once and deployed multiple times in its own container alongside the web container. +The container image is built only once and deployed multiple times in its own container alongside the web container. The *build* hook and dependencies might not vary but, as these containers are independent, they can be customized the same way using common properties. The values defined for the main container are used as default values. @@ -48,4 +48,4 @@ To share data between containers, use [services](../../add-services/_index.md). {{< /note >}} -{{< guide-buttons previous="Back" next="Cron jobs" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Cron jobs" >}} diff --git a/sites/platform/src/guides/typo3/deploy/deploy.md b/sites/platform/src/guides/typo3/deploy/deploy.md index 52de49d033..f4b3a12903 100644 --- a/sites/platform/src/guides/typo3/deploy/deploy.md +++ b/sites/platform/src/guides/typo3/deploy/deploy.md @@ -12,39 +12,40 @@ description: | The following section is only relevant when deploying the TYPO3 template or creating a new site from scratch locally using Composer. -If you're migrating an existing site, you can move on to the next step. - -```yaml - # The deploy hook runs after your application has been deployed and started. - # Code can't be modified at this point but the database is available. - # The site isn't accepting requests while this script runs so keep it - # fast. - deploy: | - # Exit hook immediately if a command exits with a non-zero status. - set -e - - # Set TYPO3 site defaults on first deploy. - if [ ! -f var/platformsh.installed ]; then - # Copy the created LocalConfiguration into the writable location. - cp public/typo3conf/LocalConfiguration.FromSource.php var/LocalConfiguration.php - - # On first install, create an inital admin user with a default password. - # *CHANGE THIS VALUE IMMEDIATELY AFTER INSTALLATION* - php vendor/bin/typo3cms install:setup \ - --install-steps-config=src/SetupDatabase.yaml \ - --site-setup-type=no \ - --site-name="TYPO3 on {{% vendor/name %}}" \ - --admin-user-name=admin \ - --admin-password=password \ - --skip-extension-setup \ - --no-interaction - - # Sets up all extensions that are marked as active in the system. - php vendor/bin/typo3cms extension:setupactive || true - - # Create file that indicates first deploy and installation has been completed. - touch var/platformsh.installed - fi; +If you're migrating an existing site, you can move on to the next step. + +```yaml {configFile="app"} +hooks: + # The deploy hook runs after your application has been deployed and started. + # Code can't be modified at this point but the database is available. + # The site isn't accepting requests while this script runs so keep it + # fast. + deploy: | + # Exit hook immediately if a command exits with a non-zero status. + set -e + + # Set TYPO3 site defaults on first deploy. + if [ ! -f var/platformsh.installed ]; then + # Copy the created LocalConfiguration into the writable location. + cp public/typo3conf/LocalConfiguration.FromSource.php var/LocalConfiguration.php + + # On first install, create an inital admin user with a default password. + # *CHANGE THIS VALUE IMMEDIATELY AFTER INSTALLATION* + php vendor/bin/typo3cms install:setup \ + --install-steps-config=src/SetupDatabase.yaml \ + --site-setup-type=no \ + --site-name="TYPO3 on {{% vendor/name %}}" \ + --admin-user-name=admin \ + --admin-password=password \ + --skip-extension-setup \ + --no-interaction + + # Sets up all extensions that are marked as active in the system. + php vendor/bin/typo3cms extension:setupactive || true + + # Create file that indicates first deploy and installation has been completed. + touch var/platformsh.installed + fi; ``` The template is designed to run the TYPO3 installer only on the first deploy diff --git a/sites/platform/src/guides/wordpress/deploy/next-steps.md b/sites/platform/src/guides/wordpress/deploy/next-steps.md index 1d9bcf33a9..138acb5a5e 100644 --- a/sites/platform/src/guides/wordpress/deploy/next-steps.md +++ b/sites/platform/src/guides/wordpress/deploy/next-steps.md @@ -13,10 +13,10 @@ but it's possible to use some non-Composer plugins and themes in your site, provided that they don't require write access at runtime. In your build hook, include: -```yaml +```yaml {configFile="app"} hooks: - build: | - rsync -a plugins/* wordpress/wp-content/plugins/ + build: | + rsync -a plugins/* wordpress/wp-content/plugins/ ``` Here, you can commit plugins to the repository in a `plugins` subdirectory, diff --git a/sites/platform/src/guides/wordpress/redis.md b/sites/platform/src/guides/wordpress/redis.md index 6ecf40ab5a..b4b475ffdb 100644 --- a/sites/platform/src/guides/wordpress/redis.md +++ b/sites/platform/src/guides/wordpress/redis.md @@ -19,7 +19,7 @@ To create a Redis service, add the following to your [services configuration](.. ```yaml {configFile="services"} rediscache: - type: redis:6.0 + type: redis:6.0 ``` That creates a service named `rediscache` with the type `redis`, specifically version `6.0`. @@ -32,7 +32,7 @@ add the following: ```yaml {configFile="app"} relationships: - redis: "rediscache:redis" + redis: "rediscache:redis" ``` The key (left side) is the name that's exposed to the application in the [`PLATFORM_RELATIONSHIPS` variable](../../development/variables/use-variables.md#use-provided-variables). @@ -87,11 +87,11 @@ title=WP Redis ```yaml {configFile="app"} hooks: - build: | - ... - if [ -f wordpress/wp-content/plugins/wp-redis/object-cache.php ]; then - cp wordpress/wp-content/plugins/wp-redis/object-cache.php wordpress/wp-content/object-cache.php - fi + build: | + ... + if [ -f wordpress/wp-content/plugins/wp-redis/object-cache.php ]; then + cp wordpress/wp-content/plugins/wp-redis/object-cache.php wordpress/wp-content/object-cache.php + fi ``` <---> @@ -102,11 +102,11 @@ title=Redis Object Cache ```yaml {configFile="app"} hooks: - build: | - ... - if [ -f wordpress/wp-content/plugins/redis-cache/includes/object-cache.php ]; then - cp wordpress/wp-content/plugins/redis-cache/includes/object-cache.php wordpress/wp-content/object-cache.php - fi + build: | + ... + if [ -f wordpress/wp-content/plugins/redis-cache/includes/object-cache.php ]; then + cp wordpress/wp-content/plugins/redis-cache/includes/object-cache.php wordpress/wp-content/object-cache.php + fi ``` {{< /codetabs >}} @@ -115,16 +115,16 @@ It should now look something like: ```yaml {configFile="app"} hooks: - build: | - set -e - bash .platform-scripts/install-redis.sh 6.0.12 - # Copy manually-provided plugins into the plugins directory. - # This allows manually-provided and composer-provided plugins to coexist. - rsync -a plugins/* wordpress/wp-content/plugins/ - - if [ -f wordpress/wp-content/plugins/redis-cache/includes/object-cache.php ]; then - cp wordpress/wp-content/plugins/redis-cache/includes/object-cache.php wordpress/wp-content/object-cache.php - fi + build: | + set -e + bash .platform-scripts/install-redis.sh 6.0.12 + # Copy manually-provided plugins into the plugins directory. + # This allows manually-provided and composer-provided plugins to coexist. + rsync -a plugins/* wordpress/wp-content/plugins/ + + if [ -f wordpress/wp-content/plugins/redis-cache/includes/object-cache.php ]; then + cp wordpress/wp-content/plugins/redis-cache/includes/object-cache.php wordpress/wp-content/object-cache.php + fi ``` Each plugin requires slightly different configuration. diff --git a/sites/platform/src/increase-observability/integrate-observability/blackfire.md b/sites/platform/src/increase-observability/integrate-observability/blackfire.md index b427b5ff6b..5028607449 100644 --- a/sites/platform/src/increase-observability/integrate-observability/blackfire.md +++ b/sites/platform/src/increase-observability/integrate-observability/blackfire.md @@ -186,8 +186,8 @@ To do so, add [a configuration](../../define-routes/cache.md#allowing-only-speci ```yaml {configFile="routes"} cache: - enabled: true - cookies: ["/SESS.*/", "__blackfire"] + enabled: true + cookies: ["/SESS.*/", "__blackfire"] ``` ## Get support @@ -237,4 +237,4 @@ To do so, run the following commands: ```bash {{% vendor/cli %}} variable:delete php:blackfire.log_file {{% vendor/cli %}} variable:delete php:blackfire.log_level -``` \ No newline at end of file +``` diff --git a/sites/platform/src/increase-observability/integrate-observability/new-relic/java.md b/sites/platform/src/increase-observability/integrate-observability/new-relic/java.md index 80a0d57ed8..d99ccbd7ad 100644 --- a/sites/platform/src/increase-observability/integrate-observability/new-relic/java.md +++ b/sites/platform/src/increase-observability/integrate-observability/new-relic/java.md @@ -81,52 +81,52 @@ Unzip `newrelic-java.zip` by configuring `maven-dependency-plugin` in your `pom. The next step is to [configure your app](../../../create-apps/_index.md) to set the agent in the JVM parameters: -```yaml -name: app +```yaml {configFile="app"} +name: myapp type: 'java:8' disk: 1024 hooks: - build: | - mvn clean package - rm -rf newrelic/ - mv target/newrelic/ newrelic/ + build: | + mvn clean package + rm -rf newrelic/ + mv target/newrelic/ newrelic/ web: - commands: - start: | - java -jar \ - -Xmx$(jq .info.limits.memory /run/config.json)m -XX:+ExitOnOutOfMemoryError \ - -javaagent:/app/newrelic/newrelic.jar + commands: + start: | + java -jar \ + -Xmx$(jq .info.limits.memory /run/config.json)m -XX:+ExitOnOutOfMemoryError \ + -javaagent:/app/newrelic/newrelic.jar ``` ### Manual Configuration To use this installation it is only required that you modify `{{< vendor/configfile "app" >}}`, which will download and set the New Relic Java agent for you. -```yaml -name: app +```yaml {configFile="app"} +name: myapp type: 'java:8' disk: 1024 variables: - env: - NEW_RELIC_URL: https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip + env: + NEW_RELIC_URL: https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip hooks: - build: | - mvn clean package - rm -rf newrelic - curl -O $NEW_RELIC_URL - unzip newrelic-java.zip + build: | + mvn clean package + rm -rf newrelic + curl -O $NEW_RELIC_URL + unzip newrelic-java.zip web: - commands: - start: | - java -jar \ - -Xmx$(jq .info.limits.memory /run/config.json)m \ - -XX:+ExitOnOutOfMemoryError \ - -javaagent:/app/newrelic/newrelic.jar + commands: + start: | + java -jar \ + -Xmx$(jq .info.limits.memory /run/config.json)m \ + -XX:+ExitOnOutOfMemoryError \ + -javaagent:/app/newrelic/newrelic.jar ``` -You need to wait a bit for your New Relic dashboard to be generated. \ No newline at end of file +You need to wait a bit for your New Relic dashboard to be generated. diff --git a/sites/platform/src/increase-observability/integrate-observability/new-relic/nodejs.md b/sites/platform/src/increase-observability/integrate-observability/new-relic/nodejs.md index 84e6069962..d0ad9d74bf 100644 --- a/sites/platform/src/increase-observability/integrate-observability/new-relic/nodejs.md +++ b/sites/platform/src/increase-observability/integrate-observability/new-relic/nodejs.md @@ -33,22 +33,22 @@ To allow New Relic to output logs, add a writable directory to put the log file At the end of the `build` hook in your `{{< vendor/configfile "app" >}}`, create a `newrelic` directory in your application root: -```yaml +```yaml {configFile="app"} hooks: - # ... your hooks - build: | - # ... your build hook - mkdir $PLATFORM_APP_DIR/newrelic + # ... your hooks + build: | + # ... your build hook + mkdir $PLATFORM_APP_DIR/newrelic ``` Now add this directory to your mounts: -```yaml +```yaml {configFile="app"} mounts: - # ... your mounts - '/newrelic/': - source: local - source_path: newrelic + # ... your mounts + '/newrelic/': + source: local + source_path: newrelic ``` To tell New Relic to use this file, create a new project level variable called `NEW_RELIC_LOG`: diff --git a/sites/platform/src/increase-observability/integrate-observability/new-relic/php.md b/sites/platform/src/increase-observability/integrate-observability/new-relic/php.md index 75a3719f76..13b21dce0d 100644 --- a/sites/platform/src/increase-observability/integrate-observability/new-relic/php.md +++ b/sites/platform/src/increase-observability/integrate-observability/new-relic/php.md @@ -30,10 +30,10 @@ Repeat these two steps for every environment you want to monitor, making sure yo Enable the New Relic extension in your `{{< vendor/configfile "app" >}}` as follows: -```yaml +```yaml {configFile="app"} runtime: - extensions: - - newrelic + extensions: + - newrelic ``` Push the changes to your {{% vendor/name %}} environment to enable New Relic as follows: diff --git a/sites/platform/src/increase-observability/integrate-observability/tideways.md b/sites/platform/src/increase-observability/integrate-observability/tideways.md index a7a94f4c01..31babf456f 100644 --- a/sites/platform/src/increase-observability/integrate-observability/tideways.md +++ b/sites/platform/src/increase-observability/integrate-observability/tideways.md @@ -29,10 +29,10 @@ Add your Tideways license key as a project level variable: Enable the Tideways extension in your `{{< vendor/configfile "app" >}}` as follows: -```yaml +```yaml {configFile="app"} runtime: - extensions: - - tideways + extensions: + - tideways ``` Enabling the extension also activates the Tideways background process. diff --git a/sites/platform/src/integrations/activity/reference.md b/sites/platform/src/integrations/activity/reference.md index ac92abb166..d165fe7860 100644 --- a/sites/platform/src/integrations/activity/reference.md +++ b/sites/platform/src/integrations/activity/reference.md @@ -51,7 +51,7 @@ You can also see [complete examples of responses](#examples). "deploy": 209.986, "execute": 210.508 }, - "log": "Building application 'app' (runtime type: php:8.2, tree: 9851a01)\n Reusing existing build for this tree ID\n\n...\nRedeploying environment test, as a clone of main\n ...\n Closing all services\n Opening application app and its relationships\n Executing deploy hook for application app\n ... Environment configuration\n app (type: php:8.0, size: S, disk: 2048)\n\n ...", + "log": "Building application 'myapp' (runtime type: php:8.2, tree: 9851a01)\n Reusing existing build for this tree ID\n\n...\nRedeploying environment test, as a clone of main\n ...\n Closing all services\n Opening application myapp and its relationships\n Executing deploy hook for application myapp\n ... Environment configuration\n myapp (type: php:8.0, size: S, disk: 2048)\n\n ...", "payload": { ... }, @@ -346,7 +346,7 @@ To get details about the configured cron job, see the `parameters` property: "user": "admin", "cluster": "abcdefgh1234567-main-abcd123", "environment": "main", - "application": "app", + "application": "myapp", "cron": "saybye", "spec": { "spec": "5 * * * *", @@ -380,7 +380,7 @@ The following example shows the full activity response to a cron job: "user": "admin", "cluster": "abcdefgh1234567-main-abcd123", "environment": "main", - "application": "app", + "application": "myapp", "cron": "saybye", "spec": { "spec": "5 * * * *", @@ -677,7 +677,7 @@ The following example shows the full activity response to a Git push: "deploy": 49.954, "execute": 51.516 }, - "log": "Found 1 new commit\n\nBuilding application 'app' (runtime type: php:8.0, tree: 9851a01)\n Reusing existing build for this tree ID\n\nProvisioning certificates\n Certificates\n - certificate 5093946: expiring on 2023-02-23 11:09:20+00:00, covering {,www}.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}\n\n\nRedeploying environment main\n Preparing deployment\n Closing service app\n Opening application app and its relationships\n Executing deploy hook for application app\n hello world\n\n Opening environment\n Environment configuration\n app (type: php:8.0, size: S, disk: 2048)\n\n Environment routes\n http://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n http://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ is served by application `app`\n https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n", + "log": "Found 1 new commit\n\nBuilding application 'myapp' (runtime type: php:8.0, tree: 9851a01)\n Reusing existing build for this tree ID\n\nProvisioning certificates\n Certificates\n - certificate 5093946: expiring on 2023-02-23 11:09:20+00:00, covering {,www}.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}\n\n\nRedeploying environment main\n Preparing deployment\n Closing service myapp\n Opening application myapp and its relationships\n Executing deploy hook for application myapp\n hello world\n\n Opening environment\n Environment configuration\n app (type: php:8.0, size: S, disk: 2048)\n\n Environment routes\n http://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n http://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ is served by application `myapp`\n https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n", "payload": { "user": { "id": "c9926428-44dc-4b10-be03-a26dd43b44c1", @@ -897,7 +897,7 @@ The following example shows the full activity response to a Git push: "ssi": { "enabled": false }, - "upstream": "app:http", + "upstream": "myapp:http", "redirects": { "expires": "-1s", "paths": {} @@ -977,7 +977,7 @@ The following example shows the full activity response to a Git push: } }, "webapps": { - "app": { + "myapp": { "resources": null, "size": "AUTO", "disk": 2048, @@ -1002,7 +1002,7 @@ The following example shows the full activity response to a Git push: "initial_size": null, "container_profile": null, "instance_count": null, - "name": "app", + "name": "myapp", "type": "php:8.0", "runtime": {}, "preflight": { diff --git a/sites/platform/src/languages/dotnet.md b/sites/platform/src/languages/dotnet.md index 5df4a28307..08035145ed 100644 --- a/sites/platform/src/languages/dotnet.md +++ b/sites/platform/src/languages/dotnet.md @@ -46,11 +46,11 @@ with the default [framework-dependent deployment](https://docs.microsoft.com/en- ```yaml {configFile="app"} hooks: - build: | - set -xe - dotnet publish --output "$PLATFORM_OUTPUT_DIR" \ - -p:UseRazorBuildServer=false \ - -p:UseSharedCompilation=false + build: | + set -xe + dotnet publish --output "$PLATFORM_OUTPUT_DIR" \ + -p:UseRazorBuildServer=false \ + -p:UseSharedCompilation=false ``` where `PLATFORM_OUTPUT_DIR` is the output directory for compiled languages available at build time. @@ -90,30 +90,30 @@ while routing other traffic to the .NET application. ```yaml {configFile="app"} web: - locations: - "/": - root: "wwwroot" - allow: true - passthru: true - rules: - # Serve these common asset types with customs cache headers. - \.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$: - allow: true - expires: 300s - commands: - start: "dotnet WebApplication1.dll" + locations: + "/": + root: "wwwroot" + allow: true + passthru: true + rules: + # Serve these common asset types with customs cache headers. + \.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$: + allow: true + expires: 300s + commands: + start: "dotnet WebApplication1.dll" ``` You can also route all requests to the application unconditionally: ```yaml {configFile="app"} web: - locations: - "/": - allow: false - passthru: true + locations: + "/": + allow: false + passthru: true - commands: - start: "dotnet WebApplication1.dll" + commands: + start: "dotnet WebApplication1.dll" ``` ## Project templates diff --git a/sites/platform/src/languages/elixir.md b/sites/platform/src/languages/elixir.md index 6bc5547b33..9f8f610cf4 100644 --- a/sites/platform/src/languages/elixir.md +++ b/sites/platform/src/languages/elixir.md @@ -31,14 +31,14 @@ Patch versions are applied periodically for bug fixes and the like. When you dep {{% language-specification type="elixir" display_name="Elixir" %}} ```yaml {configFile="apps"} -app: +myapp: type: 'elixir:' ``` For example: ```yaml {configFile="apps"} -app: +myapp: type: 'elixir:{{% latest "elixir" %}}' ``` @@ -66,8 +66,8 @@ If you are using Hex to manage your dependencies, you need to specify the `MIX_E ```yaml {configFile="app"} variables: - env: - MIX_ENV: 'prod' + env: + MIX_ENV: 'prod' ``` The `SECRET_KEY_BASE` variable is generated automatically based on the [`PLATFORM_PROJECT_ENTROPY` variable](../development/variables/use-variables.md#use-provided-variables). You can change it. @@ -76,10 +76,10 @@ Include in your build hook the steps to retrieve a local Hex and `rebar`, and th ```yaml {configFile="app"} hooks: - build: | - mix local.hex --force - mix local.rebar --force - mix do deps.get --only prod, deps.compile, compile + build: | + mix local.hex --force + mix local.rebar --force + mix do deps.get --only prod, deps.compile, compile ``` {{< note >}} @@ -93,27 +93,27 @@ you can then start it from the `web.commands.start` directive. The following basic app configuration is sufficient to run most Elixir applications. ```yaml {configFile="app"} -name: app +name: myapp type: 'elixir:{{% latest "elixir" %}}' variables: - env: - MIX_ENV: 'prod' + env: + MIX_ENV: 'prod' hooks: - build: | - mix local.hex --force - mix local.rebar --force - mix do deps.get --only prod, deps.compile, compile + build: | + mix local.hex --force + mix local.rebar --force + mix do deps.get --only prod, deps.compile, compile web: - commands: - start: mix phx.server - locations: - /: - allow: false - passthru: true + commands: + start: mix phx.server + locations: + /: + allow: false + passthru: true ``` Note that there is still an Nginx proxy server sitting in front of your application. If desired, certain paths may be served directly by Nginx without hitting your application (for static files, primarily) or you may route all requests to the Elixir application unconditionally, as in the example above. @@ -161,7 +161,7 @@ Given a [relationship](/create-apps/app-reference/single-runtime-image#relations # (identified from the relationship name) and a default endpoint. # See the Application reference for all options for defining relationships and endpoints. relationships: - postgresql: + postgresql: ``` Assuming you have in `mix.exs` the Poison library to parse JSON: @@ -189,8 +189,9 @@ config :my_app, Repo, and setup Ecto during the deploy hook: -```yaml -deploy: | +```yaml {configFile="app"} +hooks: + deploy: | mix do ecto.setup ``` diff --git a/sites/platform/src/languages/go.md b/sites/platform/src/languages/go.md index bbd265d735..a2dfc65c49 100644 --- a/sites/platform/src/languages/go.md +++ b/sites/platform/src/languages/go.md @@ -57,29 +57,29 @@ Assuming your `go.mod` and `go.sum` files are present in your repository, your a The following basic `{{< vendor/configfile "app" >}}` file is sufficient to run most Go applications. ```yaml {configFile="app"} -name: app +name: myapp type: golang:1.14 hooks: - build: | - # Modify this line if you want to build differently or use an alternate name for your executable. - go build -o bin/app + build: | + # Modify this line if you want to build differently or use an alternate name for your executable. + go build -o bin/app web: - upstream: - socket_family: tcp - protocol: http - - commands: - # If you change the build output in the build hook above, update this line as well. - start: ./bin/app - - locations: - /: - # Route all requests to the Go app, unconditionally. - allow: false - passthru: true + upstream: + socket_family: tcp + protocol: http + + commands: + # If you change the build output in the build hook above, update this line as well. + start: ./bin/app + + locations: + /: + # Route all requests to the Go app, unconditionally. + allow: false + passthru: true disk: 1024 ``` diff --git a/sites/platform/src/languages/java/_index.md b/sites/platform/src/languages/java/_index.md index ce499f09ff..b5cdbc56b9 100644 --- a/sites/platform/src/languages/java/_index.md +++ b/sites/platform/src/languages/java/_index.md @@ -12,7 +12,7 @@ layout: single You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden. -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. ### OpenJDK versions: @@ -65,16 +65,16 @@ Add something like the following to your [app configuration](../../create-apps/_ ```yaml {configFile="app"} variables: - env: - MAVEN_VERSION: {{< variable "DESIRED_VERSION_NUMBER" "3.8.6" >}} + env: + MAVEN_VERSION: {{< variable "DESIRED_VERSION_NUMBER" "3.8.6" >}} hooks: - build: | - curl -sfLO "https://dlcdn.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" - tar -zxf apache-maven-$MAVEN_VERSION-bin.tar.gz - export PATH="$PWD/apache-maven-$MAVEN_VERSION/bin:$PATH" - mvn --version - mvn clean package + build: | + curl -sfLO "https://dlcdn.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" + tar -zxf apache-maven-$MAVEN_VERSION-bin.tar.gz + export PATH="$PWD/apache-maven-$MAVEN_VERSION/bin:$PATH" + mvn --version + mvn clean package ``` ## Other JVM languages diff --git a/sites/platform/src/languages/java/migration.md b/sites/platform/src/languages/java/migration.md index cbbf4dc2da..bf2afa4a41 100644 --- a/sites/platform/src/languages/java/migration.md +++ b/sites/platform/src/languages/java/migration.md @@ -39,14 +39,14 @@ and [services](../../add-services/_index.md). ### Application ```yaml {configFile="app"} -name: app +name: myapp type: 'java:' [1] disk: 1024 hooks: - build: [2] + build: [2] web: - commands: - start: [3] + commands: + start: [3] ``` 1. [A Java version](/languages/java/_index.md#supported-versions), e,g.: `java:{{% latest "java" %}}` 2. [Hooks define what happens when building the application](../../create-apps/hooks/_index.md). This build process typically generates an executable file such as a uber-jar e.g.: `mvn clean package` @@ -63,13 +63,13 @@ Be aware that after the build, it creates a read-only system. You have the [moun ```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" [1] + type: upstream + upstream: "myapp:http" [1] "https://www.{default}/": - type: redirect - to: "https://{default}/" + type: redirect + to: "https://{default}/" ``` -1. It defines the application will link in the route, e.g.: `"app:http"` +1. It defines the application will link in the route, e.g.: `"myapp:http"` {{< note >}} Application instances have a limited amount of memory at build time, which has a maximum of 8 GB. @@ -151,17 +151,17 @@ export JAVA_OPTS="$JAVA_MEMORY -XX:+ExitOnOutOfMemoryError" This `.environment` can interact to each application file. E.g.: -```yaml -name: app +```yaml {configFile="app"} +name: myapp type: "java:11" disk: 1024 hooks: - build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true + build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true relationships: - postgresql: + postgresql: web: - commands: - start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT jarfile.jar + commands: + start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT jarfile.jar ``` ### Using Java Config Reader diff --git a/sites/platform/src/languages/lisp.md b/sites/platform/src/languages/lisp.md index 288ab5cfba..140c98ad30 100644 --- a/sites/platform/src/languages/lisp.md +++ b/sites/platform/src/languages/lisp.md @@ -52,7 +52,7 @@ If you don't want these assumptions, you can disable this behavior by specifying ```yaml {configFile="app"} build: - flavor: none + flavor: none ``` ## Dependencies @@ -65,20 +65,20 @@ If you wish to change the distributions that QuickLisp is using, you can specify ```yaml {configFile="app"} runtime: - quicklisp: - {{< variable "DISTRIBUTION_NAME" >}}: - url: "..." - version: "..." + quicklisp: + {{< variable "DISTRIBUTION_NAME" >}}: + url: "..." + version: "..." ``` For example: ```yaml {configFile="app"} runtime: + quicklisp: quicklisp: - quicklisp: - url: 'http://beta.quicklisp.org/dist/quicklisp.txt' - version: '2019-07-11' + url: 'http://beta.quicklisp.org/dist/quicklisp.txt' + version: '2019-07-11' ``` ## Built-in variables @@ -99,15 +99,15 @@ Note that the start command _must_ run in the foreground. Should the program ter The following basic `{{< vendor/configfile "app" >}}` file is sufficient to run most Lisp applications. ```yaml {configFile="app"} -name: app +name: myapp type: lisp:1.5 web: - commands: - start: ./example - locations: - /: - allow: false - passthru: true + commands: + start: ./example + locations: + /: + allow: false + passthru: true disk: 512 ``` @@ -138,7 +138,7 @@ Given a relationship defined in `{{< vendor/configfile "app" >}}`: ```yaml {configFile="app"} relationships: - postgresql: + postgresql: ``` The following would access that relationship, and provide your Lisp program the credentials to connect to a PostgreSQL instance. Add this to your `.asd` file: diff --git a/sites/platform/src/languages/nodejs/_index.md b/sites/platform/src/languages/nodejs/_index.md index 97409f0702..d89ce6dd20 100644 --- a/sites/platform/src/languages/nodejs/_index.md +++ b/sites/platform/src/languages/nodejs/_index.md @@ -17,7 +17,7 @@ You can also develop a microservice architecture mixing JavaScript and other app You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden. -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. @@ -88,8 +88,8 @@ Add the following to your app configuration: ```yaml {configFile="app"} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - sharp: "*" + nodejs: + sharp: "*" ``` These are now available as commands, the same as installing with `npm install -g`. @@ -101,12 +101,12 @@ Include any commands needed to build and setup your app in the `hooks`, as in th ```yaml {configFile="app"} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - sharp: "*" + nodejs: + sharp: "*" hooks: - build: | - npm run setup-assets - npm run build + build: | + npm run setup-assets + npm run build ``` ### 4. Start your app @@ -116,15 +116,15 @@ Specify a command to start serving your app (it must be a process running in the ```yaml {configFile="app"} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - sharp: "*" + nodejs: + sharp: "*" hooks: - build: | - npm run setup-assets - npm run build + build: | + npm run setup-assets + npm run build web: - commands: - start: node index.js + commands: + start: node index.js ``` ### 5. Listen on the right port @@ -159,17 +159,17 @@ type: 'nodejs:{{% latest "nodejs" %}}' disk: 512 dependencies: - nodejs: - sharp: "*" + nodejs: + sharp: "*" hooks: - build: | - npm run setup-assets - npm run build + build: | + npm run setup-assets + npm run build web: - commands: - start: "node index.js" + commands: + start: "node index.js" ``` ## Dependencies @@ -190,8 +190,8 @@ To switch to Yarn to manage dependencies, follow these steps: 1. Turn off the default use of npm: ```yaml {configFile="app"} - build: - flavor: none +build: + flavor: none ``` 2. Specify the version of Yarn you want: @@ -217,8 +217,8 @@ title=Yarn 3.x and Node.js 16+ {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' hooks: - build: | - corepack yarn install + build: | + corepack yarn install {{< /snippet >}} ``` @@ -234,8 +234,8 @@ title=Yarn 3.x and Node.js 14 {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - corepack: "*" + nodejs: + corepack: "*" {{< /snippet >}} ``` @@ -245,8 +245,8 @@ dependencies: {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' hooks: - build: | - corepack yarn install + build: | + corepack yarn install {{< /snippet >}} ``` @@ -262,8 +262,8 @@ title=Yarn < 3 {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - yarn: "1.22.19" + nodejs: + yarn: "1.22.19" {{< /snippet >}} ``` @@ -273,8 +273,8 @@ dependencies: {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' hooks: - build: | - yarn --frozen-lockfile + build: | + yarn --frozen-lockfile {{< /snippet >}} ``` @@ -290,14 +290,14 @@ use the following configuration: ```yaml {configFile="app"} # The name of your app. name: myapp - # Choose Node.js version 20 or above. - type: 'nodejs:20' - # Override the default Node.js build flavor. - build: - flavor: none - # Use Bun to install the dependencies. - hooks: - build: bun install +# Choose Node.js version 20 or above. +type: 'nodejs:20' +# Override the default Node.js build flavor. +build: + flavor: none +# Use Bun to install the dependencies. +hooks: + build: bun install ``` #### Use Bun as a runtime @@ -307,18 +307,18 @@ You can even [use Bun as a runtime](https://platform.sh/blog/bun-support-is-here ```yaml {configFile="app"} # The name of your app. name: myapp - # Choose Node.js version 20 or above. - type: 'nodejs:20' - # Override the default Node.js build flavor. - build: - flavor: none - # Use Bun to install the dependencies. - hooks: - build: bun install - # In the start command replace node with Bun. - web: - commands: - start: 'bun app.js' +# Choose Node.js version 20 or above. +type: 'nodejs:20' +# Override the default Node.js build flavor. +build: + flavor: none +# Use Bun to install the dependencies. +hooks: + build: bun install +# In the start command replace node with Bun. +web: + commands: + start: 'bun app.js' ``` ## Connecting to services diff --git a/sites/platform/src/languages/nodejs/node-version.md b/sites/platform/src/languages/nodejs/node-version.md index f43a03f9b0..35921651b5 100644 --- a/sites/platform/src/languages/nodejs/node-version.md +++ b/sites/platform/src/languages/nodejs/node-version.md @@ -76,8 +76,8 @@ This property accepts either an exact version or a range: ```yaml {configFile="app"} dependencies: - nodejs: - n: "*" + nodejs: + n: "*" ``` Adding it as a dependency ensures it's cached for future builds. @@ -85,22 +85,22 @@ dependencies: ```yaml {configFile="app"} variables: - env: - N_PREFIX: /app/.global + env: + N_PREFIX: /app/.global ``` 4. Install the specified version of Node.js in a [`build` hook](../../create-apps/hooks/hooks-comparison.md#build-hook): ```yaml {configFile="app"} hooks: - build: | - # Exit the hook on any failure - set -e + build: | + # Exit the hook on any failure + set -e - # Install the version specified in the .nvmrc file - n auto + # Install the version specified in the .nvmrc file + n auto - # Reset the location hash to recognize the newly installed version - hash -r + # Reset the location hash to recognize the newly installed version + hash -r ``` Now your hooks should be able to use the specified version of Node.js. You can verify this by running `node -v`. @@ -108,26 +108,26 @@ You can verify this by running `node -v`. Your final app configuration should look something like this: ```yaml {configFile="app"} -name: app +name: myapp type: 'python:{{% latest "python" %}}' dependencies: - nodejs: - n: "*" + nodejs: + n: "*" variables: - env: - N_PREFIX: /app/.global + env: + N_PREFIX: /app/.global hooks: - build: | - # Exit the hook on any failure - set -e + build: | + # Exit the hook on any failure + set -e - # Install the version specified in the .nvmrc file - n auto + # Install the version specified in the .nvmrc file + n auto - # Reset the location hash to recognize the newly installed version - hash -r + # Reset the location hash to recognize the newly installed version + hash -r ``` ## Use `nvm` @@ -146,19 +146,19 @@ To use `nvm`, follow these steps: ```yaml {configFile="app"} variables: - env: - # Update for your desired NVM version. - NVM_VERSION: v0.39.3 + env: + # Update for your desired NVM version. + NVM_VERSION: v0.39.3 ``` 2. Define your desired Node.js version using an environment variable. For your base version, set it in your app configuration: ```yaml {configFile="app"} variables: - env: - # Update these for your desired NVM and Node versions. - NVM_VERSION: v0.39.3 - NODE_VERSION: v18.14.2 + env: + # Update these for your desired NVM and Node versions. + NVM_VERSION: v0.39.3 + NODE_VERSION: v18.14.2 ``` To get different versions in different environments, [set environment-specific variables](../../development/variables/set-variables.md#create-environment-specific-variables). @@ -166,16 +166,16 @@ variables: ```yaml {configFile="app"} hooks: - build: | - set -e - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - - # Link cache with app - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then - mkdir -p $PLATFORM_CACHE_DIR/.nvm - fi - ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR + build: | + set -e + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + + # Link cache with app + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then + mkdir -p $PLATFORM_CACHE_DIR/.nvm + fi + ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR ``` {{< note >}} @@ -193,26 +193,25 @@ hooks: ```yaml {configFile="app"} hooks: - build: | - ... - # Check for Node.js version and install if not present - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then - - # Get nvm install script if correct version not present - export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" - if [ ! -f "$NVM_INSTALL_FILE" ]; then - wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" - fi - - # Install, automatically using NODE_VERSION - bash $NVM_INSTALL_FILE - fi - - # Activate nvm - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - # Use the specified version - nvm use "$NODE_VERSION" + build: | + ... + # Check for Node.js version and install if not present + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then + # Get nvm install script if correct version not present + export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" + if [ ! -f "$NVM_INSTALL_FILE" ]; then + wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" + fi + + # Install, automatically using NODE_VERSION + bash $NVM_INSTALL_FILE + fi + + # Activate nvm + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + # Use the specified version + nvm use "$NODE_VERSION" ``` 5. Optional: To use the specified Node.js version in the runtime container and not just the build, activate `nvm` via [script](../../development/variables/set-variables.md#set-variables-via-script): @@ -226,40 +225,39 @@ hooks: Your final app configuration should look something like the following: ```yaml {configFile="app"} -name: app +name: myapp type: 'python:{{% latest "python" %}}' variables: - env: - # Update these for your desired NVM and Node versions. - NVM_VERSION: v0.39.3 - NODE_VERSION: v18.14.2 + env: + # Update these for your desired NVM and Node versions. + NVM_VERSION: v0.39.3 + NODE_VERSION: v18.14.2 hooks: - build: | - set -e - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - - # Link cache with app - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then - mkdir -p $PLATFORM_CACHE_DIR/.nvm - fi - ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR - # Check for Node.js version and install if not present - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then - - # Get nvm install script if correct version not present - export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" - if [ ! -f "$NVM_INSTALL_FILE" ]; then - wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" - fi - - # Install, automatically using NODE_VERSION - bash $NVM_INSTALL_FILE - fi - - # Activate nvm - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - # Use the specified version - nvm use "$NODE_VERSION" + build: | + set -e + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + + # Link cache with app + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then + mkdir -p $PLATFORM_CACHE_DIR/.nvm + fi + ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR + # Check for Node.js version and install if not present + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then + # Get nvm install script if correct version not present + export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" + if [ ! -f "$NVM_INSTALL_FILE" ]; then + wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" + fi + + # Install, automatically using NODE_VERSION + bash $NVM_INSTALL_FILE + fi + + # Activate nvm + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + # Use the specified version + nvm use "$NODE_VERSION" ``` diff --git a/sites/platform/src/languages/php/_index.md b/sites/platform/src/languages/php/_index.md index d1fbfdb70b..c9a0773ed2 100644 --- a/sites/platform/src/languages/php/_index.md +++ b/sites/platform/src/languages/php/_index.md @@ -107,10 +107,10 @@ and nonexistent files are handled by `app.php`: ```yaml {configFile="app"} web: - locations: - '/': - root: 'public' - passthru: '/app.php' + locations: + '/': + root: 'public' + passthru: '/app.php' ``` See how to [create a basic PHP app with a front controller](../../create-apps/web/php-basic.md). To have more control, you can define rules to specify which files you want to allow [from which location](../../create-apps/web/php-basic.md#set-different-rules-for-specific-locations). @@ -120,17 +120,17 @@ To have more control, you can define rules to specify which files you want to al A complete basic app configuration looks like the following: ```yaml {configFile="app"} -name: 'app' +name: 'myapp' type: 'php:{{% latest "php" %}}' disk: 2048 web: - locations: - '/': - root: 'public' - passthru: '/app.php' + locations: + '/': + root: 'public' + passthru: '/app.php' ``` ## Dependencies @@ -145,8 +145,8 @@ To use Composer 2.x on your project, either use PHP 8.2+ or, in your app configu ```yaml {configFile="app"} dependencies: - php: - composer/composer: '^2' + php: + composer/composer: '^2' ``` Adding a dependency to the [dependencies block](/create-apps/app-reference/single-runtime-image.md#dependencies) makes it available globally. So you can then use included dependencies as commands within your app container. @@ -190,9 +190,9 @@ To install from an alternative repository: ```yaml {configFile="app"} dependencies: - php: - require: - "platformsh/client": "2.x-dev" + php: + require: + "platformsh/client": "2.x-dev" ``` This is equivalent to `composer require platformsh/client 2.x-dev`. @@ -200,8 +200,8 @@ dependencies: ```yaml {configFile="app"} repositories: - - type: vcs - url: "git@github.com:platformsh/platformsh-client-php.git" + - type: vcs + url: "git@github.com:platformsh/platformsh-client-php.git" ``` That installs `platformsh/client` from the specified repository URL as a global dependency. @@ -210,13 +210,13 @@ use the following: ```yaml {configFile="app"} dependencies: - php: - composer/composer: '^2' - require: - "platformsh/client": "2.x-dev" - repositories: - - type: vcs - url: "git@github.com:platformsh/platformsh-client-php.git" + php: + composer/composer: '^2' + require: + "platformsh/client": "2.x-dev" + repositories: + - type: vcs + url: "git@github.com:platformsh/platformsh-client-php.git" ``` ## Connect to services diff --git a/sites/platform/src/languages/php/extensions.md b/sites/platform/src/languages/php/extensions.md index 739d527e63..7de5235947 100644 --- a/sites/platform/src/languages/php/extensions.md +++ b/sites/platform/src/languages/php/extensions.md @@ -20,13 +20,13 @@ You can define the PHP extensions you want to enable or disable: ```yaml {configFile="app"} runtime: - extensions: - - raphf - - http - - igbinary - - redis - disabled_extensions: - - sqlite3 + extensions: + - raphf + - http + - igbinary + - redis + disabled_extensions: + - sqlite3 ``` You can also [include configuration options](/create-apps/app-reference/single-runtime-image.md#extensions) for specific extensions. @@ -75,6 +75,6 @@ but it takes slightly more work: ```yaml {configFile="app"} variables: - php: - extension: /app/spiffy.so + php: + extension: /app/spiffy.so ``` diff --git a/sites/platform/src/languages/php/fpm.md b/sites/platform/src/languages/php/fpm.md index fe11674a40..c9ce4216b1 100644 --- a/sites/platform/src/languages/php/fpm.md +++ b/sites/platform/src/languages/php/fpm.md @@ -113,9 +113,9 @@ you can use: ```yaml {configFile="app"} runtime: - sizing_hints: - request_memory: 110 - reserved_memory: 80 + sizing_hints: + request_memory: 110 + reserved_memory: 80 ``` Note that the minimum value for the `request_memory` key is 10 MB and the minimum value for the `reserved_memory` key is 70 MB. diff --git a/sites/platform/src/languages/php/redis.md b/sites/platform/src/languages/php/redis.md index eb33c76708..001820ce6e 100644 --- a/sites/platform/src/languages/php/redis.md +++ b/sites/platform/src/languages/php/redis.md @@ -31,10 +31,10 @@ Any tagged version of the library is acceptable: ```yaml {configFile="app"} hooks: - build: | - set -e - # Install PhpRedis v5.3.7: - curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-phpredis.sh | { bash /dev/fd/3 5.3.7 ; } 3<&0 + build: | + set -e + # Install PhpRedis v5.3.7: + curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-phpredis.sh | { bash /dev/fd/3 5.3.7 ; } 3<&0 ``` ## Install Relay @@ -54,10 +54,10 @@ Any tagged version of the library is acceptable: ```yaml {configFile="app"} hooks: - build: | - set -e - # Install Relay v0.6.0: - curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-relay.sh | { bash /dev/fd/3 v0.6.0 ; } 3<&0 + build: | + set -e + # Install Relay v0.6.0: + curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-relay.sh | { bash /dev/fd/3 v0.6.0 ; } 3<&0 ``` ## Change extension or version diff --git a/sites/platform/src/languages/php/swoole.md b/sites/platform/src/languages/php/swoole.md index 1d8ca39bd0..9c13da996b 100644 --- a/sites/platform/src/languages/php/swoole.md +++ b/sites/platform/src/languages/php/swoole.md @@ -40,14 +40,14 @@ Octane should listen on a TCP socket. ```yaml {configFile="app"} web: - upstream: - socket_family: tcp - protocol: http - commands: - start: php {{}} --port=$PORT - locations: - "/": - passthru: true - scripts: false - allow: false + upstream: + socket_family: tcp + protocol: http + commands: + start: php {{}} --port=$PORT + locations: + "/": + passthru: true + scripts: false + allow: false ``` diff --git a/sites/platform/src/languages/php/tuning.md b/sites/platform/src/languages/php/tuning.md index a9bdc946a9..5466333fe7 100644 --- a/sites/platform/src/languages/php/tuning.md +++ b/sites/platform/src/languages/php/tuning.md @@ -54,8 +54,8 @@ To enable preloading, add a variable that specifies a preload script: ```yaml {configFile="app"} variables: - php: - opcache.preload: '{{< variable "PRELOAD_SCRIPT" >}}' + php: + opcache.preload: '{{< variable "PRELOAD_SCRIPT" >}}' ``` `{{< variable "PRELOAD_SCRIPT" >}}` is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). It may be any PHP script that calls `opcache_compile_file()`. @@ -108,8 +108,8 @@ An example configuration: ```yaml {configFile="app"} variables: - php: - 'opcache.max_accelerated_files': 22000 + php: + 'opcache.max_accelerated_files': 22000 ``` #### Set memory consumption @@ -150,8 +150,8 @@ To determine the total amount of memory to use, follow these steps: ```yaml {configFile="app"} variables: - php: - 'opcache.memory_consumption': 96 + php: + 'opcache.memory_consumption': 96 ``` 8. [Restart PHP-FPM](#restart-php-fpm) and make sure that OPcache works as expected by rerunning CacheTool with the following command: @@ -176,8 +176,8 @@ Timestamp validation can be disabled by adding the following variable to your [a ```yaml {configFile="app"} variables: - php: - 'opcache.validate_timestamps': 0 + php: + 'opcache.validate_timestamps': 0 ``` When you have disabled OPcache timestamp validation, you need to explicitly clear OPcache on deployment by [restarting PHP-FPM](#restart-php-fpm). diff --git a/sites/platform/src/languages/php/xdebug.md b/sites/platform/src/languages/php/xdebug.md index fd021dbca4..432886cf91 100644 --- a/sites/platform/src/languages/php/xdebug.md +++ b/sites/platform/src/languages/php/xdebug.md @@ -38,8 +38,8 @@ To enable Xdebug, add the following to your [app configuration](/create-apps/app ```yaml {configFile="app"} runtime: - xdebug: - idekey: {{< variable "YOUR_KEY" >}} + xdebug: + idekey: {{< variable "YOUR_KEY" >}} ``` {{< variable "YOUR_KEY" >}} can be any arbitrary alphanumeric string. @@ -53,10 +53,10 @@ Depending on the cookies already listed, the result should look similar to the f ```yaml {configFile="routes"} "https://{default}/": - # ... - cache: - enabled: true - cookies: ['/^SS?ESS/', 'XDEBUG_SESSION'] + # ... + cache: + enabled: true + cookies: ['/^SS?ESS/', 'XDEBUG_SESSION'] ``` Xdebug has several configuration options available. They can be set the same way as any other [PHP setting](./_index.md#php-settings). @@ -108,7 +108,7 @@ The common steps for setup usually include: 4. Ensuring path mappings is enabled. This lets you define what remote paths on the server correspond to what path on your local machine. In the majority of cases you can just define [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory) - to map to `app`. + to map to `myapp`. 5. Listening for connections. 6. Starting debugging. While in listen mode, start the `{{% vendor/cli %}} xdebug` tunnel. Use the Xdebug helper plugin for your browser to enable debugging. diff --git a/sites/platform/src/languages/python/_index.md b/sites/platform/src/languages/python/_index.md index 42d004ac5f..780acac6c2 100644 --- a/sites/platform/src/languages/python/_index.md +++ b/sites/platform/src/languages/python/_index.md @@ -63,22 +63,22 @@ type: 'python:{{% latest "python" %}}' 2. Install the requirements for your app. ```yaml {configFile="app"} dependencies: - python3: - pipenv: "2022.12.19" + python3: + pipenv: "2022.12.19" hooks: - build: | - set -eu - pipenv install --system --deploy + build: | + set -eu + pipenv install --system --deploy ``` 3. Define the command to start your web server: ```yaml {configFile="app"} - web: - # Start your app with the configuration you define - # You can replace the file location with your location - commands: - start: python server.py +web: + # Start your app with the configuration you define + # You can replace the file location with your location + commands: + start: python server.py ``` You can choose from many web servers such as Daphne, Gunicorn, Hypercorn, and Uvicorn. @@ -96,23 +96,23 @@ type: 'python:{{% latest "python" %}}' 2. Define the conditions for your web server: ```yaml {configFile="app"} - web: - upstream: - # Send requests to the app server through a unix socket - # Its location is defined in the SOCKET environment variable - socket_family: "unix" - - # Start your app with the configuration you define - # You can replace the file location with your location - commands: - start: "uwsgi --ini conf/uwsgi.ini" - - locations: - # The folder from which to serve static assets - "/": - root: "public" - passthru: true - expires: 1h +web: + upstream: + # Send requests to the app server through a unix socket + # Its location is defined in the SOCKET environment variable + socket_family: "unix" + + # Start your app with the configuration you define + # You can replace the file location with your location + commands: + start: "uwsgi --ini conf/uwsgi.ini" + + locations: + # The folder from which to serve static assets + "/": + root: "public" + passthru: true + expires: 1h ``` 3. Create configuration for uWSGI such as the following: diff --git a/sites/platform/src/languages/python/dependencies.md b/sites/platform/src/languages/python/dependencies.md index 4ea7840aad..dd554328e5 100644 --- a/sites/platform/src/languages/python/dependencies.md +++ b/sites/platform/src/languages/python/dependencies.md @@ -45,13 +45,13 @@ title=Latest version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download the latest version of pip - python{{% latest "python" %}} -m pip install --upgrade pip - # Install dependencies - pip install -r requirements.txt + build: | + # Fail the build if any errors occur + set -eu + # Download the latest version of pip + python{{% latest "python" %}} -m pip install --upgrade pip + # Install dependencies + pip install -r requirements.txt {{< /snippet >}} ``` <---> @@ -62,16 +62,16 @@ title=Specific version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - PIP_VERSION: '22.3.1' + env: + PIP_VERSION: '22.3.1' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download a specific version of pip - python{{% latest "python" %}} -m pip install pip==$PIP_VERSION - # Install dependencies - pip install -r requirements.txt + build: | + # Fail the build if any errors occur + set -eu + # Download a specific version of pip + python{{% latest "python" %}} -m pip install pip==$PIP_VERSION + # Install dependencies + pip install -r requirements.txt {{< /snippet >}} ``` {{< /codetabs >}} @@ -102,17 +102,17 @@ title=Latest version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' dependencies: - python3: - pipenv: '*' + python3: + pipenv: '*' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download the latest version of pip - python{{% latest "python" %}} -m pip install --upgrade pip - # Install dependencies - # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date - pipenv install --deploy + build: | + # Fail the build if any errors occur + set -eu + # Download the latest version of pip + python{{% latest "python" %}} -m pip install --upgrade pip + # Install dependencies + # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date + pipenv install --deploy {{< /snippet >}} ``` <---> @@ -123,20 +123,20 @@ title=Specific version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - PIP_VERSION: '22.3.1' + env: + PIP_VERSION: '22.3.1' dependencies: - python3: - pipenv: '2022.12.19' + python3: + pipenv: '2022.12.19' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download a specific version of pip - python{{% latest "python" %}} -m pip install pip==$PIP_VERSION - # Install dependencies - # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date - pipenv install --deploy + build: | + # Fail the build if any errors occur + set -eu + # Download a specific version of pip + python{{% latest "python" %}} -m pip install pip==$PIP_VERSION + # Install dependencies + # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date + pipenv install --deploy {{< /snippet >}} ``` {{< /codetabs >}} @@ -161,9 +161,9 @@ To set up Poetry on {{% vendor/name %}}, follow these steps: ```yaml {configFile="app"} variables: - env: - POETRY_VIRTUALENVS_IN_PROJECT: true - POETRY_VIRTUALENVS_CREATE: true + env: + POETRY_VIRTUALENVS_IN_PROJECT: true + POETRY_VIRTUALENVS_CREATE: true ``` @@ -178,27 +178,27 @@ title=Latest version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - POETRY_VIRTUALENVS_IN_PROJECT: true - POETRY_VIRTUALENVS_CREATE: true + env: + POETRY_VIRTUALENVS_IN_PROJECT: true + POETRY_VIRTUALENVS_CREATE: true hooks: - build: | - # Fail the build if any errors occur - set -eu - - # Download the latest version of pip - python{{% latest "python" %}} -m pip install --upgrade pip - - # Install and configure Poetry - export PIP_USER=false - curl -sSL https://install.python-poetry.org | python3 - - # Update PATH to make Poetry available in this hook - export PATH="/app/.local/bin:$PATH" - export PIP_USER=true - - # Install dependencies - poetry install + build: | + # Fail the build if any errors occur + set -eu + + # Download the latest version of pip + python{{% latest "python" %}} -m pip install --upgrade pip + + # Install and configure Poetry + export PIP_USER=false + curl -sSL https://install.python-poetry.org | python3 - + # Update PATH to make Poetry available in this hook + export PATH="/app/.local/bin:$PATH" + export PIP_USER=true + + # Install dependencies + poetry install {{< /snippet >}} ``` <---> @@ -209,30 +209,30 @@ title=Specific version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - POETRY_VERSION: '1.4.0' - POETRY_VIRTUALENVS_IN_PROJECT: true - POETRY_VIRTUALENVS_CREATE: true + env: + POETRY_VERSION: '1.4.0' + POETRY_VIRTUALENVS_IN_PROJECT: true + POETRY_VIRTUALENVS_CREATE: true hooks: - build: | - # Fail the build if any errors occur - set -eu - - # Download the latest version of pip - python3.11 -m pip install --upgrade pip - - # Install and configure Poetry - # Set user to false to install Poetry globally - export PIP_USER=false - curl -sSL https://install.python-poetry.org | python3 - --version $POETRY_VERSION - # Update PATH to make Poetry available in this hook - export PATH="/app/.local/bin:$PATH" - # Set user to true to install dependencies only in the virtual environment - export PIP_USER=true - - # Install dependencies - poetry install + build: | + # Fail the build if any errors occur + set -eu + + # Download the latest version of pip + python3.11 -m pip install --upgrade pip + + # Install and configure Poetry + # Set user to false to install Poetry globally + export PIP_USER=false + curl -sSL https://install.python-poetry.org | python3 - --version $POETRY_VERSION + # Update PATH to make Poetry available in this hook + export PATH="/app/.local/bin:$PATH" + # Set user to true to install dependencies only in the virtual environment + export PIP_USER=true + + # Install dependencies + poetry install {{< /snippet >}} ``` {{< /codetabs >}} diff --git a/sites/platform/src/languages/python/python-version.md b/sites/platform/src/languages/python/python-version.md index 9872d2c127..1b439e4854 100644 --- a/sites/platform/src/languages/python/python-version.md +++ b/sites/platform/src/languages/python/python-version.md @@ -15,63 +15,64 @@ to install the specific version you want to use. 1. Add your target Python version as a [variable](../../development/variables/_index.md): -```yaml {configFile="app"} + ```yaml {configFile="app"} variables: - env: - # Update for your desired Python version. - PYTHON_VERSION: "3.11.0" -``` + env: + # Update for your desired Python version. + PYTHON_VERSION: "3.11.0" + ``` 2. Add Pyenv in a [`build` hook](../../create-apps/hooks/hooks-comparison.md#build-hook): -```yaml {configFile="app"} + ```yaml {configFile="app"} hooks: - build: | - # Exit the hook on any failure - set -e - - # Clone Pyenv to the build cache if not present - if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv" ]; then - mkdir -p $PLATFORM_CACHE_DIR/.pyenv - git clone https://github.com/pyenv/pyenv.git $PLATFORM_CACHE_DIR/.pyenv - fi - - # Pyenv environment variables - export PYENV_ROOT="$PLATFORM_CACHE_DIR/.pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - - # Initialize Pyenv - if command -v pyenv 1>/dev/null 2>&1; then - eval "$(pyenv init --path)" - fi - - # Install desired Python version - mkdir -p $PLATFORM_CACHE_DIR/.pyenv/versions - if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv/versions/$PYTHON_VERSION" ]; then - pyenv install $PYTHON_VERSION - fi - - # Set global Python version - pyenv global $PYTHON_VERSION -``` -Now your build hook can use the specified version of Python. -You can verify this by running `python --version`. - -If you want this Python version to be available in the runtime environment, follow these steps: + build: | + # Exit the hook on any failure + set -e + + # Clone Pyenv to the build cache if not present + if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv" ]; then + mkdir -p $PLATFORM_CACHE_DIR/.pyenv + git clone https://github.com/pyenv/pyenv.git $PLATFORM_CACHE_DIR/.pyenv + fi + + # Pyenv environment variables + export PYENV_ROOT="$PLATFORM_CACHE_DIR/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + + # Initialize Pyenv + if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init --path)" + fi + + # Install desired Python version + mkdir -p $PLATFORM_CACHE_DIR/.pyenv/versions + if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv/versions/$PYTHON_VERSION" ]; then + pyenv install $PYTHON_VERSION + fi + + # Set global Python version + pyenv global $PYTHON_VERSION + ``` + + Now your build hook can use the specified version of Python. + You can verify this by running `python --version`. + + If you want this Python version to be available in the runtime environment, follow these steps: 1. Copy Pyenv to your runtime environment at the end of your build hook: -```yaml {configFile="app"} + ```yaml {configFile="app"} hooks: - build: | - ... + build: | + ... - # Copy Pyenv directory to runtime directory - cp -R $PLATFORM_CACHE_DIR/.pyenv $PLATFORM_APP_DIR + # Copy Pyenv directory to runtime directory + cp -R $PLATFORM_CACHE_DIR/.pyenv $PLATFORM_APP_DIR - # Rehash Pyenv for new (runtime) location - PYENV_ROOT="$PLATFORM_APP_DIR/.pyenv" $PLATFORM_APP_DIR/.pyenv/bin/pyenv rehash -``` + # Rehash Pyenv for new (runtime) location + PYENV_ROOT="$PLATFORM_APP_DIR/.pyenv" $PLATFORM_APP_DIR/.pyenv/bin/pyenv rehash + ``` 2. Create an [`.environment` file](../../development/variables/set-variables.md#set-variables-via-script): ```bash @@ -84,4 +85,4 @@ If you want this Python version to be available in the runtime environment, foll export PATH=/app/.pyenv/bin:/app/.pyenv/shims:$PATH ``` -Now the specified Python version is used in the runtime environment. + Now the specified Python version is used in the runtime environment. diff --git a/sites/platform/src/languages/python/server.md b/sites/platform/src/languages/python/server.md index 71fe3e6c99..4c12a8ac1d 100644 --- a/sites/platform/src/languages/python/server.md +++ b/sites/platform/src/languages/python/server.md @@ -27,15 +27,15 @@ title=Pip (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "gunicorn -w 4 -b localhost:$PORT myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "gunicorn -w 4 -b localhost:$PORT myapp.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> diff --git a/sites/platform/src/languages/ruby.md b/sites/platform/src/languages/ruby.md index b597b5983c..897fafbae5 100644 --- a/sites/platform/src/languages/ruby.md +++ b/sites/platform/src/languages/ruby.md @@ -35,16 +35,14 @@ Patch versions are applied periodically for bug fixes and the like. When you dep {{% language-specification type="ruby" display_name="Ruby" %}} -```yaml {configFile="apps"} -app: - type: 'ruby:' +```yaml {configFile="app"} +type: 'ruby:' ``` For example: -```yaml {configFile="apps"} -app: - type: 'ruby:{{% latest "ruby" %}}' +```yaml {configFile="app"} +type: 'ruby:{{% latest "ruby" %}}' ``` {{% deprecated-versions %}} @@ -61,10 +59,9 @@ A complete example is included at the end of this section. 1. Specify the language of your application (available versions are listed above): -```yaml {configFile="apps"} -app: - type: 'ruby:{{% latest "ruby" %}}' -``` + ```yaml {configFile="app"} + type: 'ruby:{{% latest "ruby" %}}' + ``` 2. Setup environment variables. @@ -72,14 +69,14 @@ app: You can change the Rails/Bundler via those environment variables, some of which are defaults on {{% vendor/name %}}. -```yaml {configFile="app"} -variables: - env: + ```yaml {configFile="app"} + variables: + env: PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created RAILS_ENV: "production" BUNDLE_WITHOUT: 'development:test' TARGET_RUBY_VERSION: '~>{{% latest "ruby" %}}' # this will allow to not fail on PATCH update of the image -``` + ``` The `SECRET_KEY_BASE` variable is generated automatically based on the [`PLATFORM_PROJECT_ENTROPY` @@ -97,14 +94,14 @@ variables: Assuming you have your dependencies stored in the `Gemfile` at [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory), create a hook like the following: -```yaml {configFile="app"} -hooks: - build: | + ```yaml {configFile="app"} + hooks: + build: | set -e bundle install bundle exec rails assets:precompile - deploy: bundle exec rake db:migrate -``` + deploy: bundle exec rake db:migrate + ``` These are installed as your project dependencies in your environment. You can also use the `dependencies` key to install global dependencies. @@ -112,23 +109,23 @@ hooks: If you have assets, it's likely that you need NodeJS/yarn. -```yaml {configFile="app"} -dependencies: - nodejs: + ```yaml {configFile="app"} + dependencies: + nodejs: yarn: "*" -``` + ``` 4. Configure the command to start serving your application (this must be a foreground-running process) under the `web` section: -```yaml {configFile="app"} -web: - upstream: + ```yaml {configFile="app"} + web: + upstream: socket_family: unix - commands: + commands: # for puma start: "bundle exec puma -b unix://$SOCKET" # for unicorn # start: "bundle exec unicorn -l $SOCKET" -``` + ``` This assumes you have Unicorn as a dependency in your Gemfile: ```ruby @@ -137,15 +134,15 @@ web: 5. Define the web locations your application is using: -```yaml {configFile="app"} -web: - locations: + ```yaml {configFile="app"} + web: + locations: "/": - root: "public" - passthru: true - expires: 1h - allow: true -``` + root: "public" + passthru: true + expires: 1h + allow: true + ``` This configuration sets the web server to handle HTTP requests at `/static` to serve static files stored in `/app/static/` folder. Everything else is forwarded to your application server. @@ -154,18 +151,18 @@ web: The root file system is read only. You must explicitly describe writable mounts. -```yaml {configFile="app"} -mounts: - "/log": + ```yaml {configFile="app"} + mounts: + "/log": source: local source_path: log - "/storage": + "/storage": source: local source_path: storage - "/tmp": + "/tmp": source: local source_path: tmp -``` + ``` This setting allows your application writing temporary files to `/app/tmp`, logs stored in `/app/log`, and active storage in `/app/storage`. @@ -174,10 +171,10 @@ mounts: 7. Then, setup the routes to your application in `{{< vendor/configfile "routes" >}}`. -```yaml {configFile="app"} +```yaml {configFile="routes"} "https://{default}/": - type: upstream - upstream: "app:http" + type: upstream + upstream: "myapp:http" ``` ### Complete app configuration @@ -185,109 +182,109 @@ Here is a complete `{{< vendor/configfile "app" >}}` file: ```yaml {configFile="app"} # The name of the app, which must be unique within a project. -name: 'app' +name: 'myapp' type: "ruby:3.0" dependencies: - nodejs: - yarn: "*" + nodejs: + yarn: "*" # 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: - mysql: + mysql: disk: 2048 variables: - env: - BUNDLE_CACHE_ALL: '1' # Default, Cache all gems, including path and git gems. - BUNDLE_CLEAN: '1' # /!\ if you are working with Ruby<2.7 this doesn't work well, but should be safe on modern Rubies. - BUNDLE_DEPLOYMENT: '1' # Default, Disallow changes to the Gemfile. - BUNDLE_ERROR_ON_STDERR: '1' # Default. - BUNDLE_WITHOUT: 'development:test' - PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created - DEFAULT_BUNDLER_VERSION: "2.2.26" # in case none is mentioned in Gemfile.lock - EXECJS_RUNTIME: 'Node' # If you need one on your assets https://github.com/rails/execjs#readme - NODE_ENV: 'production' - NODE_VERSION: v14.17.6 - NVM_VERSION: v0.38.0 - RACK_ENV: 'production' - RAILS_ENV: 'production' - RAILS_LOG_TO_STDOUT: '1' # Default - RAILS_TMP: '/tmp' # Default + env: + BUNDLE_CACHE_ALL: '1' # Default, Cache all gems, including path and git gems. + BUNDLE_CLEAN: '1' # /!\ if you are working with Ruby<2.7 this doesn't work well, but should be safe on modern Rubies. + BUNDLE_DEPLOYMENT: '1' # Default, Disallow changes to the Gemfile. + BUNDLE_ERROR_ON_STDERR: '1' # Default. + BUNDLE_WITHOUT: 'development:test' + PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created + DEFAULT_BUNDLER_VERSION: "2.2.26" # in case none is mentioned in Gemfile.lock + EXECJS_RUNTIME: 'Node' # If you need one on your assets https://github.com/rails/execjs#readme + NODE_ENV: 'production' + NODE_VERSION: v14.17.6 + NVM_VERSION: v0.38.0 + RACK_ENV: 'production' + RAILS_ENV: 'production' + RAILS_LOG_TO_STDOUT: '1' # Default + RAILS_TMP: '/tmp' # Default hooks: - build: | - set -e - - echo "Installing NVM $NVM_VERSION" - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - # install.sh will automatically install NodeJS based on the presence of $NODE_VERSION - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - # we install the bundled bundler version and fallback to a default (in env vars above) - export BUNDLER_VERSION="$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" || $DEFAULT_BUNDLER_VERSION - echo "Install bundler $BUNDLER_VERSION" - gem install --no-document bundler -v $BUNDLER_VERSION - - echo "Installing gems" - # We copy the bundle directory to the {{% vendor/name %}} cache directory for - # safe keeping, then restore from there on the next build. That allows - # bundler to skip downloading code it doesn't need to. - [ -d "$PLATFORM_CACHE_DIR/bundle" ] && \ - rsync -az --delete "$PLATFORM_CACHE_DIR/bundle/" vendor/bundle/ - mkdir -p "$PLATFORM_CACHE_DIR/bundle" - bundle install - # synchronize updated cache for next build - [ -d "vendor/bundle" ] && \ - rsync -az --delete vendor/bundle/ "$PLATFORM_CACHE_DIR/bundle/" - - # precompile assets - echo "Precompiling assets" - # We copy the webpacker directory to the {{% vendor/name %}} cache directory for - # safe keeping, then restore from there on the next build. That allows - # bundler to skip downloading code it doesn't need to. - # https://guides.rubyonrails.org/asset_pipeline.html - mkdir -p "$PLATFORM_CACHE_DIR/webpacker" - mkdir -p "$RAILS_TMP/cache/webpacker" - [ -d "$PLATFORM_CACHE_DIR/webpacker" ] && \ - rsync -az --delete "$PLATFORM_CACHE_DIR/webpacker/" $RAILS_TMP/cache/webpacker/ - # We dont need secret here https://github.com/rails/rails/issues/32947 - SECRET_KEY_BASE=1 bundle exec rails assets:precompile - rsync -az --delete $RAILS_TMP/cache/webpacker/ "$PLATFORM_CACHE_DIR/webpacker/" - deploy: bundle exec rake db:migrate + build: | + set -e + + echo "Installing NVM $NVM_VERSION" + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + # install.sh will automatically install NodeJS based on the presence of $NODE_VERSION + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + # we install the bundled bundler version and fallback to a default (in env vars above) + export BUNDLER_VERSION="$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" || $DEFAULT_BUNDLER_VERSION + echo "Install bundler $BUNDLER_VERSION" + gem install --no-document bundler -v $BUNDLER_VERSION + + echo "Installing gems" + # We copy the bundle directory to the {{% vendor/name %}} cache directory for + # safe keeping, then restore from there on the next build. That allows + # bundler to skip downloading code it doesn't need to. + [ -d "$PLATFORM_CACHE_DIR/bundle" ] && \ + rsync -az --delete "$PLATFORM_CACHE_DIR/bundle/" vendor/bundle/ + mkdir -p "$PLATFORM_CACHE_DIR/bundle" + bundle install + # synchronize updated cache for next build + [ -d "vendor/bundle" ] && \ + rsync -az --delete vendor/bundle/ "$PLATFORM_CACHE_DIR/bundle/" + + # precompile assets + echo "Precompiling assets" + # We copy the webpacker directory to the {{% vendor/name %}} cache directory for + # safe keeping, then restore from there on the next build. That allows + # bundler to skip downloading code it doesn't need to. + # https://guides.rubyonrails.org/asset_pipeline.html + mkdir -p "$PLATFORM_CACHE_DIR/webpacker" + mkdir -p "$RAILS_TMP/cache/webpacker" + [ -d "$PLATFORM_CACHE_DIR/webpacker" ] && \ + rsync -az --delete "$PLATFORM_CACHE_DIR/webpacker/" $RAILS_TMP/cache/webpacker/ + # We dont need secret here https://github.com/rails/rails/issues/32947 + SECRET_KEY_BASE=1 bundle exec rails assets:precompile + rsync -az --delete $RAILS_TMP/cache/webpacker/ "$PLATFORM_CACHE_DIR/webpacker/" + deploy: bundle exec rake db:migrate mounts: - "/log": - source: local - source_path: log - "/storage": - source: local - source_path: storage - "/tmp": - source: local - source_path: tmp + "/log": + source: local + source_path: log + "/storage": + source: local + source_path: storage + "/tmp": + source: local + source_path: tmp web: - upstream: - socket_family: unix - commands: - # for puma - start: "bundle exec puma -b unix://$SOCKET" - # for unicorn - # start: "bundle exec unicorn -l $SOCKET" - - locations: - "/": - root: "public" - passthru: true - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + # for puma + start: "bundle exec puma -b unix://$SOCKET" + # for unicorn + # start: "bundle exec unicorn -l $SOCKET" + + locations: + "/": + root: "public" + passthru: true + expires: 1h + allow: true ``` ## Configuring services @@ -297,8 +294,8 @@ To configure it, [create a service](../add-services/_index.md) such as the follo ```yaml {configFile="services"} mysql: - type: mysql:{{% latest "mariadb" %}} - disk: 2048 + type: mysql:{{% latest "mariadb" %}} + disk: 2048 ``` ## Connecting to services @@ -306,7 +303,7 @@ Once you have a service, link to it in your [app configuration](../create-apps/_ ```yaml {configFile="app"} relationships: - mysql: + mysql: ``` By using the following Ruby function calls, you can obtain the database details. @@ -320,20 +317,20 @@ This should give you something like the following: ```json { - "mysql" : [ - { - "path" : "main", - "query" : { - "is_master" : true - }, - "port" : 3306, - "username" : "user", - "password" : "", - "host" : "mysql.internal", - "ip" : "246.0.241.50", - "scheme" : "mysql" - } - ] + "mysql" : [ + { + "path" : "main", + "query" : { + "is_master" : true + }, + "port" : 3306, + "username" : "user", + "password" : "", + "host" : "mysql.internal", + "ip" : "246.0.241.50", + "scheme" : "mysql" + } + ] } ``` diff --git a/sites/platform/src/languages/rust.md b/sites/platform/src/languages/rust.md index c42538354c..42e6b1cb57 100644 --- a/sites/platform/src/languages/rust.md +++ b/sites/platform/src/languages/rust.md @@ -13,7 +13,7 @@ banner: You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden. -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.
@@ -52,9 +52,8 @@ The following basic [app configuration](../../create-apps/_index.md) is sufficie See the [complete example](#complete-example) below for more details. ```yaml {configFile="app"} - # The app's name, which must be unique within the project. -name: 'app' +name: 'myapp' # The language and version for your app. type: 'rust:1' @@ -68,14 +67,14 @@ hooks: web: commands: - # Customize the start command with your own target. - start: './target/debug/hello' + # Customize the start command with your own target. + start: './target/debug/hello' locations: - /: - # Route all requests to the Rust app, unconditionally. - allow: false - passthru: true + /: + # Route all requests to the Rust app, unconditionally. + allow: false + passthru: true ``` Note that there is still an Nginx proxy server sitting in front of your application. If desired, certain paths may be served directly by Nginx without hitting your application (for static files, primarily) or you may route all requests to the Rust app unconditionally, as in the example above. @@ -113,53 +112,52 @@ Follow these steps: 2. Create a repository for your app and add the following `Cargo.toml` file: - ```toml - [package] - name = "hello_world" - version = "0.1.0" - edition = "2021" + ```toml + [package] + name = "hello_world" + version = "0.1.0" + edition = "2021" - [[bin]] - name = "hello" - path = "hello.rs" + [[bin]] + name = "hello" + path = "hello.rs" - [dependencies] - time = "0.1.12" - regex = "0.1.41" - base64 = "0.21.0" - serde = { version = "1.0", features = ["derive"] } + [dependencies] + time = "0.1.12" + regex = "0.1.41" + base64 = "0.21.0" + serde = { version = "1.0", features = ["derive"] } - serde_json = "1.0" - ``` + serde_json = "1.0" + ``` 3. Add the following [app configuration](../../create-apps/_index.md): -```yaml {configFile="app"} + ```yaml {configFile="app"} + # The app's name, which must be unique within the project. + name: 'myapp' -# The app's name, which must be unique within the project. -name: 'app' + # The language and version for your app. + type: 'rust:1' -# The language and version for your app. -type: 'rust:1' + # The size of the app's persistent disk (in MB). + disk: 2048 -# The size of the app's persistent disk (in MB). -disk: 2048 + hooks: + build: + cargo build -hooks: - build: - cargo build - -web: - commands: - # Customize the start command with your own target. - start: './target/debug/hello' + web: + commands: + # Customize the start command with your own target. + start: './target/debug/hello' - locations: + locations: /: - # Route all requests to the Rust app, unconditionally. - allow: false - passthru: true -``` + # Route all requests to the Rust app, unconditionally. + allow: false + passthru: true + ``` 4. To generate a `Cargo.lock` file, run the following command: diff --git a/sites/platform/src/learn/overview/yaml/platform-yaml-tags.md b/sites/platform/src/learn/overview/yaml/platform-yaml-tags.md index 092b4a5901..abe8107625 100644 --- a/sites/platform/src/learn/overview/yaml/platform-yaml-tags.md +++ b/sites/platform/src/learn/overview/yaml/platform-yaml-tags.md @@ -29,24 +29,24 @@ For example, to include another ``.platform/app1.yaml`` file in the main `{{% ve ```yaml {location=".platform/app1.yaml"} source: -root: "/" + root: "/" type: "nodejs:20" web: - commands: - start: "node index.js" + commands: + start: "node index.js" upstream: - socket_family: tcp + socket_family: tcp locations: - "/": - passthru: true + "/": + passthru: true ``` And including it: ```yaml {configFile="apps"} -app: !include - type: yaml - path: ./app1.yaml +myapp: !include + type: yaml + path: ./app1.yaml # or as default type is "yaml", it could be: #api: !include ./app1.yaml ``` @@ -79,13 +79,13 @@ This configuration is valid: ```yaml {configFile="apps"} frontend: - source: - root: frontend - # ... - hooks: - build: !include - type: string - path: ../backend/scripts/common_build.sh + source: + root: frontend + # ... + hooks: + build: !include + type: string + path: ../backend/scripts/common_build.sh ``` {{% note theme="info" %}} @@ -102,10 +102,10 @@ For example, if you have a build hook like the following: ```yaml {configFile="apps"} frontend: - hooks: - build: | - set -e - cp a.txt b.txt + hooks: + build: | + set -e + cp a.txt b.txt ``` You could create a file for the script: @@ -119,10 +119,10 @@ And replace the hook with an include tag for an identical result: ```yaml {configFile="apps"} frontend: - hooks: - build: !include - type: string - path: build.sh + hooks: + build: !include + type: string + path: build.sh ``` This helps you break longer configuration like build scripts out into a separate file for easier maintenance. @@ -137,9 +137,9 @@ Then you can include it as follows: ```yaml {configFile="apps"} properties: - favicon: !include - type: binary - path: favicon.ico + favicon: !include + type: binary + path: favicon.ico ``` ### `yaml` @@ -152,35 +152,35 @@ For example, you could have your configuration for works defined in a `worker.ya ```yaml {location="worker.yaml"} size: S commands: - start: python queue-worker.py + start: python queue-worker.py variables: - env: - type: worker + env: + type: worker ``` Then the following three configurations are exactly equivalent: ```yaml {configFile="app"} workers: - queue1: !include "worker.yaml" + queue1: !include "worker.yaml" ``` ```yaml {configFile="app"} workers: - queue1: !include - type: yaml - path: 'worker.yaml' + queue1: !include + type: yaml + path: 'worker.yaml' ``` ```yaml {configFile="app"} workers: - queue1: - size: S - commands: - start: python queue-worker.py - variables: - env: - type: worker + queue1: + size: S + commands: + start: python queue-worker.py + variables: + env: + type: worker ``` This can help simplify more complex files. @@ -194,10 +194,10 @@ You might do so as follows: ```yaml {configFile="services"} mysearch: - type: solr:8.0 - disk: 1024 - configuration: - conf_dir: !archive "solr/conf" + type: solr:8.0 + disk: 1024 + configuration: + conf_dir: !archive "solr/conf" ``` The `!archive` tag means that the value for `conf_dir` isn't the string `solr/conf` but the entire `solr/conf` directory. diff --git a/sites/platform/src/learn/overview/yaml/what-is-yaml.md b/sites/platform/src/learn/overview/yaml/what-is-yaml.md index 45a1a245b5..2717e998e6 100644 --- a/sites/platform/src/learn/overview/yaml/what-is-yaml.md +++ b/sites/platform/src/learn/overview/yaml/what-is-yaml.md @@ -32,7 +32,7 @@ The most straightforward data structure involves defining key–value pairs wher So you could have a basic configuration for an app: ```yaml {configFile="app"} -name: app +name: myapp type: "golang:1.18" disk: 1024 ``` @@ -66,17 +66,17 @@ In contrast, when you define mappings, the order doesn't matter. So you could expand the configuration from before to add another mapping: ```yaml {configFile="app"} -name: app +name: myapp type: "golang:1.18" disk: 1024 web: - commands: - start: ./bin/app - locations: - '/': - passthru: true - allow: false + commands: + start: ./bin/app + locations: + '/': + passthru: true + allow: false ``` This creates a `web` dictionary that has two dictionaries within it: `commands` and `locations`, @@ -91,24 +91,24 @@ In addition to maps defining further key–value pairs, you can also use sequenc ```yaml {configFile="app"} web: - locations: - '/': - index: - - index.html - - index.htm - passthru: true - allow: false + locations: + '/': + index: + - index.html + - index.htm + passthru: true + allow: false ``` You can also define sequences using a flow syntax: ```yaml {configFile="app"} web: - locations: - '/': - index: [index.html, index.htm] - passthru: true - allow: false + locations: + '/': + index: [index.html, index.htm] + passthru: true + allow: false ``` In either case, you get a list of values within `index`: @@ -125,9 +125,9 @@ So you could add a multi-line string to a `build` key in the `hooks` map: ```yaml {configFile="app"} hooks: - build: | - set -e - cp a.txt b.txt + build: | + set -e + cp a.txt b.txt ``` And the resulting value preserves the line break. @@ -148,17 +148,17 @@ The following example shows 4 different workers: ```yaml {configFile="app"} workers: - queue1: &runner - size: S - commands: - start: python queue-worker.py - queue2: *runner - queue3: - <<: *runner - size: M - queue4: - <<: *runner - disk: 512 + queue1: &runner + size: S + commands: + start: python queue-worker.py + queue2: *runner + queue3: + <<: *runner + size: M + queue4: + <<: *runner + disk: 512 ``` - `queue1` and `queue2` are identical with the same `size` and `commands` properties. diff --git a/sites/platform/src/learn/overview/yaml/yaml-structure.md b/sites/platform/src/learn/overview/yaml/yaml-structure.md index a141d2db69..ccac02d0f1 100644 --- a/sites/platform/src/learn/overview/yaml/yaml-structure.md +++ b/sites/platform/src/learn/overview/yaml/yaml-structure.md @@ -33,7 +33,7 @@ These three YAML files configure the following: # A unique name for the app. Must be lowercase alphanumeric characters. # Changing the name destroys data associated with the app. -name: "app" +name: "myapp" # The runtime the application uses. @@ -63,7 +63,7 @@ mariadb: "https://{default}/": type: upstream - upstream: "app:http" + upstream: "myapp:http" # A basic redirect definition # {{< code-link destination="/define-routes.html#basic-redirect-definition" text="More information" title="Click to see more information" >}} diff --git a/sites/platform/src/learn/tutorials/dependency-updates.md b/sites/platform/src/learn/tutorials/dependency-updates.md index e623e09981..8b63e56ef7 100644 --- a/sites/platform/src/learn/tutorials/dependency-updates.md +++ b/sites/platform/src/learn/tutorials/dependency-updates.md @@ -37,14 +37,14 @@ title=Composer ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - composer update - git add composer.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Composer dependencies" + operations: + update: + command: | + set -e + composer update + git add composer.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Composer dependencies" {{< /snippet >}} ``` @@ -56,14 +56,14 @@ title=npm ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - npm update - git add package.json package-lock.json - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update npm dependencies" + operations: + update: + command: | + set -e + npm update + git add package.json package-lock.json + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update npm dependencies" {{< /snippet >}} ``` @@ -75,14 +75,14 @@ title=Yarn ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - yarn upgrade - git add yarn.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update yarn dependencies" + operations: + update: + command: | + set -e + yarn upgrade + git add yarn.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update yarn dependencies" {{< /snippet >}} ``` @@ -94,15 +94,15 @@ title=Go ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - go get -u - go mod tidy - git add go.mod go.sum - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Go dependencies" + operations: + update: + command: | + set -e + go get -u + go mod tidy + git add go.mod go.sum + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Go dependencies" {{< /snippet >}} ``` @@ -114,14 +114,14 @@ title=Pipenv ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - pipenv update - git add Pipfile Pipfile.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Python dependencies" + operations: + update: + command: | + set -e + pipenv update + git add Pipfile Pipfile.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Python dependencies" {{< /snippet >}} ``` @@ -133,14 +133,14 @@ title=Bundler ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - bundle update --all - git add Gemfile Gemfile.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Ruby dependencies" + operations: + update: + command: | + set -e + bundle update --all + git add Gemfile Gemfile.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Ruby dependencies" {{< /snippet >}} ``` @@ -199,31 +199,31 @@ Make sure you carefully check your [user access on this project](/administration 2. Add a build hook to your app configuration to install the CLI as part of the build process: -```yaml {configFile="app"} -hooks: - build: | + ```yaml {configFile="app"} + hooks: + build: | set -e echo "Installing {{% vendor/name %}} CLI" curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash echo "Testing {{% vendor/name %}} CLI" {{% vendor/cli %}} -``` + ``` 3. Then, to configure a cron job to automatically update your dependencies once a day, use a configuration similar to the following: -```yaml {configFile="app"} -crons: - update: + ```yaml {configFile="app"} + crons: + update: # Run the code below every day at midnight. spec: '0 0 * * *' commands: - start: | - set -e - {{% vendor/cli %}} sync -e development code data --no-wait --yes - {{% vendor/cli %}} source-operation:run update --no-wait --yes -``` + start: | + set -e + {{% vendor/cli %}} sync -e development code data --no-wait --yes + {{% vendor/cli %}} source-operation:run update --no-wait --yes + ``` The example above synchronizes the `development` environment with its parent and then runs the `update` source operation defined [previously](#1-define-a-source-operation-to-update-your-dependencies). @@ -236,7 +236,7 @@ you can configure activity scripts or webhooks. ### Notifications through an activity script After you've defined a source operation to [update your dependencies on your project](#1-define-a-source-operation-to-update-your-dependencies), -you can configure an activity script +you can configure an activity script to receive notifications every time a dependency update is triggered. {{< note title="Example" >}} @@ -260,7 +260,7 @@ To do so, follow these steps: * the {{% vendor/name %}} CLI. * * Replace SLACK_URL in the following script with your Slack webhook URL. - * Get one here: https://api.slack.com/messaging/webhooks + * Get one here: https://api.slack.com/messaging/webhooks * You should get something like: const url = 'https://hooks.slack.com/...'; * * activity.text: a brief, one-line statement of what happened. @@ -302,7 +302,7 @@ To do so, follow these steps: add the following flag to the command: `--environments=your_environment_name`. Anytime a dependency is updated via a source operation, -the activity script now reports it to Slack. +the activity script now reports it to Slack. {{< /note >}} diff --git a/sites/platform/src/learn/tutorials/migrating.md b/sites/platform/src/learn/tutorials/migrating.md index ef0682d3ca..68c0ba7880 100644 --- a/sites/platform/src/learn/tutorials/migrating.md +++ b/sites/platform/src/learn/tutorials/migrating.md @@ -240,31 +240,15 @@ Upload to each mount separately. Suppose for instance you have the following file mounts defined: -{{% version/specific %}} - ```yaml {configFile="app"} mounts: - 'web/uploads': - source: local - source_path: uploads - 'private': - source: local - source_path: private + 'web/uploads': + source: local + source_path: uploads + 'private': + source: local + source_path: private ``` -<---> - -```yaml {configFile="app"} -applications: - myapp: - mounts: - 'web/uploads': - source: local - source_path: uploads - 'private': - source: local - source_path: private -``` -{{% /version/specific %}} Upload to each of directories above by running the following commands: diff --git a/sites/platform/src/learn/tutorials/restrict-service-access.md b/sites/platform/src/learn/tutorials/restrict-service-access.md index eaf981a8f1..c9ec35b740 100644 --- a/sites/platform/src/learn/tutorials/restrict-service-access.md +++ b/sites/platform/src/learn/tutorials/restrict-service-access.md @@ -5,7 +5,7 @@ description: Learn how to restrict access to a service using a worker and additi weight: 2 --- -{{% vendor/name %}} allows you to restrict access to a service. +{{% vendor/name %}} allows you to restrict access to a service. In this tutorial, learn how to grant your Data team `read-only` access to your production database. @@ -25,19 +25,19 @@ Edit your `{{< vendor/configfile "services" >}}` file and add the following [end ```yaml {configFile="services"} maindb: - type: mariadb:10.5 - disk: 2048 - configuration: - schemas: - - main - endpoints: - website: - default_schema: main - privileges: - main: admin - reporting: - privileges: - main: ro + type: mariadb:10.5 + disk: 2048 + configuration: + schemas: + - main + endpoints: + website: + default_schema: main + privileges: + main: admin + reporting: + privileges: + main: ro ``` ## 2. Grant your app access to the new endpoints @@ -46,39 +46,39 @@ Edit your app configuration and add new relationships to your new endpoints: ```yaml {configFile="app"} relationships: - database: - service: maindb - endpoint: website - reports: - service: maindb - endpoint: reporting + database: + service: maindb + endpoint: website + reports: + service: maindb + endpoint: reporting ``` ## 3. Create a worker with access to the read-only endpoint Edit your app configuration to add a new worker which: -- Does nothing (`sleep infinity`) +- Does nothing (`sleep infinity`) - Can access the read-only `reporting` endpoint - Allows SSH access to `viewer` ```yaml {configFile="app"} workers: - data_access: - size: S - disk: 128 - mounts: {} - commands: - start: | - sleep infinity - relationships: - reports: - service: maindb - endpoint: reporting - access: - ssh: viewer + data_access: + size: S + disk: 128 + mounts: {} + commands: + start: | + sleep infinity + relationships: + reports: + service: maindb + endpoint: reporting + access: + ssh: viewer ``` You're done! From now on, your `viewer` users can SSH in to the worker application, -and connect to your database with read-only permissions. \ No newline at end of file +and connect to your database with read-only permissions. diff --git a/sites/platform/static/images/yaml/basic.svg b/sites/platform/static/images/yaml/basic.svg index 3441df29a7..2f85eed4fe 100644 --- a/sites/platform/static/images/yaml/basic.svg +++ b/sites/platform/static/images/yaml/basic.svg @@ -1,9 +1,9 @@ nameapptypegolang:1.18disk1024 You can allow your CI system to run automated tasks using the {{% vendor/name %}} CLI. -To do so, create an environment variable named `{{% vendor/prefix_cli %}}_CLI_TOKEN` with your API token as its value. +To do so, create an environment variable named `{{% vendor/prefix_cli %}}_CLI_TOKEN` with your API token as its value. For more information, see your CI system's official documentation. To run SSH-based commands that aren't specific to the {{% vendor/name %}} CLI, @@ -162,13 +162,13 @@ Then add a build hook to your app configuration to install the CLI as part of th ```yaml {configFile="app"} hooks: - build: | - set -e - echo "Installing {{% vendor/name %}} CLI" - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash + build: | + set -e + echo "Installing {{% vendor/name %}} CLI" + curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash - echo "Testing {{% vendor/name %}} CLI" - {{% vendor/cli %}} + echo "Testing {{% vendor/name %}} CLI" + {{% vendor/cli %}} ``` You can now call the CLI from within the shell on the app container or in a cron job. @@ -177,25 +177,25 @@ To run SSH-based commands that aren't specific to the {{% vendor/name %}} CLI, see how to [load the proper SSH certificate](#use-the-cli-ssh-certificate-for-non-cli-commands). You can set up a cron job on a specific type of environment. -For example, to run the `update` source operation on your production environment, -use the following cron job: +For example, to run the `update` source operation on your production environment, +use the following cron job: ```yaml crons: - update: - spec: '0 0 * * *' - commands: - start: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - {{% vendor/cli %}} backup:create --yes --no-wait - {{% vendor/cli %}} source-operation:run update --no-wait --yes - fi + update: + spec: '0 0 * * *' + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + {{% vendor/cli %}} backup:create --yes --no-wait + {{% vendor/cli %}} source-operation:run update --no-wait --yes + fi ``` ## Use the CLI SSH certificate for non-CLI commands When you set a `{{% vendor/prefix_cli %}}_CLI_TOKEN` environment variable, -the CLI authentication isn't complete until your run a CLI command +the CLI authentication isn't complete until your run a CLI command or load the CLI SSH certificate. For example, after setting a `{{% vendor/prefix_cli %}}_CLI_TOKEN` environment variable, @@ -206,4 +206,4 @@ To do so, run the following command: ```bash {{% vendor/cli %}} ssh-cert:load --no-interaction -``` \ No newline at end of file +``` diff --git a/sites/upsun/src/create-apps/_index.md b/sites/upsun/src/create-apps/_index.md index e806f96167..65db6c27aa 100644 --- a/sites/upsun/src/create-apps/_index.md +++ b/sites/upsun/src/create-apps/_index.md @@ -29,25 +29,25 @@ The following example shows such a basic setup for Node.js: ```yaml {configFile="app"} # Top-level key, which contains configurations for all app containers. applications: - # The app's name, which must be unique within the project. - myapp: - # The language and version for your app. - type: 'nodejs:{{% latest "nodejs" %}}' - - # The app's configuration when it's exposed to the web. - web: - commands: - start: npm start - locations: - '/': - # The public directory relative to the app root. - root: 'public' - # Forward resources to the app. - passthru: true - # What files to use when serving a directory. - index: ["index.html"] - # Allow files even without specified rules. - allow: true + # The app's name, which must be unique within the project. + myapp: + # The language and version for your app. + type: 'nodejs:{{% latest "nodejs" %}}' + + # The app's configuration when it's exposed to the web. + web: + commands: + start: npm start + locations: + '/': + # The public directory relative to the app root. + root: 'public' + # Forward resources to the app. + passthru: true + # What files to use when serving a directory. + index: ["index.html"] + # Allow files even without specified rules. + allow: true ``` ## Use multiple apps @@ -124,59 +124,59 @@ title=Single-runtime image ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - myapp: - # The language and version for your app. - type: 'php:{{% latest "php" %}}' - - # Global dependencies to be added and cached and then available as commands. - dependencies: - php: - composer/composer: '^2' - - # Relationships enable an app container's access to a service or another app. - # 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: - mysql: - - # Scripts that are run as part of the build and deploy process. - hooks: - # Build hooks can modify app files on disk but not access any services like databases. - build: ./build.sh - # Deploy hooks can access services but the file system is now read-only. - deploy: ./deploy.sh - # Post deploy hooks run when the app is accepting outside requests. - post_deploy: ./post_deploy.sh - - # Define writable, persistent filesystem mounts. - # The key is the directory path relative to the application root. - # In this case, `web-files` is just a unique name for the mount. - mounts: - 'web/files': - source: storage - source_path: 'web-files' - - # The app's configuration when it's exposed to the web. - web: - locations: - '/': - # The app's public directory relative to its root. - root: 'public' - # A front controller to determine how to handle requests. - passthru: '/app.php' - # Allow uploaded files to be served, but don't run scripts. - # Missing files get sent to the front controller. - '/files': - root: 'web/files' - scripts: false - allow: true - passthru: '/app.php' + # The app's name, which must be unique within the project. + myapp: + # The language and version for your app. + type: 'php:{{% latest "php" %}}' + + # Global dependencies to be added and cached and then available as commands. + dependencies: + php: + composer/composer: '^2' + + # Relationships enable an app container's access to a service or another app. + # 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: + mysql: + + # Scripts that are run as part of the build and deploy process. + hooks: + # Build hooks can modify app files on disk but not access any services like databases. + build: ./build.sh + # Deploy hooks can access services but the file system is now read-only. + deploy: ./deploy.sh + # Post deploy hooks run when the app is accepting outside requests. + post_deploy: ./post_deploy.sh + + # Define writable, persistent filesystem mounts. + # The key is the directory path relative to the application root. + # In this case, `web-files` is just a unique name for the mount. + mounts: + 'web/files': + source: storage + source_path: 'web-files' + + # The app's configuration when it's exposed to the web. + web: + locations: + '/': + # The app's public directory relative to its root. + root: 'public' + # A front controller to determine how to handle requests. + passthru: '/app.php' + # Allow uploaded files to be served, but don't run scripts. + # Missing files get sent to the front controller. + '/files': + root: 'web/files' + scripts: false + allow: true + passthru: '/app.php' services: - mysql: - type: mariadb:{{% latest "mariadb" %}} + mysql: + type: mariadb:{{% latest "mariadb" %}} ``` <---> @@ -187,65 +187,65 @@ title=Composable image ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - myapp: - # The list of packages you want installed (from the {{% vendor/name %}} collection - # of supported runtimes and/or from Nixpkgs). - # For more information, see the Composable image page in the App reference section. - stack: - - "php@8.3" - # The list of PHP extensions you want installed. - extensions: - - apcu - - ctype - - iconv - - mbstring - - pdo_pgsql - - sodium - - xsl - # Relationships enable an app container's access to a service or another app. - # 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: - mysql: - - # Scripts that are run as part of the build and deploy process. - hooks: - # Build hooks can modify app files on disk but not access any services like databases. - build: ./build.sh - # Deploy hooks can access services but the file system is now read-only. - deploy: ./deploy.sh - # Post deploy hooks run when the app is accepting outside requests. - post_deploy: ./post_deploy.sh - - # Define writable, persistent filesystem mounts. - # The key is the directory path relative to the application root. - # In this case, `web-files` is just a unique name for the mount. - mounts: - 'web/files': - source: storage - source_path: 'web-files' - - # The app's configuration when it's exposed to the web. - web: - locations: - '/': - # The app's public directory relative to its root. - root: 'public' - # A front controller to determine how to handle requests. - passthru: '/app.php' - # Allow uploaded files to be served, but don't run scripts. - # Missing files get sent to the front controller. - '/files': - root: 'web/files' - scripts: false - allow: true - passthru: '/app.php' + # The app's name, which must be unique within the project. + myapp: + # The list of packages you want installed (from the {{% vendor/name %}} collection + # of supported runtimes and/or from Nixpkgs). + # For more information, see the Composable image page in the App reference section. + stack: + - "php@8.3" + # The list of PHP extensions you want installed. + extensions: + - apcu + - ctype + - iconv + - mbstring + - pdo_pgsql + - sodium + - xsl + # Relationships enable an app container's access to a service or another app. + # 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: + mysql: + + # Scripts that are run as part of the build and deploy process. + hooks: + # Build hooks can modify app files on disk but not access any services like databases. + build: ./build.sh + # Deploy hooks can access services but the file system is now read-only. + deploy: ./deploy.sh + # Post deploy hooks run when the app is accepting outside requests. + post_deploy: ./post_deploy.sh + + # Define writable, persistent filesystem mounts. + # The key is the directory path relative to the application root. + # In this case, `web-files` is just a unique name for the mount. + mounts: + 'web/files': + source: storage + source_path: 'web-files' + + # The app's configuration when it's exposed to the web. + web: + locations: + '/': + # The app's public directory relative to its root. + root: 'public' + # A front controller to determine how to handle requests. + passthru: '/app.php' + # Allow uploaded files to be served, but don't run scripts. + # Missing files get sent to the front controller. + '/files': + root: 'web/files' + scripts: false + allow: true + passthru: '/app.php' services: mysql: type: mariadb:{{% latest "mariadb" %}} ``` -{{< /codetabs >}} \ No newline at end of file +{{< /codetabs >}} diff --git a/sites/upsun/src/create-apps/app-reference/composable-image.md b/sites/upsun/src/create-apps/app-reference/composable-image.md index d39cafb318..6c90cd5162 100644 --- a/sites/upsun/src/create-apps/app-reference/composable-image.md +++ b/sites/upsun/src/create-apps/app-reference/composable-image.md @@ -42,11 +42,11 @@ applications: frontend: stack: - "php@{{% latest "php" %}}": - extensions: - - apcu - - sodium - - xsl - - pdo_sqlite + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite - "nodejs@{{% latest "nodejs" %}}" - "python@3.12" # Additional frontend configuration @@ -87,7 +87,7 @@ Define them as a YAML array as follows: ```yaml {configFile="app"} applications: - app: + myapp: stack: [ "@" ] # OR stack: @@ -156,7 +156,7 @@ To do so, use the following configuration: ```yaml {configFile="app"} applications: - app: + myapp: stack: [ "php@{{% latest php %}}", "facedetect" ] # OR stack: @@ -331,10 +331,10 @@ For more information, see how to [define relationships between your apps](/creat {{< note title="Availability" theme="info">}} -New syntax (default and explicit endpoints) described below is supported by most, but not all, image types -(`Relationship 'SERVICE_NAME' of application 'app' ... targets a service without a valid default endpoint configuration.`). -This syntax is currently being rolled out for all images. -If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. +New syntax (default and explicit endpoints) described below is supported by most, but not all, image types +(`Relationship 'SERVICE_NAME' of application 'myapp' ... targets a service without a valid default endpoint configuration.`). +This syntax is currently being rolled out for all images. +If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. {{< /note >}} @@ -350,10 +350,10 @@ Use the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - {{% variable "SERVICE_NAME" %}}: + {{% variable "APP_NAME" %}}: + # ... + relationships: + {{% variable "SERVICE_NAME" %}}: ``` The `SERVICE_NAME` is the name of the service as defined in its [configuration](/add-services/_index.md). @@ -364,10 +364,10 @@ For example, if you define the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - mariadb: + {{% variable "APP_NAME" %}}: + # ... + relationships: + mariadb: ``` {{% vendor/name %}} looks for a service named `mariadb` in your `{{% vendor/configfile "services" %}}` file, @@ -377,24 +377,24 @@ For reference, the equivalent configuration using explicit endpoints would be th ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - mariadb: - service: mariadb - endpoint: mysql + {{% variable "APP_NAME" %}}: + # ... + relationships: + mariadb: + service: mariadb + endpoint: mysql ``` You can define any number of relationships in this way: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - mariadb: - redis: - elasticsearch: + {{% variable "APP_NAME" %}}: + # ... + relationships: + mariadb: + redis: + elasticsearch: ``` {{< note title="Tip" theme="info" >}} @@ -403,17 +403,17 @@ An even quicker way to define many relationships is to use the following single- ```yaml {configFile="services"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: {{{< variable "SERVICE_NAME_A" >}}, {{< variable "SERVICE_NAME_B" >}}, {{< variable "SERVICE_NAME_C" >}}} + {{% variable "APP_NAME" %}}: + # ... + relationships: {{{< variable "SERVICE_NAME_A" >}}, {{< variable "SERVICE_NAME_B" >}}, {{< variable "SERVICE_NAME_C" >}}} services: - {{< variable "SERVICE_NAME_A" >}}: - type: mariadb:{{% latest "mariadb" %}} - {{< variable "SERVICE_NAME_B" >}}: - type: redis:{{% latest "redis" %}} - {{< variable "SERVICE_NAME_C" >}}: - type: elasticsearch:{{% latest "elasticsearch" %}} + {{< variable "SERVICE_NAME_A" >}}: + type: mariadb:{{% latest "mariadb" %}} + {{< variable "SERVICE_NAME_B" >}}: + type: redis:{{% latest "redis" %}} + {{< variable "SERVICE_NAME_C" >}}: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` {{< /note >}} @@ -428,12 +428,12 @@ Use the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}} + {{% variable "APP_NAME" %}}: + # ... + relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}} ``` - `RELATIONSHIP_NAME` is the name you want to give to the relationship. @@ -445,12 +445,12 @@ use the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - database: # The name of the relationship. - service: mariadb - endpoint: db1 + {{% variable "APP_NAME" %}}: + # ... + relationships: + database: # The name of the relationship. + service: mariadb + endpoint: db1 ``` For more information on how to handle multiple databases, multiple cores, @@ -468,19 +468,19 @@ see each service's dedicated page: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - database1: - service: mariadb - endpoint: admin - database2: - service: mariadb - endpoint: legacy - cache: - service: redis - search: - service: elasticsearch + {{% variable "APP_NAME" %}}: + # ... + relationships: + database1: + service: mariadb + endpoint: admin + database2: + service: mariadb + endpoint: legacy + cache: + service: redis + search: + service: elasticsearch ``` {{< /codetabs >}} @@ -489,30 +489,30 @@ applications: The following legacy syntax for specifying relationships is still supported by {{% vendor/name %}}: -```yaml +```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - : ":" + {{% variable "APP_NAME" %}}: + # ... + relationships: + : ":" services: - SERVICE_NAME_A: - type: mariadb:{{% latest "mariadb" %}} + SERVICE_NAME_A: + type: mariadb:{{% latest "mariadb" %}} ``` For example: -```yaml +```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - database: "db:mysql" + {{% variable "APP_NAME" %}}: + # ... + relationships: + database: "db:mysql" services: - db: - type: mariadb:{{% latest "mariadb" %}} + db: + type: mariadb:{{% latest "mariadb" %}} ``` Feel free to use this until the default and explicit endpoint syntax is supported on all images. @@ -687,11 +687,11 @@ Follow these steps: ```yaml {configFile="app"} applications: - backend: - mounts: - var/uploads: #The path to your mount within the backend app container. - source: storage - source_path: backend/uploads #The path to the source of the mount within the external network directory. + backend: + mounts: + var/uploads: #The path to your mount within the backend app container. + source: storage + source_path: backend/uploads #The path to the source of the mount within the external network directory. ``` This creates a `storage` mount named `var/uploads` in the `backend` app container. @@ -701,19 +701,18 @@ Follow these steps: ```yaml {configFile="app"} applications: - applications: - backend: - mounts: - var/uploads: - source: storage - source_path: backend/uploads - - frontend: - mounts: - web/uploads: #The path to your mount within the frontend app container. - source: storage - service: backend #The name of the other app, so the mount can point to the same external network directory as that other app's mount. - source_path: backend/uploads #The path to the source of the mount within the shared external network directory. + backend: + mounts: + var/uploads: + source: storage + source_path: backend/uploads + + frontend: + mounts: + web/uploads: #The path to your mount within the frontend app container. + source: storage + service: backend #The name of the other app, so the mount can point to the same external network directory as that other app's mount. + source_path: backend/uploads #The path to the source of the mount within the shared external network directory. ``` This creates another `storage` mount named `web/uploads` in the `frontend` app container. @@ -750,9 +749,9 @@ Note that {{% vendor/name %}} will provide new local mounts in the near future. The locations of mounts as they are visible to application containers can overlap somewhat. For example: -```yaml +```yaml {configFile="app"} applications: - my_app: + myapp: # ... mounts: 'var/cache_a': @@ -767,13 +766,13 @@ applications: ``` In this case, it does not matter that each mount is of a different `source` type. -Each mount is restricted to a subfolder within `var`, and all is well. +Each mount is restricted to a subfolder within `var`, and all is well. The following, however, is not allowed and will result in a failure: -```yaml +```yaml {configFile="app"} applications: - my_app: + myapp: # ... mounts: 'var/': @@ -1335,7 +1334,7 @@ crons: # Run Laravel's scheduler every 5 minutes. scheduler: spec: '*/5 * * * *' - commands: + commands: start: 'php artisan schedule:run' {{< /snippet >}} ``` @@ -1353,7 +1352,7 @@ crons: # Take a backup of the environment every day at 5:00 AM. snapshot: spec: 0 5 * * * - commands: + commands: start: | # Only run for the production environment, aka main branch if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then diff --git a/sites/upsun/src/create-apps/app-reference/single-runtime-image.md b/sites/upsun/src/create-apps/app-reference/single-runtime-image.md index e00bc090e2..f6c94fa44a 100644 --- a/sites/upsun/src/create-apps/app-reference/single-runtime-image.md +++ b/sites/upsun/src/create-apps/app-reference/single-runtime-image.md @@ -116,11 +116,11 @@ applications: frontend: stack: - "php@{{% latest "php" %}}": - extensions: - - apcu - - sodium - - xsl - - pdo_sqlite + extensions: + - apcu + - sodium + - xsl + - pdo_sqlite - "python@3.12" - "python312Packages.yq" # python package specific ``` @@ -153,10 +153,10 @@ For more information, see how to [define relationships between your apps](/creat {{< note title="Availability" theme="info">}} -New syntax (default and explicit endpoints) described below is supported by most, but not all, image types +New syntax (default and explicit endpoints) described below is supported by most, but not all, image types (`Relationship 'SERVICE_NAME' of application 'app' ... targets a service without a valid default endpoint configuration.`). -This syntax is currently being rolled out for all images. -If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. +This syntax is currently being rolled out for all images. +If you encounter this error, use the "legacy" {{% vendor/name %}} configuration noted at the bottom of this section. {{< /note >}} @@ -172,10 +172,10 @@ Use the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - {{% variable "SERVICE_NAME" %}}: + {{% variable "APP_NAME" %}}: + # ... + relationships: + {{% variable "SERVICE_NAME" %}}: ``` The `SERVICE_NAME` is the name of the service as defined in its [configuration](/add-services/_index.md). @@ -186,10 +186,10 @@ For example, if you define the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - mariadb: + {{% variable "APP_NAME" %}}: + # ... + relationships: + mariadb: ``` {{% vendor/name %}} looks for a service named `mariadb` in your `{{% vendor/configfile "services" %}}` file, @@ -199,24 +199,24 @@ For reference, the equivalent configuration using explicit endpoints would be th ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - mariadb: - service: mariadb - endpoint: mysql + {{% variable "APP_NAME" %}}: + # ... + relationships: + mariadb: + service: mariadb + endpoint: mysql ``` You can define any number of relationships in this way: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - mariadb: - redis: - elasticsearch: + {{% variable "APP_NAME" %}}: + # ... + relationships: + mariadb: + redis: + elasticsearch: ``` {{< note title="Tip" theme="info" >}} @@ -225,17 +225,17 @@ An even quicker way to define many relationships is to use the following single- ```yaml {configFile="services"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: {{{< variable "SERVICE_NAME_A" >}}, {{< variable "SERVICE_NAME_B" >}}, {{< variable "SERVICE_NAME_C" >}}} + {{% variable "APP_NAME" %}}: + # ... + relationships: {{{< variable "SERVICE_NAME_A" >}}, {{< variable "SERVICE_NAME_B" >}}, {{< variable "SERVICE_NAME_C" >}}} services: - {{< variable "SERVICE_NAME_A" >}}: - type: mariadb:{{% latest "mariadb" %}} - {{< variable "SERVICE_NAME_B" >}}: - type: redis:{{% latest "redis" %}} - {{< variable "SERVICE_NAME_C" >}}: - type: elasticsearch:{{% latest "elasticsearch" %}} + {{< variable "SERVICE_NAME_A" >}}: + type: mariadb:{{% latest "mariadb" %}} + {{< variable "SERVICE_NAME_B" >}}: + type: redis:{{% latest "redis" %}} + {{< variable "SERVICE_NAME_C" >}}: + type: elasticsearch:{{% latest "elasticsearch" %}} ``` {{< /note >}} @@ -250,12 +250,12 @@ Use the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - {{% variable "RELATIONSHIP_NAME" %}}: - service: {{% variable "SERVICE_NAME" %}} - endpoint: {{% variable "ENDPOINT_NAME" %}} + {{% variable "APP_NAME" %}}: + # ... + relationships: + {{% variable "RELATIONSHIP_NAME" %}}: + service: {{% variable "SERVICE_NAME" %}} + endpoint: {{% variable "ENDPOINT_NAME" %}} ``` - `RELATIONSHIP_NAME` is the name you want to give to the relationship. @@ -267,12 +267,12 @@ use the following configuration: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - database: # The name of the relationship. - service: mariadb - endpoint: db1 + {{% variable "APP_NAME" %}}: + # ... + relationships: + database: # The name of the relationship. + service: mariadb + endpoint: db1 ``` For more information on how to handle multiple databases, multiple cores, @@ -290,19 +290,19 @@ see each service's dedicated page: ```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - database1: - service: mariadb - endpoint: admin - database2: - service: mariadb - endpoint: legacy - cache: - service: redis - search: - service: elasticsearch + {{% variable "APP_NAME" %}}: + # ... + relationships: + database1: + service: mariadb + endpoint: admin + database2: + service: mariadb + endpoint: legacy + cache: + service: redis + search: + service: elasticsearch ``` {{< /codetabs >}} @@ -311,30 +311,30 @@ applications: The following legacy syntax for specifying relationships is still supported by {{% vendor/name %}}: -```yaml +```yaml {configFile="app"} applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - : ":" + {{% variable "APP_NAME" %}}: + # ... + relationships: + : ":" services: - SERVICE_NAME_A: - type: mariadb:{{% latest "mariadb" %}} + SERVICE_NAME_A: + type: mariadb:{{% latest "mariadb" %}} ``` For example: ```yaml applications: - {{% variable "APP_NAME" %}}: - # ... - relationships: - database: "db:mysql" + {{% variable "APP_NAME" %}}: + # ... + relationships: + database: "db:mysql" services: - db: - type: mariadb:{{% latest "mariadb" %}} + db: + type: mariadb:{{% latest "mariadb" %}} ``` Feel free to use this until the default and explicit endpoint syntax is supported on all images. @@ -441,9 +441,11 @@ Changing the name of your mount affects the default `source_path`. Say you have a `/my/cache/` mount with an undefined `source_path`: ```yaml {configFile="app"} -mounts: - '/my/cache/': - source: tmp +applications: + myapp: + mounts: + '/my/cache/': + source: tmp ``` If you rename the mount to `/cache/files/`, it will point to a new, empty `/cache/files/` directory. @@ -452,10 +454,12 @@ To ensure continuity, you need to explicitly define the `source_path` as the pre or trailing slashes: ```yaml {configFile="app"} -mounts: - '/cache/files/': - source: tmp - source_path: my/cache +applications: + myapp: + mounts: + '/cache/files/': + source: tmp + source_path: my/cache ``` The `/cache/files/` mount will point to the original `/my/cache/` directory, maintaining access to all your existing @@ -509,11 +513,11 @@ Follow these steps: ```yaml {configFile="app"} applications: - backend: - mounts: - var/uploads: #The path to your mount within the backend app container. - source: storage - source_path: backend/uploads #The path to the source of the mount within the external network directory. + backend: + mounts: + var/uploads: #The path to your mount within the backend app container. + source: storage + source_path: backend/uploads #The path to the source of the mount within the external network directory. ``` This creates a `storage` mount named `var/uploads` in the `backend` app container. @@ -523,19 +527,19 @@ Follow these steps: ```yaml {configFile="app"} applications: - applications: - backend: - mounts: - var/uploads: - source: storage - source_path: backend/uploads - - frontend: - mounts: - web/uploads: #The path to your mount within the frontend app container. - source: storage - service: backend #The name of the other app, so the mount can point to the same external network directory as that other app's mount. - source_path: backend/uploads #The path to the source of the mount within the shared external network directory. + applications: + backend: + mounts: + var/uploads: + source: storage + source_path: backend/uploads + + frontend: + mounts: + web/uploads: #The path to your mount within the frontend app container. + source: storage + service: backend #The name of the other app, so the mount can point to the same external network directory as that other app's mount. + source_path: backend/uploads #The path to the source of the mount within the shared external network directory. ``` This creates another `storage` mount named `web/uploads` in the `frontend` app container. @@ -556,9 +560,9 @@ explicitly [defining a Network Storage service](/add-services/network-storage.md The locations of mounts as they are visible to application containers can overlap somewhat. For example: -```yaml +```yaml {configFile="app"} applications: - my_app: + myapp: # ... mounts: 'var/cache_a': @@ -573,13 +577,13 @@ applications: ``` In this case, it does not matter that each mount is of a different `source` type. -Each mount is restricted to a subfolder within `var`, and all is well. +Each mount is restricted to a subfolder within `var`, and all is well. The following, however, is not allowed and will result in a failure: -```yaml +```yaml {configFile="app"} applications: - my_app: + myapp: # ... mounts: 'var/': @@ -911,8 +915,8 @@ applications: firewall: outbound: - ips: [ "1.2.3.4/32" ] - ports: [ 443 ] - - ports: [ 80 ] + ports: [ 443 ] + - ports: [ 80 ] ``` ### Outbound traffic to CDNs @@ -942,11 +946,11 @@ applications: firewall: outbound: - protocol: tcp - domains: [ "api.stripe.com", "api.twilio.com" ] - ports: [ 80, 443 ] - - protocol: tcp - ips: [ "1.2.3.4/29","2.3.4.5" ] - ports: [ 22 ] + domains: [ "api.stripe.com", "api.twilio.com" ] + ports: [ 80, 443 ] + - protocol: tcp + ips: [ "1.2.3.4/29","2.3.4.5" ] + ports: [ 22 ] ``` #### Determine which domains to allow @@ -1209,7 +1213,7 @@ crons: # Run Laravel's scheduler every 5 minutes. scheduler: spec: '*/5 * * * *' - commands: + commands: start: 'php artisan schedule:run' {{< /snippet >}} ``` @@ -1227,7 +1231,7 @@ crons: # Take a backup of the environment every day at 5:00 AM. snapshot: spec: 0 5 * * * - commands: + commands: start: | # Only run for the production environment, aka main branch if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then @@ -1254,12 +1258,12 @@ applications: crons: update: spec: '0 0 * * *' - commands: - start: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + commands: + start: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then {{% vendor/cli %}} backup:create --yes --no-wait {{% vendor/cli %}} source-operation:run update --no-wait --yes - fi + fi ``` ### Cron job timing @@ -1373,9 +1377,9 @@ applications: extensions: - geoip - name: blackfire - configuration: - server_id: foo - server_token: bar + configuration: + server_id: foo + server_token: bar ``` In this case, the `name` property is required. diff --git a/sites/upsun/src/create-apps/hooks/_index.md b/sites/upsun/src/create-apps/hooks/_index.md index d028059a37..e35af01f72 100644 --- a/sites/upsun/src/create-apps/hooks/_index.md +++ b/sites/upsun/src/create-apps/hooks/_index.md @@ -31,14 +31,14 @@ Create your `build` hook to install them all: 1. Create a `build` hook in your [app configuration](/create-apps/app-reference/single-runtime-image.md): - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - client: - source: - root: client - hooks: - build: | - set -e + client: + source: + root: client + hooks: + build: | + set -e ``` The hook has two parts so far: @@ -53,15 +53,15 @@ Create your `build` hook to install them all: If other hooks fail, the deploy still happens. 2. Install your top-level dependencies inside this `build` hook: - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - client: - source: - root: client - hooks: - build: | - set -e - yarn --frozen-lockfile + client: + source: + root: client + hooks: + build: | + set -e + yarn --frozen-lockfile ``` This installs all the dependencies for the main app. @@ -94,35 +94,35 @@ All of this configuration and preparation can be handled in a bash script. Unlike in the `build` hook, in the `deploy` hook the system is generally read-only. So create a mount where you can write the Drush configuration: - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - api: - source: - root: api - - mounts: - /.drush: - source: storage - source_path: 'drush' + api: + source: + root: api + + mounts: + /.drush: + source: storage + source_path: 'drush' ``` 4. Add a `deploy` hook that runs the preparation script: - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - api: - source: - root: api - - mounts: - /.drush: - source: storage - source_path: 'drush' - - hooks: - deploy: !include - type: string - path: platformsh-scripts/hooks.deploy.sh + api: + source: + root: api + + mounts: + /.drush: + source: storage + source_path: 'drush' + + hooks: + deploy: !include + type: string + path: platformsh-scripts/hooks.deploy.sh ``` This `!include` syntax tells the hook to process the script as if it were included in the YAML file directly. @@ -146,157 +146,156 @@ So you don't have to rebuild Drupal but you still get fresh content. 1. Set a relationship for Next.js with Drupal. This allows the Next.js app to make requests and receive data from the Drupal app. - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - client: - source: - root: client - - relationships: - api: - service: 'api' - endpoint: 'http' + client: + source: + root: client + + relationships: + api: + service: 'api' + endpoint: 'http' ``` 2. Set [mounts](/create-apps/app-reference/single-runtime-image.md#mounts). Like the [`deploy` hook](#configure-drush-and-drupal), the `post_deploy` hook has a read-only file system. Create mounts for your Next.js files: - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - client: - source: - root: client - - mounts: - /.cache: - source: tmp - source_path: 'cache' - /.next: - source: storage - source_path: 'next' - /.pm2: - source: storage - source_path: 'pm2' - deploy: - source: storage - service: files - source_path: deploy + client: + source: + root: client + + mounts: + /.cache: + source: tmp + source_path: 'cache' + /.next: + source: storage + source_path: 'next' + /.pm2: + source: storage + source_path: 'pm2' + deploy: + source: storage + service: files + source_path: deploy ``` 3. Add a `post_deploy` hook that first tests the connection between the apps: - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - client: - source: - root: client - - hooks: - post_deploy: | - . deploy/platformsh.environment - cd platformsh-scripts/test && yarn debug + client: + source: + root: client + hooks: + post_deploy: | + . deploy/platformsh.environment + cd platformsh-scripts/test && yarn debug ``` Note that you could add `set -e` here, but even if the job fails, the build/deployment itself can still be counted as successful. 4. Then build the Next.js site: - ```yaml {configfile="app"} + ```yaml {configFile="app"} applications: - client: - source: - root: client - hooks: - post_deploy: | - . deploy/platformsh.environment - cd platformsh-scripts/test && yarn debug - cd $PLATFORM_APP_DIR && yarn build + client: + source: + root: client + hooks: + post_deploy: | + . deploy/platformsh.environment + cd platformsh-scripts/test && yarn debug + cd $PLATFORM_APP_DIR && yarn build ``` The `$PLATFORM_APP_DIR` variable represents the app root and can always get you back there. ## Final hooks -```yaml {configfile="app"} +```yaml {configFile="app"} applications: - api: - # The runtime the app uses. - type: 'php:{{% latest "php" %}}' - - dependencies: - php: - composer/composer: '^2' - - # The relationships of the app with services or other apps. - relationships: - database: - service: 'db' - endpoint: 'mysql' - redis: - service: 'cache' - endpoint: 'redis' - - # The hooks executed at various points in the lifecycle of the app. - hooks: - deploy: !include - type: string - path: platformsh-scripts/hooks.deploy.sh - - # The 'mounts' describe writable, persistent filesystem mounts in the app. - mounts: - /.drush: - source: storage - source_path: 'drush' - /drush-backups: - source: storage - source_path: 'drush-backups' - deploy: - source: service - service: files - source_path: deploy - client: - # The type key specifies the language and version for your app. - type: 'nodejs:{{% latest "nodejs" %}}' - - dependencies: - nodejs: - yarn: "1.22.17" - pm2: "5.2.0" - - build: - flavor: none - - relationships: - api: - service: 'api' - endpoint: 'http' - - # The hooks that are triggered when the package is deployed. - hooks: - build: | - set -e - yarn --frozen-lockfile # Install dependencies for the main app - cd platformsh-scripts/test - yarn --frozen-lockfile # Install dependencies for the testing script - # Next.js's build is delayed to the post_deploy hook, when Drupal is available for requests. - post_deploy: | - . deploy/platformsh.environment - cd platformsh-scripts/test && yarn debug - cd $PLATFORM_APP_DIR && yarn build - - mounts: - /.cache: - source: tmp - source_path: 'cache' - /.next: - source: storage - source_path: 'next' - /.pm2: - source: storage - source_path: 'pm2' - deploy: - source: storage - service: files - source_path: deploy + api: + # The runtime the app uses. + type: 'php:{{% latest "php" %}}' + + dependencies: + php: + composer/composer: '^2' + + # The relationships of the app with services or other apps. + relationships: + database: + service: 'db' + endpoint: 'mysql' + redis: + service: 'cache' + endpoint: 'redis' + + # The hooks executed at various points in the lifecycle of the app. + hooks: + deploy: !include + type: string + path: platformsh-scripts/hooks.deploy.sh + + # The 'mounts' describe writable, persistent filesystem mounts in the app. + mounts: + /.drush: + source: storage + source_path: 'drush' + /drush-backups: + source: storage + source_path: 'drush-backups' + deploy: + source: service + service: files + source_path: deploy + client: + # The type key specifies the language and version for your app. + type: 'nodejs:{{% latest "nodejs" %}}' + + dependencies: + nodejs: + yarn: "1.22.17" + pm2: "5.2.0" + + build: + flavor: none + + relationships: + api: + service: 'api' + endpoint: 'http' + + # The hooks that are triggered when the package is deployed. + hooks: + build: | + set -e + yarn --frozen-lockfile # Install dependencies for the main app + cd platformsh-scripts/test + yarn --frozen-lockfile # Install dependencies for the testing script + # Next.js's build is delayed to the post_deploy hook, when Drupal is available for requests. + post_deploy: | + . deploy/platformsh.environment + cd platformsh-scripts/test && yarn debug + cd $PLATFORM_APP_DIR && yarn build + + mounts: + /.cache: + source: tmp + source_path: 'cache' + /.next: + source: storage + source_path: 'next' + /.pm2: + source: storage + source_path: 'pm2' + deploy: + source: storage + service: files + source_path: deploy ``` diff --git a/sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md b/sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md index 4e6189298d..15b06b3735 100644 --- a/sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md +++ b/sites/upsun/src/create-apps/hooks/hooks-and-dependencies.md @@ -22,14 +22,14 @@ Set your app configuration to have Sass available globally and use it: ```yaml {configFile="app"} applications: - myapp: - # Ensure sass is available globally - dependencies: - nodejs: - sass: "^1.47.0" + myapp: + # Ensure sass is available globally + dependencies: + nodejs: + sass: "^1.47.0" - hooks: - # Run the script defined in package.json - build: | - npm run build-css + hooks: + # Run the script defined in package.json + build: | + npm run build-css ``` diff --git a/sites/upsun/src/create-apps/hooks/vary-hooks-by-environment.md b/sites/upsun/src/create-apps/hooks/vary-hooks-by-environment.md index e1423e9490..6e30d09521 100644 --- a/sites/upsun/src/create-apps/hooks/vary-hooks-by-environment.md +++ b/sites/upsun/src/create-apps/hooks/vary-hooks-by-environment.md @@ -14,13 +14,13 @@ Check the `PLATFORM_ENVIRONMENT_TYPE` variable to see if it's in a production en ```yaml {configFile="app"} applications: - myapp: - hooks: - deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - # Run commands only when deploying to production - else - # Run commands only when deploying to development or staging environments - fi - # Commands to run regardless of the environment + myapp: + hooks: + deploy: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then + # Run commands only when deploying to production + else + # Run commands only when deploying to development or staging environments + fi + # Commands to run regardless of the environment ``` diff --git a/sites/upsun/src/create-apps/multi-app/project-structure.md b/sites/upsun/src/create-apps/multi-app/project-structure.md index d651f98538..1637566b78 100644 --- a/sites/upsun/src/create-apps/multi-app/project-structure.md +++ b/sites/upsun/src/create-apps/multi-app/project-structure.md @@ -307,9 +307,11 @@ For example, to change the source root of the `admin` app from the [unified app configuration](#unified-app-configuration) example project, you could add the following configuration: -```yaml {configFile="apps"} -source: - root: admin +```yaml {configFile="app"} +applications: + admin: + source: + root: admin ``` The `source.root` path is relative to the repository root. diff --git a/sites/upsun/src/create-apps/multi-app/relationships.md b/sites/upsun/src/create-apps/multi-app/relationships.md index 875370a8c5..1581b9f777 100644 --- a/sites/upsun/src/create-apps/multi-app/relationships.md +++ b/sites/upsun/src/create-apps/multi-app/relationships.md @@ -27,7 +27,7 @@ You have two apps, `app1` and `app2`, and `app1` needs data from `app2`. In your app configuration for `app1`, define a relationship to `app2`: -```yaml {configFile="apps"} +```yaml {configFile="app"} applications: app1: relationships: diff --git a/sites/upsun/src/create-apps/multi-app/routes.md b/sites/upsun/src/create-apps/multi-app/routes.md index 5458a1a7c3..695e2cb852 100644 --- a/sites/upsun/src/create-apps/multi-app/routes.md +++ b/sites/upsun/src/create-apps/multi-app/routes.md @@ -21,22 +21,22 @@ and a Mercure Rocks server app, defined as follows: ```yaml {configFile="apps"} applications: - admin: - source: - root: admin - type: nodejs:{{% latest "nodejs" %}} - api: - source: - root: api - type: php:{{% latest "php" %}} - gatsby: - source: - root: gatsby - type: nodejs:{{% latest "nodejs" %}} - mercure: - source: - root: mercure/.config - type: golang:{{% latest "golang" %}} + admin: + source: + root: admin + type: nodejs:{{% latest "nodejs" %}} + api: + source: + root: api + type: php:{{% latest "php" %}} + gatsby: + source: + root: gatsby + type: nodejs:{{% latest "nodejs" %}} + mercure: + source: + root: mercure/.config + type: golang:{{% latest "golang" %}} ``` {{< note >}} @@ -57,12 +57,12 @@ You could define routes for your apps as follows: ```yaml {configFile="routes"} routes: - "https://mercure.{default}/": - type: upstream - upstream: "mercure:http" - "https://{default}/": - type: upstream - upstream: "api:http" + "https://mercure.{default}/": + type: upstream + upstream: "mercure:http" + "https://{default}/": + type: upstream + upstream: "api:http" ``` So if your default domain is `example.com`, that means: @@ -83,50 +83,50 @@ Alternatively, you could define your routes as follows: ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "api:http" - "https://{default}/admin": - type: upstream - upstream: "admin:http" + "https://{default}/": + type: upstream + upstream: "api:http" + "https://{default}/admin": + type: upstream + upstream: "admin:http" ``` Then you would need to configure each app's `web.locations` property to match these paths: ```yaml {configFile="apps"} applications: - admin: - source: - root: admin - type: nodejs:{{% latest "nodejs" %}} - ... - web: - locations: - '/admin': - passthru: '/admin/index.html' - root: 'build' - index: - - 'index.html' - api: - source: - root: api - type: php:{{% latest "php" %}} - ... - web: - locations: - "/": - passthru: "/index.php" - root: "public" - index: - - index.php + admin: + source: + root: admin + type: nodejs:{{% latest "nodejs" %}} + ... + web: + locations: + '/admin': + passthru: '/admin/index.html' + root: 'build' + index: + - 'index.html' + api: + source: + root: api + type: php:{{% latest "php" %}} + ... + web: + locations: + "/": + passthru: "/index.php" + root: "public" + index: + - index.php routes: - "https://{default}/": - type: upstream - upstream: "api:http" - "https://{default}/admin": - type: upstream - upstream: "admin:http" + "https://{default}/": + type: upstream + upstream: "api:http" + "https://{default}/admin": + type: upstream + upstream: "admin:http" ``` So if your default domain is `example.com`, that means: diff --git a/sites/upsun/src/create-apps/runtime-operations.md b/sites/upsun/src/create-apps/runtime-operations.md index a10370b44c..cc06eb690d 100644 --- a/sites/upsun/src/create-apps/runtime-operations.md +++ b/sites/upsun/src/create-apps/runtime-operations.md @@ -19,14 +19,14 @@ To define a runtime operation, add a configuration similar to the following: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - operations: - {{< variable "RUNTIME_OPERATION_NAME" >}}: - role: {{< variable "USER_ROLE" >}} - commands: - start: {{< variable "COMMAND" >}} + myapp: + source: + root: "/" + operations: + {{< variable "RUNTIME_OPERATION_NAME" >}}: + role: {{< variable "USER_ROLE" >}} + commands: + start: {{< variable "COMMAND" >}} ``` When you define a runtime operation, you can specify which users can trigger it according to their user `role`: @@ -43,14 +43,14 @@ you could define an operation like the following: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - operations: - clear-rebuild: - role: admin - commands: - start: drush cache:rebuild + myapp: + source: + root: "/" + operations: + clear-rebuild: + role: admin + commands: + start: drush cache:rebuild ``` The name of the runtime operation in this case is `clear-rebuild`. @@ -131,10 +131,10 @@ define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - gatsby-build: - role: viewer - commands: - start: gatsby build + gatsby-build: + role: viewer + commands: + start: gatsby build {{< /snippet >}} ``` @@ -156,13 +156,13 @@ define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - next-build: - role: admin - commands: - # All below are valid, depending on your setup - start: next build - # start: npx next build - # start: npm run build + next-build: + role: admin + commands: + # All below are valid, depending on your setup + start: next build + # start: npx next build + # start: npm run build {{< /snippet >}} ``` @@ -189,13 +189,13 @@ To ping your Node.js app, define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - pm2-ping: - role: admin - commands: - start: | - # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT - APP=$(cat package.json | jq -r '.name') - pm2 ping $APP + pm2-ping: + role: admin + commands: + start: | + # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT + APP=$(cat package.json | jq -r '.name') + pm2 ping $APP {{< /snippet >}} ``` @@ -216,13 +216,13 @@ To reload your Node.js app, define a runtime operation similar to the following: {{< snippet name="myapp" config="app" root="myapp" >}} operations: - pm2-reload: - role: admin - commands: - start: | - # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT - APP=$(cat package.json | jq -r '.name') - pm2 reload $APP + pm2-reload: + role: admin + commands: + start: | + # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT + APP=$(cat package.json | jq -r '.name') + pm2 reload $APP {{< /snippet >}} ``` To trigger your runtime operation, run a command similar to the following: @@ -242,13 +242,13 @@ To restart your Node.js app, define a runtime operation similar to the following {{< snippet name="myapp" config="app" root="myapp" >}} operations: - pm2-restart: - role: admin - commands: - start: | - # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT - APP=$(cat package.json | jq -r '.name') - pm2 restart $APP + pm2-restart: + role: admin + commands: + start: | + # Assuming pm2 start npm --no-daemon --watch --name $APP -- start -- -p $PORT + APP=$(cat package.json | jq -r '.name') + pm2 restart $APP {{< /snippet >}} ``` @@ -267,15 +267,15 @@ To do so, define a runtime operation similar to the following: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: python:{{% latest "python" %}} - operations: - manual-migration: - role: admin - commands: - start: python manage.py manual_migration + myapp: + source: + root: "/" + type: python:{{% latest "python" %}} + operations: + manual-migration: + role: admin + commands: + start: python manage.py manual_migration ``` To trigger your runtime operation, run a command similar to the following: diff --git a/sites/upsun/src/create-apps/source-operations.md b/sites/upsun/src/create-apps/source-operations.md index cff1adac52..3b1097626a 100644 --- a/sites/upsun/src/create-apps/source-operations.md +++ b/sites/upsun/src/create-apps/source-operations.md @@ -63,29 +63,29 @@ The syntax is similar to the following: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: nodejs:{{% latest "nodejs" %}} - operations: - {{< variable "SOURCE_OPERATION_NAME" >}}: - command: {{< variable "COMMAND" >}} + myapp: + type: nodejs:{{% latest "nodejs" %}} + source: + root: "/" + operations: + {{< variable "SOURCE_OPERATION_NAME" >}}: + command: {{< variable "COMMAND" >}} ``` For example, to update a file from a remote location, you could define an operation like this: ```yaml {configFile="app"} applications: - myapp: - type: nodejs:{{% latest "nodejs" %}} - source: - root: "/" - operations: - update-file: - command: | - set -e - curl -O https://example.com/myfile.txt - git add myfile.txt - git commit -m "Update remote file" + myapp: + type: nodejs:{{% latest "nodejs" %}} + source: + root: "/" + operations: + update-file: + command: | + set -e + curl -O https://example.com/myfile.txt + git add myfile.txt + git commit -m "Update remote file" ``` The name of the source operation in this case is `update-file`. @@ -138,17 +138,17 @@ to pass to a source operation similar to the following: ```yaml {configFile="app"} applications: - myapp: - type: nodejs:{{% latest "nodejs" %}} - source: - root: "/" - operations: - update-file: - command: | - set -e - curl -O https://example.com/$FILE - git add $FILE - git commit -m "Update remote file" + myapp: + type: nodejs:{{% latest "nodejs" %}} + source: + root: "/" + operations: + update-file: + command: | + set -e + curl -O https://example.com/$FILE + git add $FILE + git commit -m "Update remote file" ``` Follow these steps to run the source operation: @@ -252,15 +252,15 @@ Make sure you carefully check your [user access on this project](../administrati ```yaml {configFile="app"} applications: - myapp: - hooks: - build: | - set -e - echo "Installing {{% vendor/name %}} CLI" - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash - - echo "Testing {{% vendor/name %}} CLI" - {{% vendor/cli %}} + myapp: + hooks: + build: | + set -e + echo "Installing {{% vendor/name %}} CLI" + curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash + + echo "Testing {{% vendor/name %}} CLI" + {{% vendor/cli %}} ``` 3. Then, to configure a cron job to automatically run a source operation once a day, @@ -268,26 +268,26 @@ applications: ```yaml {configFile="app"} applications: - myapp: - type: nodejs:{{% latest "nodejs" %}} - source: - root: "/" - operations: - update-file: - command: | - set -e - curl -O https://example.com/$FILE - git add $FILE - git commit -m "Update remote file" - crons: - update: - # Run the code below every day at midnight. - spec: '0 0 * * *' - commands: - start: | - set -e - {{% vendor/cli %}} sync -e development code data --no-wait --yes - {{% vendor/cli %}} source-operation:run update-file --no-wait --yes + myapp: + type: nodejs:{{% latest "nodejs" %}} + source: + root: "/" + operations: + update-file: + command: | + set -e + curl -O https://example.com/$FILE + git add $FILE + git commit -m "Update remote file" + crons: + update: + # Run the code below every day at midnight. + spec: '0 0 * * *' + commands: + start: | + set -e + {{% vendor/cli %}} sync -e development code data --no-wait --yes + {{% vendor/cli %}} source-operation:run update-file --no-wait --yes ``` The example above synchronizes the `development` environment with its parent and then runs the `update-file` source operation defined [previously](#define-a-source-operation). @@ -316,17 +316,17 @@ The following source operation syncronizes your branch with an upstream Git repo ```yaml {configFile="app"} applications: - myapp: - type: nodejs:{{% latest "nodejs" %}} - source: - root: "/" - operations: - upstream-update: - command: | - set -e - git remote add upstream $UPSTREAM_REMOTE - git fetch --all - git merge upstream/main + myapp: + type: nodejs:{{% latest "nodejs" %}} + source: + root: "/" + operations: + upstream-update: + command: | + set -e + git remote add upstream $UPSTREAM_REMOTE + git fetch --all + git merge upstream/main ``` 3. Now every time you run the `upstream-update` operation on a given branch, the branch fetches all changes from the upstream git repository @@ -344,14 +344,14 @@ and you need to quickly revert to the previous state. ```yaml {configFile="app"} applications: - myapp: - type: nodejs:{{% latest "nodejs" %}} - source: - root: "/" - operations: - revert: - command: | - git reset --hard HEAD~ + myapp: + type: nodejs:{{% latest "nodejs" %}} + source: + root: "/" + operations: + revert: + command: | + git reset --hard HEAD~ ``` Now every time you run the `revert` operation on a given branch, @@ -363,17 +363,17 @@ The following source operation uses Composer to update Drupal Core: ```yaml {configFile="app"} applications: - myapp: - type: php:{{% latest "php" %}} - source: - root: "/" - operations: - update-drupal-core: - command: | - set -e - composer update drupal/core --with-dependencies - git add composer.lock - git commit -m "Automated Drupal Core update." + myapp: + type: php:{{% latest "php" %}} + source: + root: "/" + operations: + update-drupal-core: + command: | + set -e + composer update drupal/core --with-dependencies + git add composer.lock + git commit -m "Automated Drupal Core update." ``` `--with-dependencies` is used to also update Drupal Core dependencies. Read more on how to [update Drupal Core via Composer on Drupal.org](https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-composer). @@ -388,17 +388,17 @@ or [overriding it](#use-variables-in-your-source-operations) when running the so ```yaml {configFile="app"} applications: - myapp: - type: php:{{% latest "php" %}} - source: - root: "/" - operations: - download-drupal-extension: - command: | - set -e - composer require $EXTENSION - git add composer.json - git commit -am "Automated install of: $EXTENSION via Composer." + myapp: + type: php:{{% latest "php" %}} + source: + root: "/" + operations: + download-drupal-extension: + command: | + set -e + composer require $EXTENSION + git add composer.json + git commit -am "Automated install of: $EXTENSION via Composer." ``` Now every time you run the `download-drupal-extension` operation, it downloads the defined extension. @@ -412,19 +412,19 @@ The following source operation updates all Git submodules recursively: ```yaml {configFile="app"} applications: - myapp: - type: php:{{% latest "php" %}} - source: - root: "/" - operations: - rebuild: - command: | - set -e - git submodule update --init --recursive - git submodule update --remote --checkout - SHA=$(git submodule | awk -F' ' '{print $1}' | sed -s 's/+//g') - echo -n "$SHA" > .sha - git add uppler .sha - git commit -m "Updating submodule to commit '$SHA'" + myapp: + type: php:{{% latest "php" %}} + source: + root: "/" + operations: + rebuild: + command: | + set -e + git submodule update --init --recursive + git submodule update --remote --checkout + SHA=$(git submodule | awk -F' ' '{print $1}' | sed -s 's/+//g') + echo -n "$SHA" > .sha + git add uppler .sha + git commit -m "Updating submodule to commit '$SHA'" ``` Now every time you run the `rebuild` operation, it updates the Git submodules. diff --git a/sites/upsun/src/create-apps/timezone.md b/sites/upsun/src/create-apps/timezone.md index 4bb5d23898..71bf868cff 100644 --- a/sites/upsun/src/create-apps/timezone.md +++ b/sites/upsun/src/create-apps/timezone.md @@ -41,8 +41,8 @@ Add the following to your app configuration: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} variables: - php: - "date.timezone": "Europe/Paris" + php: + "date.timezone": "Europe/Paris" {{< /snippet >}} ``` diff --git a/sites/upsun/src/create-apps/troubleshoot-mounts.md b/sites/upsun/src/create-apps/troubleshoot-mounts.md index 6f6a5b1820..99938b1764 100644 --- a/sites/upsun/src/create-apps/troubleshoot-mounts.md +++ b/sites/upsun/src/create-apps/troubleshoot-mounts.md @@ -47,14 +47,14 @@ This example defines two mounts, one named `private` and one `upload`: ```yaml {configFile="app"} applications: - myapp: - mounts: - 'private': - source: storage - source_path: private - 'uploads': - source: storage - source_path: uploads + myapp: + mounts: + 'private': + source: storage + source_path: private + 'uploads': + source: storage + source_path: uploads ``` With only this definition, their behavior is the same. @@ -62,19 +62,19 @@ To make `uploads` accessible, define a location with different rules as in the f ```yaml {configFile="app"} applications: - myapp: - web: - locations: - '/': - # Handle dynamic requests - root: 'public' - passthru: '/app.php' - # Allow uploaded files to be served, but don't run scripts. - '/uploads': - root: 'uploads' - expires: 300s - scripts: false - allow: true + myapp: + web: + locations: + '/': + # Handle dynamic requests + root: 'public' + passthru: '/app.php' + # Allow uploaded files to be served, but don't run scripts. + '/uploads': + root: 'uploads' + expires: 300s + scripts: false + allow: true ``` ## Mounts starting with a dot ignored @@ -84,12 +84,12 @@ To mount a directory starting with a dot, put a `/` at the start of its definiti ```yaml {configFile="app"} applications: - myapp: - web: - mounts: - '/.myhiddenfolder': - source: storage - source_path: 'myhiddenfolder' + myapp: + web: + mounts: + '/.myhiddenfolder': + source: storage + source_path: 'myhiddenfolder' ``` ## Disk space issues diff --git a/sites/upsun/src/create-apps/web/custom-headers.md b/sites/upsun/src/create-apps/web/custom-headers.md index dcfc1f582c..970ebcb2f7 100644 --- a/sites/upsun/src/create-apps/web/custom-headers.md +++ b/sites/upsun/src/create-apps/web/custom-headers.md @@ -18,18 +18,18 @@ Start by defining a header for files in general: ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - locations: - "/": - ... - # Apply rules to all static files (dynamic files get rules from your app) - headers: - X-Frame-Options: SAMEORIGIN + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + locations: + "/": + ... + # Apply rules to all static files (dynamic files get rules from your app) + headers: + X-Frame-Options: SAMEORIGIN ``` This sets the `X-Frame-Options` header to `SAMEORIGIN` for all static files. @@ -39,19 +39,19 @@ Now set up an exception for MP3 files using a [rule](/create-apps/app-reference/ ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - locations: - "/": - ... - rules: - \.mp3$: - headers: - Content-Type: audio/mpeg + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + locations: + "/": + ... + rules: + \.mp3$: + headers: + Content-Type: audio/mpeg ``` This rule sets an explicit content type for files that end in `.mp3`. @@ -62,20 +62,20 @@ Now set a rule for MP4 files. ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - locations: - "/": - ... - rules: - \.mp4$: - headers: - X-Frame-Options: SAMEORIGIN - Content-Type: video/mp4 + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + locations: + "/": + ... + rules: + \.mp4$: + headers: + X-Frame-Options: SAMEORIGIN + Content-Type: video/mp4 ``` This rule sets an explicit content type for files that end in `.mp4`. @@ -95,18 +95,18 @@ You can do so for specific origins or for all origins with a wildcard. ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - locations: - "/": - ... - # Apply rules to all static files (dynamic files get rules from your app) - headers: - Access-Control-Allow-Origin: "*" + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + locations: + "/": + ... + # Apply rules to all static files (dynamic files get rules from your app) + headers: + Access-Control-Allow-Origin: "*" ``` If you use the wildcard value, the headers are modified for each request in the following ways: diff --git a/sites/upsun/src/create-apps/web/php-basic.md b/sites/upsun/src/create-apps/web/php-basic.md index f256bf0b94..be364c0afa 100644 --- a/sites/upsun/src/create-apps/web/php-basic.md +++ b/sites/upsun/src/create-apps/web/php-basic.md @@ -13,13 +13,13 @@ Start by defining your document root (where all your publicly visible pages are) ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - root: 'public' + myapp: + source: + root: "/" + web: + locations: + '/': + root: 'public' ``` ## Define a front controller @@ -28,16 +28,16 @@ Define where all requests that don't match a file in the document root are sent. ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - root: 'public' - passthru: '/index.php' - index: - - index.php + myapp: + source: + root: "/" + web: + locations: + '/': + root: 'public' + passthru: '/index.php' + index: + - index.php ``` In this case, `/index.php` acts as a front controller and handles dynamic requests. @@ -47,17 +47,17 @@ and responses aren't cached. ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - ... - scripts: true - # No caching for static files. - # (Dynamic pages use whatever cache headers are generated by the program.) - expires: -1 + myapp: + source: + root: "/" + web: + locations: + '/': + ... + scripts: true + # No caching for static files. + # (Dynamic pages use whatever cache headers are generated by the program.) + expires: -1 ``` ## Define rules @@ -67,19 +67,19 @@ For example, you might want to allow all kinds of files except mp4 files. ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - ... - # Allow all file types generally - allow: true - rules: - # Disallow .mp4 files specifically. - \.mp4$: - allow: false + myapp: + source: + root: "/" + web: + locations: + '/': + ... + # Allow all file types generally + allow: true + rules: + # Disallow .mp4 files specifically. + \.mp4$: + allow: false ``` ## Set different rules for specific locations @@ -90,65 +90,65 @@ You could define a specific cache time for them and limit them to only static im ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - ... - # Set a 5 min expiration time for static files in this location. - # Missing files are sent to front controller - # through the '/' location above. - '/images': - expires: 300 - passthru: true - # Do not execute PHP scripts from this location and do not - # deliver their source code (for enhanced security). - scripts: false - allow: false - rules: - # Only allow static image files in this location - '\.(jpe?g|png|gif|svgz?|ico|bmp)$': - allow: true + myapp: + source: + root: "/" + web: + locations: + '/': + ... + # Set a 5 min expiration time for static files in this location. + # Missing files are sent to front controller + # through the '/' location above. + '/images': + expires: 300 + passthru: true + # Do not execute PHP scripts from this location and do not + # deliver their source code (for enhanced security). + scripts: false + allow: false + rules: + # Only allow static image files in this location + '\.(jpe?g|png|gif|svgz?|ico|bmp)$': + allow: true ``` ## Complete example ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - root: 'public' - passthru: '/index.php' - index: - - index.php - scripts: true - # No caching for static files. - # (Dynamic pages use whatever cache headers are generated by the program.) - expires: -1 - # Allow all file types generally - allow: true - rules: - # Disallow .mp4 files specifically. - \.mp4$: - allow: false - # Set a 5 min expiration time for static files in this location. - # Missing files are sent to front controller - # through the '/' location above. - '/images': - expires: 300 - passthru: true - # Do not execute PHP scripts from this location and do not - # deliver their source code (for enhanced security). - scripts: false - allow: false - rules: - # Only allow static image files in this location - '\.(jpe?g|png|gif|svgz?|ico|bmp)$': - allow: true + myapp: + source: + root: "/" + web: + locations: + '/': + root: 'public' + passthru: '/index.php' + index: + - index.php + scripts: true + # No caching for static files. + # (Dynamic pages use whatever cache headers are generated by the program.) + expires: -1 + # Allow all file types generally + allow: true + rules: + # Disallow .mp4 files specifically. + \.mp4$: + allow: false + # Set a 5 min expiration time for static files in this location. + # Missing files are sent to front controller + # through the '/' location above. + '/images': + expires: 300 + passthru: true + # Do not execute PHP scripts from this location and do not + # deliver their source code (for enhanced security). + scripts: false + allow: false + rules: + # Only allow static image files in this location + '\.(jpe?g|png|gif|svgz?|ico|bmp)$': + allow: true ``` diff --git a/sites/upsun/src/create-apps/web/rewrite-requests.md b/sites/upsun/src/create-apps/web/rewrite-requests.md index 98c43cff30..0e066b3c33 100644 --- a/sites/upsun/src/create-apps/web/rewrite-requests.md +++ b/sites/upsun/src/create-apps/web/rewrite-requests.md @@ -14,16 +14,16 @@ If so, add a [rule](/create-apps/app-reference/single-runtime-image.md#rules) si ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - ... - rules: - '^/(?[^/]+)/(?[^/]+)/$': - passthru: '/?category=$category&product=$product' + myapp: + source: + root: "/" + web: + locations: + '/': + ... + rules: + '^/(?[^/]+)/(?[^/]+)/$': + passthru: '/?category=$category&product=$product' ``` Or you might organize your images by file type, but don't want to expose the organization externally. @@ -31,16 +31,16 @@ You could rewrite requests to do that behind the scenes: ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - web: - locations: - '/': - ... - rules: - '^/img/(?.*)\.(?.*)$': - passthru: '/$type/$name.$type' + myapp: + source: + root: "/" + web: + locations: + '/': + ... + rules: + '^/img/(?.*)\.(?.*)$': + passthru: '/$type/$name.$type' ``` Now a request to `/img/image.png` returns the file found at `/png/image.png`. diff --git a/sites/upsun/src/create-apps/web/serve-different-directories.md b/sites/upsun/src/create-apps/web/serve-different-directories.md index e1e043fb0c..525e2e6bd7 100644 --- a/sites/upsun/src/create-apps/web/serve-different-directories.md +++ b/sites/upsun/src/create-apps/web/serve-different-directories.md @@ -27,20 +27,20 @@ Use a [`web` configuration](/create-apps/app-reference/single-runtime-image.md#w ```yaml {configfile="apps"} applications: - docs: - source: - root: "/" - web: - locations: - '/': - passthru: true - '/docs': - root: 'docs-public' - index: - - "index.html" - expires: 24h - scripts: false - allow: true + docs: + source: + root: "/" + web: + locations: + '/': + passthru: true + '/docs': + root: 'docs-public' + index: + - "index.html" + expires: 24h + scripts: false + allow: true ``` This way, your app can safely coexist with static files as if it were a single site hierarchy. diff --git a/sites/upsun/src/create-apps/web/static.md b/sites/upsun/src/create-apps/web/static.md index 8df10f5d1a..5dd2891f7b 100644 --- a/sites/upsun/src/create-apps/web/static.md +++ b/sites/upsun/src/create-apps/web/static.md @@ -18,22 +18,22 @@ you need to set up a minimal app configuration similar to the following: ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - # The web key configures the web server running in front of your app. - web: - locations: - /: - # Static site generators usually output built static files to a specific directory. - # Define this directory (must be an actual directory inside the root directory of your app) - # as the root for your static site. - root: "public" - # Files to consider when serving a request for a directory. - index: - - index.html + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + # The web key configures the web server running in front of your app. + web: + locations: + /: + # Static site generators usually output built static files to a specific directory. + # Define this directory (must be an actual directory inside the root directory of your app) + # as the root for your static site. + root: "public" + # Files to consider when serving a request for a directory. + index: + - index.html ``` See more information on the required minimal settings: @@ -53,17 +53,17 @@ use the following configuration: ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - locations: - '/': - ... - scripts: false - allow: true + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + locations: + '/': + ... + scripts: false + allow: true ``` See more information on [`locations` properties](/create-apps/app-reference/single-runtime-image.md#locations). @@ -78,32 +78,35 @@ To do so, use a configuration similar to the following: ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - locations: - '/': - ... - expires: 24h - rules: - \.(css|js|gif|jpe?g|png|svg)$: - expires: 4w + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + locations: + '/': + ... + expires: 24h + rules: + \.(css|js|gif|jpe?g|png|svg)$: + expires: 4w ``` You can also set a `Cache-Control` header in your rules. ```yaml {configFile="app"} -web: - locations: +applications: + myapp: + web: + locations: '/': - ... - expires: 24h - rules: - \.(css|js|gif|jpe?g|png|svg)$: - headers: - Cache-Control: "public, max-age=2419200, immutable" + ... + expires: 24h + rules: + \.(css|js|gif|jpe?g|png|svg)$: + headers: + Cache-Control: "public, max-age=2419200, immutable" +``` If `expires` and a `Cache-Control` header are set, the rule ignores the `expires` and sets only the `Cache-Control` header. For this reason, make sure to add a `max-age` value, in seconds, for the `Cache-Control` header. @@ -116,14 +119,14 @@ use the following configuration: ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "nodejs:{{% latest "nodejs" %}}" - source: - root: "/" - web: - commands: - start: sleep infinity + myapp: + # The type of the application to build. + type: "nodejs:{{% latest "nodejs" %}}" + source: + root: "/" + web: + commands: + start: sleep infinity ``` You can also use this place to start small programs, @@ -133,29 +136,29 @@ such as a [script to handle 404 errors](https://community.platform.sh/t/custom-4 ```yaml {configFile="app"} applications: - app: - # The type of the application to build. - type: "python:{{% latest "python" %}}" - source: - root: "/" - web: - locations: - '/': - # The public directory of the application relative to its root - root: 'public' - # The files to look for when serving a directory - index: - - 'index.html' - # Disable server-side scripts - scripts: false - allow: true - # Set caching policy - expires: 24h - rules: - \.(css|js|gif|jpe?g|png|svg)$: - expires: 4w - - commands: - # Run a no-op process that uses no CPU resources since this is a static site - start: sleep infinity + myapp: + # The type of the application to build. + type: "python:{{% latest "python" %}}" + source: + root: "/" + web: + locations: + '/': + # The public directory of the application relative to its root + root: 'public' + # The files to look for when serving a directory + index: + - 'index.html' + # Disable server-side scripts + scripts: false + allow: true + # Set caching policy + expires: 24h + rules: + \.(css|js|gif|jpe?g|png|svg)$: + expires: 4w + + commands: + # Run a no-op process that uses no CPU resources since this is a static site + start: sleep infinity ``` diff --git a/sites/upsun/src/create-apps/workers.md b/sites/upsun/src/create-apps/workers.md index d76542deb0..cc19048330 100644 --- a/sites/upsun/src/create-apps/workers.md +++ b/sites/upsun/src/create-apps/workers.md @@ -85,54 +85,54 @@ That means, for example, that the following two `{{< vendor/configfile "app" >}} ```yaml {configFile="app"} applications: - app: #The name of the app, which must be unique within the project. - type: python:{{% latest "python" %}} - mounts: - test: - source: storage - source_path: test - relationships: - mysql: - workers: - queue: - commands: - start: | - python queue-worker.py - mail: - commands: - start: | - python mail-worker.py + myapp: #The name of the app, which must be unique within the project. + type: python:{{% latest "python" %}} + mounts: + test: + source: storage + source_path: test + relationships: + mysql: + workers: + queue: + commands: + start: | + python queue-worker.py + mail: + commands: + start: | + python mail-worker.py services: - mysql: - type: mariadb:{{% latest "mariadb" %}} + mysql: + type: mariadb:{{% latest "mariadb" %}} ``` ```yaml {configFile="app"} applications: - app: #The name of the app, which must be unique within the project. - type: python:{{% latest "python" %}} - workers: - queue: - commands: - start: | - python queue-worker.py - mounts: - test: - source: storage - source_path: test - mysql: - mail: - commands: - start: | - python mail-worker.py - mounts: - test: - source: storage - source_path: test - mysql: + myapp: #The name of the app, which must be unique within the project. + type: python:{{% latest "python" %}} + workers: + queue: + commands: + start: | + python queue-worker.py + mounts: + test: + source: storage + source_path: test + mysql: + mail: + commands: + start: | + python mail-worker.py + mounts: + test: + source: storage + source_path: test + mysql: services: - mysql: - type: mariadb:{{% latest "mariadb" %}} + mysql: + type: mariadb:{{% latest "mariadb" %}} ``` In both cases, there are two worker instances named `queue` and `mail`. @@ -151,64 +151,64 @@ For example, consider the following configuration: ```yaml {configFile="app"} applications: - app: #The name of the app, which must be unique within the project. - type: "python:{{% latest "python" %}}" - hooks: - build: | - pip install -r requirements.txt - pip install -e . - pip install gunicorn - relationships: - mysql: - rabbitmq: + myapp: #The name of the app, which must be unique within the project. + type: "python:{{% latest "python" %}}" + hooks: + build: | + pip install -r requirements.txt + pip install -e . + pip install gunicorn + relationships: + mysql: + rabbitmq: + variables: + env: + type: 'none' + web: + commands: + start: "gunicorn -b $PORT project.wsgi:application" + variables: + env: + type: 'web' + mounts: + uploads: + source: storage + source_path: uploads + locations: + "/": + root: "" + passthru: true + allow: false + "/static": + root: "static/" + allow: true + workers: + queue: + commands: + start: | + python queue-worker.py variables: - env: - type: 'none' - web: - commands: - start: "gunicorn -b $PORT project.wsgi:application" - variables: - env: - type: 'web' - mounts: - uploads: - source: storage - source_path: uploads - locations: - "/": - root: "" - passthru: true - allow: false - "/static": - root: "static/" - allow: true - workers: - queue: - commands: - start: | - python queue-worker.py - variables: - env: - type: 'worker' - mounts: - scratch: - source: storage - source_path: scratch - mail: - commands: - start: | - python mail-worker.py - variables: - env: - type: 'worker' - mounts: {} - relationships: - rabbitmq: + env: + type: 'worker' + mounts: + scratch: + source: storage + source_path: scratch + mail: + commands: + start: | + python mail-worker.py + variables: + env: + type: 'worker' + mounts: {} + relationships: + rabbitmq: services: - mysql: - type: 'mariadb:{{% latest "mariadb" %}}' - rabbitmq: - type: 'rabbitmq:{{% latest "rabbitmq" %}}' + mysql: + type: 'mariadb:{{% latest "mariadb" %}}' + rabbitmq: + type: 'rabbitmq:{{% latest "rabbitmq" %}}' ``` There's a lot going on here, but it's all reasonably straightforward. @@ -270,34 +270,34 @@ and a `tmp` mount (called `local_dir`) to be used by a `queue` worker instance: ```yaml {configFile="app"} applications: - app: #The name of the app, which must be unique within the project. - type: "nodejs:{{% latest "nodejs" %}}" - - # Define a web instance - web: - locations: - "/": - root: "public" - passthru: true - index: ['index.html'] - - mounts: - # Define a storage mount that's available to both instances together - 'shared_dir': - source: storage - service: files - source_path: our_stuff - - # Define a local mount that's available to each instance separately - 'local_dir': - source: tmp - source_path: my_stuff - - # Define a worker instance from the same code but with a different start - workers: - queue: - commands: - start: ./start.sh + myapp: #The name of the app, which must be unique within the project. + type: "nodejs:{{% latest "nodejs" %}}" + + # Define a web instance + web: + locations: + "/": + root: "public" + passthru: true + index: ['index.html'] + + mounts: + # Define a storage mount that's available to both instances together + 'shared_dir': + source: storage + service: files + source_path: our_stuff + + # Define a local mount that's available to each instance separately + 'local_dir': + source: tmp + source_path: my_stuff + + # Define a worker instance from the same code but with a different start + workers: + queue: + commands: + start: ./start.sh ``` Both the `web` instance and `queue` worker have their own, dedicated `local_dir` mount. diff --git a/sites/upsun/src/define-routes/_index.md b/sites/upsun/src/define-routes/_index.md index 5911487528..f20f39f278 100644 --- a/sites/upsun/src/define-routes/_index.md +++ b/sites/upsun/src/define-routes/_index.md @@ -24,14 +24,14 @@ These examples show how to define routes. ### Default route definition If you don't include a file defining routes, a single default route is deployed. -If you have one app to direct traffic to and its name is `app`, +If you have one app to direct traffic to and its name is `myapp`, this is equivalent to the following: ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: app:http + "https://{default}/": + type: upstream + upstream: myapp:http ``` All traffic to your domain (say, `https://example.com`) is sent to your app. @@ -41,20 +41,20 @@ It affects your [default domain](#default). ### Basic redirect definition In a basic situation, you have one app to direct traffic to. -Say its name is `app`. +Say its name is `myapp`. And say you want to redirect requests from `https://www.example.com` to `https://example.com`. Define your routes like this: ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "app:http" + "https://{default}/": + type: upstream + upstream: "myapp:http" - "https://www.{default}/": - type: redirect - to: "https://{default}/" + "https://www.{default}/": + type: redirect + to: "https://{default}/" ``` This affects your [default domain](#default). @@ -71,17 +71,17 @@ The specifics of configuring the Router container for multiple applications is e ## Trailing slashes All defined routes have at least a slash in the path. -So you might define routes for 2 apps named `app` and `api` as follows: +So you might define routes for 2 apps named `myapp` and `api` as follows: ```yaml {configFile="routes"} routes: - "https://{default}": - type: upstream - upstream: "app:http" + "https://{default}": + type: upstream + upstream: "myapp:http" - "https://subdomain.example.com": - type: upstream - upstream: "api:http" + "https://subdomain.example.com": + type: upstream + upstream: "api:http" ``` Both of these routes would be resolved with trailing slashes. @@ -95,7 +95,7 @@ you see the following resolved routes (assuming `example.com` is your default do "id": null, "attributes": {}, "type": "upstream", - "upstream": "app", + "upstream": "myapp", "original_url": "https://{default}" }, "https://subdomain.example.com/": { @@ -132,18 +132,18 @@ You can use the `{default}` placeholder: ```yaml {configFile="routes"} routes: - "https://{default}/blog": - type: upstream - upstream: "app:http" + "https://{default}/blog": + type: upstream + upstream: "myapp:http" ``` And you can use an absolute URL: ```yaml {configFile="routes"} routes: - "https://example.com/blog": - type: upstream - upstream: "app:http" + "https://example.com/blog": + type: upstream + upstream: "myapp:http" ``` In both cases, the URLs for your Production environment are the same. @@ -173,13 +173,13 @@ You can then define the following routes: ```yaml {configFile="routes"} routes: - "https://{all}/": - type: upstream - upstream: "app:http" + "https://{all}/": + type: upstream + upstream: "myapp:http" - "https://www.{all}/": - type: redirect - to: "https://{all}/" + "https://www.{all}/": + type: redirect + to: "https://{all}/" ``` The first route means you're serving the same content at multiple domains: @@ -197,13 +197,13 @@ Say you have two apps named `app1` and `app2` and define two routes like this: ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "app1:http" + "https://{default}/": + type: upstream + upstream: "app1:http" - "https://{all}/": - type: upstream - upstream: "app2:http" + "https://{all}/": + type: upstream + upstream: "app2:http" ``` Requests to your default domain are served by `app1`. @@ -245,14 +245,14 @@ You can define your routes like this: ```yaml {configFile="routes"} routes: - "https://site1.{default}/": - type: upstream - upstream: 'app1:http' - - "https://site2.{default}/": - type: upstream - id: 'the-second' - upstream: 'app2:http' + "https://site1.{default}/": + type: upstream + upstream: 'app1:http' + + "https://site2.{default}/": + type: upstream + id: 'the-second' + upstream: 'app2:http' ``` To see the generated routes on your `feature` environment, run: @@ -265,38 +265,38 @@ The result is something like this: ```json { - "https://site1.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { - "primary": true, - "id": null, - "attributes": {}, - "type": "upstream", - "upstream": "app1", - "original_url": "https://site1.{default}/" - }, - "https://site2.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { - "primary": null, - "id": "the-second", - "attributes": {}, - "type": "upstream", - "upstream": "app2", - "original_url": "https://site2.{default}/" - }, - "http://site1.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { - "to": "https://site1.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/", - "original_url": "http://site1.{default}/", - "type": "redirect", - "primary": null, - "id": null, - "attributes": {} - }, - "http://site2.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { - "to": "https://site2.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/", - "original_url": "http://site2.{default}/", - "type": "redirect", - "primary": null, - "id": null, - "attributes": {}, - } + "https://site1.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { + "primary": true, + "id": null, + "attributes": {}, + "type": "upstream", + "upstream": "app1", + "original_url": "https://site1.{default}/" + }, + "https://site2.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { + "primary": null, + "id": "the-second", + "attributes": {}, + "type": "upstream", + "upstream": "app2", + "original_url": "https://site2.{default}/" + }, + "http://site1.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { + "to": "https://site1.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/", + "original_url": "http://site1.{default}/", + "type": "redirect", + "primary": null, + "id": null, + "attributes": {} + }, + "http://site2.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { + "to": "https://site2.feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/", + "original_url": "http://site2.{default}/", + "type": "redirect", + "primary": null, + "id": null, + "attributes": {}, + } } ``` @@ -313,25 +313,25 @@ So you can define a route like this: ```yaml {configFile="routes"} routes: - "http://{default}/": - type: upstream - upstream: "app:http" - attributes: - "foo": "bar" + "http://{default}/": + type: upstream + upstream: "myapp:http" + attributes: + "foo": "bar" ``` The attributes appear in the routes data like so: ```json "https://feature-t6dnbai-abcdef1234567.us-2.{{< vendor/urlraw "hostname" >}}/": { - "primary": true, - "id": null, - "attributes": { - "foo": "bar" - }, - "type": "upstream", - "upstream": "app", - "original_url": "https://{default}/" + "primary": true, + "id": null, + "attributes": { + "foo": "bar" + }, + "type": "upstream", + "upstream": "myapp", + "original_url": "https://{default}/" } ``` @@ -390,10 +390,10 @@ Routes on the project Example (abcdef123456), environment main (type: production +---------------------------+----------+---------------------------+ | Route | Type | To | +---------------------------+----------+---------------------------+ -| https://app.{default}/ | upstream | app:http | -| https://app.{default}/api | upstream | api:http | -| http://app.{default}/ | redirect | https://app.{default}/ | -| http://app.{default}/api | redirect | https://app.{default}/api | +| https://www.{default}/ | upstream | myapp:http | +| https://www.{default}/api | upstream | api:http | +| http://www.{default}/ | redirect | https://www.{default}/ | +| http://www.{default}/api | redirect | https://www.{default}/api | +-----------------------+----------+-------------------------------+ To view a single route, run: {{% vendor/cli %}} route:get @@ -410,34 +410,36 @@ which is a requirement for the router caching. ```yaml {configFile="routes"} routes: - "https://{default}/ws": - type: upstream - upstream: "app:http" - cache: - enabled: false - - # Below HTTP config may not be necessary for every Websocket client. - "https://{default}/ws": - type: upstream - upstream: "app:http" - cache: - enabled: false + "https://{default}/ws": + type: upstream + upstream: "myapp:http" + cache: + enabled: false + + # Below HTTP config may not be necessary for every Websocket client. + "https://{default}/ws": + type: upstream + upstream: "myapp:http" + cache: + enabled: false ``` 2. [Disable request buffering](/create-apps/app-reference/single-runtime-image.md#locations) in your app configuration. ```yaml {configFile="app"} -web: - commands: +applications: + myapp: + web: + commands: start: /app/.linuxbrew/bin/websocketd --port=$PORT ./wsmanager.sh - upstream: + upstream: socket_family: tcp protocol: http - locations: + locations: '/': - passthru: true - request_buffering: - enabled: false + passthru: true + request_buffering: + enabled: false ``` ## `.htaccess` files diff --git a/sites/upsun/src/define-routes/cache.md b/sites/upsun/src/define-routes/cache.md index 45986186f4..2f2710287f 100644 --- a/sites/upsun/src/define-routes/cache.md +++ b/sites/upsun/src/define-routes/cache.md @@ -32,14 +32,14 @@ To configure the HTTP cache, add a `cache` key to your route. You may like to st ```yaml {configFile="routes"} routes: - https://{default}/: - type: upstream - upstream: app:http - cache: - enabled: true - default_ttl: 0 - cookies: ['*'] - headers: ['Accept', 'Accept-Language'] + https://{default}/: + type: upstream + upstream: myapp:http + cache: + enabled: true + default_ttl: 0 + cookies: ['*'] + headers: ['Accept', 'Accept-Language'] ``` ## Example @@ -50,14 +50,14 @@ The presence of any cookie in the request disables caching of that response. ```yaml {configFile="routes"} routes: - https://{default}/: - type: upstream - upstream: app:http - cache: - enabled: true - headers: ['Accept', 'Accept-Language', 'X-Language-Locale'] - cookies: ['*'] - default_ttl: 60 + https://{default}/: + type: upstream + upstream: myapp:http + cache: + enabled: true + headers: ['Accept', 'Accept-Language', 'X-Language-Locale'] + cookies: ['*'] + default_ttl: 60 ``` ## How it works @@ -72,12 +72,12 @@ The default value for these keys are the following: ```yaml {configFile="routes"} routes: - https://{default}/: - # ... - cache: - enabled: true - cookies: ['*'] - headers: ['Accept', 'Accept-Language'] + https://{default}/: + # ... + cache: + enabled: true + cookies: ['*'] + headers: ['Accept', 'Accept-Language'] ``` ### Duration @@ -122,11 +122,11 @@ For example, if the `headers` key is the following, {{% vendor/name %}} caches a ```yaml {configFile="routes"} routes: - https://{default}/: - # ... - cache: - enabled: true - headers: ["Accept"] + https://{default}/: + # ... + cache: + enabled: true + headers: ["Accept"] ``` {{< note title="none">}} @@ -168,11 +168,11 @@ Other cookies are ignored. ```yaml {configFile="routes"} routes: - https://{default}/: - # ... - cache: - enabled: true - cookies: ["foo"] + https://{default}/: + # ... + cache: + enabled: true + cookies: ["foo"] ``` #### Example with a regular expression @@ -183,11 +183,11 @@ For example: ```yaml {configFile="routes"} routes: - https://{default}/: - # ... - cache: - enabled: true - cookies: ['/^SS?ESS/'] + https://{default}/: + # ... + cache: + enabled: true + cookies: ['/^SS?ESS/'] ``` This configuration causes all cookies beginning with `SESS` or `SSESS` to be part of the cache key, as a single value. @@ -228,23 +228,23 @@ If you need fine-grained caching, you can set up caching rules for several route ```yaml {configFile="routes"} routes: - https://{default}/: - type: upstream - upstream: app:http - cache: - enabled: true - - https://{default}/foo/: - type: upstream - upstream: app:http - cache: - enabled: false - - https://{default}/foo/bar/: - type: upstream - upstream: app:http - cache: - enabled: true + https://{default}/: + type: upstream + upstream: myapp:http + cache: + enabled: true + + https://{default}/foo/: + type: upstream + upstream: myapp:http + cache: + enabled: false + +https://{default}/foo/bar/: + type: upstream + upstream: myapp:http + cache: + enabled: true ``` With this configuration, the following routes are cached: @@ -269,11 +269,11 @@ This is a case of allowing only a subset of cookies to invalidate the cache. ```yaml {configFile="routes"} routes: - https://{default}/: + https://{default}/: # ... - cache: - enabled: true - cookies: ["MYCOOKIE"] + cache: + enabled: true + cookies: ["MYCOOKIE"] ``` ### Cache HTTP and HTTPS separately using the `Vary` header diff --git a/sites/upsun/src/define-routes/https.md b/sites/upsun/src/define-routes/https.md index 278566cbf6..ddb6ac34ed 100644 --- a/sites/upsun/src/define-routes/https.md +++ b/sites/upsun/src/define-routes/https.md @@ -30,7 +30,7 @@ configure your own [third-party TLS certificates](../domains/steps/tls.md). ### Let's Encrypt limitations When you use the Let's Encrypt [TLS certificates](#tls-certificates) provided by {{% vendor/name %}}, -the following limitations apply. +the following limitations apply. {{% lets_encrypt_limitations %}} @@ -52,13 +52,13 @@ To enable HTTPS, add a routing configuration similar to the following: ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "app:http" + "https://{default}/": + type: upstream + upstream: "myapp:http" - "https://www.{default}/": - type: redirect - to: "https://{default}/" + "https://www.{default}/": + type: redirect + to: "https://{default}/" ``` All traffic to your domain is then sent to your app. @@ -80,10 +80,10 @@ enforce TLS 1.3 using the `min_version` setting: ```yaml {configFile="routes"} routes: - "https://{default}/": - # ... - tls: - min_version: TLSv1.3 + "https://{default}/": + # ... + tls: + min_version: TLSv1.3 ``` Note that TLS versions older than 1.2 are deprecated and are rejected by default. @@ -95,13 +95,13 @@ To enable HSTS, use `strict_transport_security` in a configuration similar to th ```yaml {configFile="routes"} routes: - "https://{default}/": - # ... - tls: - strict_transport_security: - enabled: true - include_subdomains: true - preload: true + "https://{default}/": + # ... + tls: + strict_transport_security: + enabled: true + include_subdomains: true + preload: true ``` The following table presents the possible properties for `strict_transport_security`: @@ -126,10 +126,10 @@ To do so, enable mTLS by adding the following configuration: ```yaml {configFile="routes"} routes: - "https://{default}/": - # ... - tls: - client_authentication: "require" + "https://{default}/": + # ... + tls: + client_authentication: "require" ``` By default, all valid TLS certificates issued by a legitimate certificate authority are accepted. @@ -139,17 +139,17 @@ To do so, add a configuration similar to the following: ```yaml {configFile="routes"} routes: - "https://{default}/": - # ... - tls: - client_authentication: "require" - client_certificate_authorities: - - !include - type: string - path: root-ca1.crt - - !include - type: string - path: root-ca2.crt + "https://{default}/": + # ... + tls: + client_authentication: "require" + client_certificate_authorities: + - !include + type: string + path: root-ca1.crt + - !include + type: string + path: root-ca2.crt ``` In this case, the certificate files are resolved relative to the `{{< vendor/configdir >}}` directory. @@ -157,17 +157,17 @@ Alternatively, you can specify the certificates inline in the file: ```yaml {configFile="routes"} routes: - "https://{default}/": - # ... - tls: - client_authentication: "require" - client_certificate_authorities: - - | - -----BEGIN CERTIFICATE----- - ### Several lines of characters here ### - -----END CERTIFICATE----- - - | - -----BEGIN CERTIFICATE----- - ### Several lines of different characters here ### - -----END CERTIFICATE----- + "https://{default}/": + # ... + tls: + client_authentication: "require" + client_certificate_authorities: + - | + -----BEGIN CERTIFICATE----- + ### Several lines of characters here ### + -----END CERTIFICATE----- + - | + -----BEGIN CERTIFICATE----- + ### Several lines of different characters here ### + -----END CERTIFICATE----- ``` diff --git a/sites/upsun/src/define-routes/proxy.md b/sites/upsun/src/define-routes/proxy.md index 5a95a9e0d4..554c6526a3 100644 --- a/sites/upsun/src/define-routes/proxy.md +++ b/sites/upsun/src/define-routes/proxy.md @@ -18,9 +18,9 @@ You can define an external proxy on your {{% vendor/name %}} project by defining ```yaml {configFile="routes"} routes: - https://{default}/foo: - type: proxy - to: https://www.example.com + https://{default}/foo: + type: proxy + to: https://www.example.com ``` This route passes requests for `https://{default}/foo/index.html` to `https://www.example.com/foo/index.html`. @@ -29,9 +29,9 @@ You can also define a proxy route to an URL composed of an IP address and a port ```yaml {configFile="routes"} routes: - https://{default}/foo: - type: proxy - to: https://192.0.2.0:8000 + https://{default}/foo: + type: proxy + to: https://192.0.2.0:8000 ``` ## URL paths @@ -43,9 +43,9 @@ add a trailing slash `/` to the `to` definition. ```yaml {configFile="routes"} routes: - https://{default}/foo: - type: proxy - to: https://www.example.com/ + https://{default}/foo: + type: proxy + to: https://www.example.com/ ``` The trailing slash makes the proxy route interpret the location as having a different path. @@ -56,9 +56,9 @@ For example: ```yaml {configFile="routes"} routes: - https://{default}/foo: - type: proxy - to: https://www.example.com/bar + https://{default}/foo: + type: proxy + to: https://www.example.com/bar ``` This route passes requests for `https://{default}/foo/index.html` to `https://www.example.com/bar/index.html`. @@ -78,17 +78,17 @@ Each app handles a different language. ```yaml {configFile="routes"} routes: - https://{default}/en: - type: proxy - to: https://en.example.com/ + https://{default}/en: + type: proxy + to: https://en.example.com/ - https://{default}/jp: - type: proxy - to: https://jp.example.com/ + https://{default}/jp: + type: proxy + to: https://jp.example.com/ - https://{default}/pt: - type: proxy - to: https://pt.example.com/ + https://{default}/pt: + type: proxy + to: https://pt.example.com/ ``` The apps behind the proxy need to ensure links to assets are shown to the target domain. diff --git a/sites/upsun/src/define-routes/redirects.md b/sites/upsun/src/define-routes/redirects.md index f45b531d4f..bf2015f798 100644 --- a/sites/upsun/src/define-routes/redirects.md +++ b/sites/upsun/src/define-routes/redirects.md @@ -12,29 +12,29 @@ You can manage redirection rules on your {{% vendor/name %}} projects in two dif Using whole-route redirects, you can define very basic routes in your [`{{< vendor/configfile "routes" >}}`](./_index.md) file whose sole purpose is to redirect. A typical use case for this type of route is adding or removing a `www.` prefix to your domain, as the following example shows: -```yaml +```yaml {configFile="app"} routes: - https://{default}/: - type: redirect - to: https://www.{default}/ + https://{default}/: + type: redirect + to: https://www.{default}/ ``` ## Partial redirects In the [`{{< vendor/configfile "routes" >}}`](./_index.md) file you can also add partial redirect rules to existing routes: -```yaml +```yaml {configFile="app"} routes: - https://{default}/: - # ... - redirects: - expires: 1d - paths: - '/from': - to: 'https://example.com/' - '^/foo/(.*)/bar': - to: 'https://example.com/$1' - regexp: true + https://{default}/: + # ... + redirects: + expires: 1d + paths: + '/from': + to: 'https://example.com/' + '^/foo/(.*)/bar': + to: 'https://example.com/$1' + regexp: true ``` This format is richer and works with any type of route, including routes served directly by the application. @@ -75,15 +75,15 @@ Consider this `regexp` redirect: ```yaml '^/from(/.*|)$': - regexp: true - to: https://example.com/to$1 + regexp: true + to: https://example.com/to$1 ``` It achieves the same result as this basic redirect: ```yaml '/from': - to: https://example.com/to + to: https://example.com/to ``` <---> @@ -95,16 +95,16 @@ title= `prefix` Consider this redirect using `prefix`: ```yaml '/from': - to: https//example.com/to - prefix: false + to: https//example.com/to + prefix: false ``` It achieves the same result as this `regexp` redirect: ```yaml '^/from$': - regexp: true - to: https://example.com/to + regexp: true + to: https://example.com/to ``` <---> @@ -117,16 +117,16 @@ Consider this redirect using `append_suffix`: ```yaml '/from': - to: https//example.com/to - append_suffix: false + to: https//example.com/to + append_suffix: false ``` It achieves the same result as this `regexp` redirect: ```yaml '^/from(/.*|)$': - regexp: true - to: https://example.com/to + regexp: true + to: https://example.com/to ``` {{< /codetabs >}} @@ -144,16 +144,16 @@ You can use regular expressions to configure your redirects. In the following example, a request to `https://example.com/foo/a/b/c/bar` redirects to `https://example.com/a/b/c`: -```yaml +```yaml {configFile="app"} routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '^/foo/(.*)/bar': - to: 'https://example.com/$1' - regexp: true + https://{default}/: + type: upstream + # ... + redirects: + paths: + '^/foo/(.*)/bar': + to: 'https://example.com/$1' + regexp: true ``` The following special arguments in the `to` statement are available when `regexp` is set to `true`: @@ -180,52 +180,52 @@ For example: {{< version/specific >}} -```yaml +```yaml {configFile="app"} routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - prefix: true + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + prefix: true ``` ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - append_suffix: true + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + append_suffix: true ``` <---> ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - prefix: true + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + prefix: true ``` ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - append_suffix: true + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + append_suffix: true ``` {{< /version/specific >}} @@ -239,14 +239,14 @@ For example, with the following configuration: ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - prefix: true + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + prefix: true ``` A request to `/from/` redirects to `/to/some/path`, but a request to `/from/some/path` does not. @@ -255,14 +255,14 @@ And with the following configuration: ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://{default}/to' - append_suffix: false + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://{default}/to' + append_suffix: false ``` A request to `/from/some/path` (and any path after `/from`) redirects to just `/to`. @@ -273,16 +273,16 @@ To set a specific HTTP status code for your redirect, use the `codes` key: ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://example.com/' - code: 308 - '/here': - to: 'https://example.com/there' + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://example.com/' + code: 308 + '/here': + to: 'https://example.com/there' ``` In this example, redirects from `/from` use a `308` HTTP status code, @@ -302,16 +302,16 @@ In the following example, all redirects are cached for two weeks: ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - expires: 2w - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' + https://{default}/: + type: upstream + # ... + redirects: + expires: 2w + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' ``` If you want to set a different expiration time for a specific redirect, @@ -326,17 +326,17 @@ In the following example: ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - expires: 2w - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' - expires: 3d + https://{default}/: + type: upstream + # ... + redirects: + expires: 2w + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' + expires: 3d ``` {{% note %}} @@ -353,16 +353,16 @@ To disable caching on all your redirects, set the `expires` key to `0` under the ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - expires: 0 - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' + https://{default}/: + type: upstream + # ... + redirects: + expires: 0 + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' ``` To disable caching on a specific redirect only, @@ -372,16 +372,16 @@ In the following example, caching is disabled on the second redirect only: ```yaml routes: - https://{default}/: - type: upstream - # ... - redirects: - paths: - '/from': - to: 'https://example.com/' - '/here': - to: 'https://example.com/there' - expires: 0 + https://{default}/: + type: upstream + # ... + redirects: + paths: + '/from': + to: 'https://example.com/' + '/here': + to: 'https://example.com/there' + expires: 0 ``` ## Other redirects diff --git a/sites/upsun/src/define-routes/ssi.md b/sites/upsun/src/define-routes/ssi.md index 9d1eb4f425..a1c7e327ec 100644 --- a/sites/upsun/src/define-routes/ssi.md +++ b/sites/upsun/src/define-routes/ssi.md @@ -14,11 +14,11 @@ Start by enabling SSI: ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "app:http" - ssi: - enabled: true + "https://{default}/": + type: upstream + upstream: "myapp:http" + ssi: + enabled: true ``` Then create a file you want to include elsewhere: @@ -54,19 +54,19 @@ For example, you can activate SSI on one route with cache disabled and enable ca ```yaml {configFile="routes"} routes: - "https://{default}/": - type: upstream - upstream: "app:http" - ssi: - enabled: true - cache: - enabled: false - - "https://{default}/cache": - type: upstream - upstream: "app:http" - cache: - enabled: true + "https://{default}/": + type: upstream + upstream: "myapp:http" + ssi: + enabled: true + cache: + enabled: false + + "https://{default}/cache": + type: upstream + upstream: "myapp:http" + cache: + enabled: true ``` Then create a page that displays the current date and time and is cached for 60 seconds @@ -78,7 +78,7 @@ header("Cache-Control: max-age=60"); echo date(DATE_RFC2822); ``` -Then you could have a page with dynamic content that includes this file: +Then you could have a page with dynamic content that includes this file: ```php {location="index.php"} }}: - hooks: - build: | - set -e - git clone git@bitbucket.org:username/module.git + {{< variable "APP_NAME" >}}: + hooks: + build: | + set -e + git clone git@bitbucket.org:username/module.git ``` You can also use [private repositories as submodules](./submodules.md#use-private-git-repositories). diff --git a/sites/upsun/src/development/sanitize-db/mariadb.md b/sites/upsun/src/development/sanitize-db/mariadb.md index b09a6c5b74..f77503fe95 100644 --- a/sites/upsun/src/development/sanitize-db/mariadb.md +++ b/sites/upsun/src/development/sanitize-db/mariadb.md @@ -26,16 +26,18 @@ Add your script to sanitize the database to [a `deploy` hook](../../create-apps/ for preview environments: ```yaml {configFile="app"} -hooks: - deploy: | +applications: + myapp: + hooks: + deploy: | # ... cd /app/public if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ]; then - # Do whatever you want on the production site. + # Do whatever you want on the production site. else - drush -y sql:sanitize + drush -y sql:sanitize fi drush -y updatedb ``` @@ -47,17 +49,19 @@ To sanitize only on the initial deploy and not all future deploys, use [Drush state](https://www.drush.org/latest/commands/state_set/) as in the following example: ```yaml {configFile="app"} -hooks: - deploy: | +applications: + myapp: + hooks: + deploy: | # ... cd /app/public if [ "$PLATFORM_ENVIRONMENT_TYPE" = production ] || [ "$(drush state:get --format=string mymodule.sanitized)" != yes ]; then - # Do whatever you want on the production site. + # Do whatever you want on the production site. else - drush -y sql:sanitize - drush state:set --input-format=string mymodule.sanitized yes + drush -y sql:sanitize + drush state:set --input-format=string mymodule.sanitized yes fi ``` diff --git a/sites/upsun/src/development/sanitize-db/postgresql-symfony.md b/sites/upsun/src/development/sanitize-db/postgresql-symfony.md index 55c79c719b..142145052c 100644 --- a/sites/upsun/src/development/sanitize-db/postgresql-symfony.md +++ b/sites/upsun/src/development/sanitize-db/postgresql-symfony.md @@ -93,26 +93,30 @@ Set up a script by following these steps: 2. Update the deploy hook to run your Symfony Command on each deploy. ```yaml {configFile="app"} - hooks: - build: ... - deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ]; then - # The sanitization of the database should happen here (since it's non-production) - php bin/console app:sanitize-data - fi + applications: + myapp: + hooks: + build: ... + deploy: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ]; then + # The sanitization of the database should happen here (since it's non-production) + php bin/console app:sanitize-data + fi ``` To sanitize only on the initial deploy and not all future deploys, on sanitization create a file on a mount. Then add a check for the file as in the following example: ```yaml {configFile="app"} - hooks: - build: ... - deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ] && [ ! -f MOUNT_PATH/is_sanitized ]; then - # The sanitization of the database should happen here (since it's non-production) - php bin/console app:sanitize-data - touch MOUNT_PATH/is_sanitized - fi + applications: + myapp: + hooks: + build: ... + deploy: | + if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ] && [ ! -f MOUNT_PATH/is_sanitized ]; then + # The sanitization of the database should happen here (since it's non-production) + php bin/console app:sanitize-data + touch MOUNT_PATH/is_sanitized + fi ``` 3. Commit your changes by running the following command: diff --git a/sites/upsun/src/development/sanitize-db/postgresql.md b/sites/upsun/src/development/sanitize-db/postgresql.md index a556e2cc67..0325f48ea1 100644 --- a/sites/upsun/src/development/sanitize-db/postgresql.md +++ b/sites/upsun/src/development/sanitize-db/postgresql.md @@ -79,9 +79,11 @@ Set up a script by following these steps: 4. Update the deploy hook to run your script on each deploy. ```yaml {configFile="app"} - hooks: - build: ... - deploy: | + applications: + myapp: + hooks: + build: ... + deploy: | python manage.py migrate bash sanitize.sh ``` diff --git a/sites/upsun/src/development/submodules.md b/sites/upsun/src/development/submodules.md index 1492b96a8c..d2384657b6 100644 --- a/sites/upsun/src/development/submodules.md +++ b/sites/upsun/src/development/submodules.md @@ -129,19 +129,19 @@ To do so, follow these steps: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="false" >}} source: - operations: - rebuild: - command: | - set -e - git submodule update --init --recursive - git submodule update --remote --checkout - git add admin api gatsby mercure - if ! git diff-index --quiet HEAD; then - git commit -m "Updating submodules admin, api, gatsby and mercure" - fi + operations: + rebuild: + command: | + set -e + git submodule update --init --recursive + git submodule update --remote --checkout + git add admin api gatsby mercure + if ! git diff-index --quiet HEAD; then + git commit -m "Updating submodules admin, api, gatsby and mercure" + fi {{< /snippet >}} ``` - + For multiple app projects, make sure you define your source operation in the configuration of an app whose source code **is not** in a submodule. @@ -156,24 +156,24 @@ type: 'nodejs:{{% latest "nodejs" %}}' # The web key configures the web server running in front of your app. web: - # Commands are run once after deployment to start the application process. - commands: - # The command to launch your app. If it terminates, it’s restarted immediately. - # As this app will handle source operation only, no need to keep it alive (sleep) - start: | - sleep infinity +# Commands are run once after deployment to start the application process. + commands: + # The command to launch your app. If it terminates, it’s restarted immediately. + # As this app will handle source operation only, no need to keep it alive (sleep) + start: | + sleep infinity source: - operations: - update-submodules: - command: | - set -e - git submodule update --init --recursive - git submodule update --remote --checkout - git add . - if ! git diff-index --quiet HEAD; then - git commit -m "Updating submodules" - fi - # "git push" is automatic at the end of this command + operations: + update-submodules: + command: | + set -e + git submodule update --init --recursive + git submodule update --remote --checkout + git add . + if ! git diff-index --quiet HEAD; then + git commit -m "Updating submodules" + fi + # "git push" is automatic at the end of this command {{< /snippet >}} ``` diff --git a/sites/upsun/src/development/variables/_index.md b/sites/upsun/src/development/variables/_index.md index b372b09ecb..1e8c382338 100644 --- a/sites/upsun/src/development/variables/_index.md +++ b/sites/upsun/src/development/variables/_index.md @@ -184,10 +184,10 @@ For example, to change the PHP memory limit for all environments, use the follow ```yaml {configFile="app"} applications: - {{< variable "APP_NAME" >}}: - variables: - php: - memory_limit: "256M" + {{< variable "APP_NAME" >}}: + variables: + php: + memory_limit: "256M" ``` ## Framework-specific variables @@ -206,7 +206,7 @@ All the non-alphanumerical or `_` characters (`[^0-9A-Z_]`) are transformed into **Example:** For a relationship named ``database`` to a service named `postgresl`, -the following environment variables are automatically generated in your `app` container: +the following environment variables are automatically generated in your `myapp` container: ```bash DATABASE_URL=pgsql://main:main@postgresql.internal:5432/main diff --git a/sites/upsun/src/development/variables/use-variables.md b/sites/upsun/src/development/variables/use-variables.md index 0c69474d34..4d277e9761 100644 --- a/sites/upsun/src/development/variables/use-variables.md +++ b/sites/upsun/src/development/variables/use-variables.md @@ -169,47 +169,25 @@ public class App { Variables can have nested structures. The following example shows nested structures in an [app configuration](/create-apps/app-reference/single-runtime-image.md#variables): -{{% version/specific %}} - ```yaml {configFile="app"} -variables: - env: +applications: + {{< variable "APP_NAME" >}}: + variables: + env: BASIC: "a string" INGREDIENTS: - - 'peanut butter' - - 'jelly' + - 'peanut butter' + - 'jelly' QUANTITIES: - "milk": "1 liter" - "cookies": "1 kg" - stuff: + "milk": "1 liter" + "cookies": "1 kg" + stuff: STEPS: ['one', 'two', 'three'] COLORS: - red: '#FF0000' - green: '#00FF00' - blue: '#0000FF' -``` -<---> - -```yaml {configFile="app"} -applications: - {{< variable "APP_NAME" >}}: - variables: - env: - BASIC: "a string" - INGREDIENTS: - - 'peanut butter' - - 'jelly' - QUANTITIES: - "milk": "1 liter" - "cookies": "1 kg" - stuff: - STEPS: ['one', 'two', 'three'] - COLORS: - red: '#FF0000' - green: '#00FF00' - blue: '#0000FF' + red: '#FF0000' + green: '#00FF00' + blue: '#0000FF' ``` -{{% /version/specific %}} You can access these nested variables as follows: @@ -472,13 +450,13 @@ title= `PLATFORM_RELATIONSHIPS` environment variable 5. Call the script from the `deploy` hook your [app configuration](../../create-apps/_index.md): - ```yaml {configFile="app"} - applications: - {{< variable "APP_NAME" >}} - hooks: - deploy: | - bash export-config.sh - ``` + ```yaml {configFile="app"} + applications: + {{< variable "APP_NAME" >}} + hooks: + deploy: | + bash export-config.sh + ``` Now, when your app starts and attempts to parse `db.yaml`, the symbolic link redirects it to `config/db.yaml`. Your script writes to that file on each deploy with updated information. diff --git a/sites/upsun/src/domains/cdn/_index.md b/sites/upsun/src/domains/cdn/_index.md index 7803995bb6..bbe4b2b8fe 100644 --- a/sites/upsun/src/domains/cdn/_index.md +++ b/sites/upsun/src/domains/cdn/_index.md @@ -57,11 +57,11 @@ To disable it, change your cache configuration for the routes behind a CDN to th ```yaml {configFile="routes"} routes: "https://{default}/": - type: upstream - upstream: "app:http" - cache: - # Disable the HTTP cache on this route. It's handled by the CDN instead. - enabled: false + type: upstream + upstream: "myapp:http" + cache: + # Disable the HTTP cache on this route. It's handled by the CDN instead. + enabled: false ``` ## Prevent direct access to your server @@ -94,13 +94,13 @@ To enable mTLS, follow these steps: ```yaml {configFile="routes"} routes: - "https://{default}": - tls: - client_authentication: "require" - client_certificate_authorities: - - !include - type: string - path: cdn.crt + "https://{default}": + tls: + client_authentication: "require" + client_certificate_authorities: + - !include + type: string + path: cdn.crt ``` The procedure can vary depending on your CDN. diff --git a/sites/upsun/src/get-started/here/configure/_index.md b/sites/upsun/src/get-started/here/configure/_index.md index b19d016366..8906241c38 100644 --- a/sites/upsun/src/get-started/here/configure/_index.md +++ b/sites/upsun/src/get-started/here/configure/_index.md @@ -32,20 +32,20 @@ Follow the prompts. The `{{% vendor/cli %}} project:init` command does the follo The generated configuration varies slightly based on your answers to these prompts and whether a framework is detected. However, the structure of the configuration file remains similar to the following: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} {{< code-link destination="/create-apps/app-reference.html" text="applications:" title="Top-level key for all applications" >}} - # Configuration for all applications within an environment. - {{< code-link destination="/create-apps/app-reference.html" text="myapp:" title="Configuration for a unique application" >}} - # configuration for the application 'myapp' + # Configuration for all applications within an environment. + {{< code-link destination="/create-apps/app-reference.html" text="myapp:" title="Configuration for a unique application" >}} + # configuration for the application 'app' {{< code-link destination="/add-services.html" text="services:" title="Top-level key for all services" >}} - # Configuration for all services within an environment. - {{< code-link destination="/add-services.html" text="db:" title="Configuration for a unique service" >}} - # configuration for service 'db' + # Configuration for all services within an environment. + {{< code-link destination="/add-services.html" text="db:" title="Configuration for a unique service" >}} + # configuration for service 'db' {{< code-link destination="/define-routes.html" text="routes:" title="Top-level key for all routes, configuring how requests are handled by the Router" >}} - # Configuration for routing to applications - {{< code-link destination="/define-routes.html" text="'https://{default}/':" title="Configuration for a unique service" >}} + # Configuration for routing to applications + {{< code-link destination="/define-routes.html" text="'https://{default}/':" title="Configuration for a unique service" >}} ``` {{% note %}} If you want more information on the structure of this configuration file, see the dedicated [YAML page](/learn/overview/yaml/_index.md). diff --git a/sites/upsun/src/get-started/here/configure/nodejs.md b/sites/upsun/src/get-started/here/configure/nodejs.md index 329f9d0fc6..1d5ada1f93 100644 --- a/sites/upsun/src/get-started/here/configure/nodejs.md +++ b/sites/upsun/src/get-started/here/configure/nodejs.md @@ -39,9 +39,9 @@ Below are some examples from common Node.js framework configuration: title=Next.js +++ -```yaml {location="{{% vendor/configfile "apps" %}}"} +```yaml {configFile="app"} applications: - app: + myapp: source: root: "/" type: "nodejs:20" @@ -59,7 +59,7 @@ applications: routes: "https://{default}/": type: upstream - upstream: "app:http" + upstream: "myapp:http" # A basic redirect definition # More information: {{% vendor/url_doc %}}/define-routes.html#basic-redirect-definition "https://www.{default}/": @@ -72,9 +72,9 @@ routes: title=Express +++ -```yaml {location="{{% vendor/configfile "apps" %}}"} +```yaml {configFile="app"} applications: - app: + myapp: source: root: "/" type: "nodejs:20" @@ -92,7 +92,7 @@ applications: routes: "https://{default}/": type: upstream - upstream: "app:http" + upstream: "myapp:http" # A basic redirect definition # More information: {{% vendor/url_doc %}}/define-routes.html#basic-redirect-definition "https://www.{default}/": @@ -106,14 +106,14 @@ routes: title=Strapi +++ -```yaml {location=".{{% vendor/cli %}}/config.yaml"} +```yaml {configFile="app"} applications: - app: + myapp: source: root: "/" type: "nodejs:20" relationships: - postgresql: + postgresql: mounts: ... web: @@ -136,7 +136,7 @@ services: routes: "https://{default}/": type: upstream - upstream: "app:http" + upstream: "myapp:http" # A basic redirect definition # More information: {{% vendor/url_doc %}}/define-routes.html#basic-redirect-definition "https://www.{default}/": diff --git a/sites/upsun/src/get-started/here/set-resources.md b/sites/upsun/src/get-started/here/set-resources.md index 0e267de7f0..fed8e9585a 100644 --- a/sites/upsun/src/get-started/here/set-resources.md +++ b/sites/upsun/src/get-started/here/set-resources.md @@ -25,7 +25,7 @@ To do so, follow these steps: +-----------------------+---------+---------+-------------+-----------+-----------+ | App or service | Size | CPU | Memory (MB) | Disk (MB) | Instances | +-----------------------+---------+---------+-------------+-----------+-----------+ - | app | 1 | 1 | 384 | N/A | 1 | + | myapp | 1 | 1 | 384 | N/A | 1 | | []| 0.1 | 0.1 | 128 | N/A | 1 | +-----------------------+---------+---------+-------------+-----------+-----------+ ``` @@ -33,7 +33,7 @@ To do so, follow these steps: 2. Select the profile size you want applied to your application image. For instance, `0.1`: ```bash {location="Terminal"} - App: app + App: myapp Choose a profile size: [0.1 ] CPU 0.1, memory 64 MB [0.25] CPU 0.25, memory 128 MB diff --git a/sites/upsun/src/get-started/stacks/django.md b/sites/upsun/src/get-started/stacks/django.md index 06a5e6515a..6e061a767c 100644 --- a/sites/upsun/src/get-started/stacks/django.md +++ b/sites/upsun/src/get-started/stacks/django.md @@ -22,8 +22,8 @@ you still need to make a few changes to your {{% vendor/name %}} configuration. ## 1. Leverage environment variables -Your `settings.py` file may allow for environment variables to be set for common pieces of configuration. -In this case, add and commit a `.environment` file that includes those details. +Your `settings.py` file may allow for environment variables to be set for common pieces of configuration. +In this case, add and commit a `.environment` file that includes those details. ```bash {location=".environment"} export DJANGO_SETTINGS_MODULE=config.settings.production @@ -60,7 +60,7 @@ Near the bottom of your `settings.py` file, define a block that: - Detects when Django is running on an {{% vendor/name %}} environment - Override previous settings -If your configuration is split into a `production.py` file for production settings, place it there instead. +If your configuration is split into a `production.py` file for production settings, place it there instead. ```py {location="settings.py"} # Production/{{% vendor/name %}} settings. @@ -105,21 +105,21 @@ No matter what environment type we run on {{% vendor/name %}}, this file uses pr Every service container you configure in `.upsun/config.yaml` has a unique relationship name (`applications::relationships:`). {{% vendor/name %}} automatically uses this relationship name to expose connection credentials through environment variables (for example, via `RELATIONSHIPNAME_HOST`).
Update `settings.py` according to the example above (which configures a PostgreSQL service), where the relationship `database` results in environment variables that are leveraged to update the `DATABASES` setting for your application.
-You can use the exact same logic to configure `CACHES` from the `rediscache` relationship using the exposed `REDISCACHE_` environment variables to setup `django_redis.cache.RedisCache`. +You can use the exact same logic to configure `CACHES` from the `rediscache` relationship using the exposed `REDISCACHE_` environment variables to setup `django_redis.cache.RedisCache`. ## 4. Start the app In your app configuration, locate the `web:commands:start` section and update it as follows: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - web: - commands: - start: "gunicorn -b unix:$SOCKET config.wsgi" - upstream: - socket_family: unix + myapp: + ... + web: + commands: + start: "gunicorn -b unix:$SOCKET config.wsgi" + upstream: + socket_family: unix ``` Note that if your Django instance requires a different web server, @@ -127,39 +127,39 @@ Note that if your Django instance requires a different web server, ## 5. Configure static assets -To access Django's static assets, you need to add a second location to the `web:locations` section of your app configuration. +To access Django's static assets, you need to add a second location to the `web:locations` section of your app configuration. Locate the `web:locations` section and add a location for `/static`: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - web: - locations: - "/": - "passthru": true - "/static": - "allow": true - "expires": "1h" - "root": "static" + myapp: + ... + web: + locations: + "/": + "passthru": true + "/static": + "allow": true + "expires": "1h" + "root": "static" ``` ## 6. Install dependencies and builds -Instruct {{% vendor/name %}} to install your Python and Node (if needed) dependencies. +Instruct {{% vendor/name %}} to install your Python and Node (if needed) dependencies. Locate the `hooks:build` section and update it as follows: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - build: | - set -eux - - pip install --upgrade pip - pip install -r requirements.txt - npm install - npm run build + myapp: + ... + build: | + set -eux + + pip install --upgrade pip + pip install -r requirements.txt + npm install + npm run build ``` Remove the `npm` steps if not required for your app's assets. @@ -170,30 +170,30 @@ Note that if your project uses a different package manager, In your app configuration, locate the `deploy` section and update it as follows: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - deploy: | - set -eux + myapp: + ... + deploy: | + set -eux - python manage.py collectstatic --noinput - python manage.py migrate + python manage.py collectstatic --noinput + python manage.py migrate ``` ## 8. Allow write access where needed -Since Django can require a writable locations at runtime, you need to set up writable mounts. +Since Django can require a writable locations at runtime, you need to set up writable mounts. To do so, locate the `mounts` section (currently commented), and update it as follows: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - mounts: - "/staticfiles": - source: "local" - source_path: "static_assets" + myapp: + ... + mounts: + "/staticfiles": + source: "local" + source_path: "static_assets" ``` You can now commit all of the above changes and push to {{% vendor/name %}}. diff --git a/sites/upsun/src/get-started/stacks/express/add-database.md b/sites/upsun/src/get-started/stacks/express/add-database.md index 835ee30b5f..e3f5d19732 100644 --- a/sites/upsun/src/get-started/stacks/express/add-database.md +++ b/sites/upsun/src/get-started/stacks/express/add-database.md @@ -27,37 +27,37 @@ To create a new branch, run the following command: Configure the MariaDB service by adding a `database` service to your `.{{% vendor/cli %}}/config.yaml` file: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - my-express-app: - source: - root: "/" - type: "nodejs:20" + myapp: + source: + root: "/" + type: "nodejs:20" - [...] + [...] {{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: - database: - type: mariadb:{{% latest "mariadb" %}} + database: + type: mariadb:{{% latest "mariadb" %}} ``` -To connect the service to your application (``app``), add the following relationship: +To connect the service to your application (``myapp``), add the following relationship: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - my-express-app: - source: - root: "/" - type: "nodejs:20" + myapp: + source: + root: "/" + type: "nodejs:20" - [...] + [...] - relationships: - database: + relationships: + database: {{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: - database: - type: mariadb:{{% latest "mariadb" %}} + database: + type: mariadb:{{% latest "mariadb" %}} ``` Commit your change: diff --git a/sites/upsun/src/get-started/stacks/flask.md b/sites/upsun/src/get-started/stacks/flask.md index 07d76a1eb0..c20d8ce0ca 100644 --- a/sites/upsun/src/get-started/stacks/flask.md +++ b/sites/upsun/src/get-started/stacks/flask.md @@ -82,7 +82,7 @@ To configure all the environment variables Flask needs to run smoothly, follow t 6. Optional: You may also need to set a `SECRET_KEY` environment variable. It's used for securely signing the session cookie and can be used for any other security-related needs by extensions or your app. It usually is a long random string. - + Set the `SECRET_KEY` environment variable to leverage the [`PLATFORM_PROJECT_ENTROPY` variable](/development/variables/use-variables#use-provided-variables) provided by {{% vendor/name %}}: ```bash {location=".environment"} @@ -115,14 +115,14 @@ You need to add some writable disk space to hold the static assets that `flask-s To do so, define the `.//static` directory as [a mount](/create-apps/app-reference/single-runtime-image#mounts). In your app configuration, locate the section dedicated to mounts and update it as follows: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - mounts: - "/static": - source: "storage" - source_path: "static_assets" + myapp: + ... + mounts: + "/static": + source: "storage" + source_path: "static_assets" ``` Replace `` with the `app_name` you defined when creating your Flask project. @@ -135,18 +135,18 @@ when building the application container. To do so, customize your [build hook](/create-apps/hooks/hooks-comparison.html#build-hook). In your app configuration, locate the section dedicated to it and update it as follows: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages - # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks - hooks: - # The build hook is run after any build flavor. - # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#build-hook - build: | - set -eux - pip install -r requirements.txt + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + # The build hook is run after any build flavor. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#build-hook + build: | + set -eux + pip install -r requirements.txt ``` The {{% vendor/name %}} CLI automatically added `pip install -r requirements.txt` to your build hook configuration when you @@ -155,20 +155,20 @@ applications: If you want `pip` to be upgraded first to the latest version, add `pip install --upgrade pip` to the above line. Then, add `npm install`: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages - # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks - hooks: - # The build hook is run after any build flavor. - # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#build-hook - build: | - set -eux - pip install --upgrade pip - pip install -r requirements.txt - npm install + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + # The build hook is run after any build flavor. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#build-hook + build: | + set -eux + pip install --upgrade pip + pip install -r requirements.txt + npm install ``` Note that if your project uses a different package manager, {{% vendor/name %}} also supports [several other options](/languages/python/dependencies.md). @@ -179,36 +179,36 @@ Instruct {{% vendor/name %}} to automatically run `npm run build` when building To do so, customize your [deploy hook](/create-apps/hooks/hooks-comparison.html#deploy-hook). In your app configuration, locate the section dedicated to it: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages - # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks - hooks: - ... - # The deploy hook is run after the app container has been started, but before it has started accepting requests. - # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook - deploy: | - set -eux - # echo 'Put your deploy command here' + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + ... + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook + deploy: | + set -eux + # echo 'Put your deploy command here' ``` Add `npm run build`: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages - # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks - hooks: - ... - # The deploy hook is run after the app container has been started, but before it has started accepting requests. - # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook - deploy: | - set -eux - npm run build + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + ... + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook + deploy: | + set -eux + npm run build ``` ## 5. Configure the web server @@ -216,33 +216,33 @@ applications: [Configure the web server](/create-apps/_index.md#configure-whats-served) running in front of your app to define how your app handles dynamic requests. To do so, in your app configuration, locate the section dedicated to the web server: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - # The web key configures the web server running in front of your app. - # More information: https://docs.upsun.com/create-apps/app-reference.html#web - web: - # Commands are run once after deployment to start the application process. - # More information: https://docs.upsun.com/create-apps/app-reference.html#web-commands + myapp: + ... + # The web key configures the web server running in front of your app. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web + web: + # Commands are run once after deployment to start the application process. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web-commands ``` To add a basic Flask server, replace the default information added by the {{% vendor/name %}} CLI with `flask run -p $PORT`. Also, change the `socket_family` value from `unix` to `tcp`: -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - # The web key configures the web server running in front of your app. - # More information: https://docs.upsun.com/create-apps/app-reference.html#web - web: - # Commands are run once after deployment to start the application process. - # More information: https://docs.upsun.com/create-apps/app-reference.html#web-commands - commands: - start: "flask run -p $PORT" - upstream: - socket_family: tcp + myapp: + ... + # The web key configures the web server running in front of your app. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web + web: + # Commands are run once after deployment to start the application process. + # More information: https://docs.upsun.com/create-apps/app-reference.html#web-commands + commands: + start: "flask run -p $PORT" + upstream: + socket_family: tcp ``` You can now commit all of the above changes and push to {{% vendor/name %}}. @@ -270,19 +270,19 @@ To do so, follow these steps. 1. Set up a virtual environment where your project can run: - ```bash {location="Terminal"} + ```bash {location="Terminal"} python3 -m venv env && source venv/bin/activate ``` 2. Just like in your build hook, update pip and install the requirements: - ```bash {location="Terminal"} + ```bash {location="Terminal"} pip install --upgrade pip && pip install -r requirements.txt ``` 3. Set up a way for your local instance of Flask to communicate with your database service: - ```bash {location="Terminal"} + ```bash {location="Terminal"} {{% vendor/cli %}} tunnel:open -y ``` @@ -297,7 +297,7 @@ To do so, follow these steps. Set the following environment variable: - ```bash {location=".environment"} + ```bash {location=".environment"} export PLATFORM_RELATIONSHIPS="$({{% vendor/cli %}} tunnel:info --encode)" ``` @@ -314,7 +314,7 @@ To do so, follow these steps. 6. Source your `.environment` file to finish setting up all the environmental variables in your current bash: - ```bash {location="Terminal"} + ```bash {location="Terminal"} source ./.environment ``` @@ -324,19 +324,19 @@ To do so, follow these steps. 1. Initiate the migrations directory and prepare for the ``migrate`` command: - ```bash {location="Terminal"} + ```bash {location="Terminal"} flask db init ``` 2. Generate your migrations: - ```bash {location="Terminal"} + ```bash {location="Terminal"} flask db migrate ``` 3. Commit your generated migrations: - ```bash {location="Terminal"} + ```bash {location="Terminal"} git add migrations/* && git commit -m "Adds migrations" ``` @@ -345,25 +345,25 @@ To do so, follow these steps. To do so, re-open your `.upsun/config.yaml` file. Locate the `deploy` hook where you added `npm run build` previously and update it as follows: - ```yaml {location=".upsun/config.yaml"} + ```yaml {configFile="app"} applications: - myapp: - ... - # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages - # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks - hooks: - ... - # The deploy hook is run after the app container has been started, but before it has started accepting requests. - # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook - deploy: | - set -eux - npm run build - flask db upgrade + myapp: + ... + # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages + # More information: https://docs.upsun.com/create-apps/app-reference.html#hooks + hooks: + ... + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.upsun.com/create-apps/hooks/hooks-comparison.html#deploy-hook + deploy: | + set -eux + npm run build + flask db upgrade ``` 5. Commit all your changes and push to {{% vendor/name %}}. - - ```bash {location="Terminal"} + + ```bash {location="Terminal"} git add . git commit -m "Add changes to complete my {{% vendor/name %}} configuration" git push diff --git a/sites/upsun/src/get-started/stacks/laravel/crons.md b/sites/upsun/src/get-started/stacks/laravel/crons.md index db5dac3937..6168f3a8a6 100644 --- a/sites/upsun/src/get-started/stacks/laravel/crons.md +++ b/sites/upsun/src/get-started/stacks/laravel/crons.md @@ -17,14 +17,14 @@ To set up a cron job, update your {{% vendor/name %}} configuration as follows: ```yaml {configFile="app"} applications: - myapp: - [...] - crons: - snapshot: - spec: * * * * * - commands: - start: | - php artisan schedule:run >> /dev/null 2>&1 + myapp: + [...] + crons: + snapshot: + spec: * * * * * + commands: + start: | + php artisan schedule:run >> /dev/null 2>&1 ``` ## Run cron jobs based on environment type @@ -34,22 +34,22 @@ use the `PLATFORM_ENVIRONMENT_TYPE` environment variable: ```yaml {configFile="app"} applications: - myapp: - [...] - crons: - snapshot: - spec: 0 5 * * * - commands: - start: | - # only run for the production environment, aka main branch - if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then - php artisan schedule:run >> /dev/null 2>&1 - fi + myapp: + [...] + crons: + snapshot: + spec: 0 5 * * * + commands: + start: | + # only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + php artisan schedule:run >> /dev/null 2>&1 + fi ``` ## Run the Laravel scheduler every minute -Cron job execution on the default {{< vendor/name >}} offering are limited to once every 5 minutes. +Cron job execution on the default {{< vendor/name >}} offering are limited to once every 5 minutes. For more information, see the [documentation on crons](/create-apps/app-reference/single-runtime-image#crons). However, you can add a [worker](/create-apps/app-reference/single-runtime-image#workers) @@ -58,14 +58,13 @@ To do so, use the following configuration: ```yaml {configFile="app"} applications: + {{< variable "APP_NAME" >}}: [...] - {{< variable "APP_NAME" >}}: - [...] - workers: - scheduler: - commands: - start: | - php artisan schedule:work + workers: + scheduler: + commands: + start: | + php artisan schedule:work ``` {{< note title="Warning" theme="warning" >}} @@ -76,4 +75,4 @@ To share data between containers, use [services](/add-services/_index.md). {{< /note >}} -{{< guide-buttons previous="Back" next="Manage observability with Blackfire" nextLink="/get-started/stacks/laravel/blackfire.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Manage observability with Blackfire" nextLink="/get-started/stacks/laravel/blackfire.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/laravel/environment-variables.md b/sites/upsun/src/get-started/stacks/laravel/environment-variables.md index fd511c55b5..a8a38a87b4 100644 --- a/sites/upsun/src/get-started/stacks/laravel/environment-variables.md +++ b/sites/upsun/src/get-started/stacks/laravel/environment-variables.md @@ -27,14 +27,14 @@ about the app and its infrastructure. Assuming that MySQL, PostgreSQL, and Redis services have been added to your environment, and that the app has been granted access to those services via the following [relationships](/create-apps/app-reference/single-runtime-image#relationships): -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - ... - relationships: - mysql: ... - postgresql: ... - redis: ... + myapp: + [...] + relationships: + mysql: ... + postgresql: ... + redis: ... ``` You can transpose these variables to set up Laravel's default configuration in a `.environment` file: @@ -78,8 +78,10 @@ Each exposed environment variable is prefixed by the relationship name. For example, if you have the following relationships in your configuration: ```yaml {configFile="app"} -relationships: - database: +applications: + myapp: + relationships: + database: service: "securitydb" endpoint: "postgresql" ``` diff --git a/sites/upsun/src/get-started/stacks/laravel/faq.md b/sites/upsun/src/get-started/stacks/laravel/faq.md index 58c48c2ffc..c247423bdb 100644 --- a/sites/upsun/src/get-started/stacks/laravel/faq.md +++ b/sites/upsun/src/get-started/stacks/laravel/faq.md @@ -7,22 +7,22 @@ description: | ## How can I access my application logs? -To display the application log file (`app` file), run the following command: +To display the application log file (`/var/log/app.log` file), run the following command: ```bash {{% vendor/cli %}} log app --tail ``` -All the log messages generated by your app are sent to this `app` file. +All the log messages generated by your app are sent to this `/var/log/app.log` file. This includes language errors such as PHP errors, warnings, notices, as well as uncaught exceptions. -The file also contains your application logs if you log on `stderr`. +The file also contains your application logs if you log on `stderr`. This log doesn't include the default `laravel.log` located in `/storage`. {{% note %}} -{{% vendor/name %}} manages the `app` file for you. +{{% vendor/name %}} manages the `app.log` file for you. This is to prevent disks from getting filled and using very fast local drives instead of slower network disks. Make sure your apps always output their logs to `stderr`. @@ -94,4 +94,4 @@ export APP_DEBUG=0 For other issues unrelated to Laravel, see [Troubleshoot development](/development/troubleshoot.html). -{{< guide-buttons previous="Back" >}} \ No newline at end of file +{{< guide-buttons previous="Back" >}} diff --git a/sites/upsun/src/get-started/stacks/laravel/get-started.md b/sites/upsun/src/get-started/stacks/laravel/get-started.md index 8a7c790bfc..01fce0c56e 100644 --- a/sites/upsun/src/get-started/stacks/laravel/get-started.md +++ b/sites/upsun/src/get-started/stacks/laravel/get-started.md @@ -39,12 +39,12 @@ This guide provides instructions for deploying and working with Laravel on {{% v ```yaml {configFile="app"} applications: - myapp: - ... - runtime: - extensions: - - redis - - pdo_pgsql + myapp: + [...] + runtime: + extensions: + - redis + - pdo_pgsql ``` See all the [available PHP extensions](/languages/php/extensions.html). @@ -127,7 +127,7 @@ To make changes to your project, follow these steps: 1. Create a new environment (a Git branch) to make changes without impacting production: - ```bash {location="Terminal"} + ```bash {location="Terminal"} {{% vendor/cli %}} branch feat-a ``` @@ -148,21 +148,21 @@ To make changes to your project, follow these steps: 3. Add and commit your changes: - ```bash {location="Terminal"} + ```bash {location="Terminal"} add . git commit -a -m "Update title" ``` 4. Deploy your changes to the `feat-a` environment: - ```bash {location="Terminal"} + ```bash {location="Terminal"} {{% vendor/cli %}} deploy ``` Note that each environment has its own domain name. To view the domain name of your new environment, run the following command: - ```bash {location="Terminal"} + ```bash {location="Terminal"} {{% vendor/cli %}} url --primary ``` @@ -170,7 +170,7 @@ To make changes to your project, follow these steps: When satisfied with your changes, merge them to the main branch, deploy, and remove the feature branch: - ```bash {location="Terminal"} + ```bash {location="Terminal"} git checkout main git merge feat-a {{% vendor/cli %}} environment:delete feat-a @@ -195,4 +195,4 @@ Add an integration to your existing third-party repository: - [GitHub](/integrations/source/github.md) - [GitLab](/integrations/source/gitlab.md) -{{< guide-buttons previous="Back" next="Configure environment variables" nextLink="/get-started/stacks/laravel/environment-variables.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Configure environment variables" nextLink="/get-started/stacks/laravel/environment-variables.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md b/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md index 6d4808fafb..293536d364 100644 --- a/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md +++ b/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md @@ -26,13 +26,13 @@ This procedure assumes you have followed the steps on [how to configure Redis an ```yaml {configFile="app"} applications: - myapp: - [...] - hooks: - build: | - set -eux - composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev - php artisan horizon:install + myapp: + [...] + hooks: + build: | + set -eux + composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev + php artisan horizon:install ``` ## 2. Create a worker to run Horizon @@ -42,14 +42,15 @@ To do so, use the following configuration: ```yaml {configFile="app"} applications: + myapp: [...] - {{< variable "APP_NAME" >}}: - [...] - workers: - horizon: - commands: - start: | - php artisan horizon + {{< variable "APP_NAME" >}}: + [...] + workers: + horizon: + commands: + start: | + php artisan horizon ``` To enable the worker, push your changes to {{< vendor/name >}}: @@ -66,7 +67,7 @@ It will spawn the Horizon process after the next deploy. ## 3. Access your Horizon dashboard If you have restricted access to Horizon in your `HorizonServiceProvider.php`, -log in to your app through the web. +log in to your app through the web. Then, go to `/horizon` to access your Horizon dashboard. ![Laravel Horizon Dashboard](/images/guides/laravel/horizon-dashboard.png "0.5") @@ -93,4 +94,4 @@ Note that you can customize the resources of your Horizon worker container from For more information, see how to [configure resources](/manage-resources/adjust-resources.md). -{{< guide-buttons previous="Back" next="Set up cron jobs" nextLink="/get-started/stacks/laravel/crons.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Set up cron jobs" nextLink="/get-started/stacks/laravel/crons.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md b/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md index d4d1208979..cbdfba7a2d 100644 --- a/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md +++ b/sites/upsun/src/get-started/stacks/laravel/laravel-telescope.md @@ -5,7 +5,7 @@ description: | Setting up Laravel Telescope for debugging Laravel --- -Laravel Telescope complements your local Laravel development environment. +Laravel Telescope complements your local Laravel development environment. With Telescope, get insight into the requests coming into your app, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more. To set up Laravel Telescope on your **non-production** environments, @@ -20,7 +20,7 @@ To add the `APP_DEBUG` & `TELESCOPE_ENABLED` variables on your project, run the {{< vendor/cli >}} variable:create --level environment --name env:TELESCOPE_ENABLED --value false ``` -Note that the default values for your main environment are set to `false`. +Note that the default values for your main environment are set to `false`. To override them on other non-production environments, run the following commands: ```bash {location="Terminal"} @@ -41,13 +41,13 @@ To override them on other non-production environments, run the following command ```yaml {configFile="app"} applications: - myapp: - [...] - hooks: - build: | - set -eux - composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev - php artisan telescope:install + myapp: + [...] + hooks: + build: | + set -eux + composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev + php artisan telescope:install ``` For more options and information on how to manage authentication for the dashboard, @@ -69,9 +69,9 @@ You can now access the `/telescope` endpoint of your app. {{< note theme="tip" >}} -Telescope uses a gate defined in `TelescopeServiceProvider.php` to authorize access to the dashboard. +Telescope uses a gate defined in `TelescopeServiceProvider.php` to authorize access to the dashboard. Check that the logic here matches your needs. {{< /note >}} -{{< guide-buttons previous="Back" next="FAQ" nextLink="/get-started/stacks/laravel/faq.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="FAQ" nextLink="/get-started/stacks/laravel/faq.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md index 147d5e9ff4..60bb7ec0e1 100644 --- a/sites/upsun/src/get-started/stacks/laravel/setup-redis.md +++ b/sites/upsun/src/get-started/stacks/laravel/setup-redis.md @@ -13,24 +13,24 @@ With Laravel, you can use Redis to handle session storage, cache storage, and qu ```yaml {configFile="app"} services: - [...] - redis: - type: redis:7.0 + [...] + redis: + type: redis:7.0 ``` 2. To connect the service to your app, add the following relationship: ```yaml {configFile="app"} applications: - myapp: - [...] - relationships: - redis: + myapp: + [...] + relationships: + redis: services: - [...] - redis: - type: redis:7.0 + [...] + redis: + type: redis:7.0 ``` ## 2. Configure your Redis service @@ -58,11 +58,11 @@ If using `phpredis`, make sure you add `redis` in the list of PHP `runtime` exte ```yaml {configFile="app"} applications: - myapp: - [...] - runtime: - extensions: - - redis + myapp: + [...] + runtime: + extensions: + - redis ``` {{< /note >}} diff --git a/sites/upsun/src/get-started/stacks/nextjs.md b/sites/upsun/src/get-started/stacks/nextjs.md index 17544b4181..e6836a918a 100644 --- a/sites/upsun/src/get-started/stacks/nextjs.md +++ b/sites/upsun/src/get-started/stacks/nextjs.md @@ -81,7 +81,7 @@ title=Using the Console 2. Click **Create from scratch**. 3. Fill in details like the project name and [region](/development/regions.md). - + {{% note %}} You can define resources for your project later on, after your first push. @@ -188,15 +188,15 @@ Follow the prompts. ```yaml {configFile="apps"} applications: - myapp: - type: "nodejs:20" - hooks: - build: | - set -eux - npm run build - web: - commands: - start: npm run start -- -p $PORT + myapp: + type: "nodejs:20" + hooks: + build: | + set -eux + npm run build + web: + commands: + start: npm run start -- -p $PORT ``` As an example, above is the minimum configuration needed to deploy a Next.js application on {{% vendor/name %}} without any services. @@ -305,7 +305,7 @@ To make changes to your project, follow these steps: --- a/views/index.jade +++ b/views/index.jade @@ -2,4 +2,4 @@ extends layout - + block content h1= title - p Welcome to #{title} @@ -337,7 +337,7 @@ To make changes to your project, follow these steps: {{% vendor/cli %}} environment:delete feat-a git fetch --prune ``` - + Note that deploying to production is fast because the image built for the `feat-a` environment is reused. For a long running branch, to keep the code up-to-date with the main branch, use `git merge main` or `git rebase main`. diff --git a/sites/upsun/src/get-started/stacks/strapi/add-database.md b/sites/upsun/src/get-started/stacks/strapi/add-database.md index 9c1a4d3a3b..07fbc66d82 100644 --- a/sites/upsun/src/get-started/stacks/strapi/add-database.md +++ b/sites/upsun/src/get-started/stacks/strapi/add-database.md @@ -47,36 +47,36 @@ Add a new service to your `.upsun/config.yaml` file: +++ title=PostgreSQL +++ -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - my-strapi-project: - source: - root: "/" - type: "nodejs:20" + myapp: + source: + root: "/" + type: "nodejs:20" - [...] + [...] services: - database: - type: postgresql:{{% latest "postgresql" %}} + database: + type: postgresql:{{% latest "postgresql" %}} ``` <---> +++ title=Oracle MySQL +++ -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - my-strapi-project: - source: - root: "/" - type: "nodejs:20" + myapp: + source: + root: "/" + type: "nodejs:20" - [...] + [...] services: - database: - type: oracle-mysql:{{% latest "oracle-mysql" %}} + database: + type: oracle-mysql:{{% latest "oracle-mysql" %}} ``` {{< /codetabs >}} @@ -88,42 +88,42 @@ Add a new relationship to your `.upsun/config.yaml` file to allow access to the +++ title=PostgreSQL +++ -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - my-strapi-project: - source: - root: "/" - type: "nodejs:20" + myapp: + source: + root: "/" + type: "nodejs:20" - [...] + [...] - relationships: - database: + relationships: + database: services: - database: - type: postgresql:{{% latest "postgresql" %}} + database: + type: postgresql:{{% latest "postgresql" %}} ``` <---> +++ title=Oracle MySQL +++ -```yaml {location=".upsun/config.yaml"} +```yaml {configFile="app"} applications: - my-strapi-project: - source: - root: "/" - type: "nodejs:20" + myapp: + source: + root: "/" + type: "nodejs:20" - [...] + [...] - relationships: - database: + relationships: + database: services: - database: - type: oracle-mysql:{{% latest "oracle-mysql" %}} + database: + type: oracle-mysql:{{% latest "oracle-mysql" %}} ``` {{< /codetabs >}} diff --git a/sites/upsun/src/get-started/stacks/symfony/crons.md b/sites/upsun/src/get-started/stacks/symfony/crons.md index 13e9d17128..ecf38885f7 100644 --- a/sites/upsun/src/get-started/stacks/symfony/crons.md +++ b/sites/upsun/src/get-started/stacks/symfony/crons.md @@ -10,27 +10,31 @@ Cron jobs allow you to run scheduled tasks at specified times or intervals. To set up a cron job, add a configuration similar to the following: ```yaml {configFile="app"} -crons: - snapshot: +applications: + myapp: + crons: + snapshot: spec: 0 5 * * * - commands: - start: | - croncape symfony ... + commands: + start: | + croncape symfony ... ``` To run a command in a cron hook for specific environment types, use the `PLATFORM_ENVIRONMENT_TYPE` environment variable: ```yaml {configFile="app"} -crons: - snapshot: +applications: + myapp: + crons: + snapshot: spec: 0 5 * * * - commands: - start: | - # only run for the production environment, aka main branch - if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then - croncape symfony ... - fi + commands: + start: | + # only run for the production environment, aka main branch + if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then + croncape symfony ... + fi ``` ## Use croncape @@ -61,10 +65,10 @@ To use a custom SMTP and/or custom sender address, follow these steps: 3. To disable the provided SMTP service, run `symfony {{% vendor/cli %}}:env:info enable_smtp false`. {{% note theme="info" %}} -To use `croncape`, SMTP must be enabled on the environment, where the [`PLATFORM_SMTP_HOST`](/development/variables/use-variables#use-provided-variables) environment variable is accessible. +To use `croncape`, SMTP must be enabled on the environment, where the [`PLATFORM_SMTP_HOST`](/development/variables/use-variables#use-provided-variables) environment variable is accessible. This variable is available, and SMTP enabled, by default on all production environments. This is not the case for preview (non-production) environments, where it must be enabled with the command `symfony cloud:env:info enable_smtp true`. {{% /note %}} -{{< guide-buttons previous="Back" next="Manage observability with Blackfire" nextLink="/get-started/stacks/symfony/blackfire.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Manage observability with Blackfire" nextLink="/get-started/stacks/symfony/blackfire.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/symfony/environment-variables.md b/sites/upsun/src/get-started/stacks/symfony/environment-variables.md index 54fcc8a616..6d84cd48fe 100644 --- a/sites/upsun/src/get-started/stacks/symfony/environment-variables.md +++ b/sites/upsun/src/get-started/stacks/symfony/environment-variables.md @@ -28,7 +28,7 @@ about the app and its infrastructure. The Symfony integration exposes more environment variables: -- `APP_ENV` is set to `prod` by default. +- `APP_ENV` is set to `prod` by default. You can manually override this value for a preview environment by setting the `SYMFONY_ENV` environment variable to `dev`, and remove it when done. @@ -42,7 +42,7 @@ The Symfony integration exposes more environment variables: - `MAILFROM` is set to a random value. This value is used as a `From` header when using [croncape](./crons#use-croncape). -- `SYMFONY_IS_WORKER` is set to `1` when the container is running in the context of a worker +- `SYMFONY_IS_WORKER` is set to `1` when the container is running in the context of a worker (instead of the main application container). - `SYMFONY_CACHE_DIR` (only available during the build hook execution): @@ -102,9 +102,11 @@ symfony ssh -- symfony var:export --multiline Each exposed environment variable is prefixed by the relationship name. For example, if you have the following [relationships](/create-apps/app-reference/single-runtime-image#relationships) in your configuration: -```yaml -relationships: - database: +```yaml {configFile="app"} +applications: + myapp: + relationships: + database: service: securitydb endpoint: postgresql ``` @@ -285,4 +287,4 @@ The [Apache Kafka](/add-services/kafka) configuration is exposed via the followi - `KAFKA_PORT` - `KAFKA_IP` -{{< guide-buttons previous="Back" next="Configure workers" nextLink="/get-started/stacks/symfony/workers.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Configure workers" nextLink="/get-started/stacks/symfony/workers.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/symfony/faq.md b/sites/upsun/src/get-started/stacks/symfony/faq.md index 948d02e9a3..79e361f468 100644 --- a/sites/upsun/src/get-started/stacks/symfony/faq.md +++ b/sites/upsun/src/get-started/stacks/symfony/faq.md @@ -23,18 +23,18 @@ Note that the environment variables are available in the deploy hook. ## How can I access my application logs? -To display the application log file (`app` file), run the following command: +To display the application log file (`/var/log/app.log` file), run the following command: ```bash symfony log app --tail ``` -All the log messages generated by your app are sent to this `app` file. +All the log messages generated by your app are sent to this `/var/log/app.log` file. This includes language errors such as PHP errors, warnings, notices, as well as uncaught exceptions. The file also contains your application logs if you log on `stderr`. -Note that {{% vendor/name %}} manages the `app` file for you. +Note that {{% vendor/name %}} manages the `/var/log/app.log` file for you. This is to prevent disks from getting filled and using very fast local drives instead of slower network disks. Make sure your apps always output their logs to `stderr`. @@ -116,4 +116,4 @@ If you've already created a custom homepage, make sure you perform the following For other issues unrelated to Symfony, see [Troubleshoot development](/development/troubleshoot.html). -{{< guide-buttons previous="Back" next="Symfony CLI tips" nextLink="/get-started/stacks/symfony/symfony-cli-tips.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Symfony CLI tips" nextLink="/get-started/stacks/symfony/symfony-cli-tips.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/symfony/integration.md b/sites/upsun/src/get-started/stacks/symfony/integration.md index c3b45d2fc5..7072056b86 100644 --- a/sites/upsun/src/get-started/stacks/symfony/integration.md +++ b/sites/upsun/src/get-started/stacks/symfony/integration.md @@ -19,15 +19,17 @@ The Symfony integration is automatically enabled when: If you already have a {{% vendor/name %}} configuration without the Symfony integration, enable it by adding the following configuration: - ```yaml {configFile="app"} +```yaml {configFile="app"} +applications: + app: hooks: - build: | - set -x -e + build: | + set -x -e - curl -fs https://get.symfony.com/cloud/configurator | bash + curl -fs https://get.symfony.com/cloud/configurator | bash - # ... - ``` + # ... +``` The **configurator** enables the following integration: @@ -64,15 +66,17 @@ The `hooks` section defines the scripts that {{% vendor/name %}} runs at specifi Here's the default `hooks` section optimized for Symfony projects: ```yaml {configFile="app"} -hooks: - build: | +applications: + app: + hooks: + build: | set -x -e curl -s https://get.symfony.com/cloud/configurator | bash symfony-build - deploy: | + deploy: | set -x -e symfony-deploy @@ -96,11 +100,13 @@ During the `deploy` or `post_deploy` hooks, you can execute actions for a specif To do so, in your `{{< vendor/configfile "app" >}}`file, use the `PLATFORM_ENVIRONMENT_TYPE` [environment variable](/development/variables/_index.md)) in a condition: -```yaml -hooks: - deploy: | +```yaml {configFile="app"} +applications: + myapp: + hooks: + deploy: | if [ "PLATFORM_ENVIRONMENT_TYPE" != "production" ]; then - symfony console app:dev:anonymize + symfony console app:dev:anonymize fi ``` @@ -124,8 +130,10 @@ Use it as the main build script in your `build` hook. To override the flags used by Composer, use the `$COMPOSER_FLAGS` environment variable: ```yaml {configFile="app"} -hooks: - build: | +applications: + myapp: + hooks: + build: | set -x -e curl -s https://get.symfony.com/cloud/configurator | bash @@ -173,8 +181,10 @@ To ensure your app can be built properly, run `php-ext-install` after the [confi but before [symfony-build](#symfony-build): ```yaml {configFile="app"} -hooks: - build: | +applications: + myapp: + hooks: + build: | set -x -e curl -s https://get.symfony.com/cloud/configurator | bash @@ -188,8 +198,10 @@ When installing [PECL](https://pecl.php.net/) PHP extensions, you can configure them directly as *variables* instead: ```yaml {configFile="app"} -variables: - php-ext: +applications: + myapp: + variables: + php-ext: redis: 5.3.2 ``` @@ -206,8 +218,10 @@ If you need to use the Node installation setup by [symfony-build](#symfony-build use the following configuration: ```yaml {configFile="app"} -hooks: - build: | +applications: + myapp: + hooks: + build: | set -x -e curl -s https://get.symfony.com/cloud/configurator | bash @@ -226,8 +240,10 @@ If you want to use two different Node versions, use the following configuration instead: ```yaml {configFile="app"} -hooks: - build: | +applications: + myapp: + hooks: + build: | set -x -e curl -s https://get.symfony.com/cloud/configurator | bash @@ -247,4 +263,4 @@ hooks: yarn build --environment=prod ``` -{{< guide-buttons previous="Back" next="Configure environment variables" nextLink="/get-started/stacks/symfony/environment-variables.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Configure environment variables" nextLink="/get-started/stacks/symfony/environment-variables.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/symfony/workers.md b/sites/upsun/src/get-started/stacks/symfony/workers.md index 0c09430304..68be0f4a2d 100644 --- a/sites/upsun/src/get-started/stacks/symfony/workers.md +++ b/sites/upsun/src/get-started/stacks/symfony/workers.md @@ -13,10 +13,12 @@ You can implement workers in Symfony smoothly thanks to the [Messenger component To deploy a worker, add an entry under the `workers` section [in your app configuration](/create-apps/_index.md): ```yaml {configFile="app"} -workers: - mails: +applications: + myapp: + workers: + mails: commands: - start: symfony console messenger:consume --time-limit=60 --memory-limit=128M + start: symfony console messenger:consume --time-limit=60 --memory-limit=128M ``` Note that the `symfony` binary is available when you use the [Symfony @@ -49,4 +51,4 @@ To share data between containers, use [services](/add-services/_index.md). {{< /note >}} -{{< guide-buttons previous="Back" next="Set up cron jobs" nextLink="/get-started/stacks/symfony/crons.md" type="*" >}} \ No newline at end of file +{{< guide-buttons previous="Back" next="Set up cron jobs" nextLink="/get-started/stacks/symfony/crons.md" type="*" >}} diff --git a/sites/upsun/src/get-started/stacks/wordpress.md b/sites/upsun/src/get-started/stacks/wordpress.md index b2aac4adfd..06630e2be3 100644 --- a/sites/upsun/src/get-started/stacks/wordpress.md +++ b/sites/upsun/src/get-started/stacks/wordpress.md @@ -59,27 +59,27 @@ make the following changes to your `./.upsun/config.yaml` file. Locate the `web:locations` section and update the root (`/`) location as follows: -```yaml {location="./.upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - web: - locations: - "/": - passthru: "/index.php" - root: "wordpress" - index: - - "index.php" - expires: 600 - scripts: true - allow: true - rules: - ^/license\.text$: - allow: false - ^/readme\.html$: - allow: false + myapp: + source: + root: "/" + type: 'php:8.3' + web: + locations: + "/": + passthru: "/index.php" + root: "wordpress" + index: + - "index.php" + expires: 600 + scripts: true + allow: true + rules: + ^/license\.text$: + allow: false + ^/readme\.html$: + allow: false ``` {{< note theme="info" >}} @@ -97,50 +97,50 @@ To set one up, follow these steps: 1. Create the location.
To do so, add a `/wp-content/uploads` location as follows: - ```yaml {location="./.upsun/config.yaml"} + ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - web: - locations: - "/": - passthru: "/index.php" - root: "wordpress" - index: - - "index.php" - expires: 600 - scripts: true - allow: true - rules: - ^/license\.text$: - allow: false - ^/readme\.html$: - allow: false - "/wp-content/uploads": - root: "wordpress/wp-content/uploads" - scripts: false - allow: false - rules: - '(? To do so, locate the `mounts:` section that is commented it out, and update it as follows: - ```yaml {location="./.upsun/config.yaml"} + ```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - ... - mounts: - "wordpress/wp-content/uploads": - source: storage - source_path: "uploads" + myapp: + source: + root: "/" + type: 'php:8.3' + ... + mounts: + "wordpress/wp-content/uploads": + source: storage + source_path: "uploads" ``` {{< note theme="info" >}} @@ -154,18 +154,18 @@ To ensure your Composer dependencies are installed during the [build stage](/lea locate the `build:` section (below the `hooks:` section).
Update the `build:` section as follows: -```yaml {location="./.upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - ... - hooks: - build: | - set -eux - composer install --prefer-dist --optimize-autoloader --apcu-autoloader --no-progress --no-ansi --no-interaction - rsync -a plugins/ wordpress/wp-content/plugins/ + myapp: + source: + root: "/" + type: 'php:8.3' + ... + hooks: + build: | + set -eux + composer install --prefer-dist --optimize-autoloader --apcu-autoloader --no-progress --no-ansi --no-interaction + rsync -a plugins/ wordpress/wp-content/plugins/ ``` You can adjust the `composer install` command to meet your specific requirements. @@ -188,22 +188,22 @@ To launch these tasks during the deploy hook, locate the `deploy:` section (below the `build:` section).
Update the `deploy:` section as follows: -```yaml {location="./.upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - ... - hooks: - deploy: | - set -eux - # Flushes the object cache - wp cache flush - # Runs the WordPress database update procedure - wp core update-db - # Runs all due cron events - wp cron event run --due-now + myapp: + source: + root: "/" + type: 'php:8.3' + ... + hooks: + deploy: | + set -eux + # Flushes the object cache + wp cache flush + # Runs the WordPress database update procedure + wp core update-db + # Runs all due cron events + wp cron event run --due-now ``` ## 6. Configure your default route @@ -213,23 +213,23 @@ To do so, locate the `routes:` section, and beneath it, the `"https://{default}/ Update the route as follows: -```yaml {location="./.upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - ... + myapp: + source: + root: "/" + type: 'php:8.3' + ... routes: - "https://{default}/": - type: upstream - upstream: "myapp:http" - cache: - enabled: true - cookies: - - '/^wordpress_*/' - - '/^wp-*/' + "https://{default}/": + type: upstream + upstream: "myapp:http" + cache: + enabled: true + cookies: + - '/^wordpress_*/' + - '/^wp-*/' ``` Matching the application name `myapp` with the `upstream` definition `myapp:http` is the most important setting to ensure at this stage. @@ -241,15 +241,15 @@ You need to update the name used to represent the [relationship](/create-apps/ap To do so, locate the `relationships:` top-level property. Update the relationship for the database service as follows: -```yaml {location="./.upsun/config.yaml"} +```yaml {configFile="app"} applications: - myapp: - source: - root: "/" - type: 'php:8.3' - ... - relationships: - database: "mariadb:mysql" + myapp: + source: + root: "/" + type: 'php:8.3' + # ... + relationships: + database: "mariadb:mysql" ``` You can now commit all the changes made to `.upsun/config.yaml` and push to {{% vendor/name %}}. diff --git a/sites/upsun/src/increase-observability/application-metrics/blackfire.md b/sites/upsun/src/increase-observability/application-metrics/blackfire.md index 6a0b445dc7..ce1f831d0a 100644 --- a/sites/upsun/src/increase-observability/application-metrics/blackfire.md +++ b/sites/upsun/src/increase-observability/application-metrics/blackfire.md @@ -47,7 +47,7 @@ This includes monitoring, profiling, alerting, and build-related features. Note that Blackfire monitoring is enabled by default on your production environment. On other environment types, you need to [enable it](#blackfire-monitoring). User access settings are replicated from the {{< vendor/name >}} Console to Blackfire -- this includes all [access levels](https://blackfire.io/docs/up-and-running/access-management). - + You might have Blackfire variables already set on your project. In this case, the existing variables override the settings of the automated integration. @@ -124,9 +124,11 @@ To do so, add [a configuration](../../define-routes/cache.md#allowing-only-speci similar to the following: ```yaml {configFile="routes"} -cache: - enabled: true - cookies: ["/SESS.*/", "__blackfire"] +routes: + "https://{default}/": + cache: + enabled: true + cookies: ["/SESS.*/", "__blackfire"] ``` ## Get support @@ -176,4 +178,4 @@ To do so, run the following commands: ```bash {{% vendor/cli %}} variable:delete php:blackfire.log_file {{% vendor/cli %}} variable:delete php:blackfire.log_level -``` \ No newline at end of file +``` diff --git a/sites/upsun/src/increase-observability/application-metrics/python.md b/sites/upsun/src/increase-observability/application-metrics/python.md index 2b3a3e355e..1fd005a728 100644 --- a/sites/upsun/src/increase-observability/application-metrics/python.md +++ b/sites/upsun/src/increase-observability/application-metrics/python.md @@ -58,8 +58,8 @@ Here is an example of how you can initiate the Python `profiler` on a basic app: ``` python def foo(): - import time - time.sleep(1.0) + import time + time.sleep(1.0) profiler = Profiler(application_name="my-python-app", labels={'my-extra-label': 'data'}) profiler.start() @@ -71,4 +71,4 @@ Here is an example of how you can initiate the Python `profiler` on a basic app: ``` bash python example.py - ``` \ No newline at end of file + ``` diff --git a/sites/upsun/src/increase-observability/logs/access-logs.md b/sites/upsun/src/increase-observability/logs/access-logs.md index e63772b670..a6df14582f 100644 --- a/sites/upsun/src/increase-observability/logs/access-logs.md +++ b/sites/upsun/src/increase-observability/logs/access-logs.md @@ -127,7 +127,7 @@ See an example of [uploading logs to Amazon S3](https://gitlab.com/contextualcod | Type | Always present | Description | | ------------- | -------------- | ----------- | -| `access` | Yes | The raw access log for the nginx instance running on the container. It doesn't include requests that are redirected or cached by the [router](../../define-routes/_index.md). | +| `access` | Yes | The raw access log for t`he nginx instance running on the container. It doesn't include requests that are redirected or cached by the [router](../../define-routes/_index.md). | | `app` | Yes | All log messages generated by the app including language errors and exceptions. | | `cron` | No | The output of cron jobs. Only exists after a cron job has run. | | `deploy` | No | The output of the [`deploy` hook](../../create-apps/hooks/hooks-comparison.md#deploy-hook). Only exists after a `deploy` hook has run. | diff --git a/sites/upsun/src/integrations/activity/reference.md b/sites/upsun/src/integrations/activity/reference.md index 709b9fefc7..e90f2199b6 100644 --- a/sites/upsun/src/integrations/activity/reference.md +++ b/sites/upsun/src/integrations/activity/reference.md @@ -677,7 +677,7 @@ The following example shows the full activity response to a Git push: "deploy": 49.954, "execute": 51.516 }, - "log": "Found 1 new commit\n\nBuilding application 'app' (runtime type: php:8.0, tree: 9851a01)\n Reusing existing build for this tree ID\n\nProvisioning certificates\n Certificates\n - certificate 5093946: expiring on 2023-02-23 11:09:20+00:00, covering {,www}.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}\n\n\nRedeploying environment main\n Preparing deployment\n Closing service app\n Opening application app and its relationships\n Executing deploy hook for application app\n hello world\n\n Opening environment\n Environment configuration\n app (type: php:8.0, size: S, disk: 2048)\n\n Environment routes\n http://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n http://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ is served by application `app`\n https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n", + "log": "Found 1 new commit\n\nBuilding application 'myapp' (runtime type: php:8.0, tree: 9851a01)\n Reusing existing build for this tree ID\n\nProvisioning certificates\n Certificates\n - certificate 5093946: expiring on 2023-02-23 11:09:20+00:00, covering {,www}.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}\n\n\nRedeploying environment main\n Preparing deployment\n Closing service myapp\n Opening application myapp and its relationships\n Executing deploy hook for application myapp\n hello world\n\n Opening environment\n Environment configuration\n myapp (type: php:8.0, size: S, disk: 2048)\n\n Environment routes\n http://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n http://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ is served by application `myapp`\n https://www.main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/ redirects to https://main-abcd123-abcdefgh1234567.eu-3.{{< vendor/urlraw "hostname" >}}/\n", "payload": { "user": { "id": "c9926428-44dc-4b10-be03-a26dd43b44c1", @@ -897,7 +897,7 @@ The following example shows the full activity response to a Git push: "ssi": { "enabled": false }, - "upstream": "app:http", + "upstream": "myapp:http", "redirects": { "expires": "-1s", "paths": {} diff --git a/sites/upsun/src/languages/dotnet.md b/sites/upsun/src/languages/dotnet.md index f00b371917..0ce913740e 100644 --- a/sites/upsun/src/languages/dotnet.md +++ b/sites/upsun/src/languages/dotnet.md @@ -21,18 +21,18 @@ When you deploy your app, you always get the latest available patches. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'dotnet:' + # The app's name, which must be unique within the project. + : + type: 'dotnet:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'dotnet:{{% latest "dotnet" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'dotnet:{{% latest "dotnet" %}}' ``` ## Building the application @@ -42,14 +42,14 @@ with the default [framework-dependent deployment](https://docs.microsoft.com/en- ```yaml {configFile="app"} applications: - app: - type: 'dotnet:{{% latest "dotnet" %}}' - hooks: - build: | - set -xe - dotnet publish --output "$PLATFORM_OUTPUT_DIR" \ - -p:UseRazorBuildServer=false \ - -p:UseSharedCompilation=false + myapp: + type: 'dotnet:{{% latest "dotnet" %}}' + hooks: + build: | + set -xe + dotnet publish --output "$PLATFORM_OUTPUT_DIR" \ + -p:UseRazorBuildServer=false \ + -p:UseSharedCompilation=false ``` where `PLATFORM_OUTPUT_DIR` is the output directory for compiled languages available at build time. @@ -89,37 +89,37 @@ while routing other traffic to the .NET application. ```yaml {configFile="app"} applications: - app: - type: 'dotnet:{{% latest "dotnet" %}}' - web: - locations: - "/": - root: "wwwroot" - allow: true - passthru: true - rules: - # Serve these common asset types with customs cache headers. - \.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$: - allow: true - expires: 300s - commands: - start: "dotnet WebApplication1.dll" + myapp: + type: 'dotnet:{{% latest "dotnet" %}}' + web: + locations: + "/": + root: "wwwroot" + allow: true + passthru: true + rules: + # Serve these common asset types with customs cache headers. + \.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$: + allow: true + expires: 300s + commands: + start: "dotnet WebApplication1.dll" ``` You can also route all requests to the application unconditionally: ```yaml {configFile="app"} applications: - app: - type: 'dotnet:{{% latest "dotnet" %}}' - web: - locations: - "/": - allow: false - passthru: true - - commands: - start: "dotnet WebApplication1.dll" + myapp: + type: 'dotnet:{{% latest "dotnet" %}}' + web: + locations: + "/": + allow: false + passthru: true + + commands: + start: "dotnet WebApplication1.dll" ``` {{< repolist lang="dotnet" displayName=".NET Core" >}} diff --git a/sites/upsun/src/languages/elixir.md b/sites/upsun/src/languages/elixir.md index 3dd621158d..4c5f5a5fac 100644 --- a/sites/upsun/src/languages/elixir.md +++ b/sites/upsun/src/languages/elixir.md @@ -20,18 +20,18 @@ When you deploy your app, you always get the latest available patches. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'elixir:' + # The app's name, which must be unique within the project. + : + type: 'elixir:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'elixir:{{% latest "elixir" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'elixir:{{% latest "elixir" %}}' ``` ## Built-in variables @@ -58,11 +58,11 @@ If you are using Hex to manage your dependencies, you need to specify the `MIX_E ```yaml {configFile="app"} applications: - app: - type: 'elixir:{{% latest "elixir" %}}' - variables: - env: - MIX_ENV: 'prod' + myapp: + type: 'elixir:{{% latest "elixir" %}}' + variables: + env: + MIX_ENV: 'prod' ``` The `SECRET_KEY_BASE` variable is generated automatically based on the [`PLATFORM_PROJECT_ENTROPY` variable](../development/variables/use-variables.md#use-provided-variables). You can change it. @@ -71,13 +71,13 @@ Include in your build hook the steps to retrieve a local Hex and `rebar`, and th ```yaml {configFile="app"} applications: - app: - type: 'elixir:{{% latest "elixir" %}}' - hooks: - build: | - mix local.hex --force - mix local.rebar --force - mix do deps.get --only prod, deps.compile, compile + myapp: + type: 'elixir:{{% latest "elixir" %}}' + hooks: + build: | + mix local.hex --force + mix local.rebar --force + mix do deps.get --only prod, deps.compile, compile ``` {{< note >}} @@ -94,26 +94,26 @@ The following basic app configuration is sufficient to run most Elixir applicati ```yaml {configFile="app"} applications: - app: - type: 'elixir:{{% latest "elixir" %}}' - - variables: - env: - MIX_ENV: 'prod' - - hooks: - build: | - mix local.hex --force - mix local.rebar --force - mix do deps.get --only prod, deps.compile, compile - - web: - commands: - start: mix phx.server - locations: - /: - allow: false - passthru: true + myapp: + type: 'elixir:{{% latest "elixir" %}}' + + variables: + env: + MIX_ENV: 'prod' + + hooks: + build: | + mix local.hex --force + mix local.rebar --force + mix do deps.get --only prod, deps.compile, compile + + web: + commands: + start: mix phx.server + locations: + /: + allow: false + passthru: true ``` Note that there is still an Nginx proxy server sitting in front of your application. If desired, certain paths may be served directly by Nginx without hitting your application (for static files, primarily) or you may route all requests to the Elixir application unconditionally, as in the example above. @@ -143,17 +143,17 @@ Given a [relationship](/create-apps/app-reference/single-runtime-image#relations ```yaml {configFile="app"} applications: - myapp: - type: 'elixir:{{% latest "elixir" %}}' + myapp: + type: 'elixir:{{% latest "elixir" %}}' - [...] + [...] - # 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: - postgresql: + # 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: + postgresql: ``` Assuming you have in `mix.exs` the Poison library to parse JSON: @@ -181,7 +181,10 @@ config :my_app, Repo, and setup Ecto during the deploy hook: -```yaml -deploy: | - mix do ecto.setup +```yaml {configFile="app"} +applications: + myapp: + hooks: + deploy: | + mix do ecto.setup ``` diff --git a/sites/upsun/src/languages/go.md b/sites/upsun/src/languages/go.md index 51740de190..ac1d0dd7ca 100644 --- a/sites/upsun/src/languages/go.md +++ b/sites/upsun/src/languages/go.md @@ -20,18 +20,18 @@ When you deploy your app, you always get the latest available patches. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'golang:' + # The app's name, which must be unique within the project. + : + type: 'golang:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'golang:{{% latest "golang" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'golang:{{% latest "golang" %}}' ``` {{% deprecated-versions %}} @@ -50,30 +50,30 @@ The following basic `{{< vendor/configfile "app" >}}` file is sufficient to run ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'golang:{{% latest "golang" %}}' - - hooks: - build: | - # Modify this line if you want to build differently or - # use an alternate name for your executable. - go build -o bin/app - - web: - upstream: - socket_family: tcp - protocol: http - - commands: - # If you change the build output in the build hook above, update this line as well. - start: ./bin/app - - locations: - /: - # Route all requests to the Go app, unconditionally. - allow: false - passthru: true + # The app's name, which must be unique within the project. + myapp: + type: 'golang:{{% latest "golang" %}}' + + hooks: + build: | + # Modify this line if you want to build differently or + # use an alternate name for your executable. + go build -o bin/app + + web: + upstream: + socket_family: tcp + protocol: http + + commands: + # If you change the build output in the build hook above, update this line as well. + start: ./bin/app + + locations: + /: + # Route all requests to the Go app, unconditionally. + allow: false + passthru: true ``` Note that there is still an Nginx proxy server sitting in front of your application. diff --git a/sites/upsun/src/languages/java/_index.md b/sites/upsun/src/languages/java/_index.md index bb9908e8ac..51f4ba96be 100644 --- a/sites/upsun/src/languages/java/_index.md +++ b/sites/upsun/src/languages/java/_index.md @@ -25,18 +25,18 @@ To save space and reduce potential vulnerabilities, they don't contain GUI class ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'java:' + # The app's name, which must be unique within the project. + : + type: 'java:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'java:{{% latest "java" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'java:{{% latest "java" %}}' ``` ## Support build automation @@ -57,21 +57,21 @@ Add something like the following to your [app configuration](../../create-apps/_ ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'java:{{% latest "java" %}}' - - variables: - env: - MAVEN_VERSION: {{< variable "DESIRED_VERSION_NUMBER" "3.8.6" >}} - - hooks: - build: | - curl -sfLO "https://dlcdn.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" - tar -zxf apache-maven-$MAVEN_VERSION-bin.tar.gz - export PATH="$PWD/apache-maven-$MAVEN_VERSION/bin:$PATH" - mvn --version - mvn clean package + # The app's name, which must be unique within the project. + myapp: + type: 'java:{{% latest "java" %}}' + + variables: + env: + MAVEN_VERSION: {{< variable "DESIRED_VERSION_NUMBER" "3.8.6" >}} + + hooks: + build: | + curl -sfLO "https://dlcdn.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" + tar -zxf apache-maven-$MAVEN_VERSION-bin.tar.gz + export PATH="$PWD/apache-maven-$MAVEN_VERSION/bin:$PATH" + mvn --version + mvn clean package ``` ## Other JVM languages diff --git a/sites/upsun/src/languages/java/migration.md b/sites/upsun/src/languages/java/migration.md index bd45641144..b831008cd5 100644 --- a/sites/upsun/src/languages/java/migration.md +++ b/sites/upsun/src/languages/java/migration.md @@ -40,14 +40,14 @@ and [services](../../add-services/_index.md). ```yaml {configFile="app"} applications: - app: - type: 'java:' - - hooks: - build: [2] - web: - commands: - start: [3] + myapp: + type: 'java:' + + hooks: + build: [2] + web: + commands: + start: [3] ``` 1. [A Java version](/languages/java/_index.md#supported-versions), e,g.: `java:{{% latest "java" %}}` 2. [Hooks define what happens when building the application](../../create-apps/hooks/_index.md). This build process typically generates an executable file such as a uber-jar. For example, `mvn clean package`. @@ -64,24 +64,24 @@ Be aware that after the build, it creates a read-only system. You have the [moun ```yaml {configFile="app"} routes: - "https://{default}/": - type: upstream - upstream: "app:http" [1] - "https://www.{default}/": - type: redirect - to: "https://{default}/" + "https://{default}/": + type: upstream + upstream: "myapp:http" [1] + "https://www.{default}/": + type: redirect + to: "https://{default}/" applications: - app: - type: 'java:' - - hooks: - build: [2] - web: - commands: - start: [3] + myapp: + type: 'java:' + + hooks: + build: [2] + web: + commands: + start: [3] ``` -1. It defines the application will link in the route. For example,`"app:http"`. +1. It defines the application will link in the route. For example,`"myapp:http"`. {{< note version="1" >}} Application instances have a limited amount of memory at build time, which has a maximum of 8 GB. @@ -236,16 +236,16 @@ This `.environment` file can interact to each application file. **Example:** -```yaml +```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'java:{{% latest "java" %}}' - hooks: - build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true - relationships: - postgresql: - web: - commands: - start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT jarfile.jar + # The app's name, which must be unique within the project. + myapp: + type: 'java:{{% latest "java" %}}' + hooks: + build: ./mvnw package -DskipTests -Dquarkus.package.uber-jar=true + relationships: + postgresql: + web: + commands: + start: java -jar $JAVA_OPTS $CREDENTIAL -Dquarkus.http.port=$PORT jarfile.jar ``` diff --git a/sites/upsun/src/languages/lisp.md b/sites/upsun/src/languages/lisp.md index b583999515..f8e4bb81f7 100644 --- a/sites/upsun/src/languages/lisp.md +++ b/sites/upsun/src/languages/lisp.md @@ -20,18 +20,18 @@ When you deploy your app, you always get the latest available patches. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'lisp:' + # The app's name, which must be unique within the project. + : + type: 'lisp:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'lisp:{{% latest "lisp" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'lisp:{{% latest "lisp" %}}' ``` ## Assumptions @@ -46,10 +46,10 @@ If you don't want these assumptions, you can disable this behavior by specifying ```yaml {configFile="app"} applications: - app: - type: 'lisp:{{% latest "lisp" %}}' - build: - flavor: none + myapp: + type: 'lisp:{{% latest "lisp" %}}' + build: + flavor: none ``` ## Dependencies @@ -62,28 +62,28 @@ If you wish to change the distributions that QuickLisp is using, you can specify ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'lisp:' - runtime: - quicklisp: - {{< variable "DISTRIBUTION_NAME" >}}: - url: "..." - version: "..." + # The app's name, which must be unique within the project. + : + type: 'lisp:' + runtime: + quicklisp: + {{< variable "DISTRIBUTION_NAME" >}}: + url: "..." + version: "..." ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'lisp:{{% latest "lisp" %}}' - runtime: - quicklisp: - quicklisp: - url: 'http://beta.quicklisp.org/dist/quicklisp.txt' - version: '2019-07-11' + # The app's name, which must be unique within the project. + myapp: + type: 'lisp:{{% latest "lisp" %}}' + runtime: + quicklisp: + quicklisp: + url: 'http://beta.quicklisp.org/dist/quicklisp.txt' + version: '2019-07-11' ``` ## Built-in variables @@ -105,15 +105,15 @@ The following basic `{{< vendor/configfile "app" >}}` file is sufficient to run ```yaml {configFile="app"} applications: - app: - type: 'lisp:{{% latest "lisp" %}}' - web: - commands: - start: ./example - locations: - /: - allow: false - passthru: true + myapp: + type: 'lisp:{{% latest "lisp" %}}' + web: + commands: + start: ./example + locations: + /: + allow: false + passthru: true ``` Note that a proxy server is still in front of your app. @@ -149,10 +149,10 @@ title=Using default endpoints ```yaml {configFile="app"} applications: - app: - type: 'lisp:{{% latest "lisp" %}}' - relationships: - postgresql: + myapp: + type: 'lisp:{{% latest "lisp" %}}' + relationships: + postgresql: ``` <---> @@ -163,14 +163,14 @@ title=Using explicit endpoints ```yaml {configFile="app"} applications: - app: - type: 'lisp:{{% latest "lisp" %}}' - relationships: - # Please note: Legacy definition of the relationship is still supported: - # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships - postgresql: - service: 'postgresql' - endpoint: 'postgresql' + myapp: + type: 'lisp:{{% latest "lisp" %}}' + relationships: + # Please note: Legacy definition of the relationship is still supported: + # More information: https://docs.platform.sh/create-apps/app-reference/single-runtime-image.html#relationships + postgresql: + service: 'postgresql' + endpoint: 'postgresql' ``` {{< /codetabs >}} diff --git a/sites/upsun/src/languages/nodejs/_index.md b/sites/upsun/src/languages/nodejs/_index.md index 1542a6a52b..8c05c5150d 100644 --- a/sites/upsun/src/languages/nodejs/_index.md +++ b/sites/upsun/src/languages/nodejs/_index.md @@ -27,18 +27,18 @@ To use Node.js, specify ``nodejs`` as your [app’s type](/create-apps/app-refer ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'nodejs:' + # The app's name, which must be unique within the project. + : + type: 'nodejs:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'nodejs:{{% latest "nodejs" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'nodejs:{{% latest "nodejs" %}}' ``` To use a specific version in a container with a different language, [use a version manager](node-version.md). @@ -59,9 +59,9 @@ and add it to your app configuration: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'nodejs:{{% latest "nodejs" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'nodejs:{{% latest "nodejs" %}}' ``` ### 2. Specify any global dependencies @@ -70,12 +70,12 @@ Add the following to your app configuration: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'nodejs:{{% latest "nodejs" %}}' - dependencies: - nodejs: - sharp: "*" + # The app's name, which must be unique within the project. + myapp: + type: 'nodejs:{{% latest "nodejs" %}}' + dependencies: + nodejs: + sharp: "*" ``` These are now available as commands, the same as installing with `npm install -g`. @@ -86,16 +86,16 @@ Include any commands needed to build and setup your app in the `hooks`, as in th ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'nodejs:{{% latest "nodejs" %}}' - dependencies: - nodejs: - sharp: "*" - hooks: - build: | - npm run setup-assets - npm run build + # The app's name, which must be unique within the project. + myapp: + type: 'nodejs:{{% latest "nodejs" %}}' + dependencies: + nodejs: + sharp: "*" + hooks: + build: | + npm run setup-assets + npm run build ``` ### 4. Start your app @@ -104,19 +104,19 @@ Specify a command to start serving your app (it must be a process running in the ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'nodejs:{{% latest "nodejs" %}}' - dependencies: - nodejs: - sharp: "*" - hooks: - build: | - npm run setup-assets - npm run build - web: - commands: - start: node index.js + # The app's name, which must be unique within the project. + myapp: + type: 'nodejs:{{% latest "nodejs" %}}' + dependencies: + nodejs: + sharp: "*" + hooks: + build: | + npm run setup-assets + npm run build + web: + commands: + start: node index.js ``` ### 5. Listen on the right port @@ -144,19 +144,19 @@ A complete basic app configuration looks like the following: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - 'node-app': - type: 'nodejs:{{% latest "nodejs" %}}' - dependencies: - nodejs: - sharp: "*" - hooks: - build: | - npm run setup-assets - npm run build - web: - commands: - start: "node index.js" + # The app's name, which must be unique within the project. + 'node-app': + type: 'nodejs:{{% latest "nodejs" %}}' + dependencies: + nodejs: + sharp: "*" + hooks: + build: | + npm run setup-assets + npm run build + web: + commands: + start: "node index.js" ``` ## Dependencies @@ -178,11 +178,11 @@ To switch to Yarn to manage dependencies, follow these steps: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'nodejs:{{% latest "nodejs" %}}' - build: - flavor: none + # The app's name, which must be unique within the project. + myapp: + type: 'nodejs:{{% latest "nodejs" %}}' + build: + flavor: none ``` 2. Specify the version of Yarn you want: @@ -208,8 +208,8 @@ title=Yarn 3.x and Node.js 16+ {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' hooks: - build: | - corepack yarn install + build: | + corepack yarn install {{< /snippet >}} ``` @@ -225,8 +225,8 @@ title=Yarn 3.x and Node.js 14 {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - corepack: "*" + nodejs: + corepack: "*" {{< /snippet >}} ``` @@ -236,8 +236,8 @@ dependencies: {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' hooks: - build: | - corepack yarn install + build: | + corepack yarn install {{< /snippet >}} ``` @@ -253,8 +253,8 @@ title=Yarn < 3 {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' dependencies: - nodejs: - yarn: "1.22.19" + nodejs: + yarn: "1.22.19" {{< /snippet >}} ``` @@ -264,8 +264,8 @@ dependencies: {{< snippet name="myapp" config="app" root="/" >}} type: 'nodejs:{{% latest "nodejs" %}}' hooks: - build: | - yarn --frozen-lockfile + build: | + yarn --frozen-lockfile {{< /snippet >}} ``` @@ -280,16 +280,16 @@ use the following configuration: ```yaml {configFile="app"} applications: - # The name of your app. - myapp: - # Choose Node.js version 20 or above. - type: 'nodejs:20' - # Override the default Node.js build flavor. - build: - flavor: none - # Use Bun to install the dependencies. - hooks: - build: bun install + # The name of your app. + myapp: + # Choose Node.js version 20 or above. + type: 'nodejs:20' + # Override the default Node.js build flavor. + build: + flavor: none + # Use Bun to install the dependencies. + hooks: + build: bun install ``` #### Use Bun as a runtime @@ -298,20 +298,20 @@ You can even [use Bun as a runtime](https://platform.sh/blog/bun-support-is-here ```yaml {configFile="app"} applications: - # The name of your app. - myapp: + # The name of your app. + myapp: # Choose Node.js version 20 or above. - type: 'nodejs:20' - # Override the default Node.js build flavor. - build: - flavor: none - # Use Bun to install the dependencies. - hooks: - build: bun install - # In the start command replace node with Bun. - web: - commands: - start: 'bun app.js' + type: 'nodejs:20' + # Override the default Node.js build flavor. + build: + flavor: none + # Use Bun to install the dependencies. + hooks: + build: bun install + # In the start command replace node with Bun. + web: + commands: + start: 'bun app.js' ``` ## Connecting to services diff --git a/sites/upsun/src/languages/nodejs/node-version.md b/sites/upsun/src/languages/nodejs/node-version.md index ed681e0b8b..959ea11c45 100644 --- a/sites/upsun/src/languages/nodejs/node-version.md +++ b/sites/upsun/src/languages/nodejs/node-version.md @@ -76,12 +76,12 @@ This property accepts either an exact version or a range: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - nodejs: - n: "*" + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + nodejs: + n: "*" ``` Adding it as a dependency ensures it's cached for future builds. @@ -89,39 +89,39 @@ applications: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - nodejs: - n: "*" - variables: - env: - N_PREFIX: /app/.global + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + nodejs: + n: "*" + variables: + env: + N_PREFIX: /app/.global ``` 4. Install the specified version of Node.js in a [`build` hook](../../create-apps/hooks/hooks-comparison.md#build-hook): ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - nodejs: - n: "*" - variables: - env: - N_PREFIX: /app/.global - hooks: - build: | - # Exit the hook on any failure - set -e - - # Install the version specified in the .nvmrc file - n auto - - # Reset the location hash to recognize the newly installed version - hash -r + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + nodejs: + n: "*" + variables: + env: + N_PREFIX: /app/.global + hooks: + build: | + # Exit the hook on any failure + set -e + + # Install the version specified in the .nvmrc file + n auto + + # Reset the location hash to recognize the newly installed version + hash -r ``` Now your hooks should be able to use the specified version of Node.js. You can verify this by running `node -v`. @@ -130,25 +130,25 @@ Your final app configuration should look something like this: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - nodejs: - n: "*" - variables: - env: - N_PREFIX: /app/.global - hooks: - build: | - # Exit the hook on any failure - set -e - - # Install the version specified in the .nvmrc file - n auto - - # Reset the location hash to recognize the newly installed version - hash -r + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + nodejs: + n: "*" + variables: + env: + N_PREFIX: /app/.global + hooks: + build: | + # Exit the hook on any failure + set -e + + # Install the version specified in the .nvmrc file + n auto + + # Reset the location hash to recognize the newly installed version + hash -r ``` ## Use `nvm` @@ -163,58 +163,60 @@ You can use it to: To use `nvm`, follow these steps: 1. Define which `nvm` version to use using an [environment variable](../../development/variables/_index.md). - Add it to your [app configuration](../../create-apps/_index.md): + Add it to your [app configuration](../../create-apps/_index.md): -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'python:{{% latest "python" %}}' variables: - env: - # Update for your desired NVM version. - NVM_VERSION: v0.39.3 -``` + env: + # Update for your desired NVM version. + NVM_VERSION: v0.39.3 + ``` + 2. Define your desired Node.js version using an environment variable. - For your base version, set it in your app configuration: -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + For your base version, set it in your app configuration: + + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'python:{{% latest "python" %}}' variables: - env: - # Update these for your desired NVM and Node versions. - NVM_VERSION: v0.39.3 - NODE_VERSION: v18.14.2 -``` - To get different versions in different environments, [set environment-specific variables](../../development/variables/set-variables.md#create-environment-specific-variables). + env: + # Update these for your desired NVM and Node versions. + NVM_VERSION: v0.39.3 + NODE_VERSION: v18.14.2 + ``` + To get different versions in different environments, [set environment-specific variables](../../development/variables/set-variables.md#create-environment-specific-variables). 3. Add a `.nvm` directory to your cache in your [build hook](../../create-apps/hooks/_index.md): -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'python:{{% latest "python" %}}' variables: - env: - # Update these for your desired NVM and Node versions. - NVM_VERSION: v0.39.3 - NODE_VERSION: v18.14.2 + env: + # Update these for your desired NVM and Node versions. + NVM_VERSION: v0.39.3 + NODE_VERSION: v18.14.2 hooks: - build: | - set -e - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - - # Link cache with app - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then - mkdir -p $PLATFORM_CACHE_DIR/.nvm - fi - ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR -``` + build: | + set -e + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + + # Link cache with app + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then + mkdir -p $PLATFORM_CACHE_DIR/.nvm + fi + ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR + ``` {{< note >}} Instead of using a symlink between your cache and application directories, @@ -229,86 +231,86 @@ applications: 4. Use the cache directory and install based on the variables if not present: -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'python:{{% latest "python" %}}' variables: - env: - # Update these for your desired NVM and Node versions. - NVM_VERSION: v0.39.3 - NODE_VERSION: v18.14.2 + env: + # Update these for your desired NVM and Node versions. + NVM_VERSION: v0.39.3 + NODE_VERSION: v18.14.2 hooks: - build: | - ... - # Check for Node.js version and install if not present - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then - - # Get nvm install script if correct version not present - export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" - if [ ! -f "$NVM_INSTALL_FILE" ]; then - wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" - fi - - # Install, automatically using NODE_VERSION - bash $NVM_INSTALL_FILE - fi - - # Activate nvm - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - # Use the specified version - nvm use "$NODE_VERSION" -``` + build: | + ... + # Check for Node.js version and install if not present + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then + + # Get nvm install script if correct version not present + export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" + if [ ! -f "$NVM_INSTALL_FILE" ]; then + wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" + fi + + # Install, automatically using NODE_VERSION + bash $NVM_INSTALL_FILE + fi + + # Activate nvm + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + # Use the specified version + nvm use "$NODE_VERSION" + ``` 5. Optional: To use the specified Node.js version in the runtime container and not just the build, activate `nvm` via [script](../../development/variables/set-variables.md#set-variables-via-script): - ```bash {location=".environment"} - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - ``` + ```bash {location=".environment"} + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + ``` -Your final app configuration should look something like the following: + Your final app configuration should look something like the following: -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'python:{{% latest "python" %}}' variables: - env: - # Update these for your desired NVM and Node versions. - NVM_VERSION: v0.39.3 - NODE_VERSION: v18.14.2 + env: + # Update these for your desired NVM and Node versions. + NVM_VERSION: v0.39.3 + NODE_VERSION: v18.14.2 hooks: - build: | - set -e - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - - # Link cache with app - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then - mkdir -p $PLATFORM_CACHE_DIR/.nvm - fi - ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR - # Check for Node.js version and install if not present - if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then - - # Get nvm install script if correct version not present - export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" - if [ ! -f "$NVM_INSTALL_FILE" ]; then - wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" - fi - - # Install, automatically using NODE_VERSION - bash $NVM_INSTALL_FILE - fi - - # Activate nvm - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - # Use the specified version - nvm use "$NODE_VERSION" -``` + build: | + set -e + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + + # Link cache with app + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm" ]; then + mkdir -p $PLATFORM_CACHE_DIR/.nvm + fi + ln -s $PLATFORM_CACHE_DIR/.nvm $NVM_DIR + # Check for Node.js version and install if not present + if [ ! -d "$PLATFORM_CACHE_DIR/.nvm/versions/node/$NODE_VERSION" ]; then + + # Get nvm install script if correct version not present + export NVM_INSTALL_FILE="${PLATFORM_CACHE_DIR}/nvm_${NVM_VERSION}_install.sh" + if [ ! -f "$NVM_INSTALL_FILE" ]; then + wget -nc -O "$NVM_INSTALL_FILE" "https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh" + fi + + # Install, automatically using NODE_VERSION + bash $NVM_INSTALL_FILE + fi + + # Activate nvm + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + # Use the specified version + nvm use "$NODE_VERSION" + ``` diff --git a/sites/upsun/src/languages/php/_index.md b/sites/upsun/src/languages/php/_index.md index 03975f2057..501188c400 100644 --- a/sites/upsun/src/languages/php/_index.md +++ b/sites/upsun/src/languages/php/_index.md @@ -26,18 +26,18 @@ Note that from PHP versions 7.1 to 8.1, the images support the Zend Thread Safe ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'php:' + # The app's name, which must be unique within the project. + : + type: 'php:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' ``` {{% deprecated-versions %}} @@ -55,9 +55,9 @@ and add it to your [app configuration](../../create-apps/_index.md): ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' ``` ### 2. Serve your app @@ -90,14 +90,14 @@ and nonexistent files are handled by `app.php`: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - web: - locations: - '/': - root: 'public' - passthru: '/app.php' + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + web: + locations: + '/': + root: 'public' + passthru: '/app.php' ``` See how to [create a basic PHP app with a front controller](../../create-apps/web/php-basic.md). To have more control, you can define rules to specify which files you want to allow [from which location](../../create-apps/web/php-basic.md#set-different-rules-for-specific-locations). @@ -108,14 +108,14 @@ A complete basic app configuration looks like the following: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - web: - locations: - '/': - root: 'public' - passthru: '/app.php' + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + web: + locations: + '/': + root: 'public' + passthru: '/app.php' ``` ## Dependencies @@ -130,13 +130,13 @@ To use Composer 2.x on your project, either use PHP 8.2+ or, in your app configu ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - ... - dependencies: - php: - composer/composer: '^2' + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + [...] + dependencies: + php: + composer/composer: '^2' ``` Adding a dependency to the [dependencies block](/create-apps/app-reference/single-runtime-image.md#dependencies) makes it available globally. So you can then use included dependencies as commands within your app container. @@ -156,17 +156,17 @@ Set the build flavor to `none` and add the commands you need to your `build` hoo ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - ... - build: - flavor: none - - hooks: - build: | - set -e - composer install --no-interaction --no-dev + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + [...] + build: + flavor: none + + hooks: + build: | + set -e + composer install --no-interaction --no-dev ``` That installs production dependencies with Composer but not development dependencies. The same can be achieved by using the default build flavor and [adding the `COMPOSER_NO_DEV` variable](../../development/variables/set-variables.md). @@ -185,14 +185,14 @@ To install from an alternative repository: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - ... - dependencies: - php: - require: - "platformsh/client": "2.x-dev" + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + [...] + dependencies: + php: + require: + "platformsh/client": "2.x-dev" ``` This is equivalent to `composer require platform/client 2.x-dev`. @@ -200,17 +200,17 @@ applications: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - ... - dependencies: - php: - require: - "platformsh/client": "2.x-dev" - repositories: - - type: vcs - url: "git@github.com:platformsh/platformsh-client-php.git" + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + [...] + dependencies: + php: + require: + "platformsh/client": "2.x-dev" + repositories: + - type: vcs + url: "git@github.com:platformsh/platformsh-client-php.git" ``` That installs `platformsh/client` from the specified repository URL as a global dependency. @@ -219,18 +219,18 @@ use the following: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - ... - dependencies: - php: - composer/composer: '^2' - require: - "platformsh/client": "2.x-dev" - repositories: - - type: vcs - url: "git@github.com:platformsh/platformsh-client-php.git" + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + [...] + dependencies: + php: + composer/composer: '^2' + require: + "platformsh/client": "2.x-dev" + repositories: + - type: vcs + url: "git@github.com:platformsh/platformsh-client-php.git" ``` ## Connect to services @@ -433,12 +433,12 @@ For example, to disable `pcntl_exec` and `pcntl_fork`, add the following to your ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - disable_functions: "pcntl_exec,pcntl_fork" + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + disable_functions: "pcntl_exec,pcntl_fork" ``` Common functions to disable include: @@ -488,13 +488,14 @@ title=Run a custom script +++ 1. Add your script in a PHP file. + 2. Specify an alternative `start` command by adapting the following: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} web: - commands: - start: /usr/bin/start-php-app + commands: + start: /usr/bin/start-php-app {{< /snippet >}} ``` @@ -511,8 +512,8 @@ title=Run a custom web server ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} web: - commands: - start: /usr/bin/start-php-app + commands: + start: /usr/bin/start-php-app {{< /snippet >}} ``` @@ -521,26 +522,26 @@ web: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} web: - upstream: - socket_family: tcp - protocol: http + upstream: + socket_family: tcp + protocol: http {{< /snippet >}} ``` - When you listen on a TCP socket, the `$PORT` environment variable is automatically set. - See more options on how to [configure where requests are sent](/create-apps/app-reference/single-runtime-image.md#upstream). - You might have to configure your app to connect via the `$PORT` TCP socket, - especially when using web servers such as [Swoole](swoole.md) or [Roadrunner](https://github.com/roadrunner-server/roadrunner). +When you listen on a TCP socket, the `$PORT` environment variable is automatically set. +See more options on how to [configure where requests are sent](/create-apps/app-reference/single-runtime-image.md#upstream). +You might have to configure your app to connect via the `$PORT` TCP socket, +especially when using web servers such as [Swoole](swoole.md) or [Roadrunner](https://github.com/roadrunner-server/roadrunner). 4. Optional: Override redirects to let the custom web server handle them: ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} locations: - "/": - passthru: true - scripts: false - allow: false + "/": + passthru: true + scripts: false + allow: false {{< /snippet >}} ``` @@ -559,8 +560,8 @@ To execute runtime-specific tasks (such as clearing cache) before your app start ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} web: - commands: - start: bash {{< variable "PATH_TO_SCRIPT" >}} && /usr/bin/start-php-app + commands: + start: bash {{< variable "PATH_TO_SCRIPT" >}} && /usr/bin/start-php-app {{< /snippet >}} ``` @@ -591,11 +592,11 @@ To leverage FFIs, follow these steps: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - runtime: - extensions: - - ffi + myapp: + type: 'php:{{% latest "php" %}}' + runtime: + extensions: + - ffi ``` 3. Make sure that your [preload script](./tuning.md#opcache-preloading) calls the `FFI::load()` function. @@ -606,11 +607,11 @@ applications: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - opcache.enable_cli: true + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + opcache.enable_cli: true ``` 5. Run your script with the following command: @@ -653,9 +654,7 @@ Here is an example configuration: ```yaml {configFile="app"} applications: - frontend: - stack: - "php@8.3": extensions: @@ -685,4 +684,4 @@ applications: You can also set your [app's runtime timezone](/create-apps/timezone.md). -{{% /note %}} \ No newline at end of file +{{% /note %}} diff --git a/sites/upsun/src/languages/php/extensions.md b/sites/upsun/src/languages/php/extensions.md index 33ad6b66de..4db92cff43 100644 --- a/sites/upsun/src/languages/php/extensions.md +++ b/sites/upsun/src/languages/php/extensions.md @@ -27,16 +27,16 @@ You can define the PHP extensions you want to enable or disable: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - runtime: - extensions: - - raphf - - http - - igbinary - - redis - disabled_extensions: - - sqlite3 + myapp: + type: 'php:{{% latest "php" %}}' + runtime: + extensions: + - raphf + - http + - igbinary + - redis + disabled_extensions: + - sqlite3 ``` You can also [include configuration options](/create-apps/app-reference/single-runtime-image.md#extensions) for specific extensions. @@ -85,9 +85,9 @@ but it takes slightly more work: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - extension: /app/spiffy.so + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + extension: /app/spiffy.so ``` diff --git a/sites/upsun/src/languages/php/fpm.md b/sites/upsun/src/languages/php/fpm.md index 80b6bb6802..863e98b12c 100644 --- a/sites/upsun/src/languages/php/fpm.md +++ b/sites/upsun/src/languages/php/fpm.md @@ -102,12 +102,12 @@ you can use: <---> ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - runtime: - sizing_hints: - request_memory: 110 - reserved_memory: 80 + myapp: + type: 'php:{{% latest "php" %}}' + runtime: + sizing_hints: + request_memory: 110 + reserved_memory: 80 ``` Note that the minimum value for the `request_memory` key is 10 MB and the minimum value for the `reserved_memory` key is 70 MB. diff --git a/sites/upsun/src/languages/php/redis.md b/sites/upsun/src/languages/php/redis.md index 4cddefa9fe..af4ea5179d 100644 --- a/sites/upsun/src/languages/php/redis.md +++ b/sites/upsun/src/languages/php/redis.md @@ -31,13 +31,13 @@ Any tagged version of the library is acceptable: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - hooks: - build: | - set -e - # Install PhpRedis v5.3.7: - curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-phpredis.sh | { bash /dev/fd/3 5.3.7 ; } 3<&0 + myapp: + type: 'php:{{% latest "php" %}}' + hooks: + build: | + set -e + # Install PhpRedis v5.3.7: + curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-phpredis.sh | { bash /dev/fd/3 5.3.7 ; } 3<&0 ``` ## Install Relay @@ -57,13 +57,13 @@ Any tagged version of the library is acceptable: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - hooks: - build: | - set -e - # Install Relay v0.6.0: - curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-relay.sh | { bash /dev/fd/3 v0.6.0 ; } 3<&0 + myapp: + type: 'php:{{% latest "php" %}}' + hooks: + build: | + set -e + # Install Relay v0.6.0: + curl -fsS https://raw.githubusercontent.com/platformsh/snippets/main/src/install-relay.sh | { bash /dev/fd/3 v0.6.0 ; } 3<&0 ``` ## Change extension or version diff --git a/sites/upsun/src/languages/php/swoole.md b/sites/upsun/src/languages/php/swoole.md index 849846b245..4fdd2976cb 100644 --- a/sites/upsun/src/languages/php/swoole.md +++ b/sites/upsun/src/languages/php/swoole.md @@ -38,17 +38,17 @@ Octane should listen on a TCP socket. ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - web: - upstream: - socket_family: tcp - protocol: http - commands: - start: php {{}} --port=$PORT - locations: - "/": - passthru: true - scripts: false - allow: false + myapp: + type: 'php:{{% latest "php" %}}' + web: + upstream: + socket_family: tcp + protocol: http + commands: + start: php {{}} --port=$PORT + locations: + "/": + passthru: true + scripts: false + allow: false ``` diff --git a/sites/upsun/src/languages/php/tuning.md b/sites/upsun/src/languages/php/tuning.md index 60930133df..8f8c1727c7 100644 --- a/sites/upsun/src/languages/php/tuning.md +++ b/sites/upsun/src/languages/php/tuning.md @@ -54,11 +54,11 @@ To enable preloading, add a variable that specifies a preload script: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - opcache.preload: '{{< variable "PRELOAD_SCRIPT" >}}' + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + opcache.preload: '{{< variable "PRELOAD_SCRIPT" >}}' ``` `{{< variable "PRELOAD_SCRIPT" >}}` is a file path relative to the [app root](/create-apps/app-reference/single-runtime-image.md#root-directory). It may be any PHP script that calls `opcache_compile_file()`. @@ -111,11 +111,11 @@ An example configuration: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - 'opcache.max_accelerated_files': 22000 + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + 'opcache.max_accelerated_files': 22000 ``` #### Set memory consumption @@ -156,11 +156,11 @@ To determine the total amount of memory to use, follow these steps: ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - 'opcache.memory_consumption': 96 + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + 'opcache.memory_consumption': 96 ``` 8. [Restart PHP-FPM](#restart-php-fpm) and make sure that OPcache works as expected by rerunning CacheTool with the following command: @@ -185,11 +185,11 @@ Timestamp validation can be disabled by adding the following variable to your [a ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - variables: - php: - 'opcache.validate_timestamps': 0 + myapp: + type: 'php:{{% latest "php" %}}' + variables: + php: + 'opcache.validate_timestamps': 0 ``` When you have disabled OPcache timestamp validation, you need to explicitly clear OPcache on deployment by [restarting PHP-FPM](#restart-php-fpm). diff --git a/sites/upsun/src/languages/php/xdebug.md b/sites/upsun/src/languages/php/xdebug.md index d0425294d5..d54131a3e1 100644 --- a/sites/upsun/src/languages/php/xdebug.md +++ b/sites/upsun/src/languages/php/xdebug.md @@ -37,11 +37,11 @@ To enable Xdebug, add the following to your [app configuration](/create-apps/app ```yaml {configFile="app"} applications: - app: - type: 'php:{{% latest "php" %}}' - runtime: - xdebug: - idekey: {{< variable "YOUR_KEY" >}} + myapp: + type: 'php:{{% latest "php" %}}' + runtime: + xdebug: + idekey: {{< variable "YOUR_KEY" >}} ``` {{< variable "YOUR_KEY" >}} can be any arbitrary alphanumeric string. @@ -55,18 +55,18 @@ Depending on the cookies already listed, the result should look similar to the f ```yaml {configFile="routes"} applications: - app: - type: 'php:{{% latest "php" %}}' - runtime: - xdebug: - idekey: {{< variable "YOUR_KEY" >}} + myapp: + type: 'php:{{% latest "php" %}}' + runtime: + xdebug: + idekey: {{< variable "YOUR_KEY" >}} routes: - "https://{default}/": - # ... - cache: - enabled: true - cookies: ['/^SS?ESS/', 'XDEBUG_SESSION'] + "https://{default}/": + # ... + cache: + enabled: true + cookies: ['/^SS?ESS/', 'XDEBUG_SESSION'] ``` Xdebug has several configuration options available. They can be set the same way as any other [PHP setting](./_index.md#php-settings). @@ -118,7 +118,7 @@ The common steps for setup usually include: 4. Ensuring path mappings is enabled. This lets you define what remote paths on the server correspond to what path on your local machine. In the majority of cases you can just define [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory) - to map to `app`. + to map to `myapp`. 5. Listening for connections. 6. Starting debugging. While in listen mode, start the `{{% vendor/cli %}} xdebug` tunnel. Use the Xdebug helper plugin for your browser to enable debugging. diff --git a/sites/upsun/src/languages/python/_index.md b/sites/upsun/src/languages/python/_index.md index 73414cd254..46513d1cd3 100644 --- a/sites/upsun/src/languages/python/_index.md +++ b/sites/upsun/src/languages/python/_index.md @@ -23,18 +23,18 @@ To use Node.js, specify ``python`` as your [app’s type](/create-apps/app-refer ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'python:' + # The app's name, which must be unique within the project. + : + type: 'python:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' ``` {{% deprecated-versions %}} @@ -55,37 +55,37 @@ Once you have it configured, add the following configuration to get it running o ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' ``` 2. Install the requirements for your app. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - python3: - pipenv: "2022.12.19" - hooks: - build: | - set -eu - pipenv install --system --deploy + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + python3: + pipenv: "2022.12.19" + hooks: + build: | + set -eu + pipenv install --system --deploy ``` 3. Define the command to start your web server: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - web: - # Start your app with the configuration you define - # You can replace the file location with your location - commands: - start: python server.py + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + web: + # Start your app with the configuration you define + # You can replace the file location with your location + commands: + start: python server.py ``` You can choose from many web servers such as Daphne, Gunicorn, Hypercorn, and Uvicorn. See more about [running Python web servers](./server.md). @@ -99,34 +99,34 @@ Follow these steps to get your server started. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' ``` 2. Define the conditions for your web server: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - web: - upstream: - # Send requests to the app server through a unix socket - # Its location is defined in the SOCKET environment variable - socket_family: "unix" - - # Start your app with the configuration you define - # You can replace the file location with your location - commands: - start: "uwsgi --ini conf/uwsgi.ini" - - locations: - # The folder from which to serve static assets - "/": - root: "public" - passthru: true - expires: 1h + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + web: + upstream: + # Send requests to the app server through a unix socket + # Its location is defined in the SOCKET environment variable + socket_family: "unix" + + # Start your app with the configuration you define + # You can replace the file location with your location + commands: + start: "uwsgi --ini conf/uwsgi.ini" + + locations: + # The folder from which to serve static assets + "/": + root: "public" + passthru: true + expires: 1h ``` 3. Create configuration for uWSGI such as the following: @@ -147,16 +147,16 @@ applications: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - python3: - pipenv: "2022.12.19" - hooks: - build: | - set -eu - pipenv install --system --deploy + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + python3: + pipenv: "2022.12.19" + hooks: + build: | + set -eu + pipenv install --system --deploy ``` 5. Define the entry point in your app: @@ -180,27 +180,27 @@ add them to the `dependencies` in your [app configuration](/create-apps/app-refe ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - python3: - {{< variable "PACKAGE_NAME" >}}: {{< variable "PACKAGE_VERSION" >}} + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + python3: + {{< variable "PACKAGE_NAME" >}}: {{< variable "PACKAGE_VERSION" >}} ``` For example, to use `pipenv` to manage requirements and a virtual environment, add the following: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - dependencies: - python3: - pipenv: "2022.12.19" - hooks: - build: | - set -eu - pipenv install --system --deploy + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + dependencies: + python3: + pipenv: "2022.12.19" + hooks: + build: | + set -eu + pipenv install --system --deploy ``` ## Connect to services diff --git a/sites/upsun/src/languages/python/dependencies.md b/sites/upsun/src/languages/python/dependencies.md index 310c52fe20..7d56655a72 100644 --- a/sites/upsun/src/languages/python/dependencies.md +++ b/sites/upsun/src/languages/python/dependencies.md @@ -45,13 +45,13 @@ title=Latest version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download the latest version of pip - python{{% latest "python" %}} -m pip install --upgrade pip - # Install dependencies - pip install -r requirements.txt + build: | + # Fail the build if any errors occur + set -eu + # Download the latest version of pip + python{{% latest "python" %}} -m pip install --upgrade pip + # Install dependencies + pip install -r requirements.txt {{< /snippet >}} ``` <---> @@ -62,16 +62,16 @@ title=Specific version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - PIP_VERSION: '22.3.1' + env: + PIP_VERSION: '22.3.1' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download a specific version of pip - python{{% latest "python" %}} -m pip install pip==$PIP_VERSION - # Install dependencies - pip install -r requirements.txt + build: | + # Fail the build if any errors occur + set -eu + # Download a specific version of pip + python{{% latest "python" %}} -m pip install pip==$PIP_VERSION + # Install dependencies + pip install -r requirements.txt {{< /snippet >}} ``` {{< /codetabs >}} @@ -102,17 +102,17 @@ title=Latest version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' dependencies: - python3: - pipenv: '*' + python3: + pipenv: '*' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download the latest version of pip - python{{% latest "python" %}} -m pip install --upgrade pip - # Install dependencies - # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date - pipenv install --deploy + build: | + # Fail the build if any errors occur + set -eu + # Download the latest version of pip + python{{% latest "python" %}} -m pip install --upgrade pip + # Install dependencies + # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date + pipenv install --deploy {{< /snippet >}} ``` <---> @@ -123,20 +123,20 @@ title=Specific version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - PIP_VERSION: '22.3.1' + env: + PIP_VERSION: '22.3.1' dependencies: - python3: - pipenv: '2022.12.19' + python3: + pipenv: '2022.12.19' hooks: - build: | - # Fail the build if any errors occur - set -eu - # Download a specific version of pip - python{{% latest "python" %}} -m pip install pip==$PIP_VERSION - # Install dependencies - # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date - pipenv install --deploy + build: | + # Fail the build if any errors occur + set -eu + # Download a specific version of pip + python{{% latest "python" %}} -m pip install pip==$PIP_VERSION + # Install dependencies + # Include `--deploy` to fail the build if `Pipfile.lock` isn't up to date + pipenv install --deploy {{< /snippet >}} ``` {{< /codetabs >}} @@ -161,13 +161,13 @@ To set up Poetry on {{% vendor/name %}}, follow these steps: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'python:{{% latest "python" %}}' - variables: - env: - POETRY_VIRTUALENVS_IN_PROJECT: true - POETRY_VIRTUALENVS_CREATE: true + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + variables: + env: + POETRY_VIRTUALENVS_IN_PROJECT: true + POETRY_VIRTUALENVS_CREATE: true ``` 2. Install Poetry. You can specify the latest or a specific version of Poetry in your deployments to ensure repeatable builds. @@ -180,27 +180,27 @@ title=Latest version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - POETRY_VIRTUALENVS_IN_PROJECT: true - POETRY_VIRTUALENVS_CREATE: true + env: + POETRY_VIRTUALENVS_IN_PROJECT: true + POETRY_VIRTUALENVS_CREATE: true hooks: - build: | - # Fail the build if any errors occur - set -eu - - # Download the latest version of pip - python{{% latest "python" %}} -m pip install --upgrade pip - - # Install and configure Poetry - export PIP_USER=false - curl -sSL https://install.python-poetry.org | python3 - - # Update PATH to make Poetry available in this hook - export PATH="/app/.local/bin:$PATH" - export PIP_USER=true - - # Install dependencies - poetry install + build: | + # Fail the build if any errors occur + set -eu + + # Download the latest version of pip + python{{% latest "python" %}} -m pip install --upgrade pip + + # Install and configure Poetry + export PIP_USER=false + curl -sSL https://install.python-poetry.org | python3 - + # Update PATH to make Poetry available in this hook + export PATH="/app/.local/bin:$PATH" + export PIP_USER=true + + # Install dependencies + poetry install {{< /snippet >}} ``` <---> @@ -211,30 +211,30 @@ title=Specific version {{< snippet name="myapp" config="app" root="myapp" >}} type: 'python:{{% latest "python" %}}' variables: - env: - POETRY_VERSION: '1.4.0' - POETRY_VIRTUALENVS_IN_PROJECT: true - POETRY_VIRTUALENVS_CREATE: true + env: + POETRY_VERSION: '1.4.0' + POETRY_VIRTUALENVS_IN_PROJECT: true + POETRY_VIRTUALENVS_CREATE: true hooks: - build: | - # Fail the build if any errors occur - set -eu - - # Download the latest version of pip - python3.11 -m pip install --upgrade pip - - # Install and configure Poetry - # Set user to false to install Poetry globally - export PIP_USER=false - curl -sSL https://install.python-poetry.org | python3 - --version $POETRY_VERSION - # Update PATH to make Poetry available in this hook - export PATH="/app/.local/bin:$PATH" - # Set user to true to install dependencies only in the virtual environment - export PIP_USER=true - - # Install dependencies - poetry install + build: | + # Fail the build if any errors occur + set -eu + + # Download the latest version of pip + python3.11 -m pip install --upgrade pip + + # Install and configure Poetry + # Set user to false to install Poetry globally + export PIP_USER=false + curl -sSL https://install.python-poetry.org | python3 - --version $POETRY_VERSION + # Update PATH to make Poetry available in this hook + export PATH="/app/.local/bin:$PATH" + # Set user to true to install dependencies only in the virtual environment + export PIP_USER=true + + # Install dependencies + poetry install {{< /snippet >}} ``` {{< /codetabs >}} @@ -249,6 +249,6 @@ hooks: ```text {location=".environment"} # Updates PATH when Poetry is used, making it available during deploys, start commands, and SSH. if [ -n "$POETRY_VERSION" ]; then - export PATH="/app/.local/bin:$PATH" + export PATH="/app/.local/bin:$PATH" fi ``` diff --git a/sites/upsun/src/languages/python/python-version.md b/sites/upsun/src/languages/python/python-version.md index 5d50a9eec2..7884601355 100644 --- a/sites/upsun/src/languages/python/python-version.md +++ b/sites/upsun/src/languages/python/python-version.md @@ -17,53 +17,53 @@ to install the specific version you want to use. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - variables: - env: - # Update for your desired Python version. - PYTHON_VERSION: "3.11.0" + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + variables: + env: + # Update for your desired Python version. + PYTHON_VERSION: "3.11.0" ``` 2. Add Pyenv in a [`build` hook](../../create-apps/hooks/hooks-comparison.md#build-hook): ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - variables: - env: - # Update for your desired Python version. - PYTHON_VERSION: "3.11.0" - hooks: - build: | - # Exit the hook on any failure - set -e - - # Clone Pyenv to the build cache if not present - if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv" ]; then - mkdir -p $PLATFORM_CACHE_DIR/.pyenv - git clone https://github.com/pyenv/pyenv.git $PLATFORM_CACHE_DIR/.pyenv - fi - - # Pyenv environment variables - export PYENV_ROOT="$PLATFORM_CACHE_DIR/.pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - - # Initialize Pyenv - if command -v pyenv 1>/dev/null 2>&1; then - eval "$(pyenv init --path)" - fi - - # Install desired Python version - mkdir -p $PLATFORM_CACHE_DIR/.pyenv/versions - if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv/versions/$PYTHON_VERSION" ]; then - pyenv install $PYTHON_VERSION - fi - - # Set global Python version - pyenv global $PYTHON_VERSION + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + variables: + env: + # Update for your desired Python version. + PYTHON_VERSION: "3.11.0" + hooks: + build: | + # Exit the hook on any failure + set -e + + # Clone Pyenv to the build cache if not present + if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv" ]; then + mkdir -p $PLATFORM_CACHE_DIR/.pyenv + git clone https://github.com/pyenv/pyenv.git $PLATFORM_CACHE_DIR/.pyenv + fi + + # Pyenv environment variables + export PYENV_ROOT="$PLATFORM_CACHE_DIR/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + + # Initialize Pyenv + if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init --path)" + fi + + # Install desired Python version + mkdir -p $PLATFORM_CACHE_DIR/.pyenv/versions + if [ ! -d "$PLATFORM_CACHE_DIR/.pyenv/versions/$PYTHON_VERSION" ]; then + pyenv install $PYTHON_VERSION + fi + + # Set global Python version + pyenv global $PYTHON_VERSION ``` Now your build hook can use the specified version of Python. You can verify this by running `python --version`. @@ -74,18 +74,18 @@ If you want this Python version to be available in the runtime environment, foll ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'php:{{% latest "php" %}}' - hooks: - build: | - ... - - # Copy Pyenv directory to runtime directory - cp -R $PLATFORM_CACHE_DIR/.pyenv $PLATFORM_APP_DIR - - # Rehash Pyenv for new (runtime) location - PYENV_ROOT="$PLATFORM_APP_DIR/.pyenv" $PLATFORM_APP_DIR/.pyenv/bin/pyenv rehash + # The app's name, which must be unique within the project. + myapp: + type: 'php:{{% latest "php" %}}' + hooks: + build: | + ... + + # Copy Pyenv directory to runtime directory + cp -R $PLATFORM_CACHE_DIR/.pyenv $PLATFORM_APP_DIR + + # Rehash Pyenv for new (runtime) location + PYENV_ROOT="$PLATFORM_APP_DIR/.pyenv" $PLATFORM_APP_DIR/.pyenv/bin/pyenv rehash ``` 2. Create an [`.environment` file](../../development/variables/set-variables.md#set-variables-via-script): diff --git a/sites/upsun/src/languages/python/server.md b/sites/upsun/src/languages/python/server.md index 3436c80eed..b8b0c09c37 100644 --- a/sites/upsun/src/languages/python/server.md +++ b/sites/upsun/src/languages/python/server.md @@ -27,15 +27,15 @@ title=Pip (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "gunicorn -w 4 -b localhost:$PORT myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "gunicorn -w 4 -b localhost:$PORT app.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -46,17 +46,17 @@ title=Pip (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "gunicorn -w 4 -b unix:$SOCKET app.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -67,15 +67,15 @@ title=Pipenv (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "pipenv run gunicorn -w 4 -b localhost:$PORT myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "pipenv run gunicorn -w 4 -b localhost:$PORT app.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -86,17 +86,17 @@ title=Pipenv (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "pipenv run gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "pipenv run gunicorn -w 4 -b unix:$SOCKET app.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -107,15 +107,15 @@ title=Poetry (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "poetry run gunicorn -w 4 -b localhost:$PORT myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "poetry run gunicorn -w 4 -b localhost:$PORT app.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -126,17 +126,17 @@ title=Poetry (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "poetry run gunicorn -w 4 -b unix:$SOCKET myapp.wsgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "poetry run gunicorn -w 4 -b unix:$SOCKET app.wsgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` {{< /codetabs >}} @@ -155,14 +155,14 @@ adjust the start command to the following: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - myapp: - type: 'python:{{% latest "python" %}}' - web: - upstream: - socket_family: unix - commands: - start: "gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b unix:$SOCKET myapp.wsgi:application" + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + web: + upstream: + socket_family: unix + commands: + start: "gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b unix:$SOCKET app.wsgi:application" ``` ## Daphne @@ -179,15 +179,15 @@ title=Pip (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "daphne -p $PORT myapp.asgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "daphne -p $PORT app.asgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -198,17 +198,17 @@ title=Pip (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "daphne -u $SOCKET myapp.asgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "daphne -u $SOCKET app.asgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -219,15 +219,15 @@ title=Pipenv (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "pipenv run daphne -p $PORT myapp.asgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "pipenv run daphne -p $PORT app.asgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -238,17 +238,17 @@ title=Pipenv (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "pipenv run daphne -u $SOCKET myapp.asgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "pipenv run daphne -u $SOCKET app.asgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -259,15 +259,15 @@ title=Poetry (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "poetry run daphne -p $PORT myapp.asgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "poetry run daphne -p $PORT app.asgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -278,17 +278,17 @@ title=Poetry (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "poetry run -u $SOCKET myapp.asgi:application" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "poetry run -u $SOCKET app.asgi:application" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` {{< /codetabs >}} @@ -307,15 +307,15 @@ title=Pip (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "uvicorn myapp.asgi:application --port $PORT --workers 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "uvicorn app.asgi:application --port $PORT --workers 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -326,17 +326,17 @@ title=Pip (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "uvicorn myapp.asgi:application --uds $SOCKET --workers 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "uvicorn app.asgi:application --uds $SOCKET --workers 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -347,15 +347,15 @@ title=Pipenv (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "pipenv run uvicorn myapp.asgi:application --port $PORT --workers 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "pipenv run uvicorn app.asgi:application --port $PORT --workers 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -366,17 +366,17 @@ title=Pipenv (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "pipenv run uvicorn myapp.asgi:application --uds $SOCKET --workers 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "pipenv run uvicorn app.asgi:application --uds $SOCKET --workers 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -387,15 +387,15 @@ title=Poetry (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "poetry run uvicorn myapp.asgi:application --port $PORT --workers 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "poetry run uvicorn app.asgi:application --port $PORT --workers 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -406,17 +406,17 @@ title=Poetry (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "poetry run uvicorn myapp.asgi:application --uds $SOCKET --workers 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "poetry run uvicorn app.asgi:application --uds $SOCKET --workers 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` {{< /codetabs >}} @@ -443,15 +443,15 @@ title=Pip (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "hypercorn myapp.asgi:application -b localhost:$PORT -w 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "hypercorn app.asgi:application -b localhost:$PORT -w 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -462,17 +462,17 @@ title=Pip (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "hypercorn myapp.asgi:application -b unix:$SOCKET -w 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "hypercorn app.asgi:application -b unix:$SOCKET -w 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -483,15 +483,15 @@ title=Pipenv (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "pipenv run hypercorn myapp.asgi:application -b localhost:$PORT -w 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "pipenv run hypercorn app.asgi:application -b localhost:$PORT -w 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -502,17 +502,17 @@ title=Pipenv (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "pipenv run hypercorn myapp.asgi:application -b unix:$SOCKET -w 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "pipenv run hypercorn app.asgi:application -b unix:$SOCKET -w 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -523,15 +523,15 @@ title=Poetry (TCP) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - commands: - start: "poetry run hypercorn myapp.asgi:application -b localhost:$PORT -w 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + commands: + start: "poetry run hypercorn app.asgi:application -b localhost:$PORT -w 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` <---> @@ -542,17 +542,17 @@ title=Poetry (Unix) {{< snippet name="myapp" config="app" root="/" >}} type: 'python:{{% latest "python" %}}' web: - upstream: - socket_family: unix - commands: - start: "poetry run hypercorn myapp.asgi:application -b unix:$SOCKET -w 4" - locations: - "/": - passthru: true - "/static": - root: "static" - expires: 1h - allow: true + upstream: + socket_family: unix + commands: + start: "poetry run hypercorn app.asgi:application -b unix:$SOCKET -w 4" + locations: + "/": + passthru: true + "/static": + root: "static" + expires: 1h + allow: true {{< /snippet >}} ``` {{< /codetabs >}} @@ -570,12 +570,12 @@ adjust the start command to the following: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - myapp: - type: 'python:{{% latest "python" %}}' - web: - upstream: - socket_family: unix - commands: - start: "hypercorn myapp.asgi:application -b unix:$SOCKET -w 4 -k asyncio" + # The app's name, which must be unique within the project. + myapp: + type: 'python:{{% latest "python" %}}' + web: + upstream: + socket_family: unix + commands: + start: "hypercorn app.asgi:application -b unix:$SOCKET -w 4 -k asyncio" ``` diff --git a/sites/upsun/src/languages/ruby.md b/sites/upsun/src/languages/ruby.md index 6d35d3f63b..72d2344881 100644 --- a/sites/upsun/src/languages/ruby.md +++ b/sites/upsun/src/languages/ruby.md @@ -23,18 +23,18 @@ When you deploy your app, you always get the latest available patches. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - : - type: 'ruby:' + # The app's name, which must be unique within the project. + : + type: 'ruby:' ``` For example: ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - type: 'ruby:{{% latest "ruby" %}}' + # The app's name, which must be unique within the project. + myapp: + type: 'ruby:{{% latest "ruby" %}}' ``` {{% deprecated-versions %}} @@ -51,12 +51,12 @@ A complete example is included at the end of this section. 1. Specify the language of your application (available versions are listed above): -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' -``` + ``` 2. Setup environment variables. @@ -64,18 +64,18 @@ applications: You can change the Rails/Bundler via those environment variables, some of which are defaults on {{% vendor/name %}}. -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' variables: - env: - PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created - RAILS_ENV: "production" - BUNDLE_WITHOUT: 'development:test' - TARGET_RUBY_VERSION: '~>{{% latest "ruby" %}}' # this will allow to not fail on PATCH update of the image -``` + env: + PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created + RAILS_ENV: "production" + BUNDLE_WITHOUT: 'development:test' + TARGET_RUBY_VERSION: '~>{{% latest "ruby" %}}' # this will allow to not fail on PATCH update of the image + ``` The `SECRET_KEY_BASE` variable is generated automatically based on the [`PLATFORM_PROJECT_ENTROPY` @@ -93,118 +93,120 @@ applications: Assuming you have your dependencies stored in the `Gemfile` at [your app root](/create-apps/app-reference/single-runtime-image.md#root-directory), create a hook like the following: -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' ... hooks: - build: | - set -e - bundle install - bundle exec rails assets:precompile - deploy: bundle exec rake db:migrate -``` - - These are installed as your project dependencies in your environment. - You can also use the `dependencies` key to install global dependencies. - These can be Ruby, Python, NodeJS, or PHP libraries. - - If you have assets, it's likely that you need NodeJS/yarn. - -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + build: | + set -e + bundle install + bundle exec rails assets:precompile + deploy: bundle exec rake db:migrate + ``` + + These are installed as your project dependencies in your environment. + You can also use the `dependencies` key to install global dependencies. + These can be Ruby, Python, NodeJS, or PHP libraries. + + If you have assets, it's likely that you need NodeJS/yarn. + + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' ... dependencies: - nodejs: - yarn: "*" -``` + nodejs: + yarn: "*" + ``` + 4. Configure the command to start serving your application (this must be a foreground-running process) under the `web` section: -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' ... web: - upstream: - socket_family: unix - commands: - # for puma - start: "bundle exec puma -b unix://$SOCKET" - # for unicorn - # start: "bundle exec unicorn -l $SOCKET" -``` + upstream: + socket_family: unix + commands: + # for puma + start: "bundle exec puma -b unix://$SOCKET" + # for unicorn + # start: "bundle exec unicorn -l $SOCKET" + ``` - This assumes you have Puma as a dependency in your Gemfile: + This assumes you have Puma as a dependency in your Gemfile: - ```ruby - gem "puma", ">= 5.0" - ``` + ```ruby + gem "puma", ">= 5.0" + ``` 5. Define the web locations your application is using: -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' ... web: - locations: - "/": - root: "public" - passthru: true - expires: 1h - allow: true -``` - This configuration sets the web server to handle HTTP requests at `/static` - to serve static files stored in `/app/static/` folder. - Everything else is forwarded to your application server. + locations: + "/": + root: "public" + passthru: true + expires: 1h + allow: true + ``` + This configuration sets the web server to handle HTTP requests at `/static` + to serve static files stored in `/app/static/` folder. + Everything else is forwarded to your application server. 6. Create any Read/Write mounts. - The root file system is read only. - You must explicitly describe writable mounts. -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + The root file system is read only. + You must explicitly describe writable mounts. + + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: type: 'ruby:{{% latest "ruby" %}}' ... mounts: - "/log": - source: tmp - source_path: log - "/storage": - source: storage - source_path: storage - "/tmp": - source: tmp - source_path: tmp -``` - This setting allows your application writing temporary files to `/app/tmp`, - logs stored in `/app/log`, and active storage in `/app/storage`. - - You can define other read/write mounts (your application code itself being deployed to a read-only file system). - Note that the file system is persistent and when you backup your cluster these mounts are also backed up. + "/log": + source: tmp + source_path: log + "/storage": + source: storage + source_path: storage + "/tmp": + source: tmp + source_path: tmp + ``` + This setting allows your application writing temporary files to `/app/tmp`, + logs stored in `/app/log`, and active storage in `/app/storage`. + + You can define other read/write mounts (your application code itself being deployed to a read-only file system). + Note that the file system is persistent and when you backup your cluster these mounts are also backed up. 7. Then, setup the routes to your application in `{{< vendor/configfile "routes" >}}`. -```yaml {configFile="app"} -applications: - ... + ```yaml {configFile="app"} + applications: + ... -routes: - "https://{default}/": + routes: + "https://{default}/": type: upstream - upstream: "app:http" -``` + upstream: "myapp:http" + ``` ### Complete app configuration Here is a complete `{{< vendor/configfile "app" >}}` file: @@ -212,111 +214,111 @@ Here is a complete `{{< vendor/configfile "app" >}}` file: ```yaml {configFile="app"} # The name of the app, which must be unique within a project. applications: - app: - type: 'ruby:{{% latest "ruby" %}}' - - dependencies: - nodejs: - yarn: "*" - - relationships: - mysql: - - variables: - env: - BUNDLE_CACHE_ALL: '1' # Default, Cache all gems, including path and git gems. - BUNDLE_CLEAN: '1' # /!\ if you are working with Ruby<2.7 this doesn't work well, but should be safe on modern Rubies. - BUNDLE_DEPLOYMENT: '1' # Default, Disallow changes to the Gemfile. - BUNDLE_ERROR_ON_STDERR: '1' # Default. - BUNDLE_WITHOUT: 'development:test' - PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created - DEFAULT_BUNDLER_VERSION: "2.5.14" # In case none is mentioned in Gemfile.lock - EXECJS_RUNTIME: 'Node' # If you need one on your assets https://github.com/rails/execjs#readme - NODE_ENV: 'production' - NODE_VERSION: v14.17.6 - NVM_VERSION: v0.38.0 - RACK_ENV: 'production' - RAILS_ENV: 'production' - RAILS_LOG_TO_STDOUT: '1' # Default - RAILS_TMP: '/tmp' # Default - - hooks: - build: | - set -e - - echo "Installing NVM $NVM_VERSION" - unset NPM_CONFIG_PREFIX - export NVM_DIR="$PLATFORM_APP_DIR/.nvm" - # install.sh will automatically install NodeJS based on the presence of $NODE_VERSION - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - # we install the bundled bundler version and fallback to a default (in env vars above) - export BUNDLER_VERSION="$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" || $DEFAULT_BUNDLER_VERSION - echo "Install bundler $BUNDLER_VERSION" - gem install --no-document bundler -v $BUNDLER_VERSION - - echo "Installing gems" - # We copy the bundle directory to the {{% vendor/name %}} cache directory for - # safe keeping, then restore from there on the next build. That allows - # bundler to skip downloading code it doesn't need to. - [ -d "$PLATFORM_CACHE_DIR/bundle" ] && \ - rsync -az --delete "$PLATFORM_CACHE_DIR/bundle/" vendor/bundle/ - mkdir -p "$PLATFORM_CACHE_DIR/bundle" - bundle install - # synchronize updated cache for next build - [ -d "vendor/bundle" ] && \ - rsync -az --delete vendor/bundle/ "$PLATFORM_CACHE_DIR/bundle/" - - # precompile assets - echo "Precompiling assets" - # We copy the webpacker directory to the {{% vendor/name %}} cache directory for - # safe keeping, then restore from there on the next build. That allows - # bundler to skip downloading code it doesn't need to. - # https://guides.rubyonrails.org/asset_pipeline.html - mkdir -p "$PLATFORM_CACHE_DIR/webpacker" - mkdir -p "$RAILS_TMP/cache/webpacker" - [ -d "$PLATFORM_CACHE_DIR/webpacker" ] && \ - rsync -az --delete "$PLATFORM_CACHE_DIR/webpacker/" $RAILS_TMP/cache/webpacker/ - # We dont need secret here https://github.com/rails/rails/issues/32947 - SECRET_KEY_BASE=1 bundle exec rails assets:precompile - rsync -az --delete $RAILS_TMP/cache/webpacker/ "$PLATFORM_CACHE_DIR/webpacker/" - deploy: bundle exec rake db:migrate - - mounts: - "/log": - source: tmp - source_path: log - "/storage": - source: storage - source_path: storage - "/tmp": - source: tmp - source_path: tmp - - web: - upstream: - socket_family: unix - commands: - # for puma - start: "bundle exec puma -b unix://$SOCKET" - # for unicorn - # start: "bundle exec unicorn -l $SOCKET" - - locations: - "/": - root: "public" - passthru: true - expires: 1h - allow: true + myapp: + type: 'ruby:{{% latest "ruby" %}}' + + dependencies: + nodejs: + yarn: "*" + + relationships: + mysql: + + variables: + env: + BUNDLE_CACHE_ALL: '1' # Default, Cache all gems, including path and git gems. + BUNDLE_CLEAN: '1' # /!\ if you are working with Ruby<2.7 this doesn't work well, but should be safe on modern Rubies. + BUNDLE_DEPLOYMENT: '1' # Default, Disallow changes to the Gemfile. + BUNDLE_ERROR_ON_STDERR: '1' # Default. + BUNDLE_WITHOUT: 'development:test' + PIDFILE: "tmp/server.pid" # Allow to start puma directly even if `tmp/pids` directory is not created + DEFAULT_BUNDLER_VERSION: "2.5.14" # In case none is mentioned in Gemfile.lock + EXECJS_RUNTIME: 'Node' # If you need one on your assets https://github.com/rails/execjs#readme + NODE_ENV: 'production' + NODE_VERSION: v14.17.6 + NVM_VERSION: v0.38.0 + RACK_ENV: 'production' + RAILS_ENV: 'production' + RAILS_LOG_TO_STDOUT: '1' # Default + RAILS_TMP: '/tmp' # Default + + hooks: + build: | + set -e + + echo "Installing NVM $NVM_VERSION" + unset NPM_CONFIG_PREFIX + export NVM_DIR="$PLATFORM_APP_DIR/.nvm" + # install.sh will automatically install NodeJS based on the presence of $NODE_VERSION + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + # we install the bundled bundler version and fallback to a default (in env vars above) + export BUNDLER_VERSION="$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" || $DEFAULT_BUNDLER_VERSION + echo "Install bundler $BUNDLER_VERSION" + gem install --no-document bundler -v $BUNDLER_VERSION + + echo "Installing gems" + # We copy the bundle directory to the {{% vendor/name %}} cache directory for + # safe keeping, then restore from there on the next build. That allows + # bundler to skip downloading code it doesn't need to. + [ -d "$PLATFORM_CACHE_DIR/bundle" ] && \ + rsync -az --delete "$PLATFORM_CACHE_DIR/bundle/" vendor/bundle/ + mkdir -p "$PLATFORM_CACHE_DIR/bundle" + bundle install + # synchronize updated cache for next build + [ -d "vendor/bundle" ] && \ + rsync -az --delete vendor/bundle/ "$PLATFORM_CACHE_DIR/bundle/" + + # precompile assets + echo "Precompiling assets" + # We copy the webpacker directory to the {{% vendor/name %}} cache directory for + # safe keeping, then restore from there on the next build. That allows + # bundler to skip downloading code it doesn't need to. + # https://guides.rubyonrails.org/asset_pipeline.html + mkdir -p "$PLATFORM_CACHE_DIR/webpacker" + mkdir -p "$RAILS_TMP/cache/webpacker" + [ -d "$PLATFORM_CACHE_DIR/webpacker" ] && \ + rsync -az --delete "$PLATFORM_CACHE_DIR/webpacker/" $RAILS_TMP/cache/webpacker/ + # We dont need secret here https://github.com/rails/rails/issues/32947 + SECRET_KEY_BASE=1 bundle exec rails assets:precompile + rsync -az --delete $RAILS_TMP/cache/webpacker/ "$PLATFORM_CACHE_DIR/webpacker/" + deploy: bundle exec rake db:migrate + + mounts: + "/log": + source: tmp + source_path: log + "/storage": + source: storage + source_path: storage + "/tmp": + source: tmp + source_path: tmp + + web: + upstream: + socket_family: unix + commands: + # for puma + start: "bundle exec puma -b unix://$SOCKET" + # for unicorn + # start: "bundle exec unicorn -l $SOCKET" + + locations: + "/": + root: "public" + passthru: true + expires: 1h + allow: true routes: - "https://{default}/": - type: upstream - upstream: "app:http" + "https://{default}/": + type: upstream + upstream: "myapp:http" services: - ... + ... ``` ## Configuring services @@ -326,14 +328,14 @@ To configure it, [create a service](../add-services/_index.md) such as the follo ```yaml {configFile="services"} applications: - ... + ... routes: - ... + ... services: - mysql: - type: mysql:{{% latest "mariadb" %}} + mysql: + type: mysql:{{% latest "mariadb" %}} ``` ## Connecting to services @@ -341,18 +343,18 @@ Once you have a service, link to it in your [app configuration](../create-apps/_ ```yaml {configFile="app"} applications: - app: - type: 'ruby:{{% latest "ruby" %}}' - relationships: - mysql: - ... + myapp: + type: 'ruby:{{% latest "ruby" %}}' + relationships: + mysql: + [...] routes: - ... + [...] services: - mysql: - type: mysql:{{% latest "mariadb" %}} + mysql: + type: mysql:{{% latest "mariadb" %}} ``` By using the following Ruby function calls, you can obtain the database details. @@ -366,20 +368,20 @@ This should give you something like the following: ```json { - "mysql" : [ - { - "path" : "main", - "query" : { - "is_master" : true - }, - "port" : 3306, - "username" : "user", - "password" : "", - "host" : "mysql.internal", - "ip" : "246.0.241.50", - "scheme" : "mysql" - } - ] + "mysql" : [ + { + "path" : "main", + "query" : { + "is_master" : true + }, + "port" : 3306, + "username" : "user", + "password" : "", + "host" : "mysql.internal", + "ip" : "246.0.241.50", + "scheme" : "mysql" + } + ] } ``` diff --git a/sites/upsun/src/languages/rust.md b/sites/upsun/src/languages/rust.md index f767cd9e3f..94e09b9059 100644 --- a/sites/upsun/src/languages/rust.md +++ b/sites/upsun/src/languages/rust.md @@ -39,26 +39,26 @@ See the [complete example](#complete-example) below for more details. ```yaml {configFile="app"} applications: - # The app's name, which must be unique within the project. - app: - - # The language and version for your app. - type: 'rust:1' - - hooks: - build: - cargo build - - web: - commands: - # Customize the start command with your own target. - start: './target/debug/hello' - - locations: - /: - # Route all requests to the Rust app, unconditionally. - allow: false - passthru: true + # The app's name, which must be unique within the project. + myapp: + + # The language and version for your app. + type: 'rust:1' + + hooks: + build: + cargo build + + web: + commands: + # Customize the start command with your own target. + start: './target/debug/hello' + + locations: + /: + # Route all requests to the Rust app, unconditionally. + allow: false + passthru: true ``` Note that there is still an Nginx proxy server sitting in front of your application. If desired, certain paths may be served directly by Nginx without hitting your application (for static files, primarily) or you may route all requests to the Rust app unconditionally, as in the example above. @@ -117,29 +117,29 @@ Follow these steps: 3. Add the following [app configuration](../../create-apps/_index.md): -```yaml {configFile="app"} -applications: - # The app's name, which must be unique within the project. - app: + ```yaml {configFile="app"} + applications: + # The app's name, which must be unique within the project. + myapp: # The language and version for your app. type: 'rust:1' hooks: - build: - cargo build + build: + cargo build web: - commands: - # Customize the start command with your own target. - start: './target/debug/hello' + commands: + # Customize the start command with your own target. + start: './target/debug/hello' locations: - /: - # Route all requests to the Rust app, unconditionally. - allow: false - passthru: true -``` + /: + # Route all requests to the Rust app, unconditionally. + allow: false + passthru: true + ``` 4. To generate a `Cargo.lock` file, run the following command: diff --git a/sites/upsun/src/learn/overview/yaml/platform-yaml-tags.md b/sites/upsun/src/learn/overview/yaml/platform-yaml-tags.md index ef01679fdd..ce564ae74f 100644 --- a/sites/upsun/src/learn/overview/yaml/platform-yaml-tags.md +++ b/sites/upsun/src/learn/overview/yaml/platform-yaml-tags.md @@ -51,16 +51,16 @@ This configuration is valid: ```yaml {configFile="apps"} applications: - frontend: - source: - root: frontend + frontend: + source: + root: frontend - # ... + # ... - hooks: - build: !include - type: string - path: ../backend/scripts/common_build.sh + hooks: + build: !include + type: string + path: ../backend/scripts/common_build.sh ``` {{% /note %}} @@ -73,8 +73,10 @@ Use `string` to include an external file inline in the YAML file as if entered a For example, if you have a build hook like the following: ```yaml {configFile="app"} -hooks: - build: | +applications: + myapp: + hooks: + build: | set -e cp a.txt b.txt ``` @@ -89,8 +91,10 @@ cp a.txt b.txt And replace the hook with an include tag for an identical result: ```yaml {configFile="app"} -hooks: - build: !include +applications: + myapp: + hooks: + build: !include type: string path: build.sh ``` @@ -125,14 +129,14 @@ This configuration is valid: ```yaml {configFile="apps"} applications: - frontend: - source: - root: frontend - # ... - hooks: - build: !include - type: string - path: ../backend/scripts/common_build.sh + frontend: + source: + root: frontend + # ... + hooks: + build: !include + type: string + path: ../backend/scripts/common_build.sh ``` {{% note theme="info" %}} @@ -151,9 +155,9 @@ Then you can include it as follows: ```yaml {configFile="app"} some-property: - favicon: !include - type: binary - path: favicon.ico + favicon: !include + type: binary + path: favicon.ico ``` ### `yaml` @@ -164,37 +168,35 @@ Because `yaml` is the default, you can use it without specifying the type. For example, you could have your configuration for works defined in a `worker.yaml` file: ```yaml {location="worker.yaml"} -size: S commands: - start: python queue-worker.py + start: python queue-worker.py variables: - env: - type: worker + env: + type: worker ``` Then the following three configurations are exactly equivalent: ```yaml {configFile="app"} workers: - queue1: !include "worker.yaml" + queue1: !include "worker.yaml" ``` ```yaml {configFile="app"} workers: - queue1: !include - type: yaml - path: 'worker.yaml' + queue1: !include + type: yaml + path: 'worker.yaml' ``` ```yaml {configFile="app"} workers: - queue1: - size: S - commands: - start: python queue-worker.py - variables: - env: - type: worker + queue1: + commands: + start: python queue-worker.py + variables: + env: + type: worker ``` This can help simplify more complex files. @@ -204,23 +206,23 @@ For [multiple application](/create-apps/multi-app/_index.md) project, you can al ```yaml {location=".upsun/apps/my-app.yaml"} source: -root: "/" + root: "/" type: "nodejs:18" web: - commands: - start: "node index.js" -upstream: + commands: + start: "node index.js" + upstream: socket_family: tcp -locations: + locations: "/": - passthru: true + passthru: true ``` and including it: ```yaml {configFile="apps"} applications: - app: + myapp: !include ./apps/my-app.yaml ``` @@ -233,10 +235,9 @@ You might do so as follows: ```yaml {configFile="services"} mysearch: - type: solr:8.0 - disk: 1024 - configuration: - conf_dir: !archive "solr/conf" + type: solr:8.0 + configuration: + conf_dir: !archive "solr/conf" ``` The `!archive` tag means that the value for `conf_dir` isn't the string `solr/conf` but the entire `solr/conf` directory. diff --git a/sites/upsun/src/learn/overview/yaml/what-is-yaml.md b/sites/upsun/src/learn/overview/yaml/what-is-yaml.md index a9741bb2ca..6e3137f26f 100644 --- a/sites/upsun/src/learn/overview/yaml/what-is-yaml.md +++ b/sites/upsun/src/learn/overview/yaml/what-is-yaml.md @@ -31,14 +31,14 @@ The most straightforward data structure involves defining key–value pairs wher So you could have a basic configuration for an app: -```yaml +```yaml {configFile="app"} applications: - myapp: - type: "golang:1.18" - source: - root: /app - hooks: - build: ./build.sh + myapp: + type: "golang:1.18" + source: + root: /app + hooks: + build: ./build.sh ``` You can spot three key–value pairs: @@ -71,16 +71,16 @@ So you could expand the configuration from before to add another mapping: ```yaml {configFile="app"} applications: - myapp: - type: "golang:1.18" - - web: - commands: - start: ./bin/app - locations: - '/': - passthru: true - allow: false + myapp: + type: "golang:1.18" + + web: + commands: + start: ./bin/app + locations: + '/': + passthru: true + allow: false ``` This creates a `web` dictionary that has two dictionaries within it: `commands` and `locations`, @@ -95,28 +95,28 @@ In addition to maps defining further key–value pairs, you can also use sequenc ```yaml {configFile="app"} applications: - myapp: - web: - locations: - '/': - index: - - index.html - - index.htm - passthru: true - allow: false + myapp: + web: + locations: + '/': + index: + - index.html + - index.htm + passthru: true + allow: false ``` You can also define sequences using a flow syntax: ```yaml {configFile="app"} applications: - myapp: - web: - locations: - '/': - index: [index.html, index.htm] - passthru: true - allow: false + myapp: + web: + locations: + '/': + index: [index.html, index.htm] + passthru: true + allow: false ``` In either case, you get a list of values within `index`: @@ -133,11 +133,11 @@ So you could add a multi-line string to a `build` key in the `hooks` map: ```yaml {configFile="app"} applications: - myapp: - hooks: - build: | - set -x -e - cp a.txt b.txt + myapp: + hooks: + build: | + set -x -e + cp a.txt b.txt ``` And the resulting value preserves the line break. @@ -158,15 +158,15 @@ The following example shows 4 different workers: ```yaml {configFile="app"} applications: - myapp: - ... - workers: - queue1: &runner - commands: - start: python queue-worker.py - queue2: *runner - queue3: - <<: *runner + myapp: + # ... + workers: + queue1: &runner + commands: + start: python queue-worker.py + queue2: *runner + queue3: + <<: *runner ``` All of the workers above are identical to each other. diff --git a/sites/upsun/src/learn/overview/yaml/yaml-structure.md b/sites/upsun/src/learn/overview/yaml/yaml-structure.md index 0c6d97ccdd..085b0dfa91 100644 --- a/sites/upsun/src/learn/overview/yaml/yaml-structure.md +++ b/sites/upsun/src/learn/overview/yaml/yaml-structure.md @@ -25,9 +25,9 @@ In the ``config.yaml`` file, there are only three mandatory top-level YAML keys: - ``services``: this section of the file contains all of your [service definitions](/add-services) (for each of your apps) This looks like: -```yaml {location="{{< vendor/configfile "apps" >}}"} +```yaml {location="apps"} {{< code-link destination="/create-apps/app-reference/single-runtime-image.html" text="applications" title="Complete list of all available properties" >}}: - app: + myapp: ... {{< code-link destination="/add-services.html#available-services" text="services" title="Click to see the complete list of all available services" >}}: @@ -37,7 +37,7 @@ This looks like: {{< code-link destination="/define-routes.html" text="routes" title="The routes of the project. Each route describes how an incoming URL is going to be processed by {{% vendor/name %}} (Staging). Click for more information." >}}: "https://{default}/": type: upstream - upstream: "app:http" + upstream: "myapp:http" ``` Below these three top-level key sections, you can use any of the [available YAML tags](./platform-yaml-tags.md) you need. @@ -54,12 +54,12 @@ The following rules apply to YAML files contained in the ``.upsun`` folder: - All the YAML files in subdirectories of the ``.upsun`` folder need to be [manually imported](/learn/overview/yaml/platform-yaml-tags.md#include) and contain a [valid YAML configuration](/create-apps/app-reference/single-runtime-image.md). {{% note title="Warning" theme="warning"%}} -When {{% vendor/name %}} combines all the YAML files located at the first level of the ``.upsun`` folder, only the top-level keys (`applications`, `services`, and `routes`) are merged. So if you define an app named ``app`` in two different YAML files, {{% vendor/name %}} only takes the second one into account. +When {{% vendor/name %}} combines all the YAML files located at the first level of the ``.upsun`` folder, only the top-level keys (`applications`, `services`, and `routes`) are merged. So if you define an app named ``myapp`` in two different YAML files, {{% vendor/name %}} only takes the second one into account. Example: ```yaml {location=".upsun/app.yaml"} applications: - app: + myapp: type: nodejs:16 source: root: folder1 @@ -68,7 +68,7 @@ applications: ```yaml {location=".upsun/app-bis.yaml"} applications: - app: + myapp: type: nodejs:20 build: flavor: none @@ -79,7 +79,7 @@ Once {{% vendor/name %}} has combined the two configuration files, the blended configuration will be the following: ```yaml {location="YAML config result"} applications: - app: + myapp: type: nodejs:20 build: flavor: none diff --git a/sites/upsun/src/learn/tutorials/dependency-updates.md b/sites/upsun/src/learn/tutorials/dependency-updates.md index 5cc4569a59..58b7bede4e 100644 --- a/sites/upsun/src/learn/tutorials/dependency-updates.md +++ b/sites/upsun/src/learn/tutorials/dependency-updates.md @@ -37,14 +37,14 @@ title=Composer ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - composer update - git add composer.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Composer dependencies" + operations: + update: + command: | + set -e + composer update + git add composer.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Composer dependencies" {{< /snippet >}} ``` @@ -56,14 +56,14 @@ title=npm ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - npm update - git add package.json package-lock.json - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update npm dependencies" + operations: + update: + command: | + set -e + npm update + git add package.json package-lock.json + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update npm dependencies" {{< /snippet >}} ``` @@ -75,14 +75,14 @@ title=Yarn ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - yarn upgrade - git add yarn.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update yarn dependencies" + operations: + update: + command: | + set -e + yarn upgrade + git add yarn.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update yarn dependencies" {{< /snippet >}} ``` @@ -94,15 +94,15 @@ title=Go ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - go get -u - go mod tidy - git add go.mod go.sum - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Go dependencies" + operations: + update: + command: | + set -e + go get -u + go mod tidy + git add go.mod go.sum + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Go dependencies" {{< /snippet >}} ``` @@ -114,14 +114,14 @@ title=Pipenv ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - pipenv update - git add Pipfile Pipfile.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Python dependencies" + operations: + update: + command: | + set -e + pipenv update + git add Pipfile Pipfile.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Python dependencies" {{< /snippet >}} ``` @@ -133,14 +133,14 @@ title=Bundler ```yaml {configFile="app"} {{< snippet name="myapp" config="app" root="myapp" >}} source: - operations: - update: - command: | - set -e - bundle update --all - git add Gemfile Gemfile.lock - git add -A - git diff-index --quiet HEAD || git commit --allow-empty -m "Update Ruby dependencies" + operations: + update: + command: | + set -e + bundle update --all + git add Gemfile Gemfile.lock + git add -A + git diff-index --quiet HEAD || git commit --allow-empty -m "Update Ruby dependencies" {{< /snippet >}} ``` @@ -201,15 +201,15 @@ Make sure you carefully check your [user access on this project](/administration ```yaml {configFile="app"} applications: - myapp: - hooks: - build: | - set -e - echo "Installing {{% vendor/name %}} CLI" - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash - - echo "Testing {{% vendor/name %}} CLI" - {{% vendor/cli %}} + myapp: + hooks: + build: | + set -e + echo "Installing {{% vendor/name %}} CLI" + curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash + + echo "Testing {{% vendor/name %}} CLI" + {{% vendor/cli %}} ``` 3. Then, to configure a cron job to automatically update your dependencies once a day, @@ -217,17 +217,17 @@ applications: ```yaml {configFile="app"} applications: - myapp: - # ... - crons: - update: - # Run the code below every day at midnight. - spec: '0 0 * * *' - commands: - start: | - set -e - {{% vendor/cli %}} sync -e development code data --no-wait --yes - {{% vendor/cli %}} source-operation:run update --no-wait --yes + myapp: + # ... + crons: + update: + # Run the code below every day at midnight. + spec: '0 0 * * *' + commands: + start: | + set -e + {{% vendor/cli %}} sync -e development code data --no-wait --yes + {{% vendor/cli %}} source-operation:run update --no-wait --yes ``` The example above synchronizes the `development` environment with its parent @@ -241,7 +241,7 @@ you can configure activity scripts or webhooks. ### Notifications through an activity script After you've defined a source operation to [update your dependencies on your project](#1-define-a-source-operation-to-update-your-dependencies), -you can configure an activity script +you can configure an activity script to receive notifications every time a dependency update is triggered. {{< note title="Example" >}} @@ -265,7 +265,7 @@ To do so, follow these steps: * the {{% vendor/name %}} CLI. * * Replace SLACK_URL in the following script with your Slack webhook URL. - * Get one here: https://api.slack.com/messaging/webhooks + * Get one here: https://api.slack.com/messaging/webhooks * You should get something like: const url = 'https://hooks.slack.com/...'; * * activity.text: a brief, one-line statement of what happened. @@ -307,7 +307,7 @@ To do so, follow these steps: add the following flag to the command: `--environments=your_environment_name`. Anytime a dependency is updated via a source operation, -the activity script now reports it to Slack. +the activity script now reports it to Slack. {{< /note >}} diff --git a/sites/upsun/src/learn/tutorials/migrating/from-psh.md b/sites/upsun/src/learn/tutorials/migrating/from-psh.md index 0d2e347ae7..213a6ed4e7 100644 --- a/sites/upsun/src/learn/tutorials/migrating/from-psh.md +++ b/sites/upsun/src/learn/tutorials/migrating/from-psh.md @@ -185,12 +185,14 @@ Upload to each mount separately. Suppose you have the following mounts defined: -```yaml {location=".platform.app.yaml"} -mounts: - 'web/uploads': +```yaml {configFile="app"} +applications: + myapp: + mounts: + 'web/uploads': source: local source_path: uploads - 'private': + 'private': source: local source_path: private ``` @@ -205,14 +207,14 @@ For example: ```yaml {configFile="app"} applications: - myapp: - mounts: - 'web/uploads': - source: instance - source_path: uploads - 'private': - source: instance - source_path: private + myapp: + mounts: + 'web/uploads': + source: instance + source_path: uploads + 'private': + source: instance + source_path: private ``` Then, to upload your files, run a command similar to the following: diff --git a/sites/upsun/src/learn/tutorials/restrict-service-access.md b/sites/upsun/src/learn/tutorials/restrict-service-access.md index feb20edbbb..ab2502f522 100644 --- a/sites/upsun/src/learn/tutorials/restrict-service-access.md +++ b/sites/upsun/src/learn/tutorials/restrict-service-access.md @@ -5,7 +5,7 @@ description: Learn how to restrict access to a service using a worker and additi weight: 2 --- -{{% vendor/name %}} allows you to restrict access to a service. +{{% vendor/name %}} allows you to restrict access to a service. In this tutorial, learn how to grant your Data team `read-only` access to your production database. @@ -25,19 +25,19 @@ Edit your `{{< vendor/configfile "services" >}}` file and add the following [end ```yaml {configFile="services"} services: - maindb: - type: mariadb:10.5 - configuration: - schemas: - - main - endpoints: - website: - default_schema: main - privileges: - main: admin - reporting: - privileges: - main: ro + maindb: + type: mariadb:10.5 + configuration: + schemas: + - main + endpoints: + website: + default_schema: main + privileges: + main: admin + reporting: + privileges: + main: ro ``` ## 2. Grant your app access to the new endpoints @@ -46,42 +46,42 @@ Edit your app configuration and add new relationships to your new endpoints: ```yaml {configFile="app"} applications: - myapp: - [...] - relationships: - database: - service: maindb - endpoint: website - reports: - service: maindb - endpoint: reporting + myapp: + # ... + relationships: + database: + service: maindb + endpoint: website + reports: + service: maindb + endpoint: reporting ``` ## 3. Create a worker with access to the read-only endpoint Edit your app configuration to add a new worker which: -- Does nothing (`sleep infinity`) +- Does nothing (`sleep infinity`) - Can access the read-only `reporting` endpoint - Allows SSH access to `viewer` ```yaml {configFile="app"} applications: - myapp: - workers: - data_access: - mounts: {} - commands: - start: | - sleep infinity - relationships: - reports: - service: maindb - endpoint: reporting - access: - ssh: viewer + myapp: + workers: + data_access: + mounts: {} + commands: + start: | + sleep infinity + relationships: + reports: + service: maindb + endpoint: reporting + access: + ssh: viewer ``` You're done! From now on, your `viewer` users can SSH in to the worker application, -and connect to your database with read-only permissions. \ No newline at end of file +and connect to your database with read-only permissions. diff --git a/sites/upsun/src/manage-resources/adjust-resources.md b/sites/upsun/src/manage-resources/adjust-resources.md index 974b61be58..d2c3df3bf7 100644 --- a/sites/upsun/src/manage-resources/adjust-resources.md +++ b/sites/upsun/src/manage-resources/adjust-resources.md @@ -71,7 +71,7 @@ which causes a short downtime. Run the `resources:set` command using the following CLI options: -| CLI option | Description | +| CLI option | Description | | ----------------- | --------------------------------| | `size` | Allows you to define how much CPU you want to allocate to each app or service.
The amount of CPU then determines how much RAM is also allocated, based on the [container profile](#advanced-container-profiles). | | `disk` | Allows you to define how much disk/storage you want to allocate to each app or service. | @@ -162,7 +162,7 @@ or run commands manually. ```bash {location="Terminal"} {{% vendor/cli %}} resources:set --count {{< variable "APP_NAME" >}}:{{< variable "NUMBER_OF_INSTANCES" >}} ``` - + For example, to scale your `myapp` app to 3 instances, run the following command: ```bash {location="Terminal"} @@ -171,7 +171,7 @@ or run commands manually. You can also set the same instance count for all your apps using a wildcard. To do so, run the following command: - + ```bash {location="Terminal"} {{% vendor/cli %}} resources:set --count '*:{{< variable "NUMBER_OF_INSTANCES" >}}' ``` @@ -186,7 +186,7 @@ or run commands manually. After you've set the number of instances for your apps and workers, your environment is redeployed. If you've made no other changes, this redeployment causes no downtime. - + If the redeployment fails after you've run `{{% vendor/cli %}} resources:set`, you may need to set the resources again. {{% /note %}} @@ -249,13 +249,13 @@ The following table shows the default container profiles {{% vendor/name %}} app |-------------------------|------------------| | Chrome Headless | HIGH_CPU | | ClickHouse | HIGH_MEMORY | -| .NET | HIGH_CPU | +| .NET | HIGH_CPU | | Elasticsearch | HIGH_MEMORY | | Elasticsearch Premium | HIGH_MEMORY | | Elixir | HIGH_CPU | | Go | HIGH_CPU | | Gotenberg | HIGH_MEMORY | -| InfluxDB | HIGH_MEMORY | +| InfluxDB | HIGH_MEMORY | | Java | HIGH_MEMORY | | Kafka | HIGH_MEMORY | | Lisp | HIGH_CPU | @@ -264,18 +264,18 @@ The following table shows the default container profiles {{% vendor/name %}} app | MongoDB | HIGH_MEMORY | | MongoDB Premium | HIGH_MEMORY | | Network Storage | HIGH_MEMORY | -| NodeJS | HIGH_CPU | +| NodeJS | HIGH_CPU | | OpenSearch | HIGH_MEMORY | -| Oracle Java | HIGH_MEMORY | +| Oracle Java | HIGH_MEMORY | | Oracle MySQL | HIGH_MEMORY | -| PHP | HIGH_CPU | +| PHP | HIGH_CPU | | PostgreSQL | HIGH_MEMORY | -| Python | HIGH_CPU | +| Python | HIGH_CPU | | RabbitMQ | HIGH_MEMORY | | Redis ephemeral | BALANCED | | Redis persistent | BALANCED | | Ruby | HIGH_CPU | -| Rust | HIGH_CPU | +| Rust | HIGH_CPU | | Solr | HIGH_MEMORY | | Varnish | HIGH_MEMORY | | Vault KMS | HIGH_MEMORY | @@ -290,11 +290,11 @@ To adjust a container profile, amend the value of the `container_profile` key in ```yaml {configFile="app"} applications: - {{< variable "APP_NAME" >}}: - container_profile: HIGH_MEMORY + {{< variable "APP_NAME" >}}: + container_profile: HIGH_MEMORY services: - {{< variable "SERVICE_NAME" >}}: - type: {{< variable "SERVICE_TYPE" >}}:{{< variable "VERSION" >}} - container_profile: HIGHER_MEMORY + {{< variable "SERVICE_NAME" >}}: + type: {{< variable "SERVICE_TYPE" >}}:{{< variable "VERSION" >}} + container_profile: HIGHER_MEMORY ``` diff --git a/themes/psh-docs/layouts/partials/snippet.html b/themes/psh-docs/layouts/partials/snippet.html index 572d1f0a2c..4c200c4db1 100644 --- a/themes/psh-docs/layouts/partials/snippet.html +++ b/themes/psh-docs/layouts/partials/snippet.html @@ -57,22 +57,22 @@ {{- end -}} {{- if and (eq $placeholder "true") (not .Inner) -}} - {{- $prepend = printf "# %s# %s" $applicationsKey "..." -}} + {{- $prepend = printf "# %s# %s" $applicationsKey "..." -}} {{- else -}} {{- if eq $name "false" -}} {{- $name = "myapp" -}} {{- end -}} - {{- $prepend = printf "%s %s\n %s:" $applicationsKey $appNameComment $name -}} + {{- $prepend = printf "%s %s\n %s:" $applicationsKey $appNameComment $name -}} {{- if ne $root "false" -}} - {{- $prepend = printf "%s\n %s\n source:\n root: \"%s\"" $prepend $rootComment $root -}} + {{- $prepend = printf "%s\n %s\n source:\n root: \"%s\"" $prepend $rootComment $root -}} {{- end -}} - {{- $indent := " " }} + {{- $indent := " " }} {{- $indentCount := 0 }} {{- range split (trim .Inner "\n") "\n" -}} {{- if ne (len .) 1 -}} {{- if eq $indentCount 1 -}} - {{- $indent = " " -}} + {{- $indent = " " -}} {{- end -}} {{- $content = printf "%s\n%s%s" $content $indent . -}} {{- $indentCount = 1 -}} From 1188252ce91271db485df88967b6fa7bba93eb0c Mon Sep 17 00:00:00 2001 From: chadcarlson Date: Fri, 22 Nov 2024 15:57:23 -0500 Subject: [PATCH 18/22] Repair Platform.sh docs links. --- sites/platform/src/add-services/influxdb.md | 2 +- sites/platform/src/add-services/opensearch.md | 2 +- sites/platform/src/add-services/rabbitmq.md | 2 +- sites/platform/src/add-services/vault.md | 4 ++-- sites/platform/src/guides/drupal/elasticsearch.md | 4 ++-- sites/platform/src/guides/drupal/memcached.md | 2 +- sites/platform/src/guides/drupal/redis.md | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sites/platform/src/add-services/influxdb.md b/sites/platform/src/add-services/influxdb.md index 9f2de7d4e9..650647d250 100644 --- a/sites/platform/src/add-services/influxdb.md +++ b/sites/platform/src/add-services/influxdb.md @@ -276,7 +276,7 @@ influxdb: ``` This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, `myapp` can retrieve access credentials to the service through the environment variable `{{< vendor/prefix >}}_RELATIONSHIPS`. That variable is a base64-encoded JSON object, but can be decoded at runtime (using the built-in tool `jq`) to provide more accessible environment variables to use within the application itself: diff --git a/sites/platform/src/add-services/opensearch.md b/sites/platform/src/add-services/opensearch.md index 0e2916eda4..fa829f84bd 100644 --- a/sites/platform/src/add-services/opensearch.md +++ b/sites/platform/src/add-services/opensearch.md @@ -261,7 +261,7 @@ relationships: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, `myapp` can retrieve access credentials to the service through the environment variable `{{< vendor/prefix >}}_RELATIONSHIPS`. That variable is a base64-encoded JSON object, but can be decoded at runtime (using the built-in tool `jq`) to provide more accessible environment variables to use within the application itself: diff --git a/sites/platform/src/add-services/rabbitmq.md b/sites/platform/src/add-services/rabbitmq.md index a974748c10..ba054a4a06 100644 --- a/sites/platform/src/add-services/rabbitmq.md +++ b/sites/platform/src/add-services/rabbitmq.md @@ -295,7 +295,7 @@ To open a tunnel, follow these steps. ssh $({{% vendor/cli %}} ssh --pipe) -L 15672:{{< variable "RELATIONSHIP_NAME" >}}.internal:15672 ``` - {{< variable "RELATIONSHIP_NAME" >}} is the [name you defined](#2-add-the-relationship). + {{< variable "RELATIONSHIP_NAME" >}} is the [name you defined](#2-define-the-relationship). b) (On [dedicated environments](/glossary.html#dedicated-gen-2)) SSH into your cluster with a flag for local port forwarding: diff --git a/sites/platform/src/add-services/vault.md b/sites/platform/src/add-services/vault.md index 048e31dd53..fa839ac693 100644 --- a/sites/platform/src/add-services/vault.md +++ b/sites/platform/src/add-services/vault.md @@ -222,7 +222,7 @@ To make any calls to the Vault KMS, you need your token. Get it from the `{{< ve echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 --decode | jq -r ".{{< variable "RELATIONSHIP_NAME" >}}[0].password" ``` -`{{< variable "RELATIONSHIP_NAME" >}}` is the name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-add-the-relationship). +`{{< variable "RELATIONSHIP_NAME" >}}` is the name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-define-the-relationship). The `-r` flag returns the string itself, not wrapped in quotes. @@ -244,7 +244,7 @@ Assign it to a variable as follows: VAULT_URL=$(echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 --decode | jq -r ".{{< variable "RELATIONSHIP_NAME" >}}[0].host"):$(echo ${{< vendor/prefix >}}_RELATIONSHIPS | base64 --decode | jq -r ".{{< variable "RELATIONSHIP_NAME" >}}[0].port") ``` -`{{< variable "RELATIONSHIP_NAME" >}}` is the name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-add-the-relationship). +`{{< variable "RELATIONSHIP_NAME" >}}` is the name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-define-the-relationship). ### Manage your keys diff --git a/sites/platform/src/guides/drupal/elasticsearch.md b/sites/platform/src/guides/drupal/elasticsearch.md index 7cac43129b..55b0026816 100644 --- a/sites/platform/src/guides/drupal/elasticsearch.md +++ b/sites/platform/src/guides/drupal/elasticsearch.md @@ -55,7 +55,7 @@ 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](/add-services/elasticsearch.md#use-in-app) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](/add-services/elasticsearch.md#2-define-the-relationship) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). <---> @@ -83,7 +83,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#2-define-the-relationship) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/guides/drupal/memcached.md b/sites/platform/src/guides/drupal/memcached.md index 0e8c0d6cb5..dd9aa259e7 100644 --- a/sites/platform/src/guides/drupal/memcached.md +++ b/sites/platform/src/guides/drupal/memcached.md @@ -85,7 +85,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#app-configurationcreate-apps) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} diff --git a/sites/platform/src/guides/drupal/redis.md b/sites/platform/src/guides/drupal/redis.md index c6ea5d4bc3..652fa25e40 100644 --- a/sites/platform/src/guides/drupal/redis.md +++ b/sites/platform/src/guides/drupal/redis.md @@ -107,7 +107,7 @@ The example above leverages [explicit endpoint](/create-apps/app-reference/singl 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 `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). +With the above definition, the application container now has [access to the service](#2-define-the-relationship) via the relationship `` and its corresponding [`PLATFORM_RELATIONSHIPS` environment variable](/development/variables/use-variables.md#use-provided-variables). {{< /codetabs >}} From 36fccb77f13697970c152c74d0febab429cff4c0 Mon Sep 17 00:00:00 2001 From: chadcarlson Date: Fri, 22 Nov 2024 16:10:39 -0500 Subject: [PATCH 19/22] Repair Upsun docs links. --- sites/upsun/src/add-services/headless-chrome.md | 2 +- sites/upsun/src/add-services/influxdb.md | 2 +- sites/upsun/src/add-services/memcached.md | 2 +- sites/upsun/src/add-services/mongodb.md | 2 +- sites/upsun/src/add-services/mysql/_index.md | 2 +- sites/upsun/src/add-services/opensearch.md | 2 +- sites/upsun/src/add-services/postgresql.md | 2 +- sites/upsun/src/add-services/rabbitmq.md | 4 ++-- sites/upsun/src/add-services/redis.md | 4 ++-- sites/upsun/src/add-services/solr.md | 2 +- sites/upsun/src/add-services/vault.md | 4 ++-- sites/upsun/src/development/local/_index.md | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sites/upsun/src/add-services/headless-chrome.md b/sites/upsun/src/add-services/headless-chrome.md index 6ee073148e..6ca2a1c305 100644 --- a/sites/upsun/src/add-services/headless-chrome.md +++ b/sites/upsun/src/add-services/headless-chrome.md @@ -323,7 +323,7 @@ services: This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `chrome-headless` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `chrome-headless` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, `myapp` can retrieve access credentials to the service through the [relationship environment variable](/add-services/elasticsearch.md#relationship-reference). diff --git a/sites/upsun/src/add-services/influxdb.md b/sites/upsun/src/add-services/influxdb.md index fc2f4fad16..338244ce05 100644 --- a/sites/upsun/src/add-services/influxdb.md +++ b/sites/upsun/src/add-services/influxdb.md @@ -304,7 +304,7 @@ service: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/memcached.md b/sites/upsun/src/add-services/memcached.md index 790e82f858..b7891310c8 100644 --- a/sites/upsun/src/add-services/memcached.md +++ b/sites/upsun/src/add-services/memcached.md @@ -375,7 +375,7 @@ service: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `influxdb` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/mongodb.md b/sites/upsun/src/add-services/mongodb.md index 9d93ad394d..822c4c3af9 100644 --- a/sites/upsun/src/add-services/mongodb.md +++ b/sites/upsun/src/add-services/mongodb.md @@ -559,7 +559,7 @@ service: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `mongodb` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `mongodb` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/mysql/_index.md b/sites/upsun/src/add-services/mysql/_index.md index 026f8ff7c1..5b5290316b 100644 --- a/sites/upsun/src/add-services/mysql/_index.md +++ b/sites/upsun/src/add-services/mysql/_index.md @@ -460,7 +460,7 @@ service: This configuration defines a single application (``myapp``), whose source code exists in the ``/myapp`` directory. -``myapp`` has access to the ``mariadb`` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +``myapp`` has access to the ``mariadb`` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image.md#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/opensearch.md b/sites/upsun/src/add-services/opensearch.md index eb0dd6b070..790680cd82 100644 --- a/sites/upsun/src/add-services/opensearch.md +++ b/sites/upsun/src/add-services/opensearch.md @@ -307,7 +307,7 @@ services: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `opensearch` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/postgresql.md b/sites/upsun/src/add-services/postgresql.md index 2fc5517411..2e10ccc66a 100644 --- a/sites/upsun/src/add-services/postgresql.md +++ b/sites/upsun/src/add-services/postgresql.md @@ -369,7 +369,7 @@ services: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `postgresql` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `postgresql` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/rabbitmq.md b/sites/upsun/src/add-services/rabbitmq.md index e44f43df47..d7710d971c 100644 --- a/sites/upsun/src/add-services/rabbitmq.md +++ b/sites/upsun/src/add-services/rabbitmq.md @@ -295,7 +295,7 @@ services: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `rabbitmq` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `rabbitmq` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). @@ -359,7 +359,7 @@ To open a tunnel, follow these steps. ssh $({{% vendor/cli %}} ssh --pipe) -L 15672:{{< variable "RELATIONSHIP_NAME" >}}.internal:15672 ``` - {{< variable "RELATIONSHIP_NAME" >}} is the [name you defined](#2-add-the-relationship). + {{< variable "RELATIONSHIP_NAME" >}} is the [name you defined](#2-define-the-relationship). 2. Open `http://localhost:15672` in your browser. Log in using the username and password from the [relationship](#relationship-reference). diff --git a/sites/upsun/src/add-services/redis.md b/sites/upsun/src/add-services/redis.md index 7223f28b5b..594cab417d 100644 --- a/sites/upsun/src/add-services/redis.md +++ b/sites/upsun/src/add-services/redis.md @@ -410,7 +410,7 @@ services: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). @@ -735,7 +735,7 @@ services: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `redis` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/solr.md b/sites/upsun/src/add-services/solr.md index b1b0f608fd..fb752d8b28 100644 --- a/sites/upsun/src/add-services/solr.md +++ b/sites/upsun/src/add-services/solr.md @@ -295,7 +295,7 @@ services: {{< /codetabs >}} This configuration defines a single application (`myapp`), whose source code exists in the `/myapp` directory.
-`myapp` has access to the `solr` service, via a relationship whose name is [identical to the service name](#2-add-the-relationship) +`myapp` has access to the `solr` service, via a relationship whose name is [identical to the service name](#2-define-the-relationship) (as per [default endpoint](/create-apps/app-reference/single-runtime-image#relationships) configuration for relationships). From this, ``myapp`` can retrieve access credentials to the service through the [relationship environment variables](#relationship-reference). diff --git a/sites/upsun/src/add-services/vault.md b/sites/upsun/src/add-services/vault.md index 9c739bd0e4..0e173085f3 100644 --- a/sites/upsun/src/add-services/vault.md +++ b/sites/upsun/src/add-services/vault.md @@ -266,7 +266,7 @@ To make any calls to the Vault KMS, you need your token. Get it from the [servic echo ${{{< variable "RELATIONSHIP_NAME" >}}_PASSWORD}" ``` -`{{< variable "RELATIONSHIP_NAME" >}}` is the relationship name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-add-the-relationship). +`{{< variable "RELATIONSHIP_NAME" >}}` is the relationship name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-define-the-relationship). You can also store this as a variable: @@ -286,7 +286,7 @@ Assign it to a variable as follows: VAULT_URL=${{{< variable "RELATIONSHIP_NAME" >}}_HOST}:${{{< variable "RELATIONSHIP_NAME" >}}_PORT} ``` -`{{< variable "RELATIONSHIP_NAME" >}}` is the name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-add-the-relationship). +`{{< variable "RELATIONSHIP_NAME" >}}` is the name you [defined in your `{{< vendor/configfile "app" >}}` file](#2-define-the-relationship). ### Manage your keys diff --git a/sites/upsun/src/development/local/_index.md b/sites/upsun/src/development/local/_index.md index dbb1460034..ed3a83e2e4 100644 --- a/sites/upsun/src/development/local/_index.md +++ b/sites/upsun/src/development/local/_index.md @@ -52,7 +52,7 @@ You can now make changes to your project without pushing to {{% vendor/name %}} Instead, you can locally build your application using the {{% vendor/name %}} CLI. Note that if your app contains services, you need to open an SSH tunnel to connect to them. -For more information, see how to [connect services](../../add-services#2-connect-the-service). +For more information, see how to [connect services](../../add-services#2-define-the-relationship). ## 2. Connect to services From 0751707438ab19063832a8a8bec09778b7fb4812 Mon Sep 17 00:00:00 2001 From: chadcarlson Date: Fri, 22 Nov 2024 16:13:37 -0500 Subject: [PATCH 20/22] Address Vale error. --- sites/platform/src/administration/pricing/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/platform/src/administration/pricing/_index.md b/sites/platform/src/administration/pricing/_index.md index e3ba8858ab..973ecd9a80 100644 --- a/sites/platform/src/administration/pricing/_index.md +++ b/sites/platform/src/administration/pricing/_index.md @@ -192,7 +192,7 @@ That offering can include either a project on {{% vendor/name %}}, or profilable ## Dunning process -In instances where a payment has failed, Platform.sh will make three separate attempts to take the outstanding balance from your account. +In instances where a payment has failed, {{% vendor/name %}} will make three separate attempts to take the outstanding balance from your account. These attempts will be made on the 4th, 11th and 15th of the month. If your payment fails after the third attempt, your projects will be suspended the following day. All projects on the billing subscription will be affected. From 4a7891db0453b90f2e071c1ef84f8d0d945e56a6 Mon Sep 17 00:00:00 2001 From: chadcarlson Date: Fri, 22 Nov 2024 16:23:20 -0500 Subject: [PATCH 21/22] Address failing tests on main. --- contributing/styles/config/vocabularies/Platform/accept.txt | 5 +++++ contributing/styles/config/vocabularies/Platform/reject.txt | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contributing/styles/config/vocabularies/Platform/accept.txt b/contributing/styles/config/vocabularies/Platform/accept.txt index 809f3bcdb2..495447b95f 100644 --- a/contributing/styles/config/vocabularies/Platform/accept.txt +++ b/contributing/styles/config/vocabularies/Platform/accept.txt @@ -18,6 +18,7 @@ Brotli [Bb]undler CacheTool callee +Ceph cgroups charset client_id @@ -38,6 +39,7 @@ denylist deprovision DNSimple Docksal +docroots Drush DXP Ecto @@ -51,6 +53,7 @@ gevent geocod(?:er|ing) gitmoji glibc +glusterfs Goldmark Gotenberg [Gg]oroutines @@ -104,6 +107,7 @@ multicast [Mm]ultisite multithread Munin +mysqldump[s] Nagios Namecheap namespace @@ -205,6 +209,7 @@ WWWizer Xdebug XHProf XPath +yaml Yusuf Zend diff --git a/contributing/styles/config/vocabularies/Platform/reject.txt b/contributing/styles/config/vocabularies/Platform/reject.txt index 8c505b70cf..f801af0345 100644 --- a/contributing/styles/config/vocabularies/Platform/reject.txt +++ b/contributing/styles/config/vocabularies/Platform/reject.txt @@ -3,7 +3,3 @@ MongDB postgreSQL strapi -Platform.sh -.platform/routes.yaml -.platform/services.yaml -.platform.app.yaml From ccbf98f73ec6759bf35e1132edf81709e6885fce Mon Sep 17 00:00:00 2001 From: Chad Carlson Date: Mon, 9 Dec 2024 10:12:35 -0500 Subject: [PATCH 22/22] Apply suggestions from code review --- .../src/development/sanitize-db/postgresql-symfony.md | 10 +++++----- .../src/get-started/stacks/laravel/laravel-horizon.md | 2 -- .../src/increase-observability/logs/access-logs.md | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sites/platform/src/development/sanitize-db/postgresql-symfony.md b/sites/platform/src/development/sanitize-db/postgresql-symfony.md index 9a4f7b860a..53f8c50684 100644 --- a/sites/platform/src/development/sanitize-db/postgresql-symfony.md +++ b/sites/platform/src/development/sanitize-db/postgresql-symfony.md @@ -108,11 +108,11 @@ Set up a script by following these steps: hooks: build: ... deploy: | - if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ] && [ ! -f MOUNT_PATH/is_sanitized ]; then - # The sanitization of the database should happen here (since it's non-production) - php bin/console app:sanitize-data - touch MOUNT_PATH/is_sanitized - fi + if [ "$PLATFORM_ENVIRONMENT_TYPE" != production ] && [ ! -f MOUNT_PATH/is_sanitized ]; then + # The sanitization of the database should happen here (since it's non-production) + php bin/console app:sanitize-data + touch MOUNT_PATH/is_sanitized + fi ``` 3. Commit your changes by running the following command: diff --git a/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md b/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md index 293536d364..afd94d1463 100644 --- a/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md +++ b/sites/upsun/src/get-started/stacks/laravel/laravel-horizon.md @@ -44,8 +44,6 @@ To do so, use the following configuration: applications: myapp: [...] - {{< variable "APP_NAME" >}}: - [...] workers: horizon: commands: diff --git a/sites/upsun/src/increase-observability/logs/access-logs.md b/sites/upsun/src/increase-observability/logs/access-logs.md index a6df14582f..e63772b670 100644 --- a/sites/upsun/src/increase-observability/logs/access-logs.md +++ b/sites/upsun/src/increase-observability/logs/access-logs.md @@ -127,7 +127,7 @@ See an example of [uploading logs to Amazon S3](https://gitlab.com/contextualcod | Type | Always present | Description | | ------------- | -------------- | ----------- | -| `access` | Yes | The raw access log for t`he nginx instance running on the container. It doesn't include requests that are redirected or cached by the [router](../../define-routes/_index.md). | +| `access` | Yes | The raw access log for the nginx instance running on the container. It doesn't include requests that are redirected or cached by the [router](../../define-routes/_index.md). | | `app` | Yes | All log messages generated by the app including language errors and exceptions. | | `cron` | No | The output of cron jobs. Only exists after a cron job has run. | | `deploy` | No | The output of the [`deploy` hook](../../create-apps/hooks/hooks-comparison.md#deploy-hook). Only exists after a `deploy` hook has run. |