Skip to content

Commit

Permalink
Add xdebug profiling support
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeymike committed Feb 5, 2020
1 parent a85f202 commit 92e509a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions wf2_core/src/recipes/m2/services/php.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ impl PhpService {
pub const IMAGE_7_3: &'static str = "wearejh/php:7.3-m2";
pub const IMAGE_7_4: &'static str = "wearejh/php:7.4-m2";
pub const COMPOSER_CACHE_PATH: &'static str = "/home/www-data/.composer/cache";
pub const XDEBUG_DATA_PATH: &'static str = "/home/www-data/xdebug";

pub fn select(ctx: &Context) -> Result<DcService, failure::Error> {
match M2Vars::from_ctx(&ctx) {
Expand Down Expand Up @@ -44,6 +45,7 @@ impl M2Service for PhpService {
M2Volumes::COMPOSER_CACHE,
PhpService::COMPOSER_CACHE_PATH,
),
format!("{}:{}", M2Volumes::XDEBUG, PhpService::XDEBUG_DATA_PATH)
])
.set_depends_on(vec![(DbService::NAME)])
.set_ports(vec!["9000"])
Expand Down
14 changes: 8 additions & 6 deletions wf2_core/src/recipes/m2/templates/site.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
map "$arg_debug$cookie_XDEBUG_PROFILE$cookie_XDEBUG_TRACE$cookie_XDEBUG_SESSION" $BACKEND {
~^[0-9a-zA-Z] fastcgi_backend_debug;
default fastcgi_backend;
}

server {
add_header X-backend "$BACKEND";

set $MAGE_ROOT /var/www;

listen 80 default_server;
Expand All @@ -11,12 +18,7 @@ server {
charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";
client_max_body_size 20M;

set $BACKEND fastcgi_backend;
if ($arg_debug) {
set $BACKEND fastcgi_backend_debug;
}
client_max_body_size 20M;

# PHP entry point for setup application
location ~* ^/setup($|/) {
Expand Down
2 changes: 2 additions & 0 deletions wf2_core/src/recipes/m2/volumes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ impl M2Volumes {
pub const DB: &'static str = "db-data";
pub const COMPOSER_CACHE: &'static str = "composer-cache";
pub const ELASTICSEARCH: &'static str = "esdata";
pub const XDEBUG: &'static str = "xdebug";
}

pub fn get_volumes(ctx: &Context) -> Vec<DcVolume> {
Expand All @@ -16,5 +17,6 @@ pub fn get_volumes(ctx: &Context) -> Vec<DcVolume> {
DcVolume::new(ctx.name(), M2Volumes::APP),
DcVolume::new(ctx.name(), M2Volumes::COMPOSER_CACHE),
DcVolume::new(ctx.name(), M2Volumes::ELASTICSEARCH),
DcVolume::new(ctx.name(), M2Volumes::XDEBUG),
]
}

0 comments on commit 92e509a

Please sign in to comment.