Skip to content

Commit

Permalink
Introduce a new GlueBackendApi endpoint (#256)
Browse files Browse the repository at this point in the history
* Introduce a new GlueBackendApi endpoint

* Glue env vars extension

* SC-8094: updated docs

* Update 09-troubleshooting.md

Co-authored-by: Filip Sushko <[email protected]>
  • Loading branch information
alexanderM91 and zyuzka authored Dec 16, 2021
1 parent 46b5e99 commit aaaba5f
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Learn how to convert a project into a Docker based instance in [Integrating the

## Running production

Currently, there is no installation guide for deploying Spryker in Docker in a production environment. But you can generate the images suitable for a production environment and the archives with assets for each application - Yves, BackOffice(Zed), Backend-Gateway, Glue, , and MerchantPortal.
Currently, there is no installation guide for deploying Spryker in Docker in a production environment. But you can generate the images suitable for a production environment and the archives with assets for each application - Yves, BackOffice(Zed), Backend-Gateway, GlueStorefront(Glue), GlueBackend and MerchantPortal.

Learn how to generate Docker images and assets for a production environment in [Running production](07-running-production.md).

Expand Down
6 changes: 4 additions & 2 deletions docs/07-deploy-file/02-deploy.file.reference.v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This reference page describes version 1 of the Deploy file format. This is the n
<dd>A store related context a request is processed in.</dd>

<dt>Application</dt>
<dd>A Spryker application, like Backoffice(Zed), Backend-Gateway, Yves, Glue or MerchantPortal.</dd>
<dd>A Spryker application, like Backoffice(Zed), Backend-Gateway, Yves, GlueStorefront(Glue), GlueBackend or MerchantPortal.</dd>

<dt>Service</dt>
<dd>An external storage or utility service. Represents service type and configuration. The configuration can be defined on different levels: project-wide, region-wide, store-specific or endpoint-specific with limitations based on the service type.</dd>
Expand Down Expand Up @@ -370,7 +370,7 @@ The key must be project-wide unique.

Obligatory parameters for `application:`:

* `groups: applications: application:` - defines the type of *Application*. Possible values are `backoffice`, `backend-gateway`, `zed`, `yves`, `glue` and `merchant-portal`.
* `groups: applications: application:` - defines the type of *Application*. Possible values are `backoffice`, `backend-gateway`, `zed`, `yves`, `glue-storefront`, `glue-backend`,`glue` and `merchant-portal`.
* `groups: applications: endpoints:` - defines the list of *Endpoints* to access the *Application*. See [groups: applications: endpoints:](#groups-applications-endpoints-) to learn more.

Optional parameters for `application:`:
Expand All @@ -395,6 +395,8 @@ Optional parameters for `application:`:
* `groups: applications: application: http: max-request-body-size:` - defines the maximum allowed size of the request body that can be sent to the application, in MB. If not specified, the default values apply:
* `backoffice` - `10m`
* `merchant-portal` - `10m`
* `glue-storefront` - `10m`
* `glue-backend` - `10m`
* `glue` - `2m`
* `yves` - `1m`

Expand Down
2 changes: 1 addition & 1 deletion docs/09-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ docker/sdk up
### An application is not reachable via http
**when**
An application like Yves, BackOffice(Zed), Glue, or MerchantPortal is not reachable after installation.
An application like Yves, BackOffice(Zed), GlueStorefront(Glue), GlueBackend or MerchantPortal is not reachable after installation.
**then**
In `deploy.*.yml`, ensure that SSL encryption is disabled:
Expand Down
4 changes: 4 additions & 0 deletions generator/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public function setIsActive(bool $isActive): void
const BACKOFFICE_APP = 'backoffice';
const BACKEND_GATEWAY_APP = 'backend-gateway';
const MERCHANT_PORTAL = 'merchant-portal';
const GLUE_STOREFRONT = 'glue-storefront';
const GLUE_BACKEND = 'glue-backend';

const ENTRY_POINTS = [
BACKOFFICE_APP => 'Backoffice',
Expand All @@ -149,6 +151,8 @@ public function setIsActive(bool $isActive): void
YVES_APP => 'Yves',
GLUE_APP => 'Glue',
MERCHANT_PORTAL => 'MerchantPortal',
GLUE_STOREFRONT => 'GlueStorefront',
GLUE_BACKEND => 'GlueBackend',
];

foreach ($projectData['groups'] ?? [] as $groupName => $groupData) {
Expand Down
23 changes: 23 additions & 0 deletions generator/src/templates/application/glue-backend.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ applicationName | lower }}:
image: ${SPRYKER_DOCKER_PREFIX}_run_app:${SPRYKER_DOCKER_TAG}-{{ applicationName | lower }}
depends_on:
- database
- broker
- key_value_store
- session
- search
networks:
- private
labels:
'spryker.app.name': {{ applicationName }}
'spryker.app.type': glue-backend
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
TIDEWAYS_APIKEY: ${TIDEWAYS_APIKEY}
TIDEWAYS_CLI_ENABLED: ${TIDEWAYS_CLI_ENABLED}
TIDEWAYS_ENVIRONMENT_NAME: ${TIDEWAYS_ENVIRONMENT_NAME}
<<: *app-volumes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "application/glue.yml.twig" with _context %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "env/application/zed.env.twig" with _context %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "env/application/glue.env.twig" with project %}
10 changes: 10 additions & 0 deletions generator/src/templates/env/cli/store.env.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ SPRYKER_MAIL_SENDER_NAME={{ services['mail']['sender']['name'] | env_var }}
{% if endpointMap[storeName] is not empty %}
SPRYKER_FE_HOST={{ endpointMap[storeName]['yves'] | split(':') | first }}
SPRYKER_FE_PORT={{ (endpointMap[storeName]['yves'] | split(':'))[1] | default(project['_defaultPort']) }}
{% if endpointMap[storeName]['glue'] is not empty %}
SPRYKER_API_HOST={{ endpointMap[storeName]['glue'] | split(':') | first }}
SPRYKER_API_PORT={{ (endpointMap[storeName]['glue'] | split(':'))[1] | default(project['_defaultPort']) }}
{% endif %}
{% if endpointMap[storeName]['glue-storefront'] is not empty %}
SPRYKER_GLUE_STOREFRONT_HOST={{ endpointMap[storeName]['glue-storefront'] | split(':') | first }}
SPRYKER_GLUE_STOREFRONT_PORT={{ (endpointMap[storeName]['glue-storefront'] | split(':'))[1] | default(project['_defaultPort']) }}
{% endif %}
{% if endpointMap[storeName]['glue-backend'] is not empty %}
SPRYKER_GLUE_BACKEND_HOST={{ endpointMap[storeName]['glue-backend'] | split(':') | first }}
SPRYKER_GLUE_BACKEND_PORT={{ (endpointMap[storeName]['glue-backend'] | split(':'))[1] | default(project['_defaultPort']) }}
{% endif %}
SPRYKER_BE_HOST={{ endpointMap[storeName]['backoffice'] | split(':') | first }}
SPRYKER_BE_PORT={{ (endpointMap[storeName]['backoffice'] | split(':'))[1] | default(project['_defaultPort']) }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "nginx/http/gateway/server.conf.twig" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include 'nginx/http/gateway/glue.server.conf.twig' with _context %}
39 changes: 39 additions & 0 deletions generator/src/templates/nginx/http/glue-backend.server.conf.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% extends "nginx/http/application.server.conf.twig" %}
{% block server %}
{{ parent() }}

{% include "nginx/vhost.d/glue-backend.default.conf.twig" with _context %}
{% include "nginx/vhost.d/timeouts.conf.twig" with { timeout: timeout | default('1m') } %}
{% endblock server %}
{% block location %}
{{ parent() }}

fastcgi_param SPRYKER_ZED_HOST "{{ zedHost | split(':') | first }}";
fastcgi_param SPRYKER_ZED_PORT "{{ project['_defaultPort'] }}";

fastcgi_param SPRYKER_SESSION_BE_NAMESPACE "{{ storeServices['session']['namespace'] | default(endpointData['services']['session']['namespace']) }}";
fastcgi_param SPRYKER_GLUE_BACKEND_HOST "{{ host }}";
fastcgi_param SPRYKER_GLUE_BACKEND_PORT "{{ externalPort }}";

{% if storeServices['mail']['sender']['email'] is not empty %}
fastcgi_param SPRYKER_MAIL_SENDER_EMAIL "{{ storeServices['mail']['sender']['email'] }}";
{% endif %}
{% if storeServices['mail']['sender']['name'] is not empty %}
fastcgi_param SPRYKER_MAIL_SENDER_NAME "{{ storeServices['mail']['sender']['name'] }}";
{% endif %}

{% if project['_endpointMap'][endpointData['store']]['yves'] is not empty %}
fastcgi_param SPRYKER_FE_HOST "{{ project['_endpointMap'][endpointData['store']]['yves'] }}";
fastcgi_param SPRYKER_FE_PORT "{{ (project['_endpointMap'][endpointData['store']]['yves'] | split(':'))[1] | default(project['_defaultPort']) }}";
{% endif %}

{% if project['_endpointMap'][endpointData['store']]['glue'] is not empty %}
fastcgi_param SPRYKER_API_HOST "{{ project['_endpointMap'][endpointData['store']]['glue'] }}";
fastcgi_param SPRYKER_API_PORT "{{ (project['_endpointMap'][endpointData['store']]['glue'] | split(':'))[1] | default(project['_defaultPort']) }}";
{% endif %}

{% if project['_endpointMap'][endpointData['store']]['glue-storefront'] is not empty %}
fastcgi_param SPRYKER_API_HOST "{{ project['_endpointMap'][endpointData['store']]['glue-storefront'] }}";
fastcgi_param SPRYKER_API_PORT "{{ (project['_endpointMap'][endpointData['store']]['glue-storefront'] | split(':'))[1] | default(project['_defaultPort']) }}";
{% endif %}
{% endblock location %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "nginx/http/application.server.conf.twig" %}
{% block server %}
{{ parent() }}

{% include "nginx/vhost.d/glue-storefront.conf.twig" with _context %}
{% include "nginx/vhost.d/timeouts.conf.twig" with { timeout: timeout | default('1m') } %}
{% endblock server %}
{% block location %}
{{ parent() }}
fastcgi_param SPRYKER_ZED_HOST "{{ zedHost | split(':') | first }}";
fastcgi_param SPRYKER_ZED_PORT "{{ (zedHost | split(':'))[1] | default(project['_defaultPort']) }}";

fastcgi_param SPRYKER_GLUE_STOREFRONT_HOST "{{ host }}";
fastcgi_param SPRYKER_GLUE_STOREFRONT_PORT "{{ externalPort }}";
fastcgi_param SPRYKER_GLUE_APPLICATION_CORS_ALLOW_ORIGIN "{{ endpointData['cors-allow-origin'] | default('') | nginx_var }}";

{% if storeServices['mail']['sender']['email'] is not empty %}
fastcgi_param SPRYKER_MAIL_SENDER_EMAIL "{{ storeServices['mail']['sender']['email'] }}";
{% endif %}
{% if storeServices['mail']['sender']['name'] is not empty %}
fastcgi_param SPRYKER_MAIL_SENDER_NAME "{{ storeServices['mail']['sender']['name'] }}";
{% endif %}
{% endblock location %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client_max_body_size {{ applicationData['http']['max-request-body-size'] | default('10m') }};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include 'nginx/vhost.d/glue.default.conf.twig' %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "terraform/application/zed.tf.twig" with _context %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include 'terraform/application/glue.tf.twig' with _context %}

0 comments on commit aaaba5f

Please sign in to comment.