Collecting for multiple environments on one server

For technical reasons each tideways-daemon can handle exactly one environment. This means if you have a project runs with multiple environments on one server, this is not possible with the default setup of the tideways-daemon.

You can start the daemon multiple times on one server to get support for multiple environments.

  1. Start the daemon for a second (or third time, …​) for each additional environment on the server.

    tideways-daemon --hostname="$HOSTNAME-staging" --env=staging --address=/var/run/tideways/tidewaysd-staging.sock --log=/var/log/tideways/daemon-staging.log

    You should wrap this in a service, by copying the systemd service unit file from /lib/systemd/system/tideways-daemon.service` to create a new "tideways-daemon-staging" unit that you can use to control the process and restart it after reboots.

    [Unit]
    Description=Tideways Daemon Staging
    After=network.target
    
    [Service]
    Type=simple
    User=tideways
    Environment=TIDEWAYS_DAEMON_LOGFILE=/var/log/tideways/daemon-staging.log
    Environment=HOSTNAME=foobar-staging
    EnvironmentFile=-/etc/default/tideways-daemon
    ExecStart=/usr/bin/tideways-daemon --log=${TIDEWAYS_DAEMON_LOGFILE} $TIDEWAYS_DAEMON_EXTRA --hostname=${HOSTNAME} --env=staging --address=/var/run/tideways/tidewaysd-staging.sock
    PermissionsStartOnly=true
    ExecStartPre=/bin/mkdir -p /var/run/tideways
    ExecStartPre=/bin/chown tideways: /var/run/tideways
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
  2. Then in php.ini for the project running in staging environment you can do:

    tideways.connection=unix:///var/run/tideways/tidewaysd-staging.sock

    or setting the environment variable via Nginx vhost (via PHP-fpm pool or Apache is also possible through their APIs).

    TIDEWAYS_CONNECTION=unix:///var/run/tideways/tidewaysd-staging.sock
Still need help? Email [email protected]