Skip to content

Commit

Permalink
Merge pull request amabnl#21 in FLIGHT/service.amadeus from feature/V…
Browse files Browse the repository at this point in the history
…AN-524-search-compare-services-add-profiling to master

* commit 'e1ee8d7c994830e44e81083710fbb076960b1070':
  VAN-524 (fix) | move dependencies from require-dev to require
  VAN-524 search & compare services - add profiling script | (fix) disabled profiling by default
  VAN-524 search & compare services - add profiling script | (add) profiling via tideways and appropriate dependencies
  • Loading branch information
tsari-invia committed Dec 5, 2017
2 parents 7e16141 + e1ee8d7 commit ffe34e8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ The healthcheck is supposed to give an idea how the application works, it is als
If you add a new endpoint or a new database system please consider adding it in the `_links`
section in `./src/Index/BusinessCase/HealthCheck`.

## Profiling
Profiling is integrated for local development with docker-composer. If you want to collect data you have comment in the `XHGUI_PROFILING=enabled` env var in `docker-compose.override.yml`.

Navigate to `localhost:8000` to browser through your profiled data with XHGUI.

## Docs

Docs are written in API Blueprint. See [docs](https://apiblueprint.org/) for more information about
Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"autoload": {
"psr-4": {
"Flight\\Service\\Amadeus\\": "./src"
}
},
"files": [
"vendor/perftools/xhgui-collector/external/header.php"
]
},
"autoload-dev": {
"psr-4": {
Expand All @@ -32,7 +35,9 @@
"jms/serializer": "^1.8",
"flight/library-search-request-response-mapping": "^3.2",
"particle/validator": "^2.2",
"flight/throwup-errors": "^0.1"
"flight/throwup-errors": "^0.1",
"perftools/xhgui-collector": "^1.0",
"alcaeus/mongo-php-adapter": "^1.0"
},
"require-dev": {
"codeception/codeception": "~2.3",
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@ services:
amadeus-nginx:
ports:
- "80:80"

amadeus-php:
environment:
# XHGUI_PROFILING: enabled
XHGUI_MONGO_URI: mongo:27017
XHGUI_MONGO_DB: amadeus-profiling

mongo:
container_name: amadeus-mongo
image: mongo:latest

xhgui:
image: tsari/docker-xhgui
container_name: amadeus-xhgui
ports:
- "8000:80"
environment:
XHGUI_MONGO_URI: mongo:27017
XHGUI_MONGO_DB: amadeus-profiling
18 changes: 14 additions & 4 deletions scripts/docker/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@ FROM php:7.1-fpm-alpine
ENV XDEBUG_VERSION=2.5.5

# Install packages we want to keep
RUN apk --no-cache add fcgi git openssh libxml2 libxslt zlib libbz2
RUN apk --no-cache add fcgi git openssh libxml2 libxslt zlib libbz2 openssl-dev

# Install dependcies that are only used during installation of other packages. Afterwards it will be cleaned up.
# Install dependencies that are only used during installation of other packages. Afterwards it will be cleaned up.
RUN set -xe \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
coreutils \
bzip2-dev libxml2-dev libxslt-dev zlib-dev \
&& docker-php-ext-install -j"$(/usr/bin/nproc)" opcache mbstring zip soap pdo pdo_mysql mysqli xsl bz2 \
&& pecl install xdebug-$XDEBUG_VERSION \
&& docker-php-ext-enable opcache xdebug mbstring zip soap pdo pdo_mysql mysqli xsl \
&& pecl install xdebug-$XDEBUG_VERSION mongodb \
&& docker-php-ext-enable opcache xdebug mbstring zip soap pdo pdo_mysql mysqli xsl mongodb \
&& apk del .build-deps

# install tideways extension
ENV TIDEWAYS_VERSION=4.1.4
RUN wget -Otideways-php.tar.gz "https://s3-eu-west-1.amazonaws.com/tideways/extension/4.1.4/tideways-php-$TIDEWAYS_VERSION-x86_64.tar.gz" \
&& tar xzvf tideways-php.tar.gz \
&& cd tideways-php-$TIDEWAYS_VERSION \
&& sh install.sh \
&& echo "extension=tideways.so" > $PHP_INI_DIR/conf.d/tideways.ini \
&& echo "tideways.auto_prepend_library=0" >> $PHP_INI_DIR/conf.d/tideways.ini \
&& rm -rf /tmp/tideways-php*

# Use our own xdebug configuration.
# Just extend the existing xdebug config as the path to xdebug.so is already existent.
COPY ./scripts/docker/php/20-xdebug.ini /tmp/xdebug.ini
Expand Down
1 change: 0 additions & 1 deletion web/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down

0 comments on commit ffe34e8

Please sign in to comment.