Skip to content

Commit 9fdcb1a

Browse files
committed
Update Solr example to use Ubuntu 16.04 and Apache Solr 6.1.0.
1 parent 7f6c460 commit 9fdcb1a

File tree

4 files changed

+29
-85
lines changed

4 files changed

+29
-85
lines changed

solr/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
This project aims to make spinning up a simple local Apache Solr environment incredibly quick and easy, and to introduce users to the fast and powerful search engine behind some of the largest document collections on the Internet.
44

5-
It will install the following on a Ubuntu 12.04 linux VM:
5+
It will install the following on a Ubuntu 16.04 linux VM:
66

77
- Java
8-
- Apache Tomcat 7
98
- Apache Solr
109

1110
It should take 5-10 minutes to build or rebuild the VM from scratch on a decent broadband connection.
@@ -41,4 +40,4 @@ Note: *If there are any errors during the course of running `vagrant up`, and it
4140

4241
## About the Author
4342

44-
This project was created by [Jeff Geerling](http://jeffgeerling.com/) as an example for [Ansible for DevOps](http://www.ansiblefordevops.com/).
43+
This project was created by [Jeff Geerling](http://www.jeffgeerling.com/) as an example for [Ansible for DevOps](http://www.ansiblefordevops.com/).

solr/Vagrantfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
VAGRANTFILE_API_VERSION = "2"
55

66
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7-
config.vm.box = "geerlingguy/ubuntu1204"
7+
config.vm.box = "geerlingguy/ubuntu1604"
88
config.vm.network :private_network, ip: "192.168.66.66"
9+
config.vm.hostname = "solr.dev"
910
config.ssh.insert_key = false
1011

1112
config.vm.provider :virtualbox do |v|
12-
v.memory = 512
13+
v.memory = 1024
1314
end
1415

1516
# Ansible provisioner.

solr/provisioning/playbook.yml

Lines changed: 22 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -9,92 +9,36 @@
99
apt: update_cache=yes cache_valid_time=3600
1010

1111
handlers:
12-
- name: restart tomcat
13-
service: name=tomcat7 state=restarted
12+
- name: restart solr
13+
service: name=solr state=restarted
1414

1515
tasks:
16-
- name: Install Tomcat 7.
17-
apt: "name={{ item }} state=present"
18-
with_items:
19-
- tomcat7
20-
- tomcat7-admin
21-
22-
- name: Ensure Tomcat 7 is started and enabled on boot.
23-
service: name=tomcat7 state=started enabled=yes
16+
- name: Install Java.
17+
apt: name=openjdk-8-jdk state=present
2418

2519
- name: Download Solr.
2620
get_url:
2721
url: "https://archive.apache.org/dist/lucene/solr/{{ solr_version }}/solr-{{ solr_version }}.tgz"
2822
dest: "{{ download_dir }}/solr-{{ solr_version }}.tgz"
29-
sha256sum: "{{ solr_sha256sum }}"
23+
checksum: "{{ solr_checksum }}"
3024

3125
- name: Expand Solr.
32-
command: >
33-
tar -C /tmp -xvzf {{ download_dir }}/solr-{{ solr_version }}.tgz
34-
creates={{ download_dir }}/solr-{{ solr_version }}/dist/solr-{{ solr_version }}.war
35-
36-
- name: Copy Solr into place.
37-
command: >
38-
cp -r {{ download_dir }}/solr-{{ solr_version }} \
39-
{{ solr_dir }}
40-
creates={{ solr_dir }}/dist/solr-{{ solr_version }}.war
26+
unarchive:
27+
src: "{{ download_dir }}/solr-{{ solr_version }}.tgz"
28+
dest: "{{ download_dir }}"
29+
copy: no
30+
creates: "{{ download_dir }}/solr-{{ solr_version }}/README.txt"
4131

42-
# Use shell so commands are passed in correctly.
43-
- name: Copy Solr components into place.
32+
- name: Run Solr installation script.
4433
shell: >
45-
cp -r {{ item.src }} {{ item.dest }}
46-
creates={{ item.creates }}
47-
with_items:
48-
# Solr example configuration and war file.
49-
- src: "{{ solr_dir }}/example/webapps/solr.war"
50-
dest: "{{ solr_dir }}/solr.war"
51-
creates: "{{ solr_dir }}/solr.war"
52-
53-
- src: "{{ solr_dir }}/example/solr/*"
54-
dest: "{{ solr_dir }}/"
55-
creates: "{{ solr_dir }}/solr.xml"
56-
57-
# Solr log4j logging configuration.
58-
- src: "{{ solr_dir }}/example/lib/ext/*"
59-
dest: "/var/lib/tomcat7/shared/"
60-
creates: "/var/lib/tomcat7/shared/log4j-1.2.17.jar"
61-
62-
- src: "{{ solr_dir }}/example/resources/log4j.properties"
63-
dest: "/var/lib/tomcat7/shared/classes"
64-
creates: "/var/lib/tomcat7/shared/classes/log4j.properties"
65-
notify: restart tomcat
66-
67-
- name: Ensure solr example directory is absent.
68-
file:
69-
path: "{{ solr_dir }}/example"
70-
state: absent
71-
72-
- name: Set up solr data directory.
73-
file:
74-
path: "{{ solr_dir }}/data"
75-
state: directory
76-
owner: tomcat7
77-
group: tomcat7
78-
79-
- name: Configure solrconfig.xml for new data directory.
80-
lineinfile:
81-
dest: "{{ solr_dir }}/collection1/conf/solrconfig.xml"
82-
regexp: "^.*<dataDir.+$"
83-
line: "<dataDir>${solr.data.dir:{{ solr_dir }}/data}</dataDir>"
84-
state: present
85-
86-
- name: Set permissions for solr home.
87-
file:
88-
path: "{{ solr_dir }}"
89-
recurse: yes
90-
owner: tomcat7
91-
group: tomcat7
92-
93-
- name: Add Catalina configuration for solr.
94-
template:
95-
src: templates/solr.xml.j2
96-
dest: /etc/tomcat7/Catalina/localhost/solr.xml
97-
owner: root
98-
group: tomcat7
99-
mode: 0644
100-
notify: restart tomcat
34+
{{ download_dir }}/solr-{{ solr_version }}/bin/install_solr_service.sh
35+
{{ download_dir }}/solr-{{ solr_version }}.tgz
36+
-i /opt
37+
-d /var/solr
38+
-u solr
39+
-s solr
40+
-p 8983
41+
creates={{ solr_dir }}/bin/solr
42+
43+
- name: Ensure solr is started and enabled on boot.
44+
service: name=solr state=started enabled=yes

solr/provisioning/vars.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ download_dir: /tmp
66
solr_dir: /opt/solr
77

88
# Solr version and download information.
9-
solr_version: 4.10.4
10-
solr_sha256sum: ac3543880f1b591bcaa962d7508b528d7b42e2b5548386197940b704629ae851
9+
solr_version: 6.1.0
10+
solr_checksum: sha1:41045799ed9b5f826b0dcab4b28b3b1986afa523

0 commit comments

Comments
 (0)