Install on AWS Elastic Beanstalk
This guide covers the Docker and managed PHP platforms on Amazon Linux 2023.
Configure the API key
-
In the Elastic Beanstalk console, select your environment and open Configuration.
-
Under Updates, monitoring, and logging, choose Edit.
-
Under Runtime environment variables, choose Add environment variable.
-
Select Plain text as the source. Enter
TIDEWAYS_APIKEYas the name and your Tideways project’s API key as the value. -
Choose Apply.
Keep the API key out of your application’s source bundle and version control.
You can also source TIDEWAYS_APIKEY from AWS Secrets Manager or Systems Manager Parameter Store on platform versions released on or after March 26, 2025.
Follow the AWS instructions for secret-backed environment variables, including granting the instance profile access to the secret or parameter.
If you update or rotate the stored value, manually refresh the environment variable in Elastic Beanstalk.
Docker and Docker Compose
Install the extension in the PHP image
Use this Dockerfile to install Tideways in the official PHP Apache image and copy your application from src/.
FROM php:8.3-apache
COPY --from=ghcr.io/tideways/php:latest /tideways/ /tideways/
RUN docker-php-ext-enable --ini-name tideways.ini "$(php /tideways/get-ext-path.php)"
COPY src/ /var/www/html/
The same extension commands work with official PHP-FPM images.
For Alpine-based PHP images, copy the extension from ghcr.io/tideways/php:alpine.
See Install in Docker for more image examples.
Pass the API key at runtime to keep it out of the image build.
Add the daemon service
Save the example as docker-compose.yml at the root of the source bundle, or merge it into your existing Compose file.
services:
php:
build: .
ports:
- "80:80"
env_file:
- .env
environment:
TIDEWAYS_CONNECTION: tcp://tideways-daemon:9135
TIDEWAYS_SERVICE: app
depends_on:
- tideways-daemon
restart: unless-stopped
tideways-daemon:
image: ghcr.io/tideways/daemon:latest
restart: unless-stopped
Give each PHP service you monitor, including workers, the same TIDEWAYS_CONNECTION and env_file settings.
Keep those services and the daemon on a shared network, such as the default Compose network.
Leave the daemon’s unauthenticated port 9135 unpublished and allow outbound HTTPS to Tideways.
Compose reads TIDEWAYS_APIKEY from the .env file Elastic Beanstalk generates.
Leave any local .env out of the source bundle so Beanstalk can generate it, and add .env to .dockerignore to keep it out of the image build context.
Keep TIDEWAYS_APIKEY out of the Compose environment section, which overrides env_file.
Compose deployments handle HTTP traffic in the containers. The example publishes Apache on port 80. For PHP-FPM, publish the nginx or Apache service that forwards requests to FPM. Follow AWS’s Docker configuration instructions for enhanced health reporting.
Deploy and verify
Deploy the Dockerfile, application files, and docker-compose.yml to a Docker environment on Amazon Linux 2023.
To deploy a prebuilt application image, push it with the extension installed and replace build: . with an image: entry.
On an environment instance, run these commands from /var/app/current (with Docker access):
docker compose ps
docker compose exec -T php php -r 'exit(extension_loaded("tideways") ? 0 : 1);'
docker compose logs --tail=100 tideways-daemon
Expect both services to be running, the PHP check to exit successfully, and the daemon to listen on port 9135 without transmission errors. Send HTTP requests to a route that runs PHP and verify that new data appears in your Tideways project. If you use a custom PHP-FPM image, check that its pool passes the Tideways environment variables to workers.
Managed PHP platform
Install the packages
Add this prebuild hook as .platform/hooks/prebuild/10-install-tideways.sh in your source bundle.
#!/bin/bash
set -euo pipefail
dnf install -y 'dnf-command(config-manager)'
rpm --import 'https://packages.tideways.com/key.gpg'
cat > /tmp/tideways.repo <<'REPO'
[tideways]
name=tideways
baseurl=https://packages.tideways.com/rpm-packages/$basearch
repo_gpgcheck=1
enabled=1
skip_if_unavailable=0
gpgkey=https://packages.tideways.com/key.gpg
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
REPO
dnf config-manager --add-repo /tmp/tideways.repo
dnf install -y tideways-php tideways-daemon
systemctl enable --now tideways-daemon
systemctl is-active --quiet tideways-daemon
Elastic Beanstalk runs prebuild hooks as root before configuring the application and web server.
The tideways-php package enables the extension for the PHP version it detects. Set the API key through the environment property.
Save the hook with Unix (LF) line endings and include .platform in the deployment bundle.
To mark the hook executable before committing, use the following command.
chmod +x .platform/hooks/prebuild/10-install-tideways.sh
Deploy the bundle through the Elastic Beanstalk console or EB CLI. New instances run the hook when they deploy the bundle.
If you used the previous recipe, remove .ebextensions/10_tideways_repo.config and .ebextensions/20_tideways_install.config from your source bundle. Use an immutable deployment or environment rebuild to replace instances that still have the old API key and extension configuration on disk.
|
Verify the installation
Connect to an environment instance and check the packages, extension, and daemon:
rpm -q tideways-php tideways-daemon
php -r 'exit(extension_loaded("tideways") ? 0 : 1);'
systemctl is-enabled tideways-daemon
systemctl is-active tideways-daemon
Expect both packages to be installed, the PHP command to exit successfully, and the daemon to report enabled and active.
To verify the web runtime and API key, send HTTP requests to a route that runs PHP and confirm that new data appears in the expected Tideways project.
If deployment fails, check /var/log/eb-engine.log and /var/log/eb-hooks.log.
If deployment succeeds but no data arrives, check the daemon with journalctl -u tideways-daemon and follow the troubleshooting checklist below.