(23 comments, 60 posts)
Hi, my name is Pieter Vogelaar. I’m a web developer / DevOps engineer / IT consultant and specialized in high traffic and high profile websites. I love open source and have a great passion for automating and developing things!
Home page: http://pietervogelaar.nl
Posts by Pieter Vogelaar
Two years ago I wrote a tutorial to install a complete Postfix mail server with Dovecot, SpamAssassin and ViMbAdmin. At the moment I am automating this tutorial for CentOS 7 with Chef. For ViMbAdmin I created a recipe that clones the ViMbAdmin repository from Github, puts the configuration files from templates, creates the database, tables and inserts an admin user into the database. I thought it would be nice to share my vimbadmin recipe:
If you do a lot of Chef development, you are creating cookbooks with recipes. But also converging, testing and destroying virtual machines with Test Kitchen that uses Vagrant. In this process, virtual machines are often destroyed and build from the ground up. For every new build, all of the yum or debian packages must be downloaded and installed again. If your internet connection is not blazing fast, this will certainly slow down your work tempo a lot.
Install and configure Squid
Capistrano is great for deploying web applications. But the “current” symlink construction causes issues with PHP-FPM and OPcache enabled. PHP-FPM will display old pages after deployment or PHP-FPM just hangs. The hanging / freeze will result in your browser loading for minutes but you will just see a white screen.
To fix this, use $realpath_root instead of $document_root and set the SCRIPT_FILENAME in Nginx to pass to PHP-FPM.
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root;
This will pass the actual path “releases/20150208145800″ to PHP-FPM instead of “current” that is switched to the new release directory. OPcache can’t detect More >
When you write unit tests with PHPUnit there is a big chance that you have to mock several objects. If you want to write a unit test for your controller action and you use Doctrine ORM in your project, you will have to mock the Doctrine EntityManager, specific repositories and specify return values of the repository method calls. In the example below a repository method calls are “getCustomers” and “getNewHouse”.
The use of $this->at() (not possible)
Mocking multiple calls to the same method can be a bit difficult with PHPUnit. Because if you have More >
Gearman is a wonderful job management system. It allows a web application to pass work to be done on other servers that may be more powerful or more capable in other ways. In addition, multiple jobs can be done asyncronously. But, it’s a bit hard to get it all set up and working. This tutorial will show you how to install the latest version of Gearman, GearmanManager and Gearman Monitor on Ubuntu 12.04. Supervisor is often used to start Gearman workers and keep them running. GearmanManager looks a lot like Supervisor, but is even easier More >
This tutorial will show you how to install Selenium as a service on a Ubuntu 14.04 server. An Ubuntu server doesn’t have a GUI in contrast to Ubuntu desktop, so we will also need to setup a virtual screen where firefox will run.
Perform all actions as root!
Selenium is a Java application, so make sure Java is installed. Installation instructions: https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get.
Install Firefox and Xvfb.
apt-get update apt-get install firefox xvfb
Create a virtual screen a (re)boot.
Add the following line as first cronjob:
@reboot sh -c 'Xvfb :99 -ac -screen
Building a REST API with Apigility that is built on top of Zend Framework 2 is awesome. I’m also a big fan of Doctrine. So I started with the zf-apigility-skeleton and added the zf-apigility-doctrine vendor.
I created an User API and a Doctrine REST service called “User” with the route “/users[/:userId]“. You can defined fields per REST service. Every field will become an instance of Zend\InputFilter\Input, and together they are specified in a Zend\InputFilter\InputFilter.
The username must be unique, so for the POST (adding a user) /users More >