Skip to content

Commit 70d04b9

Browse files
committed
add: enhance Magento multi-store support with extended docs, multistore usage details, and example setups
1 parent f8bc097 commit 70d04b9

3 files changed

Lines changed: 117 additions & 1 deletion

File tree

commands/magento2/usage.help

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ ENV_TYPE_USAGE=$(cat <<EOF
1010
fixowns Fix ownerships inside container
1111
fixperms Fix permissions inside container
1212
grunt \033[32m%command%\033[0m Run grunt inside container
13-
setup-grunt Setup grunt files inside container\n
13+
setup-grunt Setup grunt files inside container
14+
multistore \033[32m<command>\033[0m Manage multi-store configuration (init, refresh, list)\n
1415
1516
EOF
1617
)

docs/configuration/multipledomains.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
If you need multiple domains configured for your project, RollDev will now automatically route all sub-domains of the configured `TRAEFIK_DOMAIN` (as given when running `env-init`) to the Varnish/Nginx containers provided there is not a more specific rule such as for example `rabbitmq.exampleproject.com` which routes to the `rabbitmq` service for the project.
44

5+
:::{tip}
6+
**Magento 2 Users:** For an easier multi-store setup, use the `roll multistore` command which automates the configuration below. See the [Magento 2 Multi-Store Configuration](../environments/magento2.md#multi-store-configuration) section for details.
7+
:::
8+
59
Multiple top-level domains may also be setup by following the instructions below:
610

711
1. Sign certificates for your new domains:

docs/environments/magento2.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,114 @@ The below example demonstrates the from-scratch setup of the Magento 2 applicati
291291
:::{note}
292292
To completely destroy the ``exampleproject`` environment we just created, run ``roll env down -v`` to tear down the project's Docker containers, volumes, etc.
293293
:::
294+
295+
---
296+
297+
## Multi-Store Configuration
298+
299+
RollDev provides the `multistore` command to easily manage Magento multi-store setups with multiple domains.
300+
301+
### Quick Setup
302+
303+
1. Create a configuration file at `.roll/stores.json`:
304+
305+
```json
306+
{
307+
"stores": {
308+
"store-nl.test": "store_nl",
309+
"store-be.test": "store_be",
310+
"store-de.test": "store_de"
311+
},
312+
"run_type": "store"
313+
}
314+
```
315+
316+
2. Initialize the multi-store configuration:
317+
318+
```bash
319+
roll multistore init
320+
```
321+
322+
3. Restart the environment:
323+
324+
```bash
325+
roll env up
326+
```
327+
328+
### Configuration Options
329+
330+
The `.roll/stores.json` file supports the following options:
331+
332+
| Option | Description |
333+
|--------|-------------|
334+
| `stores` | Object mapping hostnames to Magento store/website codes |
335+
| `run_type` | Either `"store"` or `"website"` (default: `"store"`) |
336+
337+
Use an empty string `""` for the store code to use the default store:
338+
339+
```json
340+
{
341+
"stores": {
342+
"main-store.test": "",
343+
"secondary.test": "secondary_store"
344+
},
345+
"run_type": "store"
346+
}
347+
```
348+
349+
### Commands
350+
351+
| Command | Description |
352+
|---------|-------------|
353+
| `roll multistore init` | Generate configs and sign SSL certificates for all domains |
354+
| `roll multistore refresh` | Regenerate configs without re-signing certificates |
355+
| `roll multistore list` | Show current store configuration and status |
356+
357+
### Generated Files
358+
359+
The `multistore` command automatically generates:
360+
361+
- `.roll/roll-env.yml` - Traefik routing rules, nginx volume mounts, and extra_hosts
362+
- `.roll/nginx/stores.map` - Nginx hostname-to-store-code mapping
363+
364+
### Updating Stores
365+
366+
When you need to add or modify stores:
367+
368+
1. Edit `.roll/stores.json`
369+
2. Run `roll multistore refresh`
370+
3. Restart nginx: `roll env restart nginx`
371+
372+
### Example: Complete Multi-Store Setup
373+
374+
```bash
375+
# Create stores.json
376+
cat > .roll/stores.json << 'EOF'
377+
{
378+
"stores": {
379+
"mystore-nl.test": "nl_store",
380+
"mystore-be.test": "be_store",
381+
"mystore-de.test": "de_store"
382+
},
383+
"run_type": "store"
384+
}
385+
EOF
386+
387+
# Initialize (signs certificates and generates config)
388+
roll multistore init
389+
390+
# Start environment
391+
roll env up
392+
393+
# Verify configuration
394+
roll multistore list
395+
```
396+
397+
### Troubleshooting
398+
399+
If you encounter routing issues after adding new domains:
400+
401+
1. Verify certificates exist: `ls ~/.roll/ssl/certs/`
402+
2. Check traefik config: `roll env config | grep -A5 traefik`
403+
3. Restart traefik to reload certificates: `roll svc up traefik`
404+
4. Restart the environment: `roll env down && roll env up`

0 commit comments

Comments
 (0)