Install in Docker

Tideways-Daemon Container

We provide a pre-built Docker image to pull into your project.

  1. Pull the image: docker pull ghcr.io/tideways/daemon

  2. Start the container: docker run -d --name=tideways-daemon ghcr.io/tideways/daemon

Looking at the output:

$ docker logs tideways-daemon
2024/03/14 09:15:50 maxprocs: Leaving GOMAXPROCS=12: CPU quota undefined
[tideways-daemon] 2024/03/14 09:15:50 Starting up daemon (version 1.8.42)
[tideways-daemon] 2024/03/14 09:15:50 Sending to https://ingest.tideways.io
[tideways-daemon] 2024/03/14 09:15:50 Collecting for tideways-daemon#96a2d513ef61
[tideways-daemon] 2024/03/14 09:15:50 Listening for TCP connections on [::]:9135.

We see the daemon properly starting, using tideways-daemon as the default hostname and listening on [::]:9135 (which will implicitly listen 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
To update to the latest version of the tideways-daemon you have to pull the image again and rebuild the container.

The next step is now pointing the PHP container 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.1-fpm image from Docker Hub, if you are using other base images you may need to adjust the installation:

FROM php:8.1-fpm

ENV TIDEWAYS_APIKEY=<YOUR_APIKEY>
ENV TIDEWAYS_SERVICE=app
ENV TIDEWAYS_SAMPLERATE=25
ENV TIDEWAYS_CONNECTION=tcp://tideways-daemon:9135

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yq && \
    apt-get install -yq --no-install-recommends gpg wget ca-certificates && \
    echo 'deb [signed-by=/usr/share/keyrings/tideways.gpg] https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list && \
    wget -qO - 'https://packages.tideways.com/key.gpg' | gpg --dearmor > /usr/share/keyrings/tideways.gpg && \
    apt-get update -yq && \
    apt-get install -yq tideways-php && \
    apt-get clean -yq

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 not tideways-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 its send to our backend.

With docker-compose

If you are using Docker Compose to setup your project, then integration of Tideways can be done with a dedicated container running the Tideways Daemon and all PHP containers send data to this single container.

For following docker-composer.yml example, contains only the entries for php (rudimentary) and tideways-daemon container. The php/ folder contains the Dockerfile from the documentation above.

version: '3.7'

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.
Still need help? Email [email protected]