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 Aug 13, 2020
1 parent a03f2fc commit 32c6a0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions wf2_core/src/recipes/m2/dc_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ impl DcTasksTrait for M2Recipe {
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),
];

if M2RecipeOptions::has_pwa_options(ctx) {
Expand All @@ -36,4 +37,5 @@ impl M2Volumes {
pub const COMPOSER_CACHE: &'static str = "composer-cache";
pub const ELASTICSEARCH: &'static str = "esdata";
pub const PWA: &'static str = "pwa-src";
pub const XDEBUG: &'static str = "xdebug";
}
12 changes: 7 additions & 5 deletions wf2_core/src/recipes/m2/output_files/m2.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 @@ -15,11 +22,6 @@ server {
#add_header "X-UA-Compatible" "IE=Edge";
client_max_body_size 20M;

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

# PHP entry point for setup application
location ~* ^/setup($|/) {
root $MAGE_ROOT;
Expand Down
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 @@ -16,6 +16,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 @@ -45,6 +46,7 @@ impl Service<M2Vars> 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

0 comments on commit 32c6a0e

Please sign in to comment.