geerlingguy / drupal-vm

A VM for Drupal development
https://www.drupalvm.com/
MIT License
1.37k stars 645 forks source link

Issue with php-fpm #752

Closed sbubaron closed 8 years ago

sbubaron commented 8 years ago

When attempting to vagrant up or provision I am getting this issue:

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error when trying to enable php7.0-fpm: rc=1 Failed to execute operation: No such file or directory\n"}

I have included my yml files below

==> asasbu.localvm: TASK [geerlingguy.php : include] ***********************************************
==> asasbu.localvm: included: /etc/ansible/roles/geerlingguy.php/tasks/configure-fpm.yml for localhost
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Define php_fpm_daemon.] ********************************
==> asasbu.localvm: ok: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Define php_fpm_pool_conf_path.] ************************
==> asasbu.localvm: ok: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Define php_fpm_pool_user.] *****************************
==> asasbu.localvm: ok: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Define php_fpm_pool_group.] ****************************
==> asasbu.localvm: ok: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Stat php_fpm_pool_conf_path] ***************************
==> asasbu.localvm: ok: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Ensure the default pool directory exists.] *************
==> asasbu.localvm: changed: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Ensure the default pool exists.] ***********************
==> asasbu.localvm: changed: [localhost]
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Configure php-fpm pool (if enabled).] ******************
==> asasbu.localvm: ok: [localhost] => (item={u'regexp': u'^listen.?=.+$', u'line': u'listen = 127.0.0.1:9000'})
==> asasbu.localvm: ok: [localhost] => (item={u'regexp': u'^listen\\.allowed_clients.?=.+$', u'line': u'listen.allowed_clients = 127.0.0.1'})
==> asasbu.localvm: ok: [localhost] => (item={u'regexp': u'^pm\\.max_children.?=.+$', u'line': u'pm.max_children = 50'})
==> asasbu.localvm: ok: [localhost] => (item={u'regexp': u'^pm\\.start_servers.?=.+$', u'line': u'pm.start_servers = 5'})
==> asasbu.localvm: ok: [localhost] => (item={u'regexp': u'^pm\\.min_spare_servers.?=.+$', u'line': u'pm.min_spare_servers = 5'})
==> asasbu.localvm: ok: [localhost] => (item={u'regexp': u'^pm\\.max_spare_servers.?=.+$', u'line': u'pm.max_spare_servers = 5'})
==> asasbu.localvm:
==> asasbu.localvm: TASK [geerlingguy.php : Ensure php-fpm is started and enabled at boot (if configured).] ***
==> asasbu.localvm: fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error when trying to enable php7.0-fpm: rc=1 Failed to execute operation: No such file or directory\n"}
==> asasbu.localvm:
==> asasbu.localvm: RUNNING HANDLER [geerlingguy.firewall : restart firewall] **********************
==> asasbu.localvm:
==> asasbu.localvm: RUNNING HANDLER [geerlingguy.apache : restart apache] **************************
==> asasbu.localvm:
==> asasbu.localvm: RUNNING HANDLER [geerlingguy.mysql : restart mysql] ****************************
==> asasbu.localvm:
==> asasbu.localvm: RUNNING HANDLER [geerlingguy.php : restart webserver] **************************
==> asasbu.localvm:     to retry, use: --limit @/vagrant/provisioning/playbook.retry
==> asasbu.localvm:
==> asasbu.localvm: PLAY RECAP *********************************************************************
==> asasbu.localvm: localhost                  : ok=103  changed=36   unreachable=0    failed=1

---
# `vagrant_box` can also be set to geerlingguy/centos6, geerlingguy/centos7,
# geerlingguy/ubuntu1404, geerlingguy/ubuntu1204, parallels/ubuntu-14.04, etc.
vagrant_box: geerlingguy/ubuntu1604
vagrant_user: vagrant
vagrant_synced_folder_default_type: nfs

# If you need to run multiple instances of Drupal VM, set a unique hostname,
# machine name, and IP address for each instance.
vagrant_hostname: drupalvm.dev
vagrant_machine_name: drupalvm
vagrant_ip: 192.168.88.88

# Allow Drupal VM to be accessed via a public network interface on your host.
# Vagrant boxes are insecure by default, so be careful. You've been warned!
# See: https://docs.vagrantup.com/v2/networking/public_network.html
vagrant_public_ip: ""

# A list of synced folders, with the keys 'local_path', 'destination', and
# a 'type' of [nfs|rsync|smb] (leave empty for slow native shares). See
# http://docs.drupalvm.com/en/latest/extras/syncing-folders/ for more info.
vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # any of the build_* settings are 'true'. By default the folder is set to
  # the drupal-vm folder.
  - local_path: .
    destination: /var/www/drupalvm
    type: nfs
    create: true

# Memory and CPU to use for this VM.
vagrant_memory: 1024
vagrant_cpus: 2

# The web server software to use. Can be either 'apache' or 'nginx'.
drupalvm_webserver: apache

# Set this to 'false' if you are using a different site deployment strategy and
# would like to configure 'vagrant_synced_folders' and 'apache_vhosts' manually.
build_makefile: false
drush_makefile_path: "{{ config_dir }}/drupal.make.yml"

# Set 'build_makefile' to 'false' and this to 'true' if you are using a
# composer based site deployment strategy.
build_composer: false
drupal_composer_path: "{{ config_dir }}/drupal.composer.json"
drupal_composer_install_dir: "/var/www/drupalvm/drupal"
drupal_composer_dependencies:
  - "drupal/devel:8.*"

# Set this to 'true' and 'build_makefile', 'build_composer' to 'false' if you
# are using Composer's create-project as a site deployment strategy.
build_composer_project: true
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev"
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction"

# Set this to 'false' if you don't need to install drupal (using the drupal_*
# settings below), but instead copy down a database (e.g. using drush sql-sync).
install_site: true

# Settings for installing a Drupal site (if 'install_site:' is 'true').
drupal_major_version: 8
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
drupal_domain: "{{ vagrant_hostname }}"
drupal_site_name: "Drupal"
drupal_install_profile: standard
drupal_enable_modules: [ 'devel' ]
drupal_account_name: admin
drupal_account_pass: admin
drupal_mysql_user: drupal
drupal_mysql_password: drupal
drupal_mysql_database: drupal

# Additional arguments or options to pass to `drush site-install`.
drupal_site_install_extra_args: []

# Cron jobs are added to the vagrant user's crontab. Keys include name
# (required), minute, hour, day, weekday, month, job (required), and state.
drupalvm_cron_jobs: []
  # - {
  #   name: "Drupal Cron",
  #   minute: "*/30",
  #   job: "drush -r {{ drupal_core_path }} core-cron"
  # }

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_drush_aliases: true

# Apache VirtualHosts. Add one for each site you are running inside the VM. For
# multisite deployments, you can point multiple servernames at one documentroot.
# View the geerlingguy.apache Ansible Role README for more options.
apache_vhosts:
  - servername: "{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ drupal_core_path }}"

  - servername: "adminer.{{ vagrant_hostname }}"
    documentroot: "{{ adminer_install_dir }}"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ adminer_install_dir }}"

  - servername: "xhprof.{{ vagrant_hostname }}"
    documentroot: "{{ php_xhprof_html_dir }}"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ php_xhprof_html_dir }}"

  - servername: "pimpmylog.{{ vagrant_hostname }}"
    documentroot: "{{ pimpmylog_install_dir }}"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ pimpmylog_install_dir }}"

  - servername: "{{ vagrant_ip }}"
    serveralias: "dashboard.{{ vagrant_hostname }}"
    documentroot: "{{ dashboard_install_dir }}"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ dashboard_install_dir }}"
          DirectoryIndex index.html

apache_remove_default_vhost: true
apache_mods_enabled:
  - expires.load
  - ssl.load
  - rewrite.load
  - proxy.load
  - proxy_fcgi.load

# Nginx hosts. Each site will get a server entry using the configuration defined
# here. Set the 'is_php' property for document roots that contain PHP apps like
# Drupal.
nginx_hosts:
  - server_name: "{{ drupal_domain }}"
    root: "{{ drupal_core_path }}"
    is_php: true

  - server_name: "adminer.{{ vagrant_hostname }}"
    root: "{{ adminer_install_dir }}"
    is_php: true

  - server_name: "xhprof.{{ vagrant_hostname }}"
    root: "{{ php_xhprof_html_dir }}"
    is_php: true

  - server_name: "pimpmylog.{{ vagrant_hostname }}"
    root: "{{ pimpmylog_install_dir }}"
    is_php: true

  - server_name: "{{ vagrant_ip }} dashboard.{{ vagrant_hostname }}"
    root: "{{ dashboard_install_dir }}"

nginx_remove_default_vhost: true
nginx_ppa_use: true

# MySQL Databases and users. If 'install_site' is 'true', first database will
# be used for the site.
mysql_databases:
  - name: "{{ drupal_mysql_database }}"
    encoding: utf8
    collation: utf8_general_ci

mysql_users:
  - name: "{{ drupal_mysql_user }}"
    host: "%"
    password: "{{ drupal_mysql_password }}"
    priv: "{{ drupal_mysql_database }}.*:ALL"

# Comment out any extra utilities you don't want to install. If you don't want
# to install *any* extras, make set this value to an empty set, e.g. `[]`.
installed_extras:
  - adminer
  # - blackfire
  - drupalconsole
  - mailhog
  # - memcached
  # - newrelic
  # - nodejs
  - pimpmylog
  # - redis
  # - ruby
  # - selenium
  # - solr
  - varnish
  # - xdebug
  # - xhprof

# Add any extra apt or yum packages you would like installed.
extra_packages:
  - sqlite

# `nodejs` must be in installed_extras for this to work. Valid examples: "0.10",
# "0.12", "4.x", "5.x".
nodejs_version: "0.12"
nodejs_npm_global_packages: []
nodejs_install_npm_user: "{{ drupalvm_user }}"

# `ruby` must be in installed_extras for this to work.
ruby_install_gems_user: "{{ drupalvm_user }}"
ruby_install_gems: []

# You can configure almost anything else on the server in the rest of this file.
extra_security_enabled: false

drush_version: "master"
drush_keep_updated: true
drush_composer_cli_options: "--prefer-dist --no-interaction"

firewall_allowed_tcp_ports:
  - "22"
  - "25"
  - "80"
  - "81"
  - "443"
  - "4444"
  - "8025"
  - "8080"
  - "8443"
  - "8983"
firewall_log_dropped_packets: false

# PHP Configuration. Currently-supported versions: 5.6, 7.0.
# To use 5.6, see: http://docs.drupalvm.com/en/latest/other/php-56/
php_version: "7.0"
php_memory_limit: "192M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/usr/sbin/ssmtp -t"
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "192"
php_opcache_max_accelerated_files: 4096
php_max_input_vars: "4000"

# Drupal VM defaults to using PHP-FPM with either Apache or Nginx. If you wish
# to instead use Apache + mod_php with an Ubuntu base box, make sure you add
# libapache2-mod-php7.0 to `extra_packages` elsewhere in this config file.
php_enable_php_fpm: true
php_fpm_listen: "127.0.0.1:9000"

composer_path: /usr/bin/composer
composer_home_path: "/home/{{ drupalvm_user }}/.composer"
composer_home_owner: "{{ drupalvm_user }}"
composer_home_group: "{{ drupalvm_user }}"
composer_global_packages:
  - { name: hirak/prestissimo, release: '^0.3' }

# Run specified scripts before or after VM is provisioned. Path is relative to
# the `provisioning/playbook.yml` file.
pre_provision_scripts: []
post_provision_scripts: []
  # - "../examples/scripts/configure-solr.sh"

# MySQL Configuration.
mysql_root_password: root
mysql_slow_query_log_enabled: true
mysql_slow_query_time: 2
mysql_wait_timeout: 300
adminer_install_filename: index.php

# Varnish Configuration.
varnish_listen_port: "81"
varnish_default_vcl_template_path: templates/drupalvm.vcl.j2
varnish_default_backend_host: "127.0.0.1"
varnish_default_backend_port: "80"

# Pimp my Log settings.
pimpmylog_install_dir: /usr/share/php/pimpmylog
pimpmylog_grant_all_privs: true

# XDebug configuration. XDebug is disabled by default for better performance.
php_xdebug_default_enable: 0
php_xdebug_coverage_enable: 0
php_xdebug_cli_enable: 1
php_xdebug_remote_enable: 1
php_xdebug_remote_connect_back: 1
# Use PHPSTORM for PHPStorm, sublime.xdebug for Sublime Text.
php_xdebug_idekey: PHPSTORM
php_xdebug_max_nesting_level: 256

# Solr Configuration (if enabled above).
solr_version: "5.5.1"
solr_xms: "64M"
solr_xmx: "128M"

# Selenium configuration.
selenium_version: 2.46.0

# Other configuration.
dashboard_install_dir: /var/www/dashboard
known_hosts_path: ~/.ssh/known_hosts
config.yml

vagrant_hostname: asasbu.localvm.stonybrook.edu
vagrant_machine_name: asasbu.localvm

install_site: false

drupal_major_version: 7
drupal_core_path: "/var/www/asasbu/docroot"
drupal_domain: asasbu.localvm.stonybrook.edu

drupal_mysql_user: drupaluser
drupal_mysql_password: drupal
drupal_mysql_database: default_asasbu

build_composer_project: false

apache_remove_default_vhost: true
apache_mods_enabled:
  - expires.load
  - ssl.load
  - rewrite.load
  - headers.load
  - include.load

apache_vhosts:

  - servername: "bursar.asasbu.localvm.stonybrook.edu"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ drupal_core_path }}"

mysql_databases:
  - name: "bursar_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "campuscard_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "childcare_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "ehs_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "explore_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "energy_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "pci_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "policy_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "propertycontrol_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "sustainability_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "wolfmart_asasbu"
    encoding: utf8
    collation: utf8_general_ci

  - name: "default_asasbu"
    encoding: utf8
    collation: utf8_general_ci

mysql_users:
  - name: "drupaluser"
    host: "%"
    password: "drupal"
    priv: "*.*:ALL"

installed_extras:
  - adminer
  #- drupalconsole
  - mailhog
  # - memcached
  - nodejs
  - pimpmylog
  - ruby
  # - selenium
  # - solr
  #- varnish
  - xdebug
  #- xhprof

php_packages:
  - php7.0-mcrypt

drush_version: 8.0.5
drush_keep_updated: false
local.config.yml

vagrant_ip: 192.168.88.90

vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # build_makefile: is 'true'.
  - local_path: d:\git\asasbu
    destination: /var/www/asasbu
    type: nfs
    create: true
geerlingguy commented 8 years ago

You need to add on to the php_packages—what is happening here is your local.yml file is only installing php7.0-mcrypt and it's dependencies, which don't include fpm:

php_packages:
  - php7.0-mcrypt
geerlingguy commented 8 years ago

So you should update that variable in your config.yml to be:

php_packages:
  - php7.0-common
  - php7.0-cli
  - php7.0-dev
  - php7.0-fpm
  - libpcre3-dev
  - php7.0-gd
  - php7.0-curl
  - php7.0-imap
  - php7.0-json
  - php7.0-opcache
  - php7.0-xml
  - php7.0-mbstring
  - php-sqlite3
  - php-apcu
  - php7.0-mcrypt
sbubaron commented 8 years ago

Okay, that fixed it, but I'm confused as to why it was required? Those packages aren't mentioned anywhere in the default.config.yml -- I guess I assumed that by having

php_enable_php_fpm: true

Any required packages would have been loaded? Does the fact that I specified an additional package end up overriding something down the chain?

geerlingguy commented 8 years ago

@sbubaron - Yeah; the way the variable precedence works, any variable you set in local.config.yml or config.yml will completely override the same variable in the default config. So if you set php_packages, you have to make sure you include all packages you want installed.

Some have requested the ability to have list variables append rather than overwrite, but that adds a lot of complexity to the way variable overrides are treated, and I'd rather keep it simple and just do full variable overrides.

sbubaron commented 8 years ago

@geerlingguy thanks Jeff! That does answer a few other thoughts/questions that have been bouncing around in my head -- however I'm still unsure, where was php_packages previously defined. I imagine its coming from a repo/config file in another project that Drupal-VM uses?

geerlingguy commented 8 years ago

@sbubaron - It's in the geerlingguy.php role, in the vars section—it's a funny variable, because it's platform-specific, so there are defaults for RHEL and Debian, and you can override at any level up from there. See: https://github.com/geerlingguy/ansible-role-php#role-variables