Skip to content

Commit 7d00362

Browse files
authored
Restore simplified relationships (updated) (#3881)
* Update registry to use service names for relationship names. * add-services/_index.md * add-services/headless-chrome.md * themes/../partials/examples/relationships.html * themes/../partials/examples/servicedefn.html * themes/../shortcodes/endpoint-description.md * themes/../shortcodes/v2connect2app.md * add-services/influxdb.md * Fix usage example indents and comment spacing. * add-services/kafka * add-services/memcached. * Fix double = typo. * add-services/mongodb.md * endpoint-description > oracle-mysql fix * add-services/mysql/_index.md * add-services/mysql/mysql-replication. * add-services/network-storage * add-services/opensearch.md * add-services/postgresql * add-services/rabbitmq.md * add-services/redis * add-services/solr.md * add-services/varnish * Fix random character mistake. * create-apps/_index.md * create-apps/app-reference * guides/drupal/redis. * languages/elixir. * languages/java/migration * languages/lisp. * languages/ruby. * learn/tutorials/restrict-service-access * create-apps/workers. * [guides|get-started/stacks]/symfony/environment-variables
1 parent d0e79ec commit 7d00362

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2211
-1597
lines changed

shared/data/registry.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "",
44
"disk": false,
55
"docs": {
6-
"relationship_name": "chromeheadlessbrowser",
7-
"service_name": "chromeheadless",
6+
"relationship_name": "chrome-headless",
7+
"service_name": "chrome-headless",
88
"url": "/add-services/headless-chrome.html"
99
},
1010
"endpoint": "http",
@@ -100,7 +100,7 @@
100100
"description": "A manufacture service for Elasticsearch",
101101
"disk": true,
102102
"docs": {
103-
"relationship_name": "essearch",
103+
"relationship_name": "elasticsearch",
104104
"service_name": "elasticsearch",
105105
"url": "/add-services/elasticsearch.html"
106106
},
@@ -276,7 +276,7 @@
276276
"description": "",
277277
"disk": true,
278278
"docs": {
279-
"relationship_name": "influxdbdatabase",
279+
"relationship_name": "influxdb",
280280
"service_name": "influxdb",
281281
"url": "/add-services/influxdb.html"
282282
},
@@ -355,7 +355,7 @@
355355
"description": "",
356356
"disk": true,
357357
"docs": {
358-
"relationship_name": "kafkaqueue",
358+
"relationship_name": "kafka",
359359
"service_name": "kafka",
360360
"url": "/add-services/kafka.html"
361361
},
@@ -431,7 +431,7 @@
431431
"repo_name": "mariadb",
432432
"disk": true,
433433
"docs": {
434-
"relationship_name": "mariadbdatabase",
434+
"relationship_name": "mariadb",
435435
"service_name": "mariadb",
436436
"url": "/add-services/mysql.html"
437437
},
@@ -491,7 +491,7 @@
491491
"repo_name": "mariadb",
492492
"disk": true,
493493
"docs": {
494-
"relationship_name": "mysqldatabase",
494+
"relationship_name": "mysql",
495495
"service_name": "mysql",
496496
"url": "/add-services/mysql.html"
497497
},
@@ -547,7 +547,7 @@
547547
"repo_name": "memcached",
548548
"disk": false,
549549
"docs": {
550-
"relationship_name": "memcachedcache",
550+
"relationship_name": "memcached",
551551
"service_name": "memcached",
552552
"url": "/add-services/memcached.html"
553553
},
@@ -573,7 +573,7 @@
573573
"repo_name": "mongodb",
574574
"disk": true,
575575
"docs": {
576-
"relationship_name": "mongodbdatabase",
576+
"relationship_name": "mongodb",
577577
"service_name": "mongodb",
578578
"url": "/add-services/mongodb.html"
579579
},
@@ -598,8 +598,8 @@
598598
"repo_name": "mongodb",
599599
"disk": true,
600600
"docs": {
601-
"relationship_name": "mongodbdatabase",
602-
"service_name": "mongodb",
601+
"relationship_name": "mongodb-enterprise",
602+
"service_name": "mongodb-enterprise",
603603
"url": "/add-services/mongodb.html"
604604
},
605605
"endpoint": "mongodb",
@@ -712,7 +712,7 @@
712712
"description": "A manufacture service for OpenSearch",
713713
"disk": true,
714714
"docs": {
715-
"relationship_name": "ossearch",
715+
"relationship_name": "opensearch",
716716
"service_name": "opensearch",
717717
"url": "/add-services/opensearch.html"
718718
},
@@ -754,7 +754,7 @@
754754
"repo_name": "oracle-mysql",
755755
"disk": true,
756756
"docs": {
757-
"relationship_name": "oracledatabase",
757+
"relationship_name": "oracle-mysql",
758758
"service_name": "oracle-mysql",
759759
"url": "/add-services/mysql.html"
760760
},
@@ -844,7 +844,7 @@
844844
"repo_name": "postgresql",
845845
"disk": true,
846846
"docs": {
847-
"relationship_name": "postgresqldatabase",
847+
"relationship_name": "postgresql",
848848
"service_name": "postgresql",
849849
"url": "/add-services/postgresql.html"
850850
},
@@ -946,7 +946,7 @@
946946
"repo_name": "rabbitmq",
947947
"disk": true,
948948
"docs": {
949-
"relationship_name": "rabbitmqqueue",
949+
"relationship_name": "rabbitmq",
950950
"service_name": "rabbitmq",
951951
"url": "/add-services/rabbitmq.html"
952952
},
@@ -1002,7 +1002,7 @@
10021002
"repo_name": "redis",
10031003
"disk": false,
10041004
"docs": {
1005-
"relationship_name": "rediscache",
1005+
"relationship_name": "redis",
10061006
"service_name": "redis",
10071007
"url": "/add-services/redis.html"
10081008
},
@@ -1150,7 +1150,7 @@
11501150
"repo_name": "solr",
11511151
"disk": true,
11521152
"docs": {
1153-
"relationship_name": "solrsearch",
1153+
"relationship_name": "solr",
11541154
"service_name": "solr",
11551155
"url": "/add-services/solr.html"
11561156
},
@@ -1206,7 +1206,7 @@
12061206
"repo_name": "varnish",
12071207
"disk": false,
12081208
"docs": {
1209-
"relationship_name": "varnishstats",
1209+
"relationship_name": "varnish",
12101210
"service_name": "varnish",
12111211
"url": "/add-services/varnish.html"
12121212
},
@@ -1236,7 +1236,7 @@
12361236
"description": "",
12371237
"disk": true,
12381238
"docs": {
1239-
"relationship_name": "vault_secret",
1239+
"relationship_name": "vault-kms",
12401240
"service_name": "vault-kms",
12411241
"url": "/add-services/vault.html"
12421242
},

sites/platform/src/add-services/_index.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ All service configuration happens in the `{{< vendor/configfile "services" >}}`
2828
Configure your service in the following pattern:
2929

3030
```yaml {configFile="services"}
31-
{{% snippet name="SERVICE_NAME" config="service" %}}
31+
# The name of the service container. Must be unique within a project.
32+
SERVICE_NAME:
3233
type: {{<variable "SERVICE_TYPE" >}}:{{<variable "VERSION" >}}
3334
# Other options...
34-
{{% /snippet %}}
3535
```
3636

3737
An example service configuration for two databases might look like this:
3838

3939
```yaml {configFile="services"}
40-
{{% snippet name="database1" config="service" %}}
40+
# The name of the service container. Must be unique within a project.
41+
mariadb:
4142
type: mariadb:{{% latest "mariadb" %}}
4243
disk: 2048
43-
{{% /snippet %}}
44-
{{% snippet name="database2" config="service" globKey="false" %}}
44+
# The name of the service container. Must be unique within a project.
45+
postgresql:
4546
type: postgresql:{{% latest "postgresql" %}}
4647
disk: 1024
47-
{{% /snippet %}}
4848
```
4949
5050
This YAML file is a dictionary defining all of the services you want to use.
51-
The top-level key is a custom service name ({{<variable "SERVICE_NAME" >}}; in the example, `database1` and `database2`), which you use to identify the service in step 2.
51+
The top-level key is a custom service name ({{<variable "SERVICE_NAME" >}}; in the example, `mariadb` and `postgresql`), which you use to identify the service in step 2.
5252

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

@@ -70,7 +70,7 @@ The following table presents the keys you can define for each service:
7070
| `disk` | `integer` | For some services | The size in [MB](/glossary.md#mb) of the [persistent disk](#disk) allocated to the service. Can't be set for memory-resident-only services such as `memcache` and `redis`. Limited by your plan settings. |
7171
| `size` | `string` | | How many CPU and memory [resources to allocate](#size) to the service. Possible values are `AUTO`, `S`, `M`, `L`, `XL`, `2XL`, and `4XL`. Limited by your plan settings.<BR><BR>When `AUTO` applies, available resources are automatically balanced out based on the number of containers on your plan, so that no container is oversized compared to the others. To view the actual sizes of your containers, check the **Environment Configuration** section in your deployment [activity logs](../increase-observability/logs/access-logs.md#activity-logs). |
7272
| `configuration` | dictionary | For some services | Some services have additional specific configuration options that can be defined here, such as specific endpoints. See the given service page for more details. |
73-
| `relationships` | dictionary | For some services | Some services require a relationship to your app. The content of the dictionary has the same type as the `relationships` dictionary for [app configuration](../create-apps/app-reference.md#relationships). The `endpoint_name` for apps is always `http`. |
73+
| `relationships` | dictionary | For some services | Some services require a relationship to your app. The content of the dictionary has the same type as the `relationships` dictionary for [app configuration](/create-apps/app-reference.md#relationships). The `endpoint_name` for apps is always `http`. |
7474

7575
##### Disk
7676

@@ -90,46 +90,46 @@ Note that service containers in preview environments are always set to size `S`.
9090

9191
### 2. Connect the service
9292

93-
Once you have configured a service, you need to create a relationship to connect it to an app.
94-
This is done in your [app configuration for relationships](../create-apps/app-reference.md#relationships).
95-
96-
The relationship follows this pattern:
93+
To connect the service, use the following configuration:
9794

9895
```yaml {configFile="app"}
99-
{{% snippet name="<APP_NAME>" config="app" root="false"%}}
100-
10196
# Other options...
10297
10398
# Relationships enable an app container's access to a service.
99+
# The example below shows simplified configuration leveraging a default service (identified from the relationship name) and a default endpoint.
100+
# See the Application reference for all options for defining relationships and endpoints.
104101
relationships:
105-
{{< variable "RELATIONSHIP_NAME" >}}: "{{< variable "SERVICE_NAME" >}}:{{< variable "ENDPOINT" >}}"
106-
{{% /snippet %}}
107-
{{% snippet name="SERVICE_NAME" config="service" placeholder="true"%}}
108-
type: {{<variable "SERVICE_TYPE" >}}:{{<variable "VERSION" >}}
109-
# Other options...
110-
{{% /snippet %}}
102+
{{<variable "SERVICE_NAME" >}}:
111103
```
112104

105+
You can define `<SERVICE_NAME>` as you like, so long as it's unique between all defined services
106+
and matches in both the application and services configuration.
107+
108+
The example above leverages [default endpoint](/create-apps/app-reference#relationships) configuration for relationships.
109+
That is, it uses default endpoints behind-the-scenes, providing a [relationship](/create-apps/app-reference#relationships)
110+
(the network address a service is accessible from) that is identical to the _name_ of that service.
111+
112+
Depending on your needs, instead of default endpoint configuration,
113+
you can use [explicit endpoint configuration](/create-apps/app-reference#relationships).
114+
113115
An example relationship to connect to the databases given in the [example in step 1](#1-configure-the-service):
114116

115117
```yaml {configFile="app"}
116-
{{< snippet name="<APP_NAME>" config="app" root="false">}}
117-
118118
# Other options...
119119
120-
# Relationships enable an app container's to a service.
120+
# Relationships enable an app container's access to a service.
121121
relationships:
122-
mysql_database: "database1:mysql"
123-
postgresql_database: "database2:postgresql"
124-
{{% /snippet %}}
125-
{{% snippet name="database1" config="service" placeholder="true" %}}
122+
mariadb:
123+
postgresql:
124+
```
125+
126+
```yaml {configFile="services"}
127+
mariadb:
126128
type: mariadb:{{% latest "mariadb" %}}
127129
disk: 2048
128-
{{% /snippet %}}
129-
{{% snippet name="database2" config="service" globKey="false" placeholder="true" %}}
130+
postgresql:
130131
type: postgresql:{{% latest "postgresql" %}}
131132
disk: 1024
132-
{{% /snippet %}}
133133
```
134134

135135
As with the service name, you can give the relationship any name you want
@@ -201,17 +201,17 @@ To get the credentials for a given service, run the following command:
201201
You get output like the following:
202202

203203
```yaml
204-
database:
204+
mariadb:
205205
-
206206
username: user
207207
scheme: mysql
208-
service: database
208+
service: mariadb
209209
fragment: null
210210
ip: 198.51.100.37
211-
hostname: abcdefghijklm1234567890123.database.service._.eu.{{< vendor/urlraw "hostname" >}}
211+
hostname: abcdefghijklm1234567890123.mariadb.service._.eu.{{< vendor/urlraw "hostname" >}}
212212
public: false
213213
cluster: abcdefgh1234567-main-abcd123
214-
host: database.internal
214+
host: mariadb.internal
215215
rel: mysql
216216
query:
217217
is_master: true
@@ -220,10 +220,10 @@ database:
220220
type: 'mariadb:10.6'
221221
port: 3306
222222
host_mapped: false
223-
url: 'mysql://user:@database.internal:3306/main'
223+
url: 'mysql://user:@mariadb.internal:3306/main'
224224
```
225225

226-
With this example, you can connect to the `database` relationship
226+
With this example, you can connect to the `mariadb` relationship
227227
with the user `user`, an empty password, and the database name `main` (from the `path`).
228228
The `url` property shows a full database connection that can be used from your app.
229229

sites/platform/src/add-services/headless-chrome.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Puppeteer can be used to generate PDFs and screenshots of web pages, automate fo
4242
"ip": "123.456.78.90",
4343
"hostname": "azertyuiopqsdfghjklm.chromeheadless.service._.eu-1.{{< vendor/urlraw "hostname" >}}",
4444
"cluster": "azertyuiop-main-7rqtwti",
45-
"host": "chromeheadlessbrowser.internal",
45+
"host": "chromeheadless.internal",
4646
"rel": "http",
4747
"scheme": "http",
4848
"type": "chrome-headless:{{< latest "chrome-headless" >}}",
@@ -103,7 +103,7 @@ Using the [Node.js Config Reader library](../development/variables/use-variables
103103
const platformsh = require('platformsh-config');
104104

105105
const config = platformsh.config();
106-
const credentials = config.credentials('chromeheadlessbrowser');
106+
const credentials = config.credentials('chromeheadless');
107107
```
108108

109109
and use them to define the `browserURL` parameter of `puppeteer.connect()` within an `async` function:
@@ -112,7 +112,7 @@ and use them to define the `browserURL` parameter of `puppeteer.connect()` withi
112112
exports.getBrowser = async function (url) {
113113
try {
114114
// Connect to chrome-headless using pre-formatted puppeteer credentials
115-
const formattedURL = config.formattedCredentials('chromeheadlessbrowser', 'puppeteer');
115+
const formattedURL = config.formattedCredentials('chromeheadless', 'puppeteer');
116116
const browser = await puppeteer.connect({browserURL: formattedURL});
117117

118118
...

0 commit comments

Comments
 (0)