Configure the manual startup

If you began by installing the PHP extension, the daemon should be automatically started. However, if you prefer to have more control over the daemon process, it's possible to launch the daemon manually.

Prevent the extension from starting the daemon

Use the following configuration variable in your sqreen.ini in order to do so:

sqreen.launch_daemon=0

Note that when the variable sqreen.socket_path is set to another value than localhost, the daemon won't be started automatically.

Run the daemon using Docker

Use the Sqreen Docker image for the daemon:

$ docker run sqreen/php-agent

More information about the Docker image can be found here: https://hub.docker.com/r/sqreen/php-agent/

Don't forget that the PHP extension must be properly configured to reach the daemon. See the previous section to learn how to configure it.

Manual installation

On top of having packages for most Linux distributions, the Sqreen daemon is available from static repositories. Download it manually from here or use the following commands:

$ curl https://download.sqreen.io/php/sqreen-agent/linux/sqreen-agent-latest-linux.tar.gz -o sqreen-agent.tar.gz
$ tar -xvzf sqreen-agent.tar.gz

Next copy the daemon binary:

mkdir -p /usr/local/sqreen/bin/
cp sqreen-agent /usr/bin/

Then, run the daemon:

$ ./sqreen-agent
[INFO][2017-10-17 17:23:36,620 #19.MainThread] sqreen-agent:182     sqreen-agent (1.0.2) starting up on TCP socket 0.0.0.0:7773
[INFO][2017-10-17 17:23:36,621 #19.MainThread] sqreen-agent:195     Sqreen-agent successfully started

You can isolate the daemon in its own UNIX user account:

# useradd -rU sqreen
# mkdir -p -m 755 /var/log/sqreen
# chown sqreen:sqreen /var/log/sqreen

Configure daemon startup

Below, you'll find several examples on how to configure the daemon startup with common service manager.

systemd

You can configure systemd to start the daemon:

# cp ./systemd/sqreen-agent.service /usr/lib/systemd/system/sqreen-agent.service
# systemctl enable sqreen-agent
# systemctl start sqreen-agent

Debian / Ubuntu init.d

You can configure init.d to start the daemon:

# cp ./init.d/debian/sqreen-agent /etc/init.d/
# chmod 755 /etc/init.d/sqreen-agent
# update-rc.d sqreen-agent defaults
# /etc/init.d/sqreen-agent start

Red Hat / CentOS init.d

You can configure init.d to start the daemon:

# cp ./init.d/centos/sqreen-agent /etc/init.d/
# chmod 755 /etc/init.d/sqreen-agent
# chkconfig --add sqreen-agent
# chkconfig sqreen-agent on
# /etc/init.d/sqreen-agent start