Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xdebug profiling support #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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