Skip to content

Commit cfe39ff

Browse files
Merge pull request #222 from magento/1.1-forward
Forward-port 1.1 into develop
2 parents 630d211 + 6e23d9d commit cfe39ff

File tree

16 files changed

+132
-3
lines changed

16 files changed

+132
-3
lines changed

images/nginx/1.9/etc/vhost.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ upstream fastcgi_backend {
55
server {
66
listen 80;
77
listen 443 ssl;
8+
9+
fastcgi_buffers 16 16k;
10+
fastcgi_buffer_size 32k;
811

912
server_name _;
1013

images/php/7.2-cli/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ RUN pecl install -o -f \
124124
xdebug-2.6.1 \
125125
yaml
126126

127+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
128+
&& mkdir -p /tmp/blackfire \
129+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
130+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
131+
&& ( echo extension=blackfire.so \
132+
&& echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
133+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
127134
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
128135
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
129136
&& apt-get remove libsodium* -y \
@@ -147,6 +154,7 @@ RUN cd /tmp \
147154

148155
RUN docker-php-ext-enable \
149156
bcmath \
157+
blackfire \
150158
bz2 \
151159
calendar \
152160
exif \

images/php/7.2-fpm/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ RUN pecl install -o -f \
102102
xdebug-2.6.1 \
103103
yaml
104104

105+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
106+
&& mkdir -p /tmp/blackfire \
107+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
108+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
109+
&& ( echo extension=blackfire.so \
110+
&& echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
111+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
105112
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
106113
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
107114
&& apt-get remove libsodium* -y \
@@ -125,6 +132,7 @@ RUN cd /tmp \
125132

126133
RUN docker-php-ext-enable \
127134
bcmath \
135+
blackfire \
128136
bz2 \
129137
calendar \
130138
exif \

images/php/7.3-cli/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ RUN pecl install -o -f \
121121
xdebug-2.7.1 \
122122
yaml
123123

124+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
125+
&& mkdir -p /tmp/blackfire \
126+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
127+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
128+
&& ( echo extension=blackfire.so \
129+
&& echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
130+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
124131
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
125132
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
126133
&& apt-get remove libsodium* -y \
@@ -144,6 +151,7 @@ RUN cd /tmp \
144151

145152
RUN docker-php-ext-enable \
146153
bcmath \
154+
blackfire \
147155
bz2 \
148156
calendar \
149157
exif \

images/php/7.3-fpm/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ RUN pecl install -o -f \
9999
xdebug-2.7.1 \
100100
yaml
101101

102+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
103+
&& mkdir -p /tmp/blackfire \
104+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
105+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
106+
&& ( echo extension=blackfire.so \
107+
&& echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
108+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
102109
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
103110
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
104111
&& apt-get remove libsodium* -y \
@@ -122,6 +129,7 @@ RUN cd /tmp \
122129

123130
RUN docker-php-ext-enable \
124131
bcmath \
132+
blackfire \
125133
bz2 \
126134
calendar \
127135
exif \

images/php/7.4-cli/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
FROM php:7.4-cli-buster
33
ARG GOSU_VERSION=1.11
44

5+
ENV COMPOSER_MEMORY_LIMIT -1
56
ENV PHP_MEMORY_LIMIT 2G
67
ENV MAGENTO_ROOT /app
78
ENV DEBUG false
@@ -110,6 +111,13 @@ RUN pecl install -o -f \
110111
xdebug-2.9.3 \
111112
yaml
112113

114+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
115+
&& mkdir -p /tmp/blackfire \
116+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
117+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
118+
&& ( echo extension=blackfire.so \
119+
&& echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
120+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
113121
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
114122
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
115123
&& apt-get remove libsodium* -y \
@@ -125,6 +133,7 @@ RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
125133

126134
RUN docker-php-ext-enable \
127135
bcmath \
136+
blackfire \
128137
bz2 \
129138
calendar \
130139
exif \

images/php/7.4-fpm/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ RUN pecl install -o -f \
8989
xdebug-2.9.3 \
9090
yaml
9191

92+
RUN curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
93+
&& mkdir -p /tmp/blackfire \
94+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
95+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
96+
&& ( echo extension=blackfire.so \
97+
&& echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini \
98+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
9299
RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
93100
&& rm -f /usr/local/lib/php/extensions/*/*sodium.so \
94101
&& apt-get remove libsodium* -y \
@@ -104,6 +111,7 @@ RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
104111

105112
RUN docker-php-ext-enable \
106113
bcmath \
114+
blackfire \
107115
bz2 \
108116
calendar \
109117
exif \

src/Compose/Php/ExtensionResolver.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ExtensionResolver
8585
/**
8686
* Extensions which should be ignored
8787
*/
88-
private const IGNORED_EXTENSIONS = ['blackfire', 'newrelic'];
88+
private const IGNORED_EXTENSIONS = ['newrelic'];
8989

9090
/**
9191
* @var Semver
@@ -163,6 +163,22 @@ public static function getConfig(): array
163163
'bcmath' => [
164164
'>=7.0' => [self::EXTENSION_TYPE => self::EXTENSION_TYPE_CORE],
165165
],
166+
'blackfire' => [
167+
'>=7.2' => [
168+
self::EXTENSION_TYPE => self::EXTENSION_TYPE_INSTALLATION_SCRIPT,
169+
// phpcs:disable
170+
self::EXTENSION_INSTALLATION_SCRIPT => <<< BASH
171+
curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")
172+
mkdir -p /tmp/blackfire
173+
tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire
174+
mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so
175+
( echo extension=blackfire.so
176+
echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini
177+
rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
178+
BASH
179+
// phpcs:enable
180+
]
181+
],
166182
'bz2' => [
167183
'>=7.0' => [
168184
self::EXTENSION_TYPE => self::EXTENSION_TYPE_CORE,

src/Compose/ProductionBuilder.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,27 @@ public function build(Config $config): Manager
354354
);
355355
}
356356

357+
if ($config->hasServiceEnabled(ServiceInterface::SERVICE_BLACKFIRE)) {
358+
$manager->addService(
359+
ServiceInterface::SERVICE_BLACKFIRE,
360+
$this->serviceFactory->create(
361+
ServiceInterface::SERVICE_BLACKFIRE,
362+
$config->getServiceVersion(ServiceInterface::SERVICE_BLACKFIRE),
363+
[
364+
'environment' => [
365+
'BLACKFIRE_SERVER_ID' => $config->getBlackfireConfig()['server_id'],
366+
'BLACKFIRE_SERVER_TOKEN' => $config->getBlackfireConfig()['server_token'],
367+
'BLACKFIRE_CLIENT_ID' => $config->getBlackfireConfig()['client_id'],
368+
'BLACKFIRE_CLIENT_TOKEN' => $config->getBlackfireConfig()['client_token']
369+
],
370+
'ports' => ["8707"]
371+
]
372+
),
373+
[self::NETWORK_MAGENTO],
374+
[]
375+
);
376+
}
377+
357378
$phpExtensions = $this->phpExtension->get($config);
358379

359380
/**

src/Config/Config.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,15 @@ public function hasTmpMounts(): bool
248248
return (bool)$this->all()->get(SourceInterface::SYSTEM_TMP_MOUNTS);
249249
}
250250

251+
/**
252+
* @return array
253+
* @throws ConfigurationMismatchException
254+
*/
255+
public function getBlackfireConfig(): array
256+
{
257+
return (array)$this->all()->get(SourceInterface::SERVICES_BLACKFIRE_CONFIG, []);
258+
}
259+
251260
/**
252261
* @return string|null
253262
* @throws ConfigurationMismatchException

0 commit comments

Comments
 (0)