Skip to content

aekong/ansible-vagrant-solr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Vagrant profile for an Apache Solr server

Background

Vagrant and VirtualBox (or some other VM provider) can be used to quickly build or rebuild virtual servers.

This Vagrant profile installs Apache Solr (running on Tomcat/Java) using the Ansible provisioner.

Getting Started

This README file is inside a folder that contains a Vagrantfile (hereafter this folder shall be called the [vagrant_root]), which tells Vagrant how to set up your virtual machine in VirtualBox.

To use the vagrant file, you will need to have done the following:

  1. Download and Install VirtualBox
  2. Download and Install Vagrant
  3. Install Ansible
  4. Open a shell prompt (Terminal app on a Mac) and cd into the folder containing the Vagrantfile
  5. Run the following command to install the necessary Ansible roles for this profile: $ ansible-galaxy install -r requirements.yml

Once all of that is done, you can simply type in vagrant up, and Vagrant will create a new VM, install the base box, and configure it.

Once the new VM is up and running (after vagrant up is complete and you're back at the command prompt), you can log into it via SSH if you'd like by typing in vagrant ssh. Otherwise, the next steps are below.

Setting up your hosts file

You need to modify your host machine's hosts file (Mac/Linux: /etc/hosts; Windows: %systemroot%\system32\drivers\etc\hosts), adding the line below:

192.168.33.44  solr

(Where solr) is the hostname you have configured in the Vagrantfile).

After that is configured, visit http://solr:8983/solr/ in a browser, and you'll see Apache Solr's admin interface.

If you'd like additional assistance editing your hosts file, please read How do I modify my hosts file? from Rackspace.

Author Information

Created in 2014 by Jeff Geerling, author of Ansible for DevOps.


Additional things for use with local Drupal 8

SSH into the provisioned Vagrant instance

$ vagrant ssh

Become root

$ sudo su

Get the Search API Solr Search Drupal Module: https://www.drupal.org/project/search_api_solr

$ curl https://ftp.drupal.org/files/projects/search_api_solr-8.x-1.2.tar.gz | tar -xz```

Copy Search API Solr Search module configuration into default Solr core

$ cp -r search_api_solr/solr-conf/6.x/* /var/solr/data/collection1/conf

Fix permissions for copied files

$ chown -R solr:solr /var/solr/data/collection1/conf/*

Restart solr to apply new conf changes

$ service solr restart

Add the local solr search server to Search API Module

Configuration > Search and metadata > Search API > Add Server

Fill out the required fields:

Server name: local solr

Configure SOLR Backend > Solr Connector: Standard

Solr host: solr

Solr port: 8938

Solr path: /solr

Solr core: collection1

Save

If an index already exists, use the new local server with the existing index
  1. Configuration > Search and metadata > Search API > Edit Content Index

    • Scroll down to Server, select local solr
  2. Configuration > Search and metadata > Search API > Click Content Index

    • Rebuild tracking information

    • Confirm

    • Index Now

    • Save

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published