Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update download url #4

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
18bcd71
feat(args)
minorOffense Sep 27, 2019
e833a65
feat(args): add start/stop/status args
minorOffense Sep 27, 2019
7c34d6a
feat(args): add args
minorOffense Sep 27, 2019
26a58cb
fix(args): move to right place
minorOffense Sep 27, 2019
6ef25bf
feat(args): automatically inject arguments
minorOffense Sep 27, 2019
55f43d5
fix(args): apply right args
minorOffense Sep 27, 2019
53bbe13
Merge branch 'master' into cloud-zookeeper
minorOffense Jan 29, 2020
8350bf6
fix(ownership): set solr home owned by solr
minorOffense Feb 6, 2020
4c79d7b
fix typo
minorOffense Feb 6, 2020
249a947
feat(scheme): allow url scheme
minorOffense Feb 8, 2020
cb222d4
add option
minorOffense Feb 8, 2020
f8c60b2
add actual param
minorOffense Feb 8, 2020
50b35fc
feat(java): add option to manage java or not
minorOffense Dec 20, 2021
32b1008
Merge pull request #2 from coldfrontlabs/managejava
minorOffense Dec 21, 2021
b5df935
fix(solr9): remove breaking startup flag
minorOffense Mar 15, 2023
e4df8e9
refactor(service): add post start/stop
minorOffense Oct 12, 2023
442f3ef
fix(deprecations): replace is_hash
minorOffense Oct 12, 2023
c83dbe9
fix(url): update download url
minorOffense Oct 12, 2023
a42dd35
update url again
minorOffense Oct 12, 2023
53fc2f6
Update solr.service.epp
minorOffense Oct 12, 2023
fa3d799
fix(java): remove option
minorOffense Oct 12, 2023
d33ecfd
fix(solr): remove deprecated options
minorOffense Oct 12, 2023
039c1be
fix(solr): remove deprecated options
minorOffense Oct 12, 2023
5e5218d
fix(solr): remove deprecated options
minorOffense Oct 12, 2023
aac4350
fix(solr): remove deprecated options
minorOffense Oct 12, 2023
1858573
fix(solr): remove deprecated options
minorOffense Oct 12, 2023
e04b19c
Update solr.service.epp
minorOffense Oct 17, 2023
e23362a
update download url
minorOffense Jan 13, 2024
ea74adc
Merge pull request #5 from coldfrontlabs/solr9-cloud-test
minorOffense Jan 13, 2024
407ae99
fix(error): add key store types to prevent crashing on startup
spotzero Jul 24, 2024
94d24ba
fix: typos
spotzero Jul 24, 2024
0db7a2a
feat(init): allow specifying path of custom log4j2.xml file
finalhow Jul 26, 2024
358780d
fix(config): add code to config.pp and refactor
finalhow Jul 26, 2024
997aef7
refactor(log4j): update template override
minorOffense Jul 26, 2024
6a6c646
fix(init): fix a typo, missing comma
finalhow Jul 26, 2024
cd53ee8
Merge pull request #10 from coldfrontlabs/log4j2_custom_config_path
finalhow Jul 30, 2024
238dd44
fix(template): allow for options
minorOffense Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
group => $solr::solr_user,
}

file { $::solr::solr_home:
ensure => directory,
owner => $solr::solr_user,
group => $solr::solr_user,
}

# After solr v 7.4.0 SOLR now uses log4j2.xml
if versioncmp($solr::version, '7.4.0') >= 0 {
# setup log4j2 configuration file.
Expand All @@ -31,10 +37,11 @@
ensure => file,
owner => 'solr',
group => 'solr',
content => epp('solr/log4j2.xml.epp',{
content => epp($solr::log4j_config_path, {
log4j_rootlogger_loglevel => $solr::log4j_rootlogger_loglevel,
log4j_maxfilesize => $solr::log4j_maxfilesize,
log4j_maxbackupindex => $solr::log4j_maxbackupindex,
log4j_config_options => $solr::log4j_config_options
}),
}
} else {
Expand Down Expand Up @@ -86,10 +93,14 @@
include '::systemd'
::systemd::unit_file { 'solr.service':
content => epp('solr/solr.service.epp',{
solr_pid_dir => $solr::solr_pid_dir,
solr_port => $solr::solr_port,
solr_bin => $solr::solr_bin,
solr_env => $solr::solr_env,
solr_pid_dir => $solr::solr_pid_dir,
solr_port => $solr::solr_port,
solr_bin => $solr::solr_bin,
solr_env => $solr::solr_env,
solr_start_args => $solr::solr_start_args,
solr_stop_args => $solr::solr_stop_args,
solr_status_args => $solr::solr_status_args,

}),
require => File[$::solr::solr_env],
}
Expand All @@ -103,9 +114,13 @@
ensure => file,
mode => '0755',
content => epp('solr/solr.sh.epp',{
solr_bin => $solr::solr_bin,
solr_user => $solr::solr_user,
solr_env => $solr::solr_env,
solr_bin => $solr::solr_bin,
solr_user => $solr::solr_user,
solr_env => $solr::solr_env,
solr_start_args => $solr::solr_start_args,
solr_stop_args => $solr::solr_stop_args,
solr_status_args => $solr::solr_status_args,

}),
require => File[$::solr::solr_env],
}
Expand Down
47 changes: 36 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
# Sets if this module should manage the install directory.
# True if this module should manage and false otherwise.
#
# @param [Boolean] manage_java
# Sets if this module should manage the install of Java.
# True if this module should manage and false otherwise.
#
# @param [String] solr_home
# The home directory for solr.
#
Expand All @@ -62,6 +66,9 @@
# Bash style environment variables passed at the end of the solr
# server environment.
#
# @param [Optional[String]] solr_url_scheme
# Set the URL scheme to use (e.g. https)
#
# @param [Hash] cores
# An array of hashes that define a core which will be created with the
# create_resources function.
Expand All @@ -70,6 +77,9 @@
# @param [Array[String]] required_packages
# Specified in params and is platform dependent.
#
# @param [Array[String]] java_packages
# Specified in params and is platform dependent.
#
# @param [Optional[Array]] zk_hosts
# For configuring ZooKeeper ensemble.
#
Expand All @@ -83,6 +93,12 @@
# @param log4j_rootlogger_loglevel
# The loglevel to set for log4j.
#
# @param [String] log4j_config_template
# Provide path of the log4j2.xml config file to use.
#
# @param [Hash] log4j_config_options
# Hash of additional options for your log4j template.
#
# @param [Optional[String]] schema_name
# The Solr cores' schema name. This should be set to `schema.xml` if using
# the classic schema.xml method. If using a managed schema, set this to
Expand Down Expand Up @@ -141,9 +157,9 @@
# GPL-3.0+
#
class solr (
String $version = '6.2.0',
String $url =
'http://archive.apache.org/dist/lucene/solr/',
String $version = '6.2.0',
String $url =
'https://dlcdn.apache.org/solr/solr/',
Boolean $manage_user = true,
String $solr_user = 'solr',
String $solr_host = '127.0.0.1',
Expand All @@ -152,28 +168,37 @@
String $solr_downloads = '/opt/solr_downloads',
String $install_dir = '/opt',
Boolean $install_dir_mg = false,
Boolean $manage_java = true,
String $var_dir = '/var/solr',
String $solr_logs = '/var/log/solr',
String $solr_home = '/opt/solr/server/solr',
String $java_home = $solr::params::java_home,
Optional[Array] $solr_environment = undef,
Optional[String] $solr_url_scheme = undef,
Hash $cores = {},
Array[String] $required_packages =
$solr::params::required_packages,
Optional[Array] $zk_hosts = undef,
String $log4j_maxfilesize = '4MB',
String $log4j_maxbackupindex = '9',
Array[String] $java_packages =
$solr::params::java_packages,
Optional[Array] $zk_hosts = undef,
String $log4j_maxfilesize = '4MB',
String $log4j_maxbackupindex = '9',
Variant[
Enum['ALL', 'DEBUG', 'ERROR', 'FATAL', 'INFO', 'OFF', 'TRACE',
'TRACE_INT', 'WARN'],
String] $log4j_rootlogger_loglevel = 'INFO',
Optional[String] $schema_name = undef,
String] $log4j_rootlogger_loglevel = 'INFO',
String $log4j_config_path = 'solr/log4j2.xml.epp',
Hash $log4j_config_options = {},
Optional[Array] $solr_start_args = [],
Optional[Array] $solr_status_args = [],
Optional[Array] $solr_stop_args = [],
Optional[String] $schema_name = undef,
Optional[String] $ssl_key_store = undef,
Optional[String] $ssl_key_store_password = undef,
Optional[String] $ssl_key_store_type = 'JKS',
Optional[String] $ssl_trust_store = undef,
Optional[String] $ssl_trust_store_password = undef,
Optional[String] $ssl_trust_store_type = 'JKS',
Optional[String] $ssl_trust_store_type = 'JKS',
Optional[Boolean] $ssl_need_client_auth = undef,
Optional[Boolean] $ssl_want_client_auth = undef,
Optional[String] $ssl_client_key_store = undef,
Expand Down Expand Up @@ -225,8 +250,8 @@
Class['solr::config'] ~> Class['solr::service']


if is_hash($cores) {
create_resources(::solr::core, $cores)
if $cores =~ Hash {
ensure_resources(::solr::core, $cores)
}

}
7 changes: 6 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
# install requirements
ensure_packages($solr::required_packages)

# Install java if desired.
if ($solr::manage_java) {
ensure_packages($solr::java_packages)
}

## create a solr user
user {$solr::solr_user:
ensure => present,
Expand All @@ -33,7 +38,7 @@

# download solr
archive{$tarball:
source => "${solr::url}/${solr::version}/solr-${solr::version}.tgz",
source => "${solr::url}/${solr::version}/solr-${solr::version}.tgz?action=download",
require => File[$solr::solr_downloads],
}

Expand Down
9 changes: 6 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# OS Specific configuration
case $::osfamily {
'RedHat': {
$required_packages = ['java-1.8.0-openjdk','unzip','lsof','wget']
$required_packages = ['unzip','lsof','wget']
$java_packages =['java-1.8.0-openjdk']
$java_home = '/usr/lib/jvm/jre-1.8.0'
$solr_env = '/etc/sysconfig/solr'
if versioncmp($::operatingsystemrelease, '7.0') >= 0 {
Expand All @@ -21,10 +22,12 @@
if $::operatingsystem == 'Ubuntu' and
versioncmp($::operatingsystemrelease, '15.04') >= 0 {
$is_systemd = true
$required_packages = ['unzip','lsof','software-properties-common', 'openjdk-8-jre','wget']
$required_packages = ['unzip','lsof','software-properties-common', 'wget']
$java_packages =['openjdk-8-jre']
} else {
$is_systemd = false
$required_packages = ['unzip','lsof','openjdk-8-jre','wget']
$required_packages = ['unzip','lsof','wget']
$java_packages =['openjdk-8-jre']
}
}
default: {
Expand Down
1 change: 1 addition & 0 deletions templates/log4j2.xml.epp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
String $log4j_rootlogger_loglevel,
String $log4j_maxfilesize,
String $log4j_maxbackupindex,
Hash $log4j_config_options,
|-%>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Expand Down
16 changes: 9 additions & 7 deletions templates/solr.in.sh.epp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
String $solr_port,
String $logger_config_file,
Optional[Array] $solr_environment = undef,
Optional[String] $solr_url_scheme = undef,
Optional[String] $ssl_key_store = undef,
Optional[String] $ssl_key_store_password = undef,
Optional[String] $ssl_trust_store = undef,
Expand Down Expand Up @@ -60,15 +61,8 @@ GC_TUNE="-XX:NewRatio=3 \
-XX:SurvivorRatio=4 \
-XX:TargetSurvivorRatio=90 \
-XX:MaxTenuringThreshold=8 \
-XX:+UseConcMarkSweepGC \
-XX:+UseParNewGC \
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 \
-XX:+CMSScavengeBeforeRemark \
-XX:PretenureSizeThreshold=64m \
-XX:+UseCMSInitiatingOccupancyOnly \
-XX:CMSInitiatingOccupancyFraction=50 \
-XX:CMSMaxAbortablePrecleanTime=6000 \
-XX:+CMSParallelRemarkEnabled \
-XX:+ParallelRefProcEnabled"

# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
Expand Down Expand Up @@ -167,10 +161,18 @@ SOLR_SSL_CLIENT_TRUST_STORE=<%= $ssl_client_key_store %>
SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD=<%= $ssl_client_key_store_password %>
<% } -%>

SOLR_SSL_CLIENT_KEY_STORE_TYPE=jks
SOLR_SSL_CLIENT_TRUST_STORE_TYPE=jks

# Settings for authentication
#SOLR_AUTHENTICATION_CLIENT_CONFIGURER=
#SOLR_AUTHENTICATION_OPTS=

# Settings for cloud mode with encryption
<% if $solr_url_scheme { -%>
SOLR_URL_SCHEME=<%= $solr_url_scheme %>
<% } -%>

# Note, in Puppet 6, can use built-in size function
<% if $solr_environment and size($solr_environment) != 0 { -%>
# solr::environment
Expand Down
9 changes: 5 additions & 4 deletions templates/solr.service.epp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
String $solr_port,
String $solr_bin,
String $solr_env,
Optional[Array] $solr_start_args = [],
Optional[Array] $solr_status_args = [],
Optional[Array] $solr_stop_args = [],
|-%>
####################################################################
#### NOTE: THIS FILE IS PUPPET CONTROLLED - ANY CHAGES WILL BE LOST
Expand All @@ -15,10 +18,8 @@ After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
PIDFile=<%= $solr_pid_dir %>/solr-<%= $solr_port %>.pid
Environment=SOLR_INCLUDE=<%= $solr_env %>
ExecStart=<%= $solr_bin %>/solr start -noprompt
ExecRestart=<%= $solr_bin %>/solr restart -noprompt
ExecStop=<%= $solr_bin %>/solr stop -noprompt
ExecStatus=<%= $solr_bin %>/solr status -noprompt
ExecStart=<%= $solr_bin %>/solr start <%= $solr_start_args.join(' ') %> -noprompt
ExecStop=<%= $solr_bin %>/solr stop <%= $solr_stop_args.join(' ') %> -noprompt
ExecReload=/bin/kill -s HUP $MAINPID
User=solr
PrivateTmp=true
Expand Down
9 changes: 6 additions & 3 deletions templates/solr.sh.epp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
String $solr_bin,
String $solr_user,
Optional[String] $solr_env = undef,
Optional[Array] $solr_start_args = [],
Optional[Array] $solr_status_args = [],
Optional[Array] $solr_stop_args = [],
|-%>
#!/bin/sh
####################################################################
Expand Down Expand Up @@ -67,7 +70,7 @@ fi

start () {
echo -n "Starting solr..."
su -c "SOLR_INCLUDE=$SOLR_ENV $SOLR_BIN_DIR/solr start" - $RUNAS
su -c "SOLR_INCLUDE=$SOLR_ENV $SOLR_BIN_DIR/solr start <%= $solr_start_args.join(' ') %>" - $RUNAS

RETVAL=$?
if [ $RETVAL = 0 ]
Expand All @@ -82,7 +85,7 @@ start () {
stop () {
echo -n "Stopping solr..."

su -c "SOLR_INCLUDE=$SOLR_ENV $SOLR_BIN_DIR/solr stop" - $RUNAS
su -c "SOLR_INCLUDE=$SOLR_ENV $SOLR_BIN_DIR/solr stop <%= $solr_stop_args.join(' ') %>" - $RUNAS
RETVAL=$?

if [ $RETVAL = 0 ]
Expand All @@ -97,7 +100,7 @@ stop () {
restart () {

echo -n "Restart solr..."
su -c "SOLR_INCLUDE=$SOLR_ENV $SOLR_BIN_DIR/solr restart" - $RUNAS
su -c "SOLR_INCLUDE=$SOLR_ENV $SOLR_BIN_DIR/solr restart <%= $solr_start_args.join(' ') %>" - $RUNAS
RETVAL=$?

if [ $RETVAL = 0 ]
Expand Down