Pragmatism in the real world

Simple Ansible file for Z-Ray preview

Recently, Zend made available a Z-Ray Technology Preview which takes the Z-Ray feature of Zend Server and makes it stand-alone.

This is very interesting as it means that I can run it with the PHP 5.6 on Ubuntu 14.04 LTS Vagrant set up that I prefer. I decided to create an Ansible playbook to install Z-Ray into my VM. The Z-Ray instructions are clear enough, so it was simply a case of converting them to a set of YAML steps as who wants to do manual installation nowadays?!

This is what I came up with:

---

- name: Downloading Z-Ray for PHP 5.6
  get_url:
    url: "http://downloads.zend.com/zray/1208/zray-php5.6-Ubuntu-14.04-x86_64.tar.gz"
    dest: "/home/vagrant/zray-php5.6-Ubuntu-14.04-x86_64.tar.gz"

- name: Extract Z-Ray archive
  unarchive: src=/home/vagrant/zray-php5.6-Ubuntu-14.04-x86_64.tar.gz dest=/opt copy=no creates=/opt/zray/INSTALL_ZRAY.TXT

- name: Set Z-Ray ownership
  shell: chown -R vagrant:vagrant /opt/zray

- name: Add the Z-Ray UI virtual host
  file: src=/opt/zray/zray-ui.conf dest=/etc/apache2/sites-available/zray-ui.conf

- name: Enable the Z-Ray UI virtual host
  shell: a2ensite zray-ui.conf

- name: Install Z-Ray PHP extension (Apache)
  file: src=/opt/zray/zray.ini dest=/etc/php5/apache2/conf.d/zray.ini state=link

- name: Install Z-Ray PHP extension (CLI)
  file: src=/opt/zray/zray.ini dest=/etc/php5/cli/conf.d/zray.ini state=link

- name: Link Z-Ray PHP 5.6 extension
  file: src=/opt/zray/lib/zray.so dest=/usr/lib/php5/20131226/zray.so state=link

I’ve set this up for PHP 5.6 which is what I’m using nowadays. If you’re using 5.5, then you need to download zray-php5.5-Ubuntu-14.04-x86_64.tar.gz and the link needs to be to /usr/lib/php5/20121212/zray.so.

Changing the file ownership to vagrant was important – I couldn’t get it work without doing this step and I have no idea why its needed…

The standalone Z-Ray looks to be very similar to the one supplied as part of Zend Server and is equally as helpful in terms of getting a grip on what’s going on with your application when developing it.

It has improved since I wrote about before and is even more useful now as it’s been improved and has plugins!

With the standalone version of Z-Ray, there’s really no excuse to not be using it.

2 thoughts on “Simple Ansible file for Z-Ray preview

  1. How did you find that download link? I submitted Zend's preview download form, but didn't see direct downloads like the one you found. We're running Ubuntu 12.04, and getting an apache segmentation fault after trying to install zray with the provided instructions. Thanks!

Comments are closed.