Skip to content

Commit

Permalink
Add helper script to install RD Kafka extension
Browse files Browse the repository at this point in the history
As well as the needed dependencies. Using projects only need to call
docker-php-ext-rdkafka to enable the RD Kafka extension.
  • Loading branch information
Frank Koornstra authored and renatomefi committed Dec 20, 2018
1 parent 7b074ed commit 91c2a84
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,7 @@ RUN set -x \
&& docker-php-ext-enable mongodb \
&& apk del .build-deps
```

#### RD Kafka

Since the RD Kafka extension is used across multiple projects, a helper script is provided to install both the dependencies and the extension in a uniform fashion. Run `docker-php-ext-rdkafka` to profit.
13 changes: 13 additions & 0 deletions src/php/utils/docker/docker-php-ext-rdkafka
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -xe

# shellcheck disable=SC2086
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS
apk add --no-cache librdkafka-dev

pecl install rdkafka

docker-php-ext-enable rdkafka

apk del .build-deps
7 changes: 7 additions & 0 deletions test/container/test_helper_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def test_php_images_contain_helper_scripts(host):
"/usr/local/bin/docker-php-ext-install",
"/usr/local/bin/docker-php-ext-enable",
"/usr/local/bin/docker-php-ext-configure",
"/usr/local/bin/docker-php-ext-rdkafka",
"/usr/local/bin/docker-php-entrypoint",
"/usr/local/bin/php-fpm-healthcheck",
]
Expand Down Expand Up @@ -45,3 +46,9 @@ def test_php_fpm_status_is_enabled(host):
health_check = host.run("php-fpm-healthcheck -v")
assert health_check.rc == 0
assert "pool:" in health_check.stdout

@pytest.mark.php
def test_php_source_tarball_script(host):
host.run_expect([0], "docker-php-ext-rdkafka")

assert 'rdkafka' in host.run('php -m').stdout

0 comments on commit 91c2a84

Please sign in to comment.