Skip to content

Commit 586c140

Browse files
authored
add live index service (#2565)
1 parent da5faca commit 586c140

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

apps/fulltextsearch.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,25 @@ nextcloud_occ fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_
169169
nextcloud_occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://elastic:$ELASTIC_USER_PASSWORD@localhost:9200\",\"elastic_index\":\"${NEXTCLOUD_INDEX}\"}"
170170
nextcloud_occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}"
171171

172+
# Add SystemD service for live indexing
173+
cat << SYSTEMCTL_FTS > "/etc/systemd/system/$FULLTEXTSEARCH_SERVICE"
174+
[Unit]
175+
Description=Elasticsearch Worker for Nextcloud FullTextSearch
176+
After=network.target
177+
178+
[Service]
179+
User=www-data
180+
Group=www-data
181+
WorkingDirectory=$NCPATH
182+
ExecStart=/usr/bin/php $NCPATH/occ fulltextsearch:live -q
183+
ExecStop=/usr/bin/php $NCPATH/occ fulltextsearch:stop
184+
Nice=19
185+
Restart=always
186+
187+
[Install]
188+
WantedBy=multi-user.target
189+
SYSTEMCTL_FTS
190+
172191
# Wait further for cache for index to work
173192
countdown "Waiting for a few seconds before indexing starts..." "10"
174193
if nextcloud_occ fulltextsearch:test
@@ -179,6 +198,9 @@ then
179198
if nextcloud_occ fulltextsearch:index < /dev/null
180199
then
181200
msg_box "Full Text Search was successfully installed!"
201+
# Enable the live service
202+
systemctl enable "$FULLTEXTSEARCH_SERVICE"
203+
systemctl start "$FULLTEXTSEARCH_SERVICE"
182204
fi
183205
else
184206
msg_box "There seems to be an issue with the Full Text Search test. Please report this to $ISSUES."

lib.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,14 @@ ENVASIVE=/etc/apache2/mods-available/mod-evasive.load
172172
APACHE2=/etc/apache2/apache2.conf
173173
# Full text Search
174174
fulltextsearch_install() {
175+
FULLTEXTSEARCH_DIR="$SCRIPTS"/fulltextsearch
175176
NEXTCLOUD_INDEX=$(gen_passwd "$SHUF" '[:lower:]')
176177
ELASTIC_USER_PASSWORD=$(gen_passwd "$SHUF" '[:lower:]')
177178
FULLTEXTSEARCH_IMAGE_NAME=fulltextsearch_es01
179+
FULLTEXTSEARCH_SERVICE=nextcloud-fulltext-elasticsearch-worker.service
178180
# Legacy, changed 2023-09-21
179181
DOCKER_IMAGE_NAME=es01
180-
FULLTEXTSEARCH_DIR="$SCRIPTS"/fulltextsearch
181-
# Legacy
182+
# Legacy, not used at all
182183
RORDIR=/opt/es/
183184
OPNSDIR=/opt/opensearch
184185
nc_fts="ark74/nc_fts"

0 commit comments

Comments
 (0)