-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now have 2 versions : PHP 5.6 should be 'stable' and PHP 7.2 on xhgui…
… master
- Loading branch information
Emmanuel Dyan
committed
Apr 17, 2018
1 parent
c4290b0
commit 5911eb7
Showing
12 changed files
with
281 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,78 @@ | ||
FROM edyan/php:5.6 | ||
MAINTAINER Emmanuel Dyan <emmanueldyan@gmail.com> | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Installation | ||
RUN apt-get update && \ | ||
# Upgrade the system | ||
apt-get upgrade -y && \ | ||
# Install packages | ||
apt-get install -y --no-install-recommends ca-certificates git mongodb-server nginx supervisor && \ | ||
# Clone xhgui and install 0.7.1, then remove useless files | ||
git clone https://github.com/perftools/xhgui /usr/local/src/xhgui && \ | ||
cd /usr/local/src/xhgui && \ | ||
git checkout tags/v0.7.1 && \ | ||
rm -Rf /usr/local/src/xhgui/.git \ | ||
/usr/local/src/xhgui/.scrutinizer.yml \ | ||
/usr/local/src/xhgui/.travis.yml \ | ||
/usr/local/src/xhgui/phpunit.xml \ | ||
/usr/local/src/xhgui/README.md \ | ||
/usr/local/src/xhgui/tests && \ | ||
# Clean | ||
apt-get purge git -y && \ | ||
apt-get autoremove -y && \ | ||
apt-get autoclean && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/* /var/cache/* /var/log/* | ||
|
||
|
||
# Installing XhGui | ||
WORKDIR /usr/local/src/xhgui | ||
COPY conf/xhgui.config.php /usr/local/src/xhgui/config/config.php | ||
# Install composer | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends curl && \ | ||
curl https://getcomposer.org/download/1.6.4/composer.phar -s -S -o composer.phar && \ | ||
chmod 0755 composer.phar && \ | ||
./composer.phar selfupdate --stable && \ | ||
sed -i 's/composer\.phar update/composer.phar install --no-dev/g' install.php && \ | ||
php install.php && \ | ||
chown -R www-data:www-data /usr/local/src/xhgui && \ | ||
# Clean | ||
rm -f composer.phar && \ | ||
apt-get purge curl -y && \ | ||
apt-get autoremove -y && \ | ||
apt-get autoclean && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/* /var/cache/* /var/log/* | ||
|
||
|
||
# Prepare Mongodb | ||
RUN mkdir -p /data/db /var/log/mongodb && \ | ||
chown -R mongodb:mongodb /data /var/log/mongodb | ||
|
||
|
||
# Prepare nginx | ||
COPY conf/nginx.default.conf /etc/nginx/sites-available/default | ||
RUN mkdir /var/log/nginx && \ | ||
chown -R www-data:www-data /var/log/nginx | ||
|
||
|
||
# Supervisord | ||
RUN mkdir -p /var/log/supervisor | ||
COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
|
||
# Global directives | ||
VOLUME ["/usr/local/src/xhgui"] | ||
|
||
EXPOSE 80 27017 | ||
|
||
ENV FPM_UID 33 | ||
ENV FPM_GID 33 | ||
|
||
COPY post-run.sh /root/post-run.sh | ||
RUN chmod +x /root/post-run.sh | ||
|
||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
File renamed without changes.
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
File renamed without changes.
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
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,77 @@ | ||
FROM edyan/php:7.2 | ||
MAINTAINER Emmanuel Dyan <emmanueldyan@gmail.com> | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Installation | ||
RUN apt update && \ | ||
# Upgrade the system | ||
apt upgrade -y && \ | ||
# Install packages | ||
apt install -y --no-install-recommends ca-certificates git mongodb-server nginx supervisor && \ | ||
# Clone xhgui and install 0.7.1, then remove useless files | ||
git clone https://github.com/perftools/xhgui /usr/local/src/xhgui && \ | ||
cd /usr/local/src/xhgui && \ | ||
# Keep Master | git checkout tags/v0.7.1 && \ | ||
rm -Rf /usr/local/src/xhgui/.git \ | ||
/usr/local/src/xhgui/.scrutinizer.yml \ | ||
/usr/local/src/xhgui/.travis.yml \ | ||
/usr/local/src/xhgui/phpunit.xml \ | ||
/usr/local/src/xhgui/README.md \ | ||
/usr/local/src/xhgui/tests && \ | ||
# Clean | ||
apt purge git -y && \ | ||
apt autoremove -y && \ | ||
apt autoclean && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/* /var/cache/* /var/log/* | ||
|
||
|
||
# Installing XhGui | ||
WORKDIR /usr/local/src/xhgui | ||
COPY conf/xhgui.config.php /usr/local/src/xhgui/config/config.php | ||
# Install composer | ||
RUN apt update && \ | ||
apt install -y --no-install-recommends curl && \ | ||
curl https://getcomposer.org/download/1.6.4/composer.phar -s -S -o composer.phar && \ | ||
chmod 0755 composer.phar && \ | ||
./composer.phar selfupdate --stable && \ | ||
sed -i 's/composer\.phar update/composer.phar install --no-dev/g' install.php && \ | ||
php install.php && \ | ||
chown -R www-data:www-data /usr/local/src/xhgui && \ | ||
# Clean | ||
rm -f composer.phar && \ | ||
apt purge curl -y && \ | ||
apt autoremove -y && \ | ||
apt autoclean && \ | ||
apt clean && \ | ||
rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/* /var/cache/* /var/log/* | ||
|
||
|
||
# Prepare Mongodb | ||
RUN mkdir -p /data/db /var/log/mongodb && \ | ||
chown -R mongodb:mongodb /data /var/log/mongodb | ||
|
||
|
||
# Prepare nginx | ||
COPY conf/nginx.default.conf /etc/nginx/sites-available/default | ||
RUN mkdir /var/log/nginx && \ | ||
chown -R www-data:www-data /var/log/nginx | ||
|
||
# Supervisord | ||
RUN mkdir -p /var/log/supervisor | ||
COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
|
||
# Global directives | ||
VOLUME ["/usr/local/src/xhgui"] | ||
|
||
EXPOSE 80 27017 | ||
|
||
ENV FPM_UID 33 | ||
ENV FPM_GID 33 | ||
|
||
COPY post-run.sh /root/post-run.sh | ||
RUN chmod +x /root/post-run.sh | ||
|
||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
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,20 @@ | ||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
|
||
root /usr/local/src/xhgui/webroot; | ||
|
||
index index.php; | ||
|
||
server_name _; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php?$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
include snippets/fastcgi-php.conf; | ||
fastcgi_pass 127.0.0.1:9000; | ||
fastcgi_param script_filename $document_root$fastcgi_script_name; | ||
} | ||
} |
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,29 @@ | ||
[supervisord] | ||
nodaemon=true | ||
pidfile=/var/run/supervisord.pid | ||
logfile=/var/log/supervisor.log | ||
|
||
[program:fpm] | ||
command=/usr/sbin/php-fpm7.2 -c /etc/php/7.2/fpm --nodaemonize | ||
stdout_events_enabled=true | ||
stderr_events_enabled=true | ||
|
||
[program:nginx] | ||
command=/usr/sbin/nginx -g "daemon off;" -c /etc/nginx/nginx.conf | ||
stdout_events_enabled=true | ||
stderr_events_enabled=true | ||
|
||
[program:mongodb] | ||
command=/usr/bin/mongod --smallfiles --dbpath /data/db | ||
stdout_events_enabled=true | ||
stderr_events_enabled=true | ||
user=mongodb | ||
|
||
[program:post-run] | ||
command=/root/post-run.sh | ||
stdout_events_enabled=true | ||
stderr_events_enabled=true | ||
autostart=true | ||
autorestart=false | ||
startretries=0 | ||
exitcodes = 0 |
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,19 @@ | ||
<?php | ||
return array( | ||
'debug' => false, | ||
'mode' => 'development', | ||
'save.handler' => 'mongodb', | ||
'db.host' => 'mongodb://127.0.0.1', | ||
'db.db' => 'xhprof', | ||
'db.options' => array(), | ||
'templates.path' => dirname(__DIR__) . '/src/templates', | ||
'date.format' => 'M jS H:i:s', | ||
'detail.count' => 6, | ||
'page.limit' => 25, | ||
'profiler.enable' => function () { | ||
return true; | ||
}, | ||
'profiler.simple_url' => function ($url) { | ||
return preg_replace('/\=\d+/', '', $url); | ||
} | ||
); |
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,34 @@ | ||
#!/bin/bash | ||
|
||
# Right Permissions | ||
usermod -u $FPM_UID www-data | ||
groupmod -g $FPM_GID www-data | ||
chown -R www-data:www-data /usr/local/src/xhgui /var/log/php /var/log/nginx | ||
|
||
# Define indexes for mongodb | ||
for i in $(seq 1 90); do | ||
mongo --eval "printjson(db.serverStatus())" > /dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
break | ||
fi | ||
|
||
|
||
if [ $i -eq 90 ]; then | ||
exit 1 | ||
fi | ||
|
||
sleep 1 | ||
done | ||
|
||
mongo > /dev/null 2>&1 <<EOF | ||
use xhprof | ||
db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } ) | ||
db.results.ensureIndex( { 'profile.main().wt' : -1 } ) | ||
db.results.ensureIndex( { 'profile.main().mu' : -1 } ) | ||
db.results.ensureIndex( { 'profile.main().cpu' : -1 } ) | ||
db.results.ensureIndex( { 'meta.url' : 1 } ) | ||
db.results.ensureIndex( { "meta.request_ts" : 1 }, { expireAfterSeconds : 432000 } ) | ||
EOF | ||
|
||
exit 0 |