Manage website users, vhosts, and PHP-FPM pools with a chef

I'm trying to automate my cloud environment pretty quickly using Chef so that it can automatically scale instances and add them to HAProxy. One of the problems I encountered is the concept of managing multiple virtual hosts and users created with them for use in PHP-FPM pools.

I would like to:

  • Create new user
  • Create a new virtual host with domain information and aliases, determine log locations, etc.
  • Creating public directories of virtual hosts, log file locations
  • Update the PHP-FPM cgi file so that it executes PHP files as this user in its own pool.

I am a little familiar with the chef, so I am puzzled when it comes to using one configuration to influence others. It can be done?

thanks

+6
source share
1 answer

The chef works with recipes and cookbooks and has resources .

  • Create a new user: you can use user for this. See what uses the hash for the password.

  • Create a new virtual host with domain information and aliases, determine log locations, etc. Here you can use template and attributes .

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

  • Update the PHP-FPM cgi file so that it executes PHP files as this user in its own pool: you can use bash to edit PHP-FPM.

OPSCODE has coobook to install and configure PHP. For example, see recipes , templates and attributes , and I have a little cookbook . To use any cookbook as a dependency, you can use berkshelf to manage.

+2
source

Source: https://habr.com/ru/post/986281/


All Articles