update tika service installation script, include tika in the installation of moodle, whitelist the port 9998 for tika service
This commit is contained in:
Родитель
0a1fd21a04
Коммит
5f848c7a84
|
@ -60,6 +60,19 @@
|
|||
"sourceAddressPrefix": "*",
|
||||
"sourcePortRange": "*"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Allow_tika",
|
||||
"properties": {
|
||||
"access": "Allow",
|
||||
"destinationAddressPrefix": "9998",
|
||||
"destinationPortRange": "9998",
|
||||
"direction": "Inbound",
|
||||
"priority": 1010,
|
||||
"protocol": "*",
|
||||
"sourceAddressPrefix": "*",
|
||||
"sourcePortRange": "*"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
]
|
||||
},
|
||||
"protectedSettings":{
|
||||
"commandToExecute": "[concat('bash ', parameters('moodleCommon').moodleInstallScriptFilename, ' ', parameters('moodleCommon').moodleVersion, ' ', concat(parameters('moodleCommon').gfsNameRoot, '0'), ' data ', parameters('moodleCommon').siteURL, ' ', parameters('moodleCommon').httpsTermination, ' ', parameters('moodleCommon').dbDNS, ' ', parameters('moodleCommon').moodleDbName, ' ', parameters('moodleCommon').moodleDbUser, ' ', parameters('moodleCommon').moodleDbPass, ' ', parameters('moodleCommon').moodleAdminPass, ' ', concat(parameters('moodleCommon').dbLogin, '@', parameters('moodleCommon').dbServerType, '-', parameters('moodleCommon').resourcesPrefix), ' ', parameters('moodleCommon').dbLoginPassword, ' ', parameters('moodleCommon').storageAccountName, ' ', listKeys(variables('storageAccountId'), '2017-06-01').keys[0].value, ' ', parameters('moodleCommon').moodleDbUserAzure, ' ', parameters('moodleCommon').redisDns, ' ', parameters('redisKey'), ' ', parameters('moodleCommon').elasticVm1IP, ' ', parameters('moodleCommon').installO365pluginsSwitch, ' ', parameters('moodleCommon').dbServerType, ' ', parameters('moodleCommon').fileServerType , ' ', parameters('moodleCommon').mssqlDbServiceObjectiveName, ' ', parameters('moodleCommon').mssqlDbEdition, ' ', parameters('moodleCommon').mssqlDbSize, ' ', parameters('moodleCommon').installObjectFsSwitch, ' ', parameters('moodleCommon').installGdprPluginsSwitch, ' ', parameters('moodleCommon').thumbprintSslCert, ' ', parameters('moodleCommon').thumbprintCaCert, ' ', parameters('moodleCommon').searchType, ' ', parameters('azureSearchKey'), ' ', parameters('moodleCommon').azureSearchNameHost)]"
|
||||
"commandToExecute": "[concat('bash ', parameters('moodleCommon').moodleInstallScriptFilename, ' ', parameters('moodleCommon').moodleVersion, ' ', concat(parameters('moodleCommon').gfsNameRoot, '0'), ' ', 'data', ' ', parameters('moodleCommon').siteURL, ' ', parameters('moodleCommon').dbDNS, ' ', parameters('moodleCommon').moodleDbName, ' ', parameters('moodleCommon').moodleDbUser, ' ', parameters('moodleCommon').moodleDbPass, ' ', parameters('moodleCommon').moodleAdminPass, ' ', concat(parameters('moodleCommon').dbLogin, '@', parameters('moodleCommon').dbServerType, '-', parameters('moodleCommon').resourcesPrefix), ' ', parameters('moodleCommon').dbLoginPassword, ' ', parameters('moodleCommon').storageAccountName, ' ', listKeys(variables('storageAccountId'), '2017-06-01').keys[0].value, ' ', parameters('moodleCommon').moodleDbUserAzure, ' ', parameters('moodleCommon').redisDns, ' ', parameters('redisKey'), ' ', parameters('moodleCommon').elasticVm1IP, ' ', parameters('moodleCommon').installO365pluginsSwitch, ' ', parameters('moodleCommon').dbServerType, ' ', parameters('moodleCommon').fileServerType , ' ', parameters('moodleCommon').mssqlDbServiceObjectiveName, ' ', parameters('moodleCommon').mssqlDbEdition, ' ', parameters('moodleCommon').mssqlDbSize, ' ', parameters('moodleCommon').installObjectFsSwitch, ' ', parameters('moodleCommon').installGdprPluginsSwitch, ' ', parameters('moodleCommon').thumbprintSslCert, ' ', parameters('moodleCommon').thumbprintCaCert, ' ', parameters('moodleCommon').searchType, ' ', parameters('azureSearchKey'), ' ', parameters('moodleCommon').azureSearchNameHost, ' ', parameters('moodleCommon').tikaVmIP)]"
|
||||
},
|
||||
"type": "CustomScript",
|
||||
"typeHandlerVersion": "2.0"
|
||||
|
|
|
@ -26,33 +26,33 @@
|
|||
glusterNode=${2}
|
||||
glusterVolume=${3}
|
||||
siteFQDN=${4}
|
||||
httpsTermination=${5}
|
||||
dbIP=${6}
|
||||
moodledbname=${7}
|
||||
moodledbuser=${8}
|
||||
moodledbpass=${9}
|
||||
adminpass=${10}
|
||||
dbadminlogin=${11}
|
||||
dbadminpass=${12}
|
||||
wabsacctname=${13}
|
||||
wabsacctkey=${14}
|
||||
azuremoodledbuser=${15}
|
||||
redisDns=${16}
|
||||
redisAuth=${17}
|
||||
elasticVm1IP=${18}
|
||||
installO365pluginsSwitch=${19}
|
||||
dbServerType=${20}
|
||||
fileServerType=${21}
|
||||
mssqlDbServiceObjectiveName=${22}
|
||||
mssqlDbEdition=${23}
|
||||
mssqlDbSize=${24}
|
||||
installObjectFsSwitch=${25}
|
||||
installGdprPluginsSwitch=${26}
|
||||
thumbprintSslCert=${27}
|
||||
thumbprintCaCert=${28}
|
||||
searchType=${29}
|
||||
azureSearchKey=${30}
|
||||
azureSearchNameHost=${31}
|
||||
dbIP=${5}
|
||||
moodledbname=${6}
|
||||
moodledbuser=${7}
|
||||
moodledbpass=${8}
|
||||
adminpass=${9}
|
||||
dbadminlogin=${10}
|
||||
dbadminpass=${11}
|
||||
wabsacctname=${12}
|
||||
wabsacctkey=${13}
|
||||
azuremoodledbuser=${14}
|
||||
redisDns=${15}
|
||||
redisAuth=${16}
|
||||
elasticVm1IP=${17}
|
||||
installO365pluginsSwitch=${18}
|
||||
dbServerType=${19}
|
||||
fileServerType=${20}
|
||||
mssqlDbServiceObjectiveName=${21}
|
||||
mssqlDbEdition=${22}
|
||||
mssqlDbSize=${23}
|
||||
installObjectFsSwitch=${24}
|
||||
installGdprPluginsSwitch=${25}
|
||||
thumbprintSslCert=${26}
|
||||
thumbprintCaCert=${27}
|
||||
searchType=${28}
|
||||
azureSearchKey=${29}
|
||||
azureSearchNameHost=${30}
|
||||
tikaVmIP=${31}
|
||||
|
||||
echo $moodleVersion >> /tmp/vars.txt
|
||||
echo $glusterNode >> /tmp/vars.txt
|
||||
|
@ -85,6 +85,7 @@
|
|||
echo $searchType >> /tmp/vars.txt
|
||||
echo $azureSearchKey >> /tmp/vars.txt
|
||||
echo $azureSearchNameHost >> /tmp/vars.txt
|
||||
echo $tikaVmIP >> /tmp/vars.txt
|
||||
|
||||
. ./helper_functions.sh
|
||||
check_fileServerType_param $fileServerType
|
||||
|
@ -851,14 +852,14 @@ EOF
|
|||
|
||||
if [ "$searchType" = "elastic" ]; then
|
||||
# Set up elasticsearch plugin
|
||||
sed -i "23 a \$CFG->forced_plugin_settings = ['search_elastic' => ['hostname' => 'http://$elasticVm1IP']];" /moodle/html/moodle/config.php
|
||||
sed -i "23 a \$CFG->forced_plugin_settings = ['search_elastic' => ['hostname' => 'http://$elasticVm1IP', 'fileindexing' => 'true'], 'search_elastic_fileindexing' => ['tikahostname' => 'http://$tikaVmIP', 'tikaport' => '9998']];" /moodle/html/moodle/config.php
|
||||
sed -i "23 a \$CFG->searchengine = 'elastic';" /moodle/html/moodle/config.php
|
||||
sed -i "23 a \$CFG->enableglobalsearch = 'true';" /moodle/html/moodle/config.php
|
||||
# create index
|
||||
sudo -u www-data php /moodle/html/moodle/search/cli/indexer.php --force --reindex
|
||||
elif [ "$searchType" = "azure" ]; then
|
||||
# Set up Azure Search service plugin
|
||||
sed -i "23 a \$CFG->forced_plugin_settings = ['search_azure' => ['searchurl' => 'https://$azureSearchNameHost', 'apikey' => '$azureSearchKey']];" /moodle/html/moodle/config.php
|
||||
sed -i "23 a \$CFG->forced_plugin_settings = ['search_azure' => ['searchurl' => 'https://$azureSearchNameHost', 'apikey' => '$azureSearchKey', 'enrichmentsettings' => 'true'], 'search_azure_enrichsettings' => ['tikahostname' => 'http://$tikaVmIP', 'tikaport' => '9998']];" /moodle/html/moodle/config.php
|
||||
sed -i "23 a \$CFG->searchengine = 'azure';" /moodle/html/moodle/config.php
|
||||
sed -i "23 a \$CFG->enableglobalsearch = 'true';" /moodle/html/moodle/config.php
|
||||
# create index
|
||||
|
|
|
@ -33,11 +33,75 @@ echo $tikavmip >> /tmp/vars.txt
|
|||
sudo apt-get -y install unattended-upgrades
|
||||
|
||||
# download apache tika server
|
||||
wget -q http://apache.mirror.amaze.com.au/tika/tika-server-1.17.jar
|
||||
mkdir -p /usr/local/src/tika-1.18/tika-server/target/
|
||||
wget -q http://apache.mirror.amaze.com.au/tika/tika-server-1.18.jar --directory-prefix=/usr/share/java/
|
||||
|
||||
# install the required packages
|
||||
sudo apt-get install -y openjdk-8-jre openjdk-8-jdk default-jre default-jdk
|
||||
|
||||
# Configure tika
|
||||
|
||||
cat <<EOF > /etc/systemd/system/tika-server.service
|
||||
[Unit]
|
||||
Description = Java Service
|
||||
After network.target = tika-server.service
|
||||
|
||||
[Service]
|
||||
Type = forking
|
||||
ExecStart = /usr/local/bin/tika-server start
|
||||
ExecStop = /usr/local/bin/tika-server stop
|
||||
ExecReload = /usr/local/bin/tika-server reload
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
chmod 777 /etc/systemd/system/tika-server.service
|
||||
|
||||
cat <<EOF > /usr/local/bin/tika-server
|
||||
#!/bin/sh
|
||||
SERVICE_NAME=tika-server
|
||||
PATH_TO_JAR=/usr/share/java/tika-server-1.18.jar
|
||||
PID_PATH_NAME=/tmp/tika-server-pid
|
||||
case \$1 in
|
||||
start)
|
||||
echo "Starting \$SERVICE_NAME ..."
|
||||
if [ ! -f \$PID_PATH_NAME ]; then
|
||||
nohup java -jar \$PATH_TO_JAR --host=$tikavmip --port=9998 >> /var/log/tika-server.out 2>&1&
|
||||
echo \$! > \$PID_PATH_NAME
|
||||
echo "\$SERVICE_NAME started ..."
|
||||
else
|
||||
echo "\$SERVICE_NAME is already running ..."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if [ -f \$PID_PATH_NAME ]; then
|
||||
PID=\$(cat $PID_PATH_NAME);
|
||||
echo "\$SERVICE_NAME stoping ..."
|
||||
kill \$PID;
|
||||
echo "\$SERVICE_NAME stopped ..."
|
||||
rm \$PID_PATH_NAME
|
||||
else
|
||||
echo "\$SERVICE_NAME is not running ..."
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
if [ -f \$PID_PATH_NAME ]; then
|
||||
PID=\$(cat $PID_PATH_NAME);
|
||||
echo "\$SERVICE_NAME stopping ...";
|
||||
kill \$PID;
|
||||
echo "\$SERVICE_NAME stopped ...";
|
||||
rm \$PID_PATH_NAME
|
||||
echo "\$SERVICE_NAME starting ..."
|
||||
nohup java -jar \$PATH_TO_JAR --host=$tikavmip --port=9998 >> /var/log/tika-server.out 2>&1&
|
||||
echo \$! > \$PID_PATH_NAME
|
||||
echo "\$SERVICE_NAME started ..."
|
||||
else
|
||||
echo "\$SERVICE_NAME is not running ..."
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x /usr/local/bin/tika-server
|
||||
systemctl enable tika-server.service
|
||||
systemctl start tika-server.service
|
||||
} > /tmp/setup.log
|
||||
|
|
Загрузка…
Ссылка в новой задаче