add fulltextsearch as option

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-08-22 13:04:44 +02:00
parent 2ba61b8971
commit 8010030a5d
17 changed files with 155 additions and 3 deletions

View file

@ -144,3 +144,12 @@ updates:
labels:
- 3. to review
- dependencies
- package-ecosystem: "docker"
directory: "/Containers/fulltextsearch"
schedule:
interval: "daily"
time: "12:00"
open-pull-requests-limit: 10
labels:
- 3. to review
- dependencies

View file

@ -0,0 +1,4 @@
# Probably from here https://github.com/elastic/elasticsearch/blob/main/distribution/docker/src/docker/Dockerfile
FROM elasticsearch:7.17.5
RUN elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch ingest-attachment

View file

@ -237,7 +237,8 @@ RUN set -ex; \
chmod +r /upgrade.exclude && \
chmod +x /cron.sh && \
chmod +x /notify.sh && \
chmod +x /activate-collabora.sh
chmod +x /activate-collabora.sh && \
chmod +x /activate-fulltextsearch.sh
RUN set -ex; \
mkdir /mnt/ncdata; \

View file

@ -0,0 +1,9 @@
#!/bin/bash
if [ "$FULLTEXTSEARCH_ENABLED" != yes ]; then
# Basically sleep for forever if fulltextsearch is not enabled
sleep 365d
fi
echo "Activating fulltextsearch..."
php /var/www/html/occ fulltextsearch:live -q
sleep 365d

View file

@ -423,5 +423,47 @@ if version_greater "24.0.0.0" "$installed_version"; then
fi
fi
# Fulltextsearch
if [ "$FULLTEXTSEARCH_ENABLED" = 'yes' ]; then
while ! nc -z "$FULLTEXTSEARCH_HOST" 9200; do
echo "waiting for Fulltextsearch to become available..."
sleep 5
done
if ! [ -d "/var/www/html/custom_apps/fulltextsearch" ]; then
php /var/www/html/occ app:install fulltextsearch
elif [ "$(php /var/www/html/occ config:app:get fulltextsearch enabled)" = "no" ]; then
php /var/www/html/occ app:enable fulltextsearch
else
php /var/www/html/occ app:update fulltextsearch
fi
if ! [ -d "/var/www/html/custom_apps/fulltextsearch_elasticsearch" ]; then
php /var/www/html/occ app:install fulltextsearch_elasticsearch
elif [ "$(php /var/www/html/occ config:app:get fulltextsearch_elasticsearch enabled)" = "no" ]; then
php /var/www/html/occ app:enable fulltextsearch_elasticsearch
else
php /var/www/html/occ app:update fulltextsearch_elasticsearch
fi
if ! [ -d "/var/www/html/custom_apps/files_fulltextsearch" ]; then
php /var/www/html/occ app:install files_fulltextsearch
elif [ "$(php /var/www/html/occ config:app:get files_fulltextsearch enabled)" = "no" ]; then
php /var/www/html/occ app:enable files_fulltextsearch
else
php /var/www/html/occ app:update files_fulltextsearch
fi
php /var/www/html/occ fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}'
php /var/www/html/occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://$FULLTEXTSEARCH_HOST:9200\"}"
php /var/www/html/occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}"
else
if [ -d "/var/www/html/custom_apps/fulltextsearch" ]; then
php /var/www/html/occ app:remove fulltextsearch
fi
if [ -d "/var/www/html/custom_apps/fulltextsearch_elasticsearch" ]; then
php /var/www/html/occ app:remove fulltextsearch_elasticsearch
fi
if [ -d "/var/www/html/custom_apps/files_fulltextsearch" ]; then
php /var/www/html/occ app:remove files_fulltextsearch
fi
fi
# Remove the update skip file always
rm -f /mnt/ncdata/skip.update

View file

@ -35,3 +35,10 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/activate-collabora.sh
[program:activate-fulltextsearch]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/activate-fulltextsearch.sh

View file

@ -3,6 +3,7 @@
{
"identifier": "nextcloud-aio-apache",
"dependsOn": [
"nextcloud-aio-fulltextsearch",
"nextcloud-aio-onlyoffice",
"nextcloud-aio-collabora",
"nextcloud-aio-clamav",
@ -144,7 +145,9 @@
"TALK_PORT=%TALK_PORT%",
"IMAGINARY_ENABLED=%IMAGINARY_ENABLED%",
"IMAGINARY_HOST=nextcloud-aio-imaginary",
"PHP_UPLOAD_LIMIT=%NEXTCLOUD_UPLOAD_LIMIT%"
"PHP_UPLOAD_LIMIT=%NEXTCLOUD_UPLOAD_LIMIT%",
"FULLTEXTSEARCH_ENABLED=%FULLTEXTSEARCH_ENABLED%",
"FULLTEXTSEARCH_HOST=nextcloud-aio-fulltextsearch"
],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
@ -388,6 +391,31 @@
"secrets": [],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
},
{
"identifier": "nextcloud-aio-fulltextsearch",
"dependsOn": [],
"displayName": "Fulltextsearch",
"containerName": "nextcloud/aio-fulltextsearch",
"ports": [],
"internalPorts": [
"9200"
],
"environmentVariables": [
"TZ=%TIMEZONE%",
"discovery.type=single-node",
"ES_JAVA_OPTS=-Xms1024M -Xmx1024M"
],
"volumes": [
{
"name": "nextcloud_aio_elasticsearch",
"location": "/usr/share/elasticsearch/data",
"writeable": true
}
],
"secrets": [],
"maxShutdownTime": 10,
"restartPolicy": "unless-stopped"
}
]
}

View file

@ -0,0 +1,5 @@
document.addEventListener("DOMContentLoaded", function(event) {
// Fulltextsearch
var fulltextsearch = document.getElementById("fulltextsearch");
fulltextsearch.disabled = true;
});

View file

@ -103,6 +103,7 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
'automatic_updates' => $configurationManager->areAutomaticUpdatesEnabled(),
'is_backup_section_enabled' => $configurationManager->isBackupSectionEnabled(),
'is_imaginary_enabled' => $configurationManager->isImaginaryEnabled(),
'is_fulltextsearch_enabled' => $configurationManager->isFulltextsearchEnabled(),
]);
})->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) {

View file

@ -27,4 +27,8 @@ document.addEventListener("DOMContentLoaded", function(event) {
// Imaginary
var imaginary = document.getElementById("imaginary");
imaginary.addEventListener('change', makeOptionsFormSubmitVisible);
// Fulltextsearch
var fulltextsearch = document.getElementById("fulltextsearch");
fulltextsearch.addEventListener('change', makeOptionsFormSubmitVisible);
});

View file

@ -69,6 +69,10 @@ class ContainerDefinitionFetcher
if (!$this->configurationManager->isImaginaryEnabled()) {
continue;
}
} elseif ($entry['identifier'] === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) {
continue;
}
}
$ports = new ContainerPorts();
@ -154,6 +158,10 @@ class ContainerDefinitionFetcher
if (!$this->configurationManager->isImaginaryEnabled()) {
continue;
}
} elseif ($value === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) {
continue;
}
}
$dependsOn[] = $value;
}

View file

@ -95,6 +95,11 @@ class ConfigurationController
} else {
$this->configurationManager->SetImaginaryEnabledState(0);
}
if (isset($request->getParsedBody()['fulltextsearch'])) {
$this->configurationManager->SetFulltextsearchEnabledState(1);
} else {
$this->configurationManager->SetFulltextsearchEnabledState(0);
}
}
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {

View file

@ -154,6 +154,21 @@ class ConfigurationManager
$this->WriteConfig($config);
}
public function isFulltextsearchEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isFulltextsearchEnabled']) && $config['isFulltextsearchEnabled'] === 1) {
return true;
} else {
return false;
}
}
public function SetFulltextsearchEnabledState(int $value) : void {
$config = $this->GetConfig();
$config['isFulltextsearchEnabled'] = $value;
$this->WriteConfig($config);
}
public function isOnlyofficeEnabled() : bool {
$config = $this->GetConfig();
if (isset($config['isOnlyofficeEnabled']) && $config['isOnlyofficeEnabled'] === 1) {

View file

@ -304,6 +304,12 @@ class DockerActionManager
} else {
$replacements[1] = '';
}
} elseif ($out[1] === 'FULLTEXTSEARCH_ENABLED') {
if ($this->configurationManager->isFulltextsearchEnabled()) {
$replacements[1] = 'yes';
} else {
$replacements[1] = '';
}
} elseif ($out[1] === 'NEXTCLOUD_UPLOAD_LIMIT') {
$replacements[1] = $this->configurationManager->GetNextcloudUploadLimit();
} elseif ($out[1] === 'NEXTCLOUD_MAX_TIME') {

View file

@ -452,6 +452,11 @@
{% else %}
<input type="checkbox" id="collabora" name="collabora"><label for="collabora">Collabora (Nextcloud Office)</label><br>
{% endif %}
{% if is_fulltextsearch_enabled == true %}
<input type="checkbox" id="fulltextsearch" name="fulltextsearch" checked="checked"><label for="fulltextsearch">Fulltextsearch (needs ~1GB additional RAM)</label><br>
{% else %}
<input type="checkbox" id="fulltextsearch" name="fulltextsearch"><label for="fulltextsearch">Fulltextsearch (needs ~1GB additional RAM)</label><br>
{% endif %}
{% if is_imaginary_enabled == true %}
<input type="checkbox" id="imaginary" name="imaginary" checked="checked"><label for="imaginary">Imaginary</label><br>
{% else %}
@ -469,7 +474,7 @@
{% endif %}
<input id="options-form-submit" class="button" type="submit" value="Save changes" />
</form>
<b>Minimal system requirements:</b> When any optional addon is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV, at least 3GB RAM are required. Recommended are at least 4GB of RAM.<br><br>
<b>Minimal system requirements:</b> When any optional addon is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV or Fulltextsearch, at least 3GB RAM are required. When enabling everything, at least 4GB RAM are required. Recommended are at least 1GB more RAM than the minimal requirement.<br><br>
{% if isAnyRunning == true or is_x64_platform == false %}
<script type="text/javascript" src="disable-clamav.js"></script>
<script type="text/javascript" src="disable-onlyoffice.js"></script>
@ -478,6 +483,7 @@
<script type="text/javascript" src="disable-talk.js"></script>
<script type="text/javascript" src="disable-collabora.js"></script>
<script type="text/javascript" src="disable-imaginary.js"></script>
<script type="text/javascript" src="disable-fulltextsearch.js"></script>
{% endif %}
{% if is_collabora_enabled == true and isAnyRunning == false and was_start_button_clicked == true %}

View file

@ -9,6 +9,7 @@ Included are:
- Backup solution (based on [BorgBackup](https://github.com/borgbackup/borg#what-is-borgbackup))
- Imaginary
- ClamAV
- Fulltextsearch
## How to use this?
The following instructions are especially meant for Linux. For macOS see [this](#how-to-run-aio-on-macos), for Windows see [this](#how-to-run-aio-on-windows).

View file

@ -8,6 +8,7 @@
- [ ] Collabora by trying to open a .docx or .odt file in Nextcloud
- [ ] Nextcloud Talk by opening the Talk app in Nextcloud, creating a new chat and trying to join a call in this chat. Also verifying in the settings that the HPB and turn server work.
- [ ] Imaginary by having a look if when uploading a new picture in Nextcloud, it adds some log entries to the container
- [ ] Fulltextsearch by trying to search for a heading inside a file in Nextcloud
- [ ] When Collabora is enabled, it should show below the Optional Addons section a section where you can change the dictionaries for collabora. `de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru` should be a valid setting. E.g. `de.De` not. If already set, it should show a button that allows to remove the setting again.
You can now continue with [060-environmental-variables.md](./060-environmental-variables.md)