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

ARG TIDEWAYS_EXTENSION_VERSION=5.1.14
ARG TIDEWAYS_APIKEY=xyz
ARG TIDEWAYS_DAEMON_URI=tcp://tideways:9135

# 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-7.3.so /usr/local/lib/php/extensions/no-debug-non-zts-20180731/tideways.so \
 && printf "extension=tideways.so\ntideways.connection=${TIDEWAYS_DAEMON_URI}\ntideways.api_key=${TIDEWAYS_APIKEY}\ntideways.features.deprecations=1\ntideways.sql_long_query_time_ms=100\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

See the documentation of how to get Tideways running in a Docker compose setup as an example of how containers interact.

Still need help? Email [email protected]