Skip to content

Commit

Permalink
Merge pull request #19 from idealista/features/18
Browse files Browse the repository at this point in the history
#18 Check version for conditional installation
  • Loading branch information
dortegau authored Apr 3, 2017
2 parents 9050c40 + d15969f commit 60a0d97
Show file tree
Hide file tree
Showing 14 changed files with 188 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tests/.cache
tests/__pycache__
.molecule
.vagrant
.cache
47 changes: 28 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
# Change Log
All notable changes to this project will be documented in this file.

## [Unreleased](https://github.com/idealista-tech/solrcloud-role/tree/develop)
## [Unreleased](https://github.com/idealista/solrcloud-role/tree/develop)

## [1.4.0](https://github.com/idealista-tech/solrcloud-role/tree/1.4.0) (2017-03-16)
[Full Changelog](https://github.com/idealista-tech/solrcloud-role/compare/1.3.0...1.4.0)
## [1.5.0](https://github.com/idealista/solrcloud-role/tree/1.5.0) (2017-03-31)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.4.0...1.5.0)

### Added
- *[#15](https://github.com/idealista-tech/solrcloud-role/issues/15) Add jetty-http config file* @javierRobledo
*Renamed some vars (backwards compatible!)* @jmonterrubio

## [1.3.0](https://github.com/idealista-tech/solrcloud-role/tree/1.3.0) (2017-02-23)
[Full Changelog](https://github.com/idealista-tech/solrcloud-role/compare/1.2.0...1.3.0)
### Fixed
- *[#18](https://github.com/idealista/solrcloud-role/issues/18) Check version for conditional installation* @jmonterrubio

## [1.4.0](https://github.com/idealista/solrcloud-role/tree/1.4.0) (2017-03-16)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.3.0...1.4.0)

### Added
- *[#15](https://github.com/idealista/solrcloud-role/issues/15) Add jetty-http config file* @javierRobledo

## [1.3.0](https://github.com/idealista/solrcloud-role/tree/1.3.0) (2017-02-23)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.2.0...1.3.0)

### Added
- *[#11](https://github.com/idealista-tech/solrcloud-role/issues/11) Add mount folder for backup* @jmonterrubio
- *[#11](https://github.com/idealista/solrcloud-role/issues/11) Add mount folder for backup* @jmonterrubio

## [1.2.0](https://github.com/idealista-tech/solrcloud-role/tree/1.2.0) (2017-01-27)
[Full Changelog](https://github.com/idealista-tech/solrcloud-role/compare/1.1.1...1.2.0)
## [1.2.0](https://github.com/idealista/solrcloud-role/tree/1.2.0) (2017-01-27)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.1.1...1.2.0)

### Added
- *[#8](https://github.com/idealista-tech/solrcloud-role/issues/8) Set JVM args by configuration* @jmonterrubio
- *[#8](https://github.com/idealista/solrcloud-role/issues/8) Set JVM args by configuration* @jmonterrubio

## [1.1.1](https://github.com/idealista-tech/solrcloud-role/tree/1.1.1) (2017-01-11)
[Full Changelog](https://github.com/idealista-tech/solrcloud-role/compare/1.1.0...1.1.1)
## [1.1.1](https://github.com/idealista/solrcloud-role/tree/1.1.1) (2017-01-11)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.1.0...1.1.1)

### Fixed
- *[#4](https://github.com/idealista-tech/solrcloud-role/issues/4) Copy solr.xml file for not default data dir* @jmonterrubio
- *[#4](https://github.com/idealista/solrcloud-role/issues/4) Copy solr.xml file for not default data dir* @jmonterrubio

## [1.1.0](https://github.com/idealista-tech/solrcloud-role/tree/1.1.0)
[Full Changelog](https://github.com/idealista-tech/solrcloud-role/compare/1.0.1...1.1.0)
## [1.1.0](https://github.com/idealista/solrcloud-role/tree/1.1.0)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.0.1...1.1.0)

### Added
- *[#1](https://github.com/idealista-tech/solrcloud-role/issues/1) Enable all the jetty HttpConfiguration parameters from ansible* @jmonterrubio
- *[#1](https://github.com/idealista/solrcloud-role/issues/1) Enable all the jetty HttpConfiguration parameters from ansible* @jmonterrubio

### Fixed
- *Renamed solrcloud-role in tests playbook* @jmonterrubio

## [1.0.1](https://github.com/idealista-tech/solrcloud-role/tree/1.0.1)
[Full Changelog](https://github.com/idealista-tech/solrcloud-role/compare/1.0.0...1.0.1)
## [1.0.1](https://github.com/idealista/solrcloud-role/tree/1.0.1)
[Full Changelog](https://github.com/idealista/solrcloud-role/compare/1.0.0...1.0.1)

### Fixed
- *JMX enable* @jmonterrubio
Expand All @@ -48,6 +57,6 @@ All notable changes to this project will be documented in this file.
- *Code refactor* @jmonterrubio
- *Update SolrCloud sources repository* @jmonterrubio

## [1.0.0](https://github.com/idealista-tech/solrcloud-role/tree/1.0.0)
## [1.0.0](https://github.com/idealista/solrcloud-role/tree/1.0.0)
### Added
- *First commit* @jmonterrubio
55 changes: 37 additions & 18 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
---
## General

solr_cloud_version: 6.3.0

## Service options

# Owner
solr_user: solr
solr_group: solr

solr_log_dir: /var/log/solr
solr_home: /var/solr
solr_data_dir: "{{ solr_home }}/data"

# start on boot
solr_service_enabled: yes
# current state: started, stopped
solr_service_state: started

solr_cloud_version: 6.3.0
solr_cloud_build_name: solr-{{ solr_cloud_version }}
solr_cloud_package: "{{ solr_cloud_build_name }}.tgz"
solr_cloud_url: http://archive.apache.org/dist/lucene/solr/{{ solr_cloud_version }}/{{ solr_cloud_package }}
# Files & Paths
solr_log_dir: /var/log/solr
solr_home: /var/solr
solr_data_dir: "{{ solr_home }}/data"

# Ports
solr_port: 8983
solr_jmx_enabled: 'true'
solr_jmx_port: 1099
solr_host: "{{ hostvars[ansible_nodename]['ansible_' + ansible_default_ipv4.alias]['ipv4']['address'] }}"

# JVM
solr_gc_tune: "-XX:NewRatio=3 \
-XX:SurvivorRatio=4 \
-XX:TargetSurvivorRatio=90 \
Expand All @@ -39,13 +44,11 @@ solr_gc_tune: "-XX:NewRatio=3 \
-XX:+UseFastAccessorMethods \
-XX:+UseTLAB"
solr_stack_size: 256k

solr_heap: 512m
solr_jetty_threads_min: 10
solr_jetty_threads_max: 10000
solr_jetty_threads_idle_timeout: 5000
solr_jetty_threads_stop_timeout: 60000

solr_jetty_secure_port: 8443
solr_jetty_output_buffer_size: 32768
solr_jetty_output_aggregation_size: 8192
Expand All @@ -55,15 +58,31 @@ solr_jetty_send_server_version: #'false'
solr_jetty_send_date_header: #'false'
solr_jetty_header_cache_size: #512
solr_jetty_delay_dispatch_until_content: #'false'

solr_jetty_http_selectors: #-1
solr_jetty_http_acceptors: #-1

zookeeper_hosts: localhost:2181
zookeeper_hosts_solr_path: solr
zk_host: "{{ zookeeper_hosts }}/{{ zookeeper_hosts_solr_path }}"
zookeeper_client_path: /opt/solr/server/scripts/cloud-scripts
# ZOOKEEPER
zookeeper_hosts: localhost:2181 # Deprecated
zookeeper_hosts_solr_path: solr # Deprecated
zk_host: "{{ zookeeper_hosts }}/{{ zookeeper_hosts_solr_path }}" # Deprecated
zookeeper_client_path: /opt/solr/server/scripts/cloud-scripts # Deprecated

solr_zookeeper_hosts: "{{ zookeeper_hosts }}"
solr_zookeeper_hosts_solr_path: "{{ zookeeper_hosts_solr_path }}"
solr_zk_host: "{{ solr_zookeeper_hosts }}/{{ solr_zookeeper_hosts_solr_path }}"
solr_zookeeper_client_path: "{{ zookeeper_client_path }}"

# LOG
log_root_level: WARN # Deprecated
log_file_size: 500MB # Deprecated
log_max_backup_index: 9 # Deprecated

solr_log_root_level: "{{ log_root_level }}"
solr_log_file_size: "{{ log_file_size }}"
solr_log_max_backup_index: "{{ log_max_backup_index }}"

log_root_level: WARN
log_file_size: 500MB
log_max_backup_index: 9
# MOUNT
#mount_name: # Deprecated
#mount_source: # Deprecated
solr_mount_name: "{{ mount_name }}"
solr_mount_source: "{{ mount_source }}"
9 changes: 9 additions & 0 deletions molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ ansible:
# configuration options for the internal call to vagrant
vagrant:
# molecule's --platform option will look for these names
raw_config_args:
- "landrush.enabled = true"
- "landrush.tld = ''"
- "landrush.guest_redirect_dns = false"
platforms:
- name: Debian
box: debian/jessie64
Expand All @@ -44,6 +48,11 @@ vagrant:
cpus: 1

instances:
- name: zookeeper
interfaces:
- network_name: private_network
type: dhcp
auto_config: true
- name: solrcloud
ansible_groups:
- group01
Expand Down
39 changes: 29 additions & 10 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@

- name: SolrCloud | Give execution permission to zkcli script
file:
path: "{{ zookeeper_client_path }}/zkcli.sh"
path: "{{ solr_zookeeper_client_path }}/zkcli.sh"
mode: 0744

- name: SolrCloud | Check Root Path (znode) in ZooKeeper
command: >
{{ solr_zookeeper_client_path }}/zkcli.sh
-zkhost {{ solr_zookeeper_hosts }}
-cmd list /{{ solr_zookeeper_hosts_solr_path }}
register: solr_path_check
changed_when: false

- name: SolrCloud | Create Root Path (znode) in ZooKeeper using zkcli script
shell: "{{ zookeeper_client_path }}/zkcli.sh -zkhost {{ zookeeper_hosts }} -cmd makepath /{{ zookeeper_hosts_solr_path }} >> /tmp/path_created.out"
args:
creates: /tmp/path_created.out
ignore_errors: true
tags:
skip_ansible_lint
command: >
{{ solr_zookeeper_client_path }}/zkcli.sh
-zkhost {{ solr_zookeeper_hosts }}
-cmd makepath /{{ solr_zookeeper_hosts_solr_path }}
when: '" /{{ solr_zookeeper_hosts_solr_path }} " not in solr_path_check.stdout'

- name: SolrCloud | Configuring jetty server
template:
Expand Down Expand Up @@ -52,7 +59,11 @@
apt:
name: nfs-common
state: installed
when: mount_name is defined and mount_source is defined
when:
- mount_name is defined
- mount_source is defined
- solr_mount_name is defined
- solr_mount_source is defined

- name: SolrCloud | Create NFS folder (Mount the folder)
mount:
Expand All @@ -61,12 +72,20 @@
fstype: nfs
opts: "{{ mount_options }}"
state: mounted
when: mount_name is defined and mount_source is defined
when:
- mount_name is defined
- mount_source is defined
- solr_mount_name is defined
- solr_mount_source is defined

- name: SolrCloud | Create NFS folder (Change owner)
file:
path: "{{ mount_name }}"
state: directory
owner: "{{ solr_user }}"
group: "{{ solr_group }}"
when: mount_name is defined and mount_source is defined
when:
- mount_name is defined
- mount_source is defined
- solr_mount_name is defined
- solr_mount_source is defined
38 changes: 33 additions & 5 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,50 @@
- "{{ solr_log_dir }}"
- "{{ solr_data_dir }}"

- name: SolrCloud | Check if service is running
command: systemctl status solr.service
ignore_errors: yes
changed_when: false
register: service_solrcloud_status

- name: SolrCloud | Check installed version
action: >
uri \
url="http://localhost:{{ solr_port }}/solr/admin/info/system" \
return_content=yes
register: solrcloud_check
changed_when: false
ignore_errors: true
when: service_solrcloud_status | success

- name: SolrCloud | Download SolrCloud binaries
get_url:
url: "{{ solr_cloud_url }}"
dest: /tmp/{{ solr_cloud_package }}
register: download_solr
when: |
"Loaded: not-found" in service_solrcloud_status.stdout or
service_solrcloud_status | success and
(solrcloud_check | failed or
"<str name=\"lucene-spec-version\">{{ solr_cloud_version }}</str>" not in solrcloud_check.content)
- name: SolrCloud | Extract SolrCloud installation script in the current directory
shell: "tar xzf /tmp/{{ solr_cloud_package }} {{ solr_cloud_build_name }}/bin/install_solr_service.sh --strip-components=2"
args:
chdir: /tmp
when: download_solr|changed
when: |
"Loaded: not-found" in service_solrcloud_status.stdout or
service_solrcloud_status | success and
(solrcloud_check | failed or
"<str name=\"lucene-spec-version\">{{ solr_cloud_version }}</str>" not in solrcloud_check.content)
tags:
skip_ansible_lint
- skip_ansible_lint

- name: SolrCloud | Execute SolrCloud installation script
shell: /tmp/install_solr_service.sh /tmp/{{ solr_cloud_package }} -f -u {{ solr_user }} -n
when: download_solr|changed
when: |
"Loaded: not-found" in service_solrcloud_status.stdout or
service_solrcloud_status | success and
(solrcloud_check | failed or
"<str name=\"lucene-spec-version\">{{ solr_cloud_version }}</str>" not in solrcloud_check.content)
tags:
skip_ansible_lint
- skip_ansible_lint
15 changes: 12 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
---

- include: install.yml
- name: SolrCloud | Install
include: install.yml
tags:
- install

- include: config.yml
- name: SolrCloud | Configure
include: config.yml
tags:
- configure

- include: service.yml
- name: SolrCloud | Service
include: service.yml
tags:
- service
6 changes: 3 additions & 3 deletions templates/log4j.properties.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Default Solr log4j config
# rootLogger log level may be programmatically overridden by -Dsolr.log.level
solr.log=${solr.log.dir}
log4j.rootLogger={{ log_root_level }}, file, CONSOLE
log4j.rootLogger={{ solr_log_root_level }}, file, CONSOLE

# Console appender will be programmatically disabled when Solr is started with option -Dsolr.log.muteconsole
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
Expand All @@ -10,8 +10,8 @@ log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p

#- size rotation with log cleanup.
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.MaxFileSize={{ log_file_size }}
log4j.appender.file.MaxBackupIndex={{ log_max_backup_index }}
log4j.appender.file.MaxFileSize={{ solr_log_file_size }}
log4j.appender.file.MaxBackupIndex={{ solr_log_max_backup_index }}

#- File to log to and log format
log4j.appender.file.File=${solr.log}/solr.log
Expand Down
2 changes: 1 addition & 1 deletion templates/solr.in.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GC_TUNE="{{ solr_gc_tune }}"
# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
# e.g. host1:2181,host2:2181/chroot
# Leave empty if not using SolrCloud
ZK_HOST="{{ zk_host }}"
ZK_HOST="{{ solr_zk_host }}"

# Set the ZooKeeper client timeout (for SolrCloud mode)
ZK_CLIENT_TIMEOUT="15000"
Expand Down
2 changes: 2 additions & 0 deletions tests/group_vars/group01.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
solr_cloud_version: 6.3.0
solr_port: 8983

solr_zookeeper_hosts: zookeeper:2181
3 changes: 3 additions & 0 deletions tests/host_vars/zookeeper/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zookeeper_hosts:
- host: "{{inventory_hostname}}" # the machine running
id: 1
6 changes: 5 additions & 1 deletion tests/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---

- hosts: all
- hosts: zookeeper
roles:
- role: java
- role: zookeeper

- hosts: solrcloud
roles:
- role: java
- role: solrcloud-role
Loading

0 comments on commit 60a0d97

Please sign in to comment.