Install in Alpine Docker Containers
When you are using the Alpine Linux distribution to run your PHP application in Docker containers, then the regular builds of Tideways will not work, because they are built for a glibc based distribution and Alpine uses musl.
You can get an Alpine build of the Tideways PHP extension from the downloads page.
This is an example Dockerfile to work with the Archive for Alpine and install Tideways into your container. It is a good start but will need some adjustments. (Note: We are working on an installer that makes this process easier in the future).
FROM php:7.3-fpm-alpine
# IMPORTANT: Find current version at https://tideways.com/profiler/downloads
ARG TIDEWAYS_EXTENSION_VERSION=5.4.22
ARG TIDEWAYS_APIKEY=xyz
ARG TIDEWAYS_DAEMON_URI=tcp://tideways:9135
ARG TIDEWAYS_PHP_VERSION=7.3
ARG TIDEWAYS_PHP_EXTVER=20180731
# Install tideways extension
RUN wget https://tideways.s3-eu-west-1.amazonaws.com/extension/${TIDEWAYS_EXTENSION_VERSION}/tideways-php-${TIDEWAYS_EXTENSION_VERSION}-alpine.tar.gz \
&& tar xvzf tideways-php-${TIDEWAYS_EXTENSION_VERSION}-alpine.tar.gz \
&& cp ./build/dist/tideways-php-alpine-${TIDEWAYS_PHP_VERSION}.so /usr/local/lib/php/extensions/no-debug-non-zts-${TIDEWAYS_PHP_EXTVER}/tideways.so \
&& printf "extension=tideways.so\ntideways.connection=${TIDEWAYS_DAEMON_URI}\ntideways.api_key=${TIDEWAYS_APIKEY}\n" > /usr/local/etc/php/conf.d/40-tideways.ini
You need to adjust the following things for your configuration:
-
The PHP version in FROM
-
The line copying the tideways-php-alpine-$version.so file into your Extension directory. Don’t forget to adjust the PHP Module Number that is part of the extension directory name.
-
The
TIDEWAYS_APIKEY
build argument to the Tideways API Key you find in your Tideways projects setup screen. -
The
TIDEWAYS_DAEMON_URI
needs to point to the tcp address of the tideways daemon container -
The
TIDEWAYS_PHP_VERSION
is the same version that you are using for PHP in the DockerFROM php:
line. -
The
TIDEWAYS_PHP_EXTVER
is the extension version that corresponds to the PHP Version.
The following extension versions exist at the moment for PHP on Alpine:
PHP | Extension |
---|---|
8.1 |
20210902 |
8.0 |
20200930 |
7.4 |
20190902 |
7.3 |
20180731 |
7.2 |
20170718 |
See the documentation of how to get Tideways running in a Docker compose setup as an example of how containers interact.