Skip to content

Commit acbc065

Browse files
committed
Per store/region maintenance page
1 parent 994848e commit acbc065

4 files changed

Lines changed: 72 additions & 2 deletions

File tree

docs/07-deploy-file/02-deploy.file.reference.v1.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,67 @@ docker:
837837
Now you can access the applications from the `{ IP address 1 }` and `{ IP address 2 }` IP addresses.
838838

839839

840+
### Per-store and per-region maintenance pages
841+
842+
By default, all endpoints of an application share the same maintenance page located at `public/{application}/maintenance/index.html` (e.g., `public/Yves/maintenance/index.html`).
843+
844+
You can customize the maintenance page per store or per region by placing an `index.html` file in a subdirectory named after the store or region code:
845+
846+
```
847+
public/Yves/maintenance/
848+
├── index.html # Default maintenance page (fallback)
849+
├── EU/
850+
│ └── index.html # Maintenance page for EU region
851+
├── US/
852+
│ └── index.html # Maintenance page for US region
853+
├── DE/
854+
│ └── index.html # Maintenance page for DE store (legacy store mode)
855+
└── AT/
856+
└── index.html # Maintenance page for AT store (legacy store mode)
857+
```
858+
859+
The same structure applies to all applications (`Backoffice`, `MerchantPortal`, `Zed`, etc.).
860+
861+
Nginx resolves the maintenance page using the following fallback order:
862+
863+
**Dynamic store mode** (region-based endpoints):
864+
1. `maintenance/{region}/index.html` — region-specific page
865+
2. `maintenance/index.html` — default page
866+
867+
**Legacy store mode** (store-based endpoints):
868+
1. `maintenance/{store}/index.html` — store-specific page
869+
2. `maintenance/{region}/index.html` — region-specific page
870+
3. `maintenance/index.html` — default page
871+
872+
If no store-specific or region-specific page exists, the default `maintenance/index.html` is served. The default maintenance page is required and must always be present.
873+
874+
#### Testing maintenance pages locally
875+
876+
To verify a maintenance page locally without changing the deploy file, follow these steps:
877+
878+
1. Boot the environment with your deploy file:
879+
```bash
880+
docker/sdk boot {deploy file name}
881+
```
882+
883+
2. Open the generated `docker/deployment/default/docker-compose.yml` and add the `SPRYKER_MAINTENANCE_MODE_ENABLED` environment variable to the `frontend` service:
884+
```yaml
885+
services:
886+
frontend:
887+
image: ...
888+
environment:
889+
SPRYKER_MAINTENANCE_MODE_ENABLED: 1
890+
```
891+
892+
3. Start the environment:
893+
```bash
894+
docker/sdk up
895+
```
896+
897+
4. Open Yves in a browser — the maintenance page should be displayed.
898+
899+
> **Note:** `docker/deployment/default/docker-compose.yml` is a generated file and will be overwritten the next time `docker/sdk boot` is run. This approach is intended for temporary local testing only. Do not commit this change.
900+
840901

841902
### docker: logs:
842903
* `docker: logs: path:` defines the path to the directory with Docker logs. This variable is optional. If not specified, the default value applies: `path: '/var/log/spryker`.

generator/src/templates/nginx/conf.d/frontend.default.conf.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ server {
4444
zedHost: zedHost,
4545
timeout: applicationData['http']['timeout'] | default('1m'),
4646
project: _context,
47-
regionEndpointMap: _context['regionEndpointMap'][endpointData['identifier']]
47+
regionEndpointMap: _context['regionEndpointMap'][endpointData['identifier']],
48+
groupRegion: groupData['region'],
4849
} %}
4950
{% endfor %}
5051
{% endfor %}

generator/src/templates/nginx/http/application.server.conf.twig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,12 @@
5656
fastcgi_param SPRYKER_JENKINS_CSRF_PROTECTION_ENABLED {{ (services['scheduler']['csrf-protection-enabled'] | default(false)) ? 1 : 0 }};
5757
{% endblock location %}
5858
}
59+
60+
location @maintenance {
61+
{% if endpointData['region'] is defined %}
62+
try_files /maintenance/{{ endpointData['identifier'] }}/index.html /maintenance/index.html =503;
63+
{% else %}
64+
try_files /maintenance/{{ endpointData['identifier'] }}/index.html /maintenance/{{ groupRegion }}/index.html /maintenance/index.html =503;
65+
{% endif %}
66+
}
5967
{% endblock locations %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 422 425 426 428 429 431 451 /errorpage/4xx.html;
22
error_page 500 501 502 504 505 506 507 508 509 510 511 /errorpage/5xx.html;
3-
error_page 503 /maintenance/index.html;
3+
error_page 503 @maintenance;

0 commit comments

Comments
 (0)