2. Setting up a Tideways Account

Okay, now that we have a basic understanding of what Tideways is, let’s get in and start using it. To do that, we’ll need to do four things:

Ubuntu and PHP-FPM are used in the examples in this documentation. However, if you’re working with a different Linux distribution, you can find instructions on how to set up and configure the Tideways daemon on Docker, CentOS, Red Hat, and Fedora, AWS Elastic Beanstalk, and more. You can also find documentation showing how to configure Tideways for use with NGINX and Apache virtual hosts.

Register an Account

First up, you’ll need to register for an account. To do that, go to https://app.tideways.io/register/. There, you’ll see two ways to register:

  1. Via the new user registration form; and

  2. Via GitHub

We’ll use the registration form.

registration form

Enter your first name, email address, and password, and then click Start Profiling. Once the form is submitted, you’ll then be prompted to confirm the email address that you used to register, after which you’ll be redirected back to the dashboard, After the email address has been confirmed, you’re ready to create an organisation.

Create an Organization With An Application

create organisation horizontal

To create an organization, click Create Your Own Organisation, at the bottom of the page. You will then be directed to the "Create New Organisation" page. Here, you need to complete the following steps:

  1. Fill in the company and project names

  2. Set the correct timezone

  3. Read and accept the Terms of Service; and

  4. Click Start your free 30 days trial

The company and project name fields can only contain characters, numbers, dashes and underscores.

Install and Configure the Tideways Daemon

setup instructions

To install the Tideways PHP extension and daemon, run the installation instructions below. The instructions:

  1. Add a new Apt repository to the list of available repositories

  2. Retrieve the GPG key, so that the authenticity of the packages can be verified

  3. Update the Apt cache

  4. Install the Tideways PHP extension and daemon

echo 'deb [signed-by=/usr/share/keyrings/tideways.gpg] https://packages.tideways.com/apt-packages-main any-version main' | sudo tee /etc/apt/sources.list.d/tideways.list
wget -qO - 'https://packages.tideways.com/key.gpg' | gpg --dearmor | sudo tee /usr/share/keyrings/tideways.gpg > /dev/null
sudo apt-get update
sudo apt-get install tideways-daemon tideways-php

Check the Status of the Tideways Daemon

With the Tideways PHP extension and daemon installed, it’s worth checking that the Tideways daemon is running properly. It should be, as that’s part of the installation process, however, it never hurts to check and be sure. To do that, run the following command:

sudo systemctl status tideways-daemon
[ ok ] Starting tideways-daemon (via systemctl): tideways-daemon.service.

You should see output similar to the following, written to the terminal.

● tideways-daemon.service - Tideways Daemon
   Loaded: loaded (/lib/systemd/system/tideways-daemon.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-03-06 08:36:36 CET; 12h ago
  Process: 1237 ExecStartPre=/bin/chown tideways: /var/run/tideways (code=exited, status=0/SUCCESS)
  Process: 1232 ExecStartPre=/bin/mkdir -p /var/run/tideways (code=exited, status=0/SUCCESS)
 Main PID: 1246 (tideways-daemon)
    Tasks: 16 (limit: 4915)
   CGroup: /system.slice/tideways-daemon.service
           └─1246 /usr/bin/tideways-daemon --log=/var/log/tideways/daemon.log

Mär 06 08:36:36 settermjd-desktop systemd[1]: Starting Tideways Daemon...
Mär 06 08:36:36 settermjd-desktop systemd[1]: Started Tideways Daemon.

In the terminal output, you can see that the Tideways daemon is running, as "active (running)" is printed on the third line, next to "Active".

If you need to debug any issues with the Tideways daemon, or want to know what the daemon is doing, make sure to read through /var/log/tideways/daemon.log.

Configure the Tideways PHP Extension

With the Tideways daemon installed and running, you now need to configure the Tideways PHP extension with an API key. There are four ways of doing this:

  1. Use a PHP INI file

  2. Use a PHP-FPM configuration file

  3. Use an Nginx or Apache virtual hosts; and

  4. Use PHP code in our applications

To use a PHP INI file, add the two pre-generated INI configuration lines, which include the API key, to /etc/php/7.4/mods-available/tideways.ini. After that, restart PHP-FPM by running sudo systemctl restart php7.4-fpm, and then check that it restarted successfully, using sudo systemctl status php7.4-fpm.

This should give output similar to the following.

● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-03-06 08:36:38 CET; 12h ago
     Docs: man:php-fpm7.4(8)
  Process: 1557 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 73 (code=exi
 Main PID: 1233 (php-fpm7.4)
   Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
    Tasks: 3 (limit: 4915)
   CGroup: /system.slice/php7.4-fpm.service
           ├─1233 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
           ├─1552 php-fpm: pool www
           └─1553 php-fpm: pool www

Mär 06 08:36:36 settermjd-desktop systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Mär 06 08:36:38 settermjd-desktop systemd[1]: Started The PHP 7.4 FastCGI Process Manager.

If it is running, then in the output, which you can see above, on the third line, you’ll see Active: active (running). Otherwise, we’ll see inactive (dead). If PHP FPM did not restart successfully, we should read through the output in PHP FPM’s log file to find out why it did not restart successfully.

Next, check the extension’s loaded and configured in PHP. To do that run php --ri tideways in the terminal. You should see output similar to the following in the terminal:

Tideways => 5.0.62
Can connect to tideways-daemon? => Yes, version 1.5.76
Profiler is started? => NO!
Sample Rate (tideways.sample_rate) => 25
Framework (tideways.framework) => all
Service Name (tideways.service) =>
Monitoring mode (tideways.monitor) => basic
Monitoring CLI enabled (tideways.monitor_cli) =>
Log Level (tideways.log_level) => 0

With all these steps complete, the Tideways daemon and PHP extension are configured, running, and ready to use.

See Data Flowing In

With everything ready to go, it’s time to get some data flowing in. The easiest way is to use the application as you usually would. When you’re doing that, you’ll see it update as ever more information is added.

In addition to regular usage, you can also use load test tools, such as ApacheBench, which is part of the Apache HTTP server, or Siege, which is an http load testing and benchmarking utility, designed to let web developers measure their code under duress.

Viewing the Logs

You can also see that data is being sent to Tideways, by tailing the Tideways log file. The file is named daemon.log and is stored in /var/log/tideways/.

2020/03/14 13:48:05 Starting up daemon (version 1.5.9)
2020/03/14 13:48:05 Sending to https://app.tideways.io
2020/03/14 13:48:05 Sending for Environment 'staging1'
2020/03/14 13:48:05 Collecting for demo.tideways.io
2020/03/14 13:48:05 Supported server stats: CPU [X]  Memory [X]  Load [X]  Disk [X]  Network [X]
2020/03/14 13:48:05 Listening for Unix Socket connections at /var/run/tideways/tidewaysd.sock.
2020/03/14 13:48:05 Listening for UDP connections 127.0.0.1:8135

The example provides example log file output. It includes the number of measurements, profiles, summary profiles, exceptions, and matched Tracepoints. You can see that the information sent quickly grew, for example, from 5 measurements, up to 6,795 measurements.

Are You Stuck?

If any of these instructions don’t work for you, make sure to check out the troubleshooting documentation. There, you’ll find details on how to resolve data not being transmitted, how to install Tideways on a custom PHP installation, how to work around SELinux, and loads more. Be sure to start with the Troubleshooting Checklist.

In Conclusion

And that’s how to:

  1. Register an account

  2. Create an organisation with an application

  3. Install and configure the Tideways daemon and PHP extension

  4. Send data from the Tideways daemon to your Tideways application.

Still need help? Email [email protected]