Skip to content

Commit

Permalink
WIP: remove disk references for service definitions (platformsh#3491)
Browse files Browse the repository at this point in the history
* fix: remove disk references for service definitions

* Vendorize service pages to remove disk key batch 1

* Batch 2

* Vendorize index page to remove disk

* Temp fix for Redis mess

---------

Co-authored-by: Marine Gandy <[email protected]>
Co-authored-by: AnouckColson <[email protected]>
Co-authored-by: AnouckColson <[email protected]>
  • Loading branch information
4 people authored Oct 10, 2023
1 parent 10e9600 commit 76a9cb1
Show file tree
Hide file tree
Showing 19 changed files with 1,500 additions and 167 deletions.
3 changes: 2 additions & 1 deletion sites/friday/.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ golang:
type: golang
versions:
deprecated:
- '1.19'
- '1.18'
- '1.17'
- '1.16'
Expand All @@ -214,8 +215,8 @@ golang:
- '1.9'
- '1.8'
supported:
- '1.21'
- '1.20'
- '1.19'
influxdb:
description: ''
disk: true
Expand Down
93 changes: 83 additions & 10 deletions sites/platform/src/add-services/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,34 @@ Configure your service in the following pattern:

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

{{< version/specific >}}
<!-- Version 1 -->

```yaml {configFile="services"}
{{% snippet name="database1" config="service" %}}
{{< snippet name="database1" config="service" >}}
type: mariadb:{{% latest "mariadb" %}}
disk: 2048
{{% /snippet %}}
{{% snippet name="database2" config="service" globKey="false" %}}
{{< /snippet >}}
{{< snippet name="database2" config="service" globKey="false" >}}
type: postgresql:{{% latest "postgresql" %}}
disk: 1024
{{% /snippet %}}
{{< /snippet >}}
```

<--->
<!-- Version 2 -->

```yaml {configFile="services"}
{{< snippet name="database1" config="service" >}}
type: mariadb:{{% latest "mariadb" %}}
{{< /snippet >}}
{{< snippet name="database2" config="service" globKey="false" >}}
type: postgresql:{{% latest "postgresql" %}}
{{< /snippet >}}
```

{{< /version/specific >}}

{{% version/specific %}}
<!-- API Version 1 -->
This YAML file is a dictionary defining all of the services you want to use.
Expand All @@ -79,6 +96,10 @@ Always back up your data before changing existing services in your `{{< vendor/c

The following table presents the keys you can define for each service:

{{% version/specific %}}

<!-- Version 1 -->

| Name | Type | Required | Description |
| --------------- | ---------- | ----------------- | ----------- |
| `type` | `string` | Yes | One of the [available services](#available-services) in the format `type:version`. |
Expand All @@ -87,7 +108,19 @@ The following table presents the keys you can define for each service:
| `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. |
| `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`. |

<--->
<!-- Version 2 -->

| Name | Type | Required | Description |
| --------------- | ---------- | ----------------- | ----------- |
| `type` | `string` | Yes | One of the [available services](#available-services) in the format `type:version`. |
| `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. |
| `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`. |

{{% /version/specific %}}

{{% version/specific %}}
<!-- Version 1 -->

##### Disk

Expand All @@ -105,6 +138,20 @@ If your plan is sufficiently large for bigger containers, you can increase the s

Note that service containers in preview environments are always set to size `S`.

<--->
<!-- Version 2 -->

##### Resources (CPU, RAM, disk)

{{% vendor/name %}} allows you to configure resources (CPU, RAM, and disk) per environment for each of your services.
For more information, see how to [manage resources](/manage-resources.md).

{{% disk-space-mb %}}

{{% disk-downsize type="service" %}}

{{% /version/specific %}}

### 2. Connect the service

Once you have configured a service, you need to create a relationship to connect it to an app.
Expand All @@ -129,26 +176,52 @@ relationships:

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

{{% version/specific %}}
<!-- Version 1 -->

```yaml {configFile="app"}
{{% snippet name="<APP_NAME>" config="app" root="false"%}}
{{< snippet name="<APP_NAME>" config="app" root="false">}}

# Other options...

# Relationships enable an app container's to a service.
relationships:
mysql_database: "database1:mysql"
postgresql_database: "database2:postgresql"
{{% /snippet %}}
{{% snippet name="database1" config="service" placeholder="true" %}}
{{< /snippet >}}
{{< snippet name="database1" config="service" placeholder="true" >}}
type: mariadb:{{% latest "mariadb" %}}
disk: 2048
{{% /snippet %}}
{{% snippet name="database2" config="service" globKey="false" placeholder="true" %}}
{{< /snippet >}}
{{< snippet name="database2" config="service" globKey="false" placeholder="true" >}}
type: postgresql:{{% latest "postgresql" %}}
disk: 1024
{{% /snippet %}}
{{< /snippet >}}
```

<--->
<!-- Version 2 -->

```yaml {configFile="app"}
{{< snippet name="<APP_NAME>" config="app" root="false">}}

# Other options...

# Relationships enable an app container's to a service.
relationships:
mysql_database: "database1:mysql"
postgresql_database: "database2:postgresql"
{{< /snippet >}}
{{< snippet name="database1" config="service" placeholder="true" >}}
type: mariadb:{{% latest "mariadb" %}}
{{< /snippet >}}
{{< snippet name="database2" config="service" globKey="false" placeholder="true" >}}
type: postgresql:{{% latest "postgresql" %}}
{{< /snippet >}}
```

{{% /version/specific %}}

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.
Expand Down
68 changes: 60 additions & 8 deletions sites/platform/src/add-services/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ relationships:
{{< /snippet >}}
{{< snippet name="searchelastic" config="service" placeholder="true" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
disk: 256
{{< /snippet >}}
```

Expand Down Expand Up @@ -220,16 +219,33 @@ No username or password is required to connect to it.
Starting with Elasticsearch 7.2 you may optionally enable HTTP Basic authentication.
To do so, include the following in your `{{< vendor/configfile "services" >}}` configuration:

{{< version/specific >}}
<!-- Version 1 -->

```yaml {configFile="services"}
{{% snippet name="search" config="service" %}}
{{< snippet name="search" config="service" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
disk: 2048
configuration:
authentication:
enabled: true
{{% /snippet %}}
{{< /snippet >}}
```

<--->
<!-- Version 2 -->

```yaml {configFile="services"}
{{< snippet name="search" config="service" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
configuration:
authentication:
enabled: true
{{< /snippet >}}
```

{{< /version/specific >}}

If you're using a [premium version](#supported-versions),
use the `elasticsearch-enterprise` type.

Expand All @@ -245,33 +261,69 @@ To do so, add a route to `{{< vendor/configfile "routes" >}}` that has `search:e

For example:

{{< version/specific >}}
<!-- Version 1 -->

```yaml {configFile="routes"}
{{% snippet name="search:elasticsearch" config="route" subDom="es" redirect="false" /%}}
{{% snippet name="search" config="service" placeholder="true" %}}
{{< snippet name="search:elasticsearch" config="route" subDom="es" redirect="false" />}}
{{< snippet name="search" config="service" placeholder="true" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
disk: 2048
configuration:
authentication:
enabled: true
{{% /snippet %}}
{{< /snippet >}}
```

<--->
<!-- Version 2 -->

```yaml {configFile="routes"}
{{< snippet name="search:elasticsearch" config="route" subDom="es" redirect="false" />}}
{{< snippet name="search" config="service" placeholder="true" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
configuration:
authentication:
enabled: true
{{< /snippet >}}
```

{{< /version/specific >}}

## Plugins

Elasticsearch offers a number of plugins.
To enable them, list them under the `configuration.plugins` key in your `{{< vendor/configfile "services" >}}` file, like so:

{{< version/specific >}}
<!-- Version 1 -->

```yaml {configFile="services"}
{{% snippet name="search" config="service" %}}
{{< snippet name="search" config="service" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
disk: 1024
configuration:
plugins:
- analysis-icu
- lang-python
{{% /snippet %}}
{{< /snippet >}}
```

<--->
<!-- Version 2 -->

```yaml {configFile="services"}
{{< snippet name="search" config="service" >}}
type: elasticsearch:{{% latest "elasticsearch" %}}
configuration:
plugins:
- analysis-icu
- lang-python
{{< /snippet >}}
```

{{< /version/specific >}}

If you're using a [premium version](#supported-versions),
use the `elasticsearch-enterprise` type.

Expand Down
27 changes: 23 additions & 4 deletions sites/platform/src/add-services/influxdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,37 @@ See more information on [how to upgrade to version 2.3 or later](#upgrade-to-ver

{{% endpoint-description type="influxdb" /%}}

{{< version/specific >}}
<!-- Version 1 -->

```yaml {configFile="app"}
{{% snippet name="myapp" config="app" root="myapp" %}}
{{< snippet name="myapp" config="app" root="myapp" >}}
# Relationships enable an app container's access to a service.
relationships:
influxtimedb: "timedb:influxdb"
{{% /snippet %}}
{{% snippet name="timedb" config="service" placeholder="true" %}}
{{< /snippet >}}
{{< snippet name="timedb" config="service" placeholder="true" >}}
type: influxdb:{{% latest "influxdb" %}}
disk: 256
{{% /snippet %}}
{{< /snippet >}}
```

<--->
<!-- Version 2 -->

```yaml {configFile="app"}
{{< snippet name="myapp" config="app" root="myapp" >}}
# Relationships enable an app container's access to a service.
relationships:
influxtimedb: "timedb:influxdb"
{{< /snippet >}}
{{< snippet name="timedb" config="service" placeholder="true" >}}
type: influxdb:{{% latest "influxdb" %}}
{{< /snippet >}}
```

{{< /version/specific >}}

{{% v2connect2app serviceName="timedb" relationship="influxtimedb" var="INFLUX_HOST"%}}

```bash {location="myapp/.environment"}
Expand Down
1 change: 0 additions & 1 deletion sites/platform/src/add-services/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ relationships:
{{< /snippet >}}
{{< snippet name="queuekafka" config="service" placeholder="true" >}}
type: kafka:{{% latest "kafka" %}}
disk: 512
{{< /snippet >}}
```

Expand Down
1 change: 0 additions & 1 deletion sites/platform/src/add-services/memcached.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ relationships:
{{< /snippet >}}
{{< snippet name="cachemc" config="service" placeholder="true" >}}
type: memcached:{{% latest "memcached" %}}
disk: 256
{{< /snippet >}}
```

Expand Down
1 change: 0 additions & 1 deletion sites/platform/src/add-services/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ relationships:
{{< /snippet >}}
{{< snippet name="dbmongo" config="service" placeholder="true" >}}
type: mongodb-enterprise:{{% latest "mongodb-enterprise" %}}
disk: 256
{{< /snippet >}}
```

Expand Down
Loading

0 comments on commit 76a9cb1

Please sign in to comment.