Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manage website users, vhosts and PHP-FPM pools using Chef

I'm looking to automate my cloud environment fairly soon using Chef so it can automatically scale instances and add them to HAProxy. One issue I'm having is with the concept of managing multiple virtualhosts and the users created with them to use in PHP-FPM pools.

What I'd like to do is:

  • Create a new user
  • Create a new virtualhost with domain information and aliases, define log * locations etc
  • Create public virtualhost directories, log file locations
  • Update PHP-FPM cgi file so it executes PHP files as that user in it's own pool

I'm a little new to Chef so I'm a puzzled when it comes to using one configuration to influence others. Can this be done?

Thanks

like image 831
MrNorm Avatar asked Apr 30 '15 09:04

MrNorm


1 Answers

Chef work with recipes and cookbooks and have some resources.

  • Create a new user: for this, you can use user. Look that use a hash for password.

  • Create a new virtualhost with domain information and aliases, define log * locations etc: Here, you can use template and attributes.

  • Create public virtualhost directories, log file location: Here, you can use the resurce directory with correct user, group and permission.

  • Update PHP-FPM cgi file so it executes PHP files as that user in it's own pool: To edit PHP-FPM, you can use a bash.

OPSCODE have a coobook to install and config PHP. For example, see the recipes, templates and attributes and I have a little cookbook. For use any cookbook as dependencies, you can use the berkshelf to manage.

like image 167
acfreitas Avatar answered Oct 08 '22 21:10

acfreitas