This commit is contained in:
Daniel Hansson 2019-03-17 13:22:19 +01:00 коммит произвёл GitHub
Родитель 9a2074c053
Коммит c2c67a2a6a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 1 добавлений и 132 удалений

Просмотреть файл

@ -1,120 +0,0 @@
#!/bin/bash
# T&M Hansson IT AB © - 2019, https://www.hanssonit.se/
# shellcheck disable=2034,2059
true
# shellcheck source=lib.sh
NC_UPDATE=1 && NEXTANT_INSTALL=1 . <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
unset NEXTANT_INSTALL
unset NC_UPDATE
# Check for errors + debug code and abort if something isn't right
# 1 = ON
# 0 = OFF
DEBUG=0
debug_mode
# Solr Server & Nextant App Installation
# Must be root
root_check
# Nextcloud 12 is required.
if [ ! "${CURRENTVERSION%%.*}" -le "13" ]
then
msg_box "This script is developed to work with Nextcloud 12 and earlier.
Please use Full Text Search instead. You can find the script here:
https://github.com/nextcloud/vm/blob/master/apps/fulltextsearch.sh"
exit
fi
msg_box "Nextant is not maintained anymore, and is now replaced with Full Text Search. Sorry, not much we can do about it.
Nextant is still fully functional though, but it will not be developed any further.
Please use Full Text Search instead. You can find the script here:
https://github.com/nextcloud/vm/blob/master/apps/fulltextsearch.sh
Please report any bugs regarding the script to $ISSUES"
# Make sure there is an Nextcloud installation
if ! [ "$(occ_command -V)" ]
then
print_text_in_color "$Red" "It seems there is no Nextcloud server installed, please check your installation."
exit 1
fi
# Check if it's a clean install
if [ -d "$SOLR_HOME" ]
then
print_text_in_color "$Red" "It seems like $SOLR_HOME already exists. Have you already run this script?"
print_text_in_color "$Red" "If yes, revert all the settings and try again, it must be a clean install."
exit 1
fi
print_text_in_color "$ICyan" "Starting to setup Solr & Nextant on Nextcloud..."
# Installing requirements
apt update -q4 & spinner_loading
apt install default-jre -y
# Getting and installing Apache Solr
print_text_in_color "$ICyan" "Installing Apache Solr"
print_text_in_color "$ICyan" "It might take some time depending on your bandwith, please be patient..."
mkdir -p "$SOLR_HOME"
check_command cd "$SOLR_HOME"
wget -q "$SOLR_DL" --show-progress
tar -zxf "$SOLR_RELEASE"
if "./solr-$SOLR_VERSION/bin/install_solr_service.sh" "$SOLR_RELEASE"
then
rm -rf "${SOLR_HOME:?}/$SOLR_RELEASE"
wget -q https://raw.githubusercontent.com/apache/lucene-solr/master/solr/bin/install_solr_service.sh -P $SCRIPTS/
else
print_text_in_color "$Red" "Solr failed to install, something is wrong with the Solr installation"
exit 1
fi
sudo sed -i '35,37 s/"jetty.host" \//"jetty.host" default="127.0.0.1" \//' $SOLR_JETTY
iptables -A INPUT -p tcp -s localhost --dport 8983 -j ACCEPT
iptables -A INPUT -p tcp --dport 8983 -j DROP
# Not tested
#sudo apt install iptables-persistent
#sudo service iptables-persistent start
#sudo iptables-save > /etc/iptables.conf
if service solr start
then
sudo -u solr /opt/solr/bin/solr create -c nextant
else
print_text_in_color "$Red" "Solr failed to start, something is wrong with the Solr installation"
exit 1
fi
# Add search suggestions feature
sed -i '2i <!DOCTYPE config [' "$SOLR_DSCONF"
sed -i "3i <\!ENTITY nextant_component SYSTEM \"$NCPATH/apps/nextant/config/nextant_solrconfig.xml\"\>" "$SOLR_DSCONF"
sed -i '4i ]>' "$SOLR_DSCONF"
sed -i '$d' "$SOLR_DSCONF" | sed -i '$d' "$SOLR_DSCONF"
echo "
&nextant_component;
</config>" | tee -a "$SOLR_DSCONF"
check_command "echo \"SOLR_OPTS=\\\"\\\$SOLR_OPTS -Dsolr.allow.unsafe.resourceloading=true\\\"\" | sudo tee -a /etc/default/solr.in.sh"
check_command service solr restart
# Get nextant app for nextcloud
check_command wget -q -P "$NC_APPS_PATH" "$NT_DL"
check_command cd "$NC_APPS_PATH"
check_command tar zxf "$NT_RELEASE"
# Enable Nextant
rm -r "$NT_RELEASE"
occ_command app:enable nextant
chown -R www-data:www-data $NCPATH/apps
occ_command nextant:test http://127.0.0.1:8983/solr/ nextant --save
occ_command nextant:index

13
lib.sh
Просмотреть файл

@ -14,6 +14,7 @@ SNAPDIR=/var/snap/spreedme
GPGDIR=/tmp/gpg
BACKUP=/mnt/NCBACKUP
RORDIR=/opt/es/
NC_APPS_PATH=$NCPATH/apps
# Ubuntu OS
DISTRO=$(lsb_release -sd | cut -d ' ' -f 2)
@ -82,18 +83,6 @@ DHPARAMS="$CERTFILES/$SUBDOMAIN/dhparam.pem"
# Collabora App
HTTPS_CONF="/etc/apache2/sites-available/$SUBDOMAIN.conf"
HTTP2_CONF="/etc/apache2/mods-available/http2.conf"
# Nextant
# this var get's the latest automatically:
SOLR_VERSION=$(curl -s https://github.com/apache/lucene-solr/tags | grep -o "release.*</span>$" | grep -o '[0-6].[0-9].[0-9]' | sort -t. -k1,1n -k2,2n -k3,3n | tail -n1)
[ ! -z "$NEXTANT_INSTALL" ] && NEXTANT_VERSION=$(curl -s https://api.github.com/repos/nextcloud/fulltextsearch/releases/10134699 | grep 'tag_name' | cut -d\" -f4 | sed -e "s|v||g")
NT_RELEASE=nextant-$NEXTANT_VERSION.tar.gz
NT_DL=https://github.com/nextcloud/fulltextsearch/releases/download/v$NEXTANT_VERSION/$NT_RELEASE
SOLR_RELEASE=solr-$SOLR_VERSION.tgz
SOLR_DL=http://www-eu.apache.org/dist/lucene/solr/$SOLR_VERSION/$SOLR_RELEASE
NC_APPS_PATH=$NCPATH/apps
SOLR_HOME=/home/$SUDO_USER/solr_install/
SOLR_JETTY=/opt/solr/server/etc/jetty-http.xml
SOLR_DSCONF=/opt/solr-$SOLR_VERSION/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
# PHP-FPM
PHP_INI=/etc/php/7.2/fpm/php.ini
PHP_POOL_DIR=/etc/php/7.2/fpm/pool.d