Giter VIP home page Giter VIP logo

solr-vagrant-base's Introduction

solr-vagrant-base

Vagrant base box with Java 8 and Solr 6 on CentOS 6.

Quick Start

Basic Vagrantfile to use this box:

Vagrant.configure("2") do |config|
  config.vm.box = 'solr'
  # XXX: since we do not have central hosting location for boxes yet
  #      you will have to build the solr-vagrant base box locally
  #      before using this example
  config.vm.box_url = "file:///apps/git/solr-vagrant/package.box"

  config.vm.hostname = 'solrvagrant'
  config.vm.network "private_network", ip: "192.168.40.222"

  # start Solr (without SSL)
  config.vm.provision "shell", privileged: false, inline: <<-SHELL
    cd /apps/solr/solr && ./control startnossl
  SHELL
end

Your Solr instance will be available at http://192.168.40.222:8984.

Enabling HTTPS

It is very simple to enable HTTPS. The base box includes a script to generate a self-signed HTTPS cert.

Just create a dist folder on your host, and add a synced /apps/dist folder to the Vagrantfile:

# for caching of the HTTPS cert
config.vm.synced_folder "dist", "/apps/dist"

Add a shell provisioner to run the https-cert.sh script before starting Solr:

# create HTTPS cert
config.vm.provision "shell", privileged: false, inline: <<-SHELL
  /apps/solr/scripts/https-cert.sh DNS:solrvagrant,IP:192.168.40.222
SHELL

The optional argument to https-cert.sh is a comma-separted list of Subject Alternative Names to include in the certificate, in addition to localhost and 127.0.0.1. You should make sure these to match the values you set in config.vm.hostname and config.vm.private_network.

Update the command to start Solr from startnossl to just start:

# start Solr (with SSL)
config.vm.provision "shell", privileged: false, inline: <<-SHELL
  cd /apps/solr/solr && ./control start
SHELL

Your Solr instance will be available over HTTPS at https://192.168.40.222:8984.

Note that the first time you visit that URL, your browser will present you with a security warning about the certificate, since it is self-signed. Because the https-cert.sh script caches the certificate it generates to the host, after the first time you run vagrant up, it should re-use the same certificate generated on the first run.

Deploying Cores

You can also easily deploy cores from synced folders. These folders can be Git repositories, in which case the deploy script uses git clone. Otherwise, the deploy script falls back to a recursive copy (cp -rp).

The core.sh script takes 1 or 2 arguments. The first argument is the path to the core source directory (on the VM). The second argument is the name to use for the core in Solr. If no name is given, it defaults to the basename of the source directory path.

The default cores directory on the VM is /apps/solr/solr/cores.

Just add a synced folder pointing to your core:

config.vm.synced_folder "/apps/git/my-solr-core", "/apps/git/my-solr-core"

And add a shell provisioner to run the core.sh script before starting Solr:

config.vm.provision "shell", privileged: false, inline: <<-SHELL
  /apps/solr/scripts/core.sh /apps/git/my-solr-core my-solr-core
  # equivalent command that takes the core name from the source path
  /apps/solr/scripts/core.sh /apps/git/my-solr-core
SHELL

Running the Base Box

To run the base box itself, do the following:

git clone [email protected]:umd-lib/solr-vagrant-base.git
cd solr-vagrant-base
# download a Java 8 JDK into the dist folder
vagrant up

Building the Base Box

Bring up the base box as above, then run vagrant package.

License

See the LICENSE file for license rights and limitations (Apache 2.0).

solr-vagrant-base's People

Contributors

peichman-umd avatar

Watchers

James Cloos avatar Mohamed Mohideen Abdul Rasheed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.