Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 785b6f0

Browse files
authored
MAGECLOUD-2739 update services (#5039)
* MAGECLOUD-2739 update services with required values * clarify role of the config files * Update examples * Update project-conf-files_services-redis.md * apply technical feedback and update examples * forgot disk value example * simplified the relationships property * typos * describe relationships and scrub pretty print * Apply suggestions from code review Co-Authored-By: Margaret Eker <meker@adobe.com> * updates from feedback * fix the environment steps
1 parent 681851d commit 785b6f0

8 files changed

+186
-165
lines changed

_includes/cloud/pretty-print-services.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

guides/v2.2/cloud/project/project-conf-files_magento-app.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,22 @@ access:
5959

6060
### `relationships`
6161

62-
Defines the service mapping in your application.
62+
Defines the service mapping in the application.
6363

64-
The left-hand side is the name of the relationship as it will be exposed to the application in the `MAGENTO_CLOUD_RELATIONSHIPS` environment variable. The right-hand side is in the form `<service-name>:<endpoint-name>`, where `<service-name>` comes from `.magento/services.yaml` and `<endpoint-name>` should be the same as the value of `type` declared in that same file.
65-
66-
Example of valid options are:
64+
The relationship `name` is available to the application in the `MAGENTO_CLOUD_RELATIONSHIPS` environment variable. The `<service-name>:<endpoint-name>` relationship maps to the name and type values defined in the `.magento/services.yaml` file.
6765

66+
```yaml
67+
relationships:
68+
<name>: "<service-name>:<endpoint-name>"
6869
```
69-
database: "mysql:mysql"
70-
database2: "mysql2:mysql"
71-
cache: "arediscache:redis"
72-
search: "searchengine:solr"
70+
71+
The following is an example of the default relationships:
72+
73+
```yaml
74+
relationships:
75+
database: "mysql:mysql"
76+
redis: "redis:redis"
77+
elasticsearch: "elasticsearch:elasticsearch"
7378
```
7479

7580
See [Services]({{page.baseurl}}/cloud/project/project-conf-files_services.html) for a full list of currently supported service types and endpoints.

guides/v2.2/cloud/project/project-conf-files_services-elastic.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ functional_areas:
4141

4242
For information on how these changes affect your environments, see [Services]({{ page.baseurl }}/cloud/project/project-conf-files_services.html).
4343

44-
1. [Verify the relationships](#verify-relationships) and configure Elasticsearch in the Admin UI.
44+
1. [Verify the relationships]({{page.baseurl}}/cloud/project/project-conf-files_services.html#service-relationships) and configure Elasticsearch in the Admin UI.
4545

4646
### Add Elasticsearch plugins
4747

@@ -80,11 +80,5 @@ See [Elasticsearch plugin documentation](https://www.elastic.co/guide/en/elastic
8080
{:.bs-callout-info}
8181
If you use the ElasticSuite third-party plugin, you must [update the `{{site.data.var.ct}}` package]({{page.baseurl}}/cloud/project/ece-tools-update.html) to version 2002.0.19 or later.
8282

83-
## Verify relationships
84-
85-
{{site.data.var.ece}} uses the [MAGENTO_CLOUD_RELATIONSHIPS]({{ page.baseurl }}/cloud/env/variables-cloud.html) variable to retrieve the environment-related relationships. You must use this information when you [configure Elasticsearch through the Magento Admin]({{page.baseurl}}/config-guide/elasticsearch/configure-magento.html).
86-
87-
{% include cloud/pretty-print-services.md %}
88-
8983
{: .bs-callout-warning}
9084
Staging and Production environments that are in the same cluster share a single Elasticsearch instance, so you must specify a unique Elasticsearch prefix for each of these environments.

guides/v2.2/cloud/project/project-conf-files_services-mysql.md

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,77 @@ functional_areas:
66
- Setup
77
---
88

9-
The `mysql` service provides data storage. It is based on [MariaDB](https://mariadb.com/), supporting the [XtraDB](https://www.percona.com/software/mysql-database/percona-server/xtradb) storage engine (equivalent to MySQL with InnoDB).
9+
The `mysql` service provides persistent data storage. It is based on [MariaDB](https://mariadb.com/), supporting the [XtraDB](https://www.percona.com/software/mysql-database/percona-server/xtradb) storage engine.
1010

11-
We support MariaDB version 10.0, which includes reimplemented features from MySQL 5.6 and 5.7.
11+
We support MariaDB version 10.2, which includes reimplemented features from MySQL 5.6 and 5.7.
1212

13-
To access the MariaDB database directly, [open an SSH tunnel]({{ page.baseurl }}/cloud/env/environments-start.html#env-start-tunn) and use the following command:
13+
#### To access the MariaDB database directly:
14+
15+
Using SSH, log in to the remote server and connect to the database.
16+
17+
For Starter:
1418

1519
```bash
16-
mysql -h database.internal -u user
20+
mysql -h database.internal -u <username>
1721
```
1822

19-
{% include cloud/service-config-integration-starter.md %}
23+
For Pro, use the db, username, and password from the relationship:
24+
25+
```bash
26+
mysql -h<db> -p<number> -u<username> -p<password>
27+
```
28+
29+
## Enable MySQL
30+
31+
1. Add the required name, type, and disk value (in MB) to the `.magento/services.yaml` file.
32+
33+
```yaml
34+
mysql:
35+
type: mysql:10.2
36+
disk: 2048
37+
```
38+
39+
1. Configure the relationships in the `.magento.app.yaml` file.
40+
41+
```yaml
42+
relationships:
43+
database: "mysql:mysql"
44+
```
45+
46+
1. Add, commit, and push your code changes.
47+
48+
```bash
49+
git add -A && git commit -m "Enable mysql service" && git push origin <branch-name>
50+
```
51+
52+
1. [Verify the relationships]({{page.baseurl}}/cloud/project/project-conf-files_services.html#service-relationships).
53+
54+
{: .bs-callout-info }
55+
- If you configure one MySQL user, you cannot use the [`DEFINER`](http://dev.mysql.com/doc/refman/5.6/en/show-grants.html) access control mechanism for stored procedures and views.
56+
- MySQL errors such as `PDO Exception 'MySQL server has gone away` are usually the result of exhausting your existing disk space. Be sure you have sufficient space allocated to the service in [`.magento/services.yaml`]({{ page.baseurl }}/cloud/project/project-conf-files_magento-app.html#disk).
2057

21-
## Set up multiple database users {#cloud-appyaml-mysqlusers}
58+
## Set up multiple database users
2259

2360
Optionally, you can set up multiple databases as well as multiple users with different permissions.
2461

25-
An _endpoint_ is a user who has privileges you specify. By default, there is one endpoint named `mysql` that has administrator access to all defined databases. To set up multiple databases and users, you must specify multiple endpoints.
62+
An _endpoint_ is a set of credentials (or users) with specific privileges. By default, there is one endpoint named `mysql` that has administrator access to all defined databases. To set up multiple databases and users, you must define multiple endpoints in the services.yaml file and declare the relationships in the .magento.app.yaml file.
2663

27-
{:.bs-callout .bs-callout-warning}
64+
{: .bs-callout-warning}
2865
You cannot use multiple _databases_ with {{site.data.var.ee}} at this time. You **can** create multiple endpoints to restrict access to the `main` database.
2966

30-
To specify user access, use the `endpoints` nested array. Each endpoint can have access to one or more schemas (databases), and can have different levels of permission on each.
67+
Use a nested array to define the endpoints for specific user access. Each endpoint can designate access to one or more schemas (databases) and different levels of permission on each.
3168

3269
The valid permission levels are:
3370

3471
- `ro`: Only SELECT queries are allowed.
35-
- `rw`: SELECT queries as well as INSERT/UPDATE/DELETE queries are allowed.
72+
- `rw`: SELECT queries and INSERT, UPDATE, and DELETE queries are allowed.
3673
- `admin`: All queries are allowed, including DDL queries (CREATE TABLE, DROP TABLE, and so on).
3774

3875
If no endpoints are defined, a single endpoint named `mysql` has `admin` access to the `main` database. For example:
3976

4077
```yaml
41-
mysqldb:
42-
type: mysql:10.0
78+
mysql:
79+
type: mysql:10.2
4380
disk: 2048
4481
configuration:
4582
schemas:
@@ -55,40 +92,19 @@ mysqldb:
5592
importer:
5693
privileges:
5794
main: rw
58-
5995
```
6096

61-
In the preceding example, the endpoint (that is, user) `reporter` has `ro` privileges to the `main` database and endpoint `importer` has `rw` access to the `main` database. This means that:
97+
In the preceding example, the `admin` endpoint provides admin-level access to the `main` database, the `reporter` endpoint provides read-only access, and the `importer` endpoint provides read-write access. This means that:
6298

6399
- The `admin` user has full control of the database.
64100
- The `repoter` user has SELECT privileges only.
65101
- The `importer` user has SELECT, INSERT, UPDATE, and DELETE privileges.
66102

67-
## Add MySQL in services.yaml and .magento.app.yaml {#settings}
68-
69-
To enable MySQL, add the following code with your installed version and allocated disk space in MB to `.magento/services.yaml`.
70-
71-
```yaml
72-
mysql:
73-
type: mysql:10.0
74-
disk: 2048
75-
```
76-
77-
To configure the relationships for the environment variable, set a relationship in your `.magento.app.yaml` in the Git branch. For example:
103+
You must add the endpoints defined in the above example to the `relationships` property of the `.magento.app.yaml` file. For example:
78104

79105
```yaml
80106
relationships:
81-
database: "mydatabase:mysql"
107+
database: "mysql:admin"
108+
databasereporter: "mysql:reporter"
109+
databaseimporter: "mysql:importer"
82110
```
83-
84-
Merge and deploy the code to set the configurations for Redis. For information on how these changes affect your environments, see [`services.yaml`]({{ page.baseurl }}/cloud/project/project-conf-files_services.html).
85-
86-
{: .bs-callout-info }
87-
- If you configure one MySQL user, you cannot use the [`DEFINER`](http://dev.mysql.com/doc/refman/5.6/en/show-grants.html) access control mechanism for stored procedures and views.
88-
- MySQL errors such as `PDO Exception 'MySQL server has gone away` are usually the result of exhausting your existing disk space. Be sure you have sufficient space allocated to the service in [`.magento/services.yaml`]({{ page.baseurl }}/cloud/project/project-conf-files_magento-app.html#disk).
89-
90-
## Verify environment-related relationships {#cloud-es-config-mg}
91-
92-
We use the {{site.data.var.ece}} environment variable [`$MAGENTO_CLOUD_RELATIONSHIPS`]({{ page.baseurl }}/cloud/env/environment-vars_cloud.html), a JSON object, to retrieve environment-related relationships.
93-
94-
{% include cloud/pretty-print-services.md %}

guides/v2.2/cloud/project/project-conf-files_services-rabbit.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ relationships:
3636

3737
Merge and deploy the code to set the configurations for RabbitMQ. For information on how these changes affect your environments, see [`services.yaml`]({{ page.baseurl }}/cloud/project/project-conf-files_services.html).
3838

39-
## Verify environment-related relationships {#cloud-es-config-mg}
40-
41-
We use the {{site.data.var.ece}} environment variable [`$MAGENTO_CLOUD_RELATIONSHIPS`]({{ page.baseurl }}/cloud/env/environment-vars_cloud.html), a JSON object, to retrieve environment-related relationships.
42-
43-
{% include cloud/pretty-print-services.md %}
44-
4539
## Connect to RabbitMQ for debugging {#connect}
4640

4741
For debugging purposes, it is useful to directly connect to a service instance in one of the following ways:
@@ -68,11 +62,7 @@ You can do this using [SSH tunneling]({{ page.baseurl }}/cloud/env/environments-
6862
magento-cloud tunnel:open
6963
```
7064

71-
1. Pretty-print the relationships. This lets you see which username and password to use, and you can verify the remote service's port.
72-
73-
```bash
74-
php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));'
75-
```
65+
1. [Verify the relationships]({{page.baseurl}}/cloud/project/project-conf-files_services.html#service-relationships).
7666

7767
1. Enable local port forwarding to RabbitMQ.
7868

guides/v2.2/cloud/project/project-conf-files_services-redis.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,40 @@ We support Redis versions 2.8, 3.0, and 5.0. Redis 3.0 supports up to 64 differe
1212

1313
{% include cloud/service-config-integration-starter.md %}
1414

15-
## Add Redis in configuration files {#settings}
15+
## Enable Redis
1616

17-
To enable Redis, add your installed version and allocated disk space in MB to `.magento/services.yaml` file:
17+
1. Add the required name and type to the `.magento/services.yaml` file.
1818

19-
```yaml
20-
myredis:
21-
type: redis:3.0
22-
```
19+
```yaml
20+
redis:
21+
type: redis:3.2
22+
```
2323
24-
To provide your own Redis configuration, add a `core_config` key in your `.magento/services.yaml` file:
24+
To provide your own Redis configuration, add a `core_config` key in your `.magento/services.yaml` file:
2525

26-
```yaml
27-
cache:
28-
type: redis:3.0
29-
```
26+
```yaml
27+
cache:
28+
type: redis:3.2
29+
```
3030

31-
To configure relationships for an environment variable in your `.magento.app.yaml` file:
31+
1. Configure the relationships in the `.magento.app.yaml` file.
3232

33-
```yaml
34-
runtime:
35-
extensions:
36-
- redis
33+
```yaml
34+
runtime:
35+
extensions:
36+
- redis
3737
38-
relationships:
39-
redis: "myredis:redis"
40-
```
38+
relationships:
39+
redis: "redis:redis"
40+
```
4141

42-
Merge and deploy the code to set the configurations for Redis. For information on how these changes affect your environments, see [`services.yaml`]({{ page.baseurl }}/cloud/project/project-conf-files_services.html).
42+
1. Add, commit, and push your code changes.
4343

44-
## Verify environment-related relationships {#cloud-es-config-mg}
44+
```bash
45+
git add -A && git commit -m "Enable redis service" && git push origin <branch-name>
46+
```
4547

46-
We use the {{site.data.var.ece}} environment variable [`$MAGENTO_CLOUD_RELATIONSHIPS`]({{ page.baseurl }}/cloud/env/environment-vars_cloud.html), a JSON object, to retrieve environment-related relationships.
47-
48-
{% include cloud/pretty-print-services.md %}
48+
1. [Verify the relationships]({{page.baseurl}}/cloud/project/project-conf-files_services.html#service-relationships).
4949

5050
## Using the Redis CLI
5151

0 commit comments

Comments
 (0)