-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.php] | ||
indent_size = 4 | ||
|
||
[*.scss] | ||
indent_size = 2 | ||
|
||
[*.js] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.editorconfig export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<div align="center"> | ||
|
||
# ddev-xhgui-pro - use XHGui with DDEV | ||
|
||
 | ||
[](https://github.com/semantic-release/semantic-release) | ||
 | ||
|
||
</div> | ||
|
||
This repository provides the XHGui service to [DDEV](https://ddev.readthedocs.io). | ||
**Batteries included!** - automagically configures itself based on your project settings.. | ||
|
||
## Installation | ||
|
||
```bash | ||
ddev get oblakdev/ddev-xhgui-pro | ||
ddev restart | ||
``` | ||
|
||
## Configuration | ||
|
||
There isn't one. Addon does everything for you. | ||
It automatically enables itself when you turn on xhprof in your project, and disables itself when you turn it off. | ||
|
||
## Usage | ||
|
||
```bash | ||
ddev xhprof on | ||
``` | ||
|
||
Visit `https://your-project.ddev.site/xhgui` to see the XHGui dashboard. | ||
|
||
___ | ||
|
||
**Based on the original [ddev-contrib recipe](https://github.com/ddev/ddev-contrib/tree/master/docker-compose-services/mongodb)** | ||
**Developed and maintained by [Oblak Studio](https://github.com/oblakstudio)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#ddev-generated | ||
|
||
hooks: | ||
post-start: | ||
- exec: "cd /var/www/html/profiler > /dev/null || (mkdir -p /var/www/html/profiler && cd /var/www/html/profiler && composer require perftools/php-profiler)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#ddev-generated | ||
|
||
volumes: | ||
hxgui-ui-nginx: | ||
name: ddev-${DDEV_SITENAME}-xhgui-ui-nginx | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
xhgui-mongo-config: | ||
name: ddev-${DDEV_SITENAME}-xhgui-mongo-data | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
xhgui-mongo-data: | ||
name: ddev-${DDEV_SITENAME}-xhgui-mongo-data | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
xhgui-mongo-journal: | ||
name: ddev-${DDEV_SITENAME}-xhgui-mongo-journal | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
|
||
services: | ||
hxgui-ui: | ||
container_name: ddev-${DDEV_SITENAME}-xhgui-ui | ||
image: xhgui/xhgui:latest | ||
volumes: | ||
- "hxgui-ui-nginx:/run/nginx" | ||
- "./xhgui-ui/config/nginx.conf:/etc/nginx/http.d/default.conf:ro" | ||
- "./xhgui-ui/config/app.php:/var/www/xhgui/config/config.php" | ||
networks: | ||
- default | ||
- ddev_default | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
com.ddev.approot: $DDEV_APPROOT | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "2" | ||
memory: "1024M" | ||
reservations: | ||
cpus: "1" | ||
memory: "512M" | ||
restart: no | ||
depends_on: | ||
web: | ||
condition: service_started | ||
xhgui-mongo: | ||
condition: service_healthy | ||
|
||
xhgui-mongo: | ||
container_name: ddev-${DDEV_SITENAME}-xhgui-mongo | ||
image: mongo:7.0 | ||
environment: | ||
MONGO_INITDB_DATABASE: xhprof | ||
volumes: | ||
- "xhgui-mongo-data:/data/db" | ||
- "xhgui-mongo-config:/data/configdb" | ||
- "xhgui-mongo-journal:/data/db/journal" | ||
networks: | ||
- default | ||
expose: | ||
- "27017" | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
com.ddev.approot: $DDEV_APPROOT | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "2" | ||
memory: "1024M" | ||
reservations: | ||
cpus: "1" | ||
memory: "512M" | ||
restart: no | ||
healthcheck: | ||
test: | ||
[ | ||
"CMD", | ||
"mongosh", | ||
"--quiet", | ||
"127.0.0.1/test", | ||
"--eval", | ||
"'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'", | ||
] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 5 | ||
start_period: 20s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: ddev-hxgui-pro | ||
|
||
project_files: | ||
- xhgui/collector/xhprof_prepend.php | ||
- xhgui/config/app.php | ||
- xhgui/config/nginx.conf | ||
- config.xhgui-pro.yaml | ||
- docker-compose.xhgui-pro.yaml | ||
|
||
pre_install-actions: | ||
- | | ||
#ddev-description: Cleanup the auto-prepend-file | ||
rm -f xhprof/xhprof_prepend.php | ||
post_install_actions: | ||
- | | ||
#ddev-description: Create the auto-prepend-file | ||
echo "<?php" > xhprof/xhprof_prepend.php && tail -n +3 ./xhgui/collector/xhprof_prepend.php >> xhprof/xhprof_prepend.php | ||
- | | ||
#ddev-description: Create traefik config for xhgui | ||
cat <<EOF >traefik/config/${DDEV_SITENAME}-xhgui-pro.yaml | ||
#ddev-generated | ||
http: | ||
middlewares: | ||
strip-hxgui-${DDEV_SITENAME}-prefix: | ||
stripPrefix: | ||
prefixes: | ||
- "/xhgui" | ||
forceSlash: false | ||
routers: | ||
${DDEV_SITENAME}-xhgui-ui-http: | ||
rule: "Host(\`${DDEV_SITENAME}.${DDEV_TLD}\`) && PathPrefix(\`/xhgui\`)" | ||
service: "${DDEV_SITENAME}-xhgui-ui" | ||
tls: false | ||
entryPoints: | ||
- "http-80" | ||
middlewares: | ||
- "strip-hxgui-${DDEV_SITENAME}-prefix@file" | ||
${DDEV_SITENAME}-xhgui-ui-https: | ||
rule: "Host(\`${DDEV_SITENAME}.${DDEV_TLD}\`) && PathPrefix(\`/xhgui\`)" | ||
service: "${DDEV_SITENAME}-xhgui-ui" | ||
tls: true | ||
entryPoints: | ||
- "http-443" | ||
middlewares: | ||
- "strip-hxgui-${DDEV_SITENAME}-prefix@file" | ||
services: | ||
${DDEV_SITENAME}-xhgui-ui: | ||
loadBalancer: | ||
servers: | ||
- url: "http://ddev-${DDEV_SITENAME}-xhgui-ui:80" | ||
tls: | ||
certificates: | ||
- certFile: /mnt/ddev-global-cache/traefik/certs/${DDEV_SITENAME}.crt | ||
keyFile: /mnt/ddev-global-cache/traefik/certs/${DDEV_SITENAME}.key | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
#ddev-generated | ||
|
||
use Xhgui\Profiler\Profiler; | ||
|
||
if (!extension_loaded('xhprof')) { | ||
return; | ||
} | ||
|
||
require_once '/var/www/html/profiler/vendor/autoload.php'; | ||
|
||
$config = [ | ||
'save.handler' => Profiler::SAVER_STACK, | ||
'save.handler.stack' => [ | ||
'savers' => [ | ||
Profiler::SAVER_UPLOAD, | ||
Profiler::SAVER_FILE, | ||
], | ||
'saveAll' => FALSE, | ||
], | ||
'save.handler.file' => [ | ||
'filename' => '/tmp/xhgui.data.jsonl', | ||
], | ||
'save.handler.upload' => [ | ||
'url' => 'http://hxgui-ui/run/import', | ||
'timeout' => 3, | ||
'token' => getenv('XHGUI_UPLOAD_TOKEN', 'token'), | ||
], | ||
'profiler.enable' => function () { | ||
return true; | ||
}, | ||
'profiler.simple_url' => function ($url) { | ||
return str_replace(getenv('DDEV_HOSTNAME'), '', $url); | ||
}, | ||
]; | ||
|
||
$profiler = new Profiler($config); | ||
$profiler->start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php #ddev-generated | ||
|
||
$env = getenv(); | ||
$mup = $env['XHGUI_MONGO_USERNAME'] ?? false | ||
? [ | ||
'username' => $env['XHGUI_MONGO_USERNAME'], | ||
'password' => $env['XHGUI_MONGO_PASSWORD'], | ||
] : []; | ||
|
||
return [ | ||
'save.handler' => $env['XHGUI_SAVE_HANDLER'] ?? 'mongodb', | ||
'pdo' => [ | ||
'dsn' => $env['XHGUI_PDO_DSN'] ?? null, | ||
'user' => $env['XHGUI_PDO_USER'] ?? null, | ||
'pass' => $env['XHGUI_PDO_PASS'] ?? null, | ||
'table' => $env['XHGUI_PDO_TABLE'] ?? 'results', | ||
'tableWatch' => $env['XHGUI_PDO_TABLE_WATCHES'] ?? 'watches', | ||
], | ||
|
||
// Database options for MongoDB. | ||
'mongodb' => [ | ||
'hostname' => $env['XHGUI_MONGO_HOSTNAME'] ?? 'xhgui-mongo', | ||
'port' => $env['XHGUI_MONGO_PORT'] ?? 27017, | ||
'database' => $env['XHGUI_MONGO_DATABASE'] ?? 'xhprof', | ||
'options' => $mup, | ||
'driverOptions' => [], | ||
], | ||
'run.view.filter.names' => ['Zend*', 'Composer*'], | ||
'upload.token' => $env['XHGUI_UPLOAD_TOKEN'] ?? 'token', | ||
'path.prefix' => '/xhgui', | ||
'timezone' => '', | ||
'date.format' => 'M jS H:i:s', | ||
'detail.count' => 6, | ||
'page.limit' => 25, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ddev-generated | ||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
server_name xhgui; | ||
|
||
root /var/www/xhgui/webroot; | ||
index index.php; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php?$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
try_files $uri =404; | ||
include /etc/nginx/fastcgi_params; | ||
fastcgi_pass 127.0.0.1:9000; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
} | ||
} |