Skip to content

Commit 78842a4

Browse files
authored
Merge branch 'master' into feature/safeindexdefault
2 parents 34eb34f + 24e70c7 commit 78842a4

16 files changed

Lines changed: 113 additions & 3 deletions

File tree

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ sudo: required
22

33
env:
44
DOCKER_COMPOSE_VERSION: 1.17.1
5+
GOSS_PATH: ./goss
56

67
services:
78
- docker
@@ -11,6 +12,9 @@ before_install:
1112
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
1213
- chmod +x docker-compose
1314
- sudo mv docker-compose /usr/local/bin
15+
- curl -L https://raw.githubusercontent.com/aelsabbahy/goss/master/extras/dgoss/dgoss -o dgoss
16+
- curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.6/goss-linux-amd64 -o goss
17+
- chmod 755 dgoss goss
1418

1519
# - Build and run all variants
1620
# - Ensure text from phpinfo is present in default response

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ volumes:
130130
### Monitoring
131131
---
132132
- NewRelic APM: automatically enabled by adding providing environment variables `REPLACE_NEWRELIC_APP` and `REPLACE_NEWRELIC_LICENSE`
133+
- NewRelic Distributed Tracing: Before enabling distributed tracing be sure to read the [transition guide](https://docs.newrelic.com/docs/apm/distributed-tracing/getting-started/transition-guide-distributed-tracing). To enable this set `NEWRELIC_TRACING_ENABLED` to `true`.
133134
- PHP-FPM Status: available *only* inside container at `/__status`. Application healthcheck can pull PHP-FPM statistics from `http://127.0.0.1/__status?json`. To open to more clients than local, add more `allow` statements in `__status` location block in `$CONF_NGINX_SITE`(`/etc/nginx/sites-available/default`)
134135
- Nginx Status: available *only* inside container at `/__nginx_status`. Application healthcheck can pull nginx statistics from `http://127.0.0.1/__nginx_status`. To open to more clients than local, add more `allow` statements in `__nginx_status` location block in $CONF_NGINX_SITE (`/etc/nginx/sites-available/default`)
135136

@@ -187,6 +188,7 @@ Variable | Example | Default | Description
187188
`SERVER_FASTCGI_BUSY_BUFFERS_SIZE` | `SERVER_FASTCGI_BUSY_BUFFERS_SIZE=‘1024k’` | 256k | [docs](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_busy_buffers_size)
188189
`REPLACE_NEWRELIC_APP` | `REPLACE_NEWRELIC_APP=prod-server-abc` | - | Sets application name for newrelic
189190
`REPLACE_NEWRELIC_LICENSE` | `REPLACE_NEWRELIC_LICENSE=abcdefg` | - | Sets license for newrelic, when combined with above, will enable newrelic reporting
191+
`NEWRELIC_TRACING_ENABLED` | `NEWRELIC_TRACING_ENABLED=true` | disabled | Sets transaction_tracer and distributed_tracing true for newrelic, when combined with above, will enable [newrelic distributed tracing](https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration#inivar-distributed-enabled)
190192
`PHP_FPM_MEMORY_LIMIT` | `PHP_FPM_MEMORY_LIMIT=256M` | 192MB | Sets memory limit for FPM instances of PHP
191193
`PHP_FPM_MAX_EXECUTION_TIME` | `PHP_FPM_MAX_EXECUTION_TIME=30` | 60 | Sets time limit for FPM workers
192194
`PHP_FPM_UPLOAD_MAX_FILESIZE` | `PHP_FPM_UPLOAD_MAX_FILESIZE=100M` | 1M | Sets both upload_max_filesize and post_max_size

container/root/run.d/07-newrelic.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@ if [ $REPLACE_NEWRELIC_APP ] && [ $REPLACE_NEWRELIC_LICENSE ]
55
then
66
echo "[newrelic] enabling APM metrics for ${REPLACE_NEWRELIC_APP}"
77
sed -i 's/;extension\s\?=/extension =/' $CONF_PHPMODS/newrelic.ini
8+
9+
if [ "$NEWRELIC_TRACING_ENABLED" = "true" ]
10+
then
11+
echo "[newrelic] enabling tracing for ${REPLACE_NEWRELIC_APP}"
12+
sed -i "s/;newrelic.transaction_tracer.enabled = .*/newrelic.transaction_tracer.enabled = true/" $CONF_PHPMODS/newrelic.ini
13+
sed -i "s/;newrelic.distributed_tracing_enabled = .*/newrelic.distributed_tracing_enabled = true/" $CONF_PHPMODS/newrelic.ini
14+
fi
815
fi

container/root/tests/php-fpm/5.6.goss.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ file:
9797
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
9898
- '/^newrelic.loglevel = \"warning\"/'
9999
- '/^newrelic.daemon.loglevel = \"warning\"/'
100+
- '!/^newrelic.transaction_tracer.enabled = true/'
101+
- '!/^newrelic.distributed_tracing_enabled = true/'
102+
- '/^;newrelic.transaction_tracer.enabled = true/'
103+
- '/^;newrelic.distributed_tracing_enabled = false/'
100104
/etc/php/5.6/fpm/php-fpm.conf:
101105
exists: true
102106
contains:

container/root/tests/php-fpm/7.0.goss.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ file:
9797
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
9898
- '/^newrelic.loglevel = \"warning\"/'
9999
- '/^newrelic.daemon.loglevel = \"warning\"/'
100+
- '!/^newrelic.transaction_tracer.enabled = true/'
101+
- '!/^newrelic.distributed_tracing_enabled = true/'
102+
- '/^;newrelic.transaction_tracer.enabled = true/'
103+
- '/^;newrelic.distributed_tracing_enabled = false/'
100104
/etc/php/7.0/fpm/php-fpm.conf:
101105
exists: true
102106
contains:

container/root/tests/php-fpm/7.1.goss.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ file:
9797
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
9898
- '/^newrelic.loglevel = \"warning\"/'
9999
- '/^newrelic.daemon.loglevel = \"warning\"/'
100+
- '!/^newrelic.transaction_tracer.enabled = true/'
101+
- '!/^newrelic.distributed_tracing_enabled = true/'
102+
- '/^;newrelic.transaction_tracer.enabled = true/'
103+
- '/^;newrelic.distributed_tracing_enabled = false/'
100104
/etc/php/7.1/fpm/php-fpm.conf:
101105
exists: true
102106
contains:
103107
- '/^error_log = \/dev\/stdout/'
104-

container/root/tests/php-fpm/7.2-alpine.goss.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,14 @@ package:
102102
installed: true
103103
php7-zip:
104104
installed: true
105+
106+
file:
107+
/etc/php7/conf.d/newrelic.ini:
108+
exists: true
109+
mode: "0644"
110+
filetype: file # file, symlink, directory
111+
contains: # Check file content for these patterns
112+
- '!/^newrelic.transaction_tracer.enabled = true/'
113+
- '!/^newrelic.distributed_tracing_enabled = true/'
114+
- '/^;newrelic.transaction_tracer.enabled = true/'
115+
- '/^;newrelic.distributed_tracing_enabled = false/'

container/root/tests/php-fpm/7.2.goss.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,11 @@ file:
250250
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
251251
- '/^newrelic.loglevel = \"warning\"/'
252252
- '/^newrelic.daemon.loglevel = \"warning\"/'
253+
- '!/^newrelic.transaction_tracer.enabled = true/'
254+
- '!/^newrelic.distributed_tracing_enabled = true/'
255+
- '/^;newrelic.transaction_tracer.enabled = true/'
256+
- '/^;newrelic.distributed_tracing_enabled = false/'
253257
/etc/php/7.2/fpm/php-fpm.conf:
254258
exists: true
255259
contains:
256-
- '/^error_log = \/dev\/stdout/'
257-
260+
- '/^error_log = \/dev\/stdout/'

container/root/tests/php-fpm/7.3.goss.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,13 @@ file:
247247
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
248248
- '/^newrelic.loglevel = \"warning\"/'
249249
- '/^newrelic.daemon.loglevel = \"warning\"/'
250+
- '!/^newrelic.transaction_tracer.enabled = true/'
251+
- '!/^newrelic.distributed_tracing_enabled = true/'
252+
- '/^;newrelic.transaction_tracer.enabled = true/'
253+
- '/^;newrelic.distributed_tracing_enabled = false/'
250254
/etc/php/7.3/fpm/php-fpm.conf:
251255
exists: true
252256
contains:
253257
- '/^error_log = \/dev\/stdout/'
254258

259+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
file:
2+
/etc/php/5.6/mods-available/newrelic.ini:
3+
exists: true
4+
mode: "0644"
5+
filetype: file # file, symlink, directory
6+
contains: # Check file content for these patterns
7+
- '/^newrelic.transaction_tracer.enabled = true/'
8+
- '/^newrelic.distributed_tracing_enabled = true/'

0 commit comments

Comments
 (0)