geerlingguy / drupal-vm

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

Solr does not seem to install completely #1546

Closed kevinquillen closed 6 years ago

kevinquillen commented 7 years ago

Issue Type

Your Environment

Vagrant 1.9.2
VirtualBox 5.1.26r117224
ansible 2.2.1.0
  config file = 
  configured module search path = Default w/o overrides

DrupalVM v4.2.1

Your OS

Summary

I have destroyed my VM and provisioned it a few times, but it seems to be refusing to connect to my local solr instance via Search API. I have ssh'd into the server, and solr status says:

> service solr status
* solr.service - Apache SOLR
   Loaded: loaded (/etc/systemd/system/solr.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2017-09-13 19:28:21 UTC; 10min ago
  Process: 1079 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1068 ExecStart=/opt/solr/bin/solr -e cloud -noprompt (code=exited, status=203/EXEC)
 Main PID: 1068 (code=exited, status=203/EXEC)

Also, if I try to run the example provision script for solr, I get this output:

/opt/solr/bin/solr: No such file or directory

Solr exists at /opt/solr, but no /bin folder.

Console output from last provision:

TASK [geerlingguy.solr : Ensure solr_user group exists.] ***********************
changed: [pncbdev]

TASK [geerlingguy.solr : Ensure solr_user exists.] *****************************
changed: [pncbdev]

TASK [geerlingguy.solr : Set solr_filename for Solr 4+.] ***********************
ok: [pncbdev]

TASK [geerlingguy.solr : Set solr_filename for Solr 3.x.] **********************
skipping: [pncbdev]

TASK [geerlingguy.solr : Download Solr.] ***************************************
changed: [pncbdev]

TASK [geerlingguy.solr : Expand Solr.] *****************************************
changed: [pncbdev]

TASK [geerlingguy.solr : Check if Solr is already installed.] ******************
ok: [pncbdev]

TASK [geerlingguy.solr : Copy Solr into place.] ********************************
changed: [pncbdev]

TASK [geerlingguy.solr : Ensure Solr install files are owned by the solr_user.] 
changed: [pncbdev]

TASK [geerlingguy.solr : Check if solr_home is already set up.] ****************
ok: [pncbdev]

TASK [geerlingguy.solr : Ensure solr_home directory exists.] *******************
changed: [pncbdev]

TASK [geerlingguy.solr : Copy Solr example into solr_home.] ********************
changed: [pncbdev]

TASK [geerlingguy.solr : Fix the example solrconfig.xml file.] *****************
ok: [pncbdev]

TASK [geerlingguy.solr : Ensure Solr home files are owned by the solr_user.] ***
changed: [pncbdev]

TASK [geerlingguy.solr : Ensure log file is created and has proper permissions.] ***
ok: [pncbdev]

TASK [geerlingguy.solr : Copy solr init script into place.] ********************
changed: [pncbdev]

TASK [geerlingguy.solr : Ensure daemon is installed (Debian).] *****************
changed: [pncbdev]

TASK [geerlingguy.solr : Copy solr systemd unit file into place (for systemd systems).] ***
changed: [pncbdev]

TASK [geerlingguy.solr : Ensure lsof is present (RedHat).] *********************
skipping: [pncbdev]

TASK [geerlingguy.solr : Ensure setfacl support is present.] *******************
skipping: [pncbdev]

TASK [geerlingguy.solr : Run Solr installation script.] ************************
skipping: [pncbdev]

TASK [geerlingguy.solr : Ensure solr is stopped (RHEL 7 workaround).] **********
skipping: [pncbdev]

TASK [geerlingguy.solr : Run systemd daemon_reload (RHEL 7 workaround).] *******
skipping: [pncbdev]

TASK [geerlingguy.solr : Ensure solr is started and enabled on boot.] **********
changed: [pncbdev]

TASK [geerlingguy.solr : Check current list of Solr cores.] ********************
skipping: [pncbdev]

TASK [geerlingguy.solr : Ensure Solr conf directories exist.] ******************
skipping: [pncbdev] => (item=collection1) 

TASK [geerlingguy.solr : Ensure core configuration directories exist.] *********
skipping: [pncbdev] => (item=collection1) 

TASK [geerlingguy.solr : Create configured cores.] *****************************
skipping: [pncbdev] => (item=collection1) 

TASK [geerlingguy.solr : Remove existing SOLR_HEAP configuration.] *************
skipping: [pncbdev]

TASK [geerlingguy.solr : Apply Solr configuration changes.] ********************
skipping: [pncbdev] => (item={u'regexp': u'^.?SOLR_JAVA_MEM=', u'line': u'SOLR_JAVA_MEM="-Xms64M -Xmx128M"'}) 
skipping: [pncbdev] => (item={u'regexp': u'^SOLR_PORT=', u'line': u'SOLR_PORT="8983"'}) 
skipping: [pncbdev] => (item={u'regexp': u'^.?SOLR_TIMEZONE=', u'line': u'SOLR_TIMEZONE="UTC"'}) 
geerlingguy commented 7 years ago
TASK [geerlingguy.solr : Ensure solr is started and enabled on boot.] **********
changed: [pncbdev]

...seems to indicate it started—but solr's init scripts can be baffling sometimes.

Was this working before, and now it's not? Also, can you share what customizations you have in your config.yml? Maybe this is something new in a later version or in an older version?

kevinquillen commented 7 years ago

Yeah, it was previously working. Came back to the project a few months later, now does not work. The only new addition was a new apache vhost.

---
# `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: pncb.local
vagrant_machine_name: pncbdev
vagrant_ip: 0.0.0.0

# 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/pncbdev
    type: nfs
    create: true

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

# Minimum required versions.
drupalvm_vagrant_version_min: '1.8.6'
drupalvm_ansible_version_min: '2.2'

# Force use of ansible_local provisioner, even if Ansible is installed on host.
force_ansible_local: false

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

# The database system to use. Can be either 'mysql' or 'pgsql'.
drupalvm_database: mysql

# 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"
drush_make_options: "--no-gitinfofile"

# 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/docroot/drupal"
drupal_composer_dependencies:
  - "drupal/devel:1.x-dev"

# 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: false
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: false

# Required Drupal settings.
drupal_core_path: "/var/www/pncbdev/docroot"
drupal_db_user: drupal
drupal_db_password: drupal
drupal_db_name: drupal
drupal_ipn_db_user: drupal
drupal_ipn_db_password: drupal
drupal_ipn_db_name: drupal_ipn

# Settings for installing a Drupal site if 'install_site:' is 'true'.
drupal_major_version: 8
drupal_domain: "{{ vagrant_hostname }}"
drupal_site_name: "Drupal"
drupal_install_profile: standard
drupal_enable_modules: [ 'devel' ]
drupal_account_name: admin
drupal_account_pass: admin

# 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: []

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

# Helper variable to configure the PHP-FPM connection for each Apache
# VirtualHost in the `apache_vhosts` list.
apache_vhost_php_fpm_parameters: |
    <FilesMatch \.php$>
      SetHandler "proxy:fcgi://{{ php_fpm_listen }}"
    </FilesMatch>

# 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 }}"
    serveralias: "www.{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "ipn.local"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "adminer.{{ vagrant_hostname }}"
    documentroot: "{{ adminer_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "xhprof.{{ vagrant_hostname }}"
    documentroot: "{{ php_xhprof_html_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "pimpmylog.{{ vagrant_hostname }}"
    documentroot: "{{ pimpmylog_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "{{ vagrant_ip }}"
    serveralias: "dashboard.{{ vagrant_hostname }}"
    documentroot: "{{ dashboard_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

apache_packages_state: latest
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 }} www.{{ 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 }}"
    is_php: true

nginx_remove_default_vhost: true
nginx_ppa_use: true

# MySQL databases and users.
mysql_databases:
  - name: "{{ drupal_db_name }}"
    encoding: utf8mb4
    collation: utf8mb4_general_ci
  - name: "{{ drupal_ipn_db_name }}"
    encoding: utf8mb4
    collation: utf8mb4_general_ci

mysql_users:
  - name: "{{ drupal_db_user }}"
    host: "%"
    password: "{{ drupal_db_password }}"
    priv: "{{ drupal_db_name }}.*:ALL"
  - name: "{{ drupal_ipn_db_user }}"
    host: "%"
    password: "{{ drupal_ipn_db_password }}"
    priv: "{{ drupal_ipn_db_name }}.*:ALL"

# PostgreSQL databases and users.
postgresql_databases:
  - name: "{{ drupal_db_name }}"

postgresql_users:
  - name: "{{ drupal_db_user }}"
    password: "{{ drupal_db_password }}"
    db: "{{ drupal_db_name }}"
    priv: "ALL"

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

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

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

drush_version: "8.x"
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"
  - "9200"
firewall_log_dropped_packets: false
firewall_disable_firewalld: true
firewall_disable_ufw: true

# PHP Configuration. Currently-supported versions: 5.6, 7.0, 7.1.
# See version-specific notes: http://docs.drupalvm.com/en/latest/configurations/php/
php_version: "7.0"
php_install_recommends: no
php_memory_limit: "256M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/opt/mailhog/mhsendmail"
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"

xhprof_download_url: https://github.com/phacility/xhprof/archive/master.tar.gz
xhprof_download_folder_name: xhprof-master

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: []
  - "../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

# Node.js configuration (if enabled above).
# Valid examples: "0.10", "0.12", "4.x", "5.x".
nodejs_version: "0.12"
nodejs_npm_global_packages: []
nodejs_install_npm_user: "{{ drupalvm_user }}"
npm_config_prefix: "/home/{{ drupalvm_user }}/.npm-global"

# Ruby Configuration (if enabled above).
ruby_install_gems_user: "{{ drupalvm_user }}"
ruby_install_gems: []

# Varnish Configuration (if enabled above).
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: 1
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
php_xdebug_remote_port: "9000"

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

# Selenium configuration.
selenium_version: 2.53.0

# Other configuration.
dashboard_install_dir: /var/www/dashboard
known_hosts_path: ~/.ssh/known_hosts
#ssh_home: "{{ drupal_core_path }}"
kevinquillen commented 7 years ago

Is there a way to kickstart this manually, for now?

kevinquillen commented 7 years ago

service solr start also displays:

Failed to start solr.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status solr.service' for details.

Previously, it did not output anything.

kevinquillen commented 7 years ago

I nuked it and started over with a fresh copy of DrupalVM (4.6.0) and still have the same result. Still using Solr 4.5.1 in config.yml.

Trying again with 5.5.4, just to see if there is a difference (I see there are different tasks for solr 5+ or lower than 5).

kevinquillen commented 7 years ago

Solr 5.5.4 worked and installed on the first try. Though, this could be problematic as Acquia (at least all my client runs 4.5.1 and there are surely differences.

I am fairly baffled. But yeah, using 4.5.1 didn't work at all - it used to. I probably attempted 5 new provisions, and it only worked when I tried 5.5.4.

d70rr3s commented 7 years ago

Hi, I was having the same issue with the latest version of the VM but with versions 6.4.x and 6.6.x and actually the Solr server wasn't running. After many tries I boosted VM memory form 2Gb to 2.5Gb and Solr JVM memory from 64/128Mb up to 256/512Mb (defaults) and after reloading the VM it just start working thus if I run sudo service solr status it just drop existed state but if checked from init.d script it show the Solr server running as expected.

fubarhouse commented 7 years ago

I had a similar problem at home recently.

Because I can and it was a local thing, I simply completely removed Solr and started fresh.

Worked like a breeze since, but a cause - nothing changed, so I've no notion as to why.

To be fair, I was running some automated scripts to create and remove cores so I assumed it was my fault. A fresh start is always a good idea when automating stuff like this.

lcatlett commented 7 years ago

I just ran into this issue and it seems it is due to invalid systemd configuration for solr 4 as reported in https://github.com/geerlingguy/ansible-role-solr/pull/81. Since that has not been merged yet I needed re-install the solr role after changing requirements.yml:

- src: https://github.com/jonathonwalz/ansible-role-solr
  version: fix-pre5-systemd
  name: geerlingguy.solr

After a vagrant reload --provision solr 4.5.1 is working without issue.

oxyc commented 6 years ago

I'll close this as a duplicate of #1518

danepowell commented 6 years ago

@lcatlett you mention modifying a requirements.yml, where exactly would that be on a BLT-generated project? There is no requirements.yml in BLT-generated projects, only box/config.yml, which doesn't really make sense as a target for that change.

I found this can be worked around using the change I suggest for BLT here: https://github.com/acquia/blt/pull/2841

Also I wouldn't say this is a dupe of #1518, although they are somewhat related. If anything, it's a dupe of https://github.com/geerlingguy/ansible-role-solr/pull/81

But DrupalVM could easily fix it by either merging that PR or incorporating Lindsey's suggestion to use the fix branch.