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_DAEMON_URI=tcp://tideways:9135

# Install tideways extension
 && tar xvzf tideways-php-${TIDEWAYS_EXTENSION_VERSION}-alpine.tar.gz \
 && cp ./build/dist/ /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ \
 && printf "\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-$ 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]