Skip to content

Commit cc22f6e

Browse files
authored
Merge branch 'main' into docs/add-phpmyadmin-service
2 parents 7c86163 + 113d5dc commit cc22f6e

File tree

10 files changed

+231
-26
lines changed

10 files changed

+231
-26
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/_build
2+
/d2lang_svg
3+
/.venv

architecture.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Architecture Overview
2+
3+
Warden runs three layers of services on your development machine:
4+
5+
```{mermaid}
6+
flowchart TB
7+
classDef default fill:#ffffff,stroke:#3f51b5,stroke-width:1.5px,color:#000000,font-weight:bold,font-size:12px;
8+
9+
subgraph DevSys ["Developer's System"]
10+
direction TB
11+
12+
subgraph Host ["Host Services"]
13+
direction LR
14+
h1["Warden CLI"] ~~~ h2["Docker Engine"] ~~~ h3["Mutagen File Sync"] ~~~ h4["Trusted SSL Root CA"]
15+
end
16+
17+
subgraph Global ["Global Docker Services — warden svc up"]
18+
direction LR
19+
g1["Traefik<br>Reverse Proxy + SSL"] ~~~ g2["DNSmasq"] ~~~ g3["Mailpit<br>Email Catcher"] ~~~ g4["SSH Tunnel"] ~~~ g5["phpMyAdmin"] ~~~ g6["Portainer"]
20+
end
21+
22+
subgraph Project ["Per-Project Docker Services — warden env up"]
23+
direction LR
24+
p1["Nginx"] ~~~ p2["PHP-FPM"] ~~~ p3["MariaDB / MySQL"] ~~~ p4["Redis / Valkey"] ~~~ p5["Elasticsearch /<br>OpenSearch"] ~~~ p6["RabbitMQ"] ~~~ p7["Varnish"]
25+
end
26+
27+
Host ~~~ Global ~~~ Project
28+
end
29+
30+
style DevSys fill:#f5f5f5,stroke:#666666,stroke-width:1px,rx:8,ry:8
31+
style Host fill:transparent,stroke:none
32+
style Global fill:#fff3e0,stroke:#FF9800,stroke-width:1px,rx:8,ry:8
33+
style Project fill:#e8f5e9,stroke:#4CAF50,stroke-width:1px,stroke-dasharray: 5 5,rx:8,ry:8
34+
```
35+
36+
## Host Services
37+
38+
The Warden CLI orchestrates everything via Docker Compose. On your host machine:
39+
40+
- **Warden CLI** — Bash tool that manages all Docker services
41+
- **Docker Engine** — Runs all containers
42+
- **Mutagen** — Bi-directional file sync between host and containers (macOS)
43+
- **Trusted SSL Root CA** — Local certificate authority for `*.test` HTTPS domains
44+
45+
## Global Docker Services
46+
47+
Started once with `warden svc up`, shared across all projects:
48+
49+
| Service | Purpose | URL |
50+
|---------|---------|-----|
51+
| Traefik | Reverse proxy + SSL termination | traefik.warden.test |
52+
| DNSmasq | DNS resolver for `*.test` domains ||
53+
| Mailpit | Email catcher (SMTP) | webmail.warden.test |
54+
| SSH Tunnel | Database access for GUI clients (:2222) ||
55+
| phpMyAdmin | Database management UI | phpmyadmin.warden.test |
56+
| Portainer | Container management UI (opt-in) | portainer.warden.test |
57+
58+
## Per-Project Docker Services
59+
60+
Started per project with `warden env up`, each on an isolated Docker network:
61+
62+
| Service | Default | Toggle Flag |
63+
|---------|---------|-------------|
64+
| Nginx | All types | `WARDEN_NGINX` |
65+
| PHP-FPM | All types ||
66+
| MariaDB / MySQL | All types | `WARDEN_DB` |
67+
| Redis / Valkey | All types | `WARDEN_REDIS` / `WARDEN_VALKEY` |
68+
| Elasticsearch / OpenSearch | Magento 2 | `WARDEN_ELASTICSEARCH` / `WARDEN_OPENSEARCH` |
69+
| RabbitMQ | Magento 2 | `WARDEN_RABBITMQ` |
70+
| Varnish | Magento 2 | `WARDEN_VARNISH` |
71+
72+
### Additional Optional Services
73+
74+
These can be enabled per-project via flags in your `.env` file:
75+
76+
- **Blackfire** / **SPX** — PHP profiling (`WARDEN_BLACKFIRE`, `WARDEN_PHP_SPX`)
77+
- **Selenium** — Browser automation testing with optional VNC (`WARDEN_SELENIUM`)
78+
- **Allure** — Test report dashboard (`WARDEN_ALLURE`)
79+
- **PHP-Debug** — Xdebug-enabled PHP-FPM (used via `warden debug`)
80+
- **ElasticHQ** — Elasticsearch management UI (`WARDEN_ELASTICHQ`)

conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'sphinx_rtd_theme',
2424
'sphinx_copybutton',
2525
'sphinx_markdown_tables',
26+
'sphinxcontrib.mermaid',
2627
]
2728

2829
source_suffix = ['.rst', '.md']
@@ -34,7 +35,7 @@
3435
version = ''
3536
release = ''
3637

37-
exclude_patterns = ['_build']
38+
exclude_patterns = ['_build', '.venv']
3839

3940
html_theme = "sphinx_rtd_theme"
4041
html_show_sourcelink = False

configuration/blackfire.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,23 @@ Note: You can obtain the IDs and Tokens used in the above from within your Black
1919

2020
To use the Blackfire CLI Tool, you can run `warden blackfire [arguments]`.
2121

22-
For more information on the CLI tool, please see [Profiling CLI Commands](https://blackfire.io/docs/cookbooks/profiling-cli) in Blackfire's documentation.
22+
For more information on the CLI tool, please see [Profiling CLI Commands](https://blackfire.io/docs/cookbooks/profiling-cli) in Blackfire's documentation.
23+
24+
## Browser Profiling
25+
26+
Blackfire provides browser extensions that let you profile any page directly from the toolbar. Install the extension for your browser, log in to your Blackfire account, navigate to the page you want to profile, and click the **Profile** button in the extension.
27+
28+
For a full walkthrough, see [Profiling HTTP Requests with a Browser](https://docs.blackfire.io/profiling-cookbooks/profiling-http-via-browser) in Blackfire's documentation.
29+
30+
### Browser extensions
31+
32+
* [Firefox extension](https://docs.blackfire.io/integrations/browsers/firefox)**recommended**, supports all profiling features including **Profile all requests** (POST, Ajax, API calls)
33+
* [Chrome extension](https://docs.blackfire.io/integrations/browsers/chrome) — single-page profiling works, but **Profile all requests** is unavailable (see below)
34+
35+
### Chrome limitation
36+
37+
:::{warning}
38+
Chrome's Manifest V3 restricts extensions from modifying outgoing request headers, which breaks the **Profile all requests** feature. Chrome can only profile the initial page load — it cannot capture follow-up POST requests, Ajax calls, or API requests within a session. Single-page profiling still works normally.
39+
40+
If your workflow relies on profiling all requests in a session, **use Firefox** where this feature remains fully supported. For more details, see [Announcing changes to the "Profile all requests" feature on Chrome](https://blog.blackfire.io/announcing-changes-to-the-profile-all-requests-feature-on-chrome.html) on the Blackfire blog.
41+
:::

environments/customizing.md

Lines changed: 121 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Customizing An Environment
22

3-
Further information on customizing or extending an environment is forthcoming. For now, this section is limited to very simple and somewhat common customizations.
3+
## Version Customization via `.env`
44

55
To configure your project with a non-default PHP version, add the following to the project's `.env` file and run `warden env up` to re-create the affected containers:
66

77
PHP_VERSION=7.2
88

9-
The versions of MariaDB, Elasticsearch, Varnish, Redis, NodeJS and Composer may also be similarly configured using variables in the `.env` file:
9+
The versions of Elasticsearch, Varnish, Redis, NodeJS and Composer may also be similarly configured using variables in the `.env` file:
1010

11-
* `MARIADB_VERSION`
1211
* `ELASTICSEARCH_VERSION`
1312
* `REDIS_VERSION`
1413
* `VALKEY_VERSION`
@@ -17,24 +16,93 @@ The versions of MariaDB, Elasticsearch, Varnish, Redis, NodeJS and Composer may
1716
* `NODE_VERSION`
1817
* `COMPOSER_VERSION`
1918

19+
## Database
20+
21+
Warden supports both **MariaDB** (default) and **MySQL** as the database engine. The distribution and version are controlled via two environment variables in your project's `.env` file:
22+
23+
* `MYSQL_DISTRIBUTION` — set to `mariadb` (default) or `mysql`
24+
* `MYSQL_DISTRIBUTION_VERSION` — the image tag/version to use
25+
26+
For example, to use MariaDB 11.4:
27+
28+
MYSQL_DISTRIBUTION=mariadb
29+
MYSQL_DISTRIBUTION_VERSION=11.4
30+
31+
To use MySQL 8.4 instead:
32+
33+
MYSQL_DISTRIBUTION=mysql
34+
MYSQL_DISTRIBUTION_VERSION=8.4
35+
36+
:::{note}
37+
Drupal and CakePHP environments use `DB_DISTRIBUTION` and `DB_DISTRIBUTION_VERSION` instead of the `MYSQL_` prefix. The values and behavior are the same.
38+
:::
39+
40+
After changing the database distribution or version, run `warden env up` to re-create the database container.
41+
42+
:::{warning}
43+
Switching distributions (e.g. from MariaDB to MySQL) is **not** a drop-in replacement for existing data volumes. If you change the distribution on an existing environment, you should export your database first, remove the db volume (`warden env down -v`), and re-import after the new container is running.
44+
:::
45+
2046
Start of some environments could be skipped by using variables in `.env` file:
2147

2248
* `WARDEN_DB=0`
2349
* `WARDEN_REDIS=0`
2450
* `WARDEN_VALKEY=0`
2551

26-
## Docker Specific Customizations
27-
To override default docker settings, add a custom configuration file in your project root
28-
folder: `/.warden/warden-env.yml`
29-
This file will be merged with the default environment configuration.
30-
One example for a use case is [the setup of multiple domains](https://docs.warden.dev/configuration/multipledomains.html?highlight=warden%20env%20yml#multiple-domains).
52+
## Docker Compose Overrides
3153

32-
## PHP Specific Customizations
33-
To override default php settings, follow the docker customization above and include your custom `php.ini` file.
34-
In this case the `warden-env.yml` should look like this:
54+
For customizations beyond `.env` variables, Warden supports per-project Docker Compose override files. Create a `.warden/warden-env.yml` file in your project root to override or extend the default service configuration.
55+
56+
This file is a standard Docker Compose YAML partial. Warden loads it **after** all built-in service definitions, giving it the highest merge precedence — any service, volume, label, or environment variable defined here will override the defaults.
57+
58+
:::{tip}
59+
Preview the fully merged Docker Compose configuration at any time with:
60+
61+
warden env config
62+
:::
63+
64+
### OS-Specific Overrides
65+
66+
In addition to `.warden/warden-env.yml`, Warden also loads OS-specific override files if they exist:
67+
68+
* `.warden/warden-env.darwin.yml` — applied only on **macOS**
69+
* `.warden/warden-env.linux.yml` — applied only on **Linux**
70+
71+
This is useful for platform-specific volume mount options or performance tuning.
72+
73+
### Custom Docker Image
74+
75+
To use a custom PHP-FPM image (e.g., with pre-installed extensions or from a private registry):
76+
77+
```yaml
78+
services:
79+
php-fpm:
80+
image: my-registry/custom-php:8.3
81+
php-debug:
82+
image: my-registry/custom-php:8.3-debug
83+
```
84+
85+
### Adding Extra Services
86+
87+
You can add services not included by default. For example, to add Adminer with Traefik routing:
3588
89+
```yaml
90+
services:
91+
adminer:
92+
image: adminer:latest
93+
labels:
94+
- traefik.enable=true
95+
- traefik.http.routers.${WARDEN_ENV_NAME}-adminer.rule=Host(`adminer.${TRAEFIK_DOMAIN}`)
96+
- traefik.http.routers.${WARDEN_ENV_NAME}-adminer.tls=true
3697
```
37-
version: "3.5"
98+
99+
After adding this and running `warden env up -d`, Adminer will be accessible at `https://adminer.<project>.test`.
100+
101+
## PHP Specific Customizations
102+
103+
To override default PHP settings, mount a custom `php.ini` file via `.warden/warden-env.yml`:
104+
105+
```yaml
38106
services:
39107
php-fpm:
40108
volumes:
@@ -43,14 +111,18 @@ services:
43111
volumes:
44112
- ./.warden/php/zz-config.ini:/etc/php.d/zz-config.ini
45113
```
114+
46115
Now add the referenced `.warden/php/zz-config.ini` file with your wanted changes.
47116
For example you could change the error reporting value:
48-
```
117+
118+
```ini
49119
error_reporting=(E_ALL ^ E_DEPRECATED)
50120
```
121+
51122
The config file will be merged with the default `01-php.ini` resp. override the values
52123
included there. The default values are the following:
53-
```
124+
125+
```ini
54126
date.timezone = UTC
55127
max_execution_time = 3600
56128
max_input_vars = 10000
@@ -60,22 +132,51 @@ post_max_size = 25M
60132
session.auto_start = Off
61133
upload_max_filesize = 25M
62134
```
135+
63136
## Nginx Specific Customizations
64-
To override the default nginx configuration of your project, add a new file
65-
`.warden/warden-env.yml` to your project root with the following content:
66-
```
67-
version: "3.5"
137+
138+
To override the default nginx configuration of your project, add the following to `.warden/warden-env.yml`:
139+
140+
```yaml
68141
services:
69142
nginx:
70143
volumes:
71144
- ./.warden/nginx/custom.conf:/etc/nginx/default.d/custom.conf
72145
```
146+
73147
There you can specify a custom Nginx configuration which will be included following the `.conf` files within the `/etc/nginx/available.d` directory: `include /etc/nginx/default.d/*.conf`
74148

149+
## Advanced: Project-Level Environment Partials
150+
151+
Beyond `.warden/warden-env.yml`, Warden supports a more granular override mechanism through project-level environment partial directories. For each service partial (e.g., `php-fpm`, `nginx`, `db`), Warden searches the following locations in order:
152+
153+
1. Built-in includes: `<warden>/environments/includes/`
154+
2. Built-in type-specific: `<warden>/environments/<env-type>/`
155+
3. User home includes: `~/.warden/environments/includes/`
156+
4. User home type-specific: `~/.warden/environments/<env-type>/`
157+
5. **Project includes: `.warden/environments/includes/`**
158+
6. **Project type-specific: `.warden/environments/<env-type>/`**
159+
160+
Files at each location use suffixes: `.base.yml` (all platforms), `.darwin.yml` (macOS), `.linux.yml` (Linux).
161+
162+
For example, to override just the `php-fpm` partial for a Magento 2 project, create:
163+
164+
.warden/environments/includes/php-fpm.base.yml
165+
166+
This is loaded in addition to (and after) the built-in `php-fpm.base.yml`, so Docker Compose merge semantics apply.
167+
168+
:::{note}
169+
The `.warden/warden-env.yml` file is still loaded **after** all partials, so it always has the final say.
170+
:::
171+
172+
## Multiple Domains
173+
174+
For configuring multiple top-level domains, see [Multiple Domains](../configuration/multipledomains.md).
175+
75176
## Magento 1 Specific Customizations
76177

77-
If you use a `modman` structure, initialize the environment in your project path.
78-
The `.modman` folder and the corresponding `.basedir` file will be recognized and set up automatically.
178+
If you use a `modman` structure, initialize the environment in your project path.
179+
The `.modman` folder and the corresponding `.basedir` file will be recognized and set up automatically.
79180

80181
## Magento 2 Specific Customizations
81182

environments/magento2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ In addition to the below manual process, there is a `Github Template available f
234234
:::
235235
236236
:::{note}
237-
Use of 2FA is mandatory on Magento ``2.4.x`` and setup of 2FA should be skipped when installing ``2.3.x`` or earlier. Where 2FA is setup manually via UI upon login rather than using the CLI commands above, the 2FA configuration email may be retrieved from `the Mailhog service <https://mailhog.warden.test/>`_.
237+
Use of 2FA is mandatory on Magento ``2.4.x`` and setup of 2FA should be skipped when installing ``2.3.x`` or earlier. Where 2FA is setup manually via UI upon login rather than using the CLI commands above, the 2FA configuration email may be retrieved from [the webmail service](https://webmail.warden.test/).
238238
:::
239239
240240
11. Launch the application in your browser:

environments/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Files are currently mounted using a delegated mount on macOS and natively on Lin
9696

9797
## Commonalities
9898

99-
In addition to the above, each environment type (with the exception of the `local` type) come with PHP setup to use `mhsendmail` to ensure outbound email does not inadvertently leave your network and to support simpler testing of email functionality. Mailhog may be accessed by navigating to [https://mailhog.warden.test/](https://mailhog.warden.test/) in a browser.
99+
In addition to the above, each environment type (with the exception of the `local` type) come with PHP setup to use `mhsendmail` to ensure outbound email does not inadvertently leave your network and to support simpler testing of email functionality. The webmail interface may be accessed by navigating to [https://webmail.warden.test/](https://webmail.warden.test/) in a browser.
100100

101101
Where PHP is specified in the above list, there should be two `fpm` containers, `php-fpm` and `php-debug` in order to provide Xdebug support. Use of Xdebug is enabled by setting the `XDEBUG_SESSION` cookie in your browser to direct the request to the `php-debug` container. Shell sessions opened in the debug container via `warden debug` will also connect PHP process for commands on the CLI to Xdebug.
102102

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ caption: Getting Started
2020
---
2121
2222
installing
23+
architecture
2324
services
2425
usage
2526
environments

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ sphinx-copybutton==0.5.2
44
sphinx-markdown-tables==0.0.17
55
sphinx-rtd-theme==3.0.2
66
myst-parser==4.0.0
7-
Jinja2==3.1.6
7+
Jinja2==3.1.6
8+
sphinxcontrib-mermaid

services.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After running `warden svc up` for the first time following installation, the fol
55
* [https://traefik.warden.test/](https://traefik.warden.test/)
66
* [https://portainer.warden.test/](https://portainer.warden.test/)
77
* [https://dnsmasq.warden.test/](https://dnsmasq.warden.test/)
8-
* [https://mailhog.warden.test/](https://mailhog.warden.test/)
8+
* [https://webmail.warden.test/](https://webmail.warden.test/)
99
* [https://phpmyadmin.warden.test/](https://phpmyadmin.warden.test/)
1010

1111
## Customizable Settings

0 commit comments

Comments
 (0)