Install in Docker
Tideways-Daemon Container
We provide a pre-built Docker image to pull into your project.
-
Pull the image:
docker pull ghcr.io/tideways/daemon
-
Start the container:
docker run -d --name=tideways-daemon ghcr.io/tideways/daemon
Looking at the output:
$ docker logs tideways-daemon [tideways-daemon] Starting up daemon [tideways-daemon] Sending to https://ingest.tideways.io [tideways-daemon] Collecting for tideways-daemon [tideways-daemon] Listening for TCP connections on [::]:9135.
We see the daemon starting, using tideways-daemon as the default
hostname and listening on [::]:9135
which implicitly listens on IPv4’s 0.0.0.0
as well.
The Tideways-Daemon does not perform authentication, thus it is necessary to set up proper network or firewall rules that the container cannot be reached from public. |
You can pass all configuration flags directly to docker run
, for example, the environment and hostname flags:
$ docker run -d --name=tideways-staging-daemon ghcr.io/tideways/daemon --env=staging --hostname=tideways-staging-daemon
The next step is to point your PHP container(s) towards the tideways-daemon container.
Installing Tideways Extension in a Docker PHP Container
A Docker container running PHP then requires the Tideways PHP extension to be installed and a small change to the configuration to point to the Daemon’s container instead of a local socket (which is the default).
Here is an example based on how to install the Tideways PHP extension with
the php:8.3-fpm
image from Docker Hub, if you are using other base images, you
may need to adjust the installation:
FROM php:8.3-fpm
ENV TIDEWAYS_APIKEY=<YOUR_APIKEY>
ENV TIDEWAYS_SERVICE=app
ENV TIDEWAYS_SAMPLERATE=25
ENV TIDEWAYS_CONNECTION=tcp://tideways-daemon:9135
# Use `ghcr.io/tideways/php:alpine` when using an alpine-based PHP image.
COPY --from=ghcr.io/tideways/php:latest /tideways/ /tideways/
RUN docker-php-ext-enable --ini-name tideways.ini "$(php /tideways/get-ext-path.php)"
To pass your API key, you can either edit the Dockerfile or create ./php/.env
and add the environment variable as follows
TIDEWAYS_APIKEY=<YOUR_APIKEY>
You can also change the other extension-related environment variables.
-
TIDEWAYS_SERVICE
declaring the service name -
TIDEWAYS_CONNECTION
with the address of the daemon if it is nottideways-daemon:9135
. -
TIDEWAYS_SAMPLERATE
to reconfigure the sample rate.
The PHP container now sends all data to the Tideways-Daemon container for further processing before it sends it on to our backend.
Alpine Containers
When using Alpine Linux, use a slightly modified Dockerfile:
FROM php:8.3-fpm-alpine
ENV TIDEWAYS_APIKEY=<YOUR_APIKEY>
ENV TIDEWAYS_SERVICE=app
ENV TIDEWAYS_SAMPLERATE=25
ENV TIDEWAYS_CONNECTION=tcp://tideways-daemon:9135
COPY --from=ghcr.io/tideways/php:alpine /tideways/ /tideways/
RUN docker-php-ext-enable --ini-name tideways.ini "$(php /tideways/get-ext-path.php)"
With docker-compose
If you are using Docker Compose to set up your project, the integration of Tideways can be done using a dedicated service running the Tideways-Daemon container. All PHP containers will then send data to this single container.
In the following docker-composer.yml
example we show a rudimentary php entry and the tideways-daemon
container.
The php/
folder contains the Dockerfile from the documentation above.
services:
php:
build:
context: ./php
links:
- tideways-daemon
env_file:
- ./php/.env
tideways-daemon:
image: ghcr.io/tideways/daemon
command: "--env=production" # Modify environment and add any other daemon parameters here
If you integrate Tideways in your existing Docker Compose setup, a common mistake is to forget linking tideways-daemon and PHP containers, so that they can communicate over the network. |