add Languagetool (#144)

* add etke.cc languagetool v6.3-0 to requierements

* add languagetool to setup

* add LanguageTool to group_vars

* fix container_additional_networks var name

* add docs

* just a small clarification in the doc

* Fix incorrect closing role-specific comment

* Fix typos and improve wording on LanguageTool docs page

* Upgrade LanguageTool (v6.3-0 -> v6.3-1)

* Switch from languagetool_container_additional_networks to languagetool_container_additional_networks_auto

This is a new addition in LanguageTool v6.3-1

* Do not enable Traefik labels conditionally based on languagetool_hostname

This may have been appropriate for other roles, for which the hostname is optional, but not here.

For LanguageTool, `languagetool_hostname` is required.

* Fix languagetool section alignment

* Update languagetool.md with better explanation about n-gram data

---------

Co-authored-by: sudo-Tiz <mathis.worksome@simplelogin.fr>
Co-authored-by: Slavi Pantaleev <slavi@devture.com>
This commit is contained in:
Tiz 2024-02-13 17:39:14 +00:00 committed by GitHub
parent 99e3733ed6
commit 18e752f3f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,62 @@
# LanguageTool
[LanguageTool](https://languagetool.org/) is an open source online grammar, style and spell checker. Installing it is powered by the [etke.cc/roles/languagetool](https://gitlab.com/etke.cc/roles/languagetool) Ansible role and [Erikvl87/docker-languagetool](https://github.com/Erikvl87/docker-languagetool) docker image.
## Dependencies
This service requires the following other services:
- [Traefik](traefik.md) - a reverse-proxy server
## Configuration
To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process:
```yaml
########################################################################
# #
# languagetool #
# #
########################################################################
languagetool_enabled: true
languagetool_hostname: mash.example.com
languagetool_path_prefix: /languagetool
########################################################################
# #
# /languagetool #
# #
########################################################################
```
In the example configuration above, we configure the service to be hosted at `https://mash.example.com/languagetool`.
You can remove the `languagetool_path_prefix` variable definition, to make it default to `/`, so that the service is served at `https://mash.example.com/`.
### Enabling n-gram data
LanguageTool can make use of large n-gram data sets to detect errors with words that are often confused, like *their* and *there*.
Learn more in [Finding errors using n-gram data](https://dev.languagetool.org/finding-errors-using-n-gram-data).
The **n-gram data set is huge and thus not part of the LanguageTool installation**. To make use of it with your own LanguageTool server, you may enable n-gram data and choose which languages to download n-gram data for.
For a list of languages for which the Ansible role supports downloading n-gram data, consult the `languagetool_ngrams_langs` variable in [the `default/main.yml` file](https://gitlab.com/etke.cc/roles/languagetool/-/blob/main/defaults/main.yml). Additional languages may be available. If the role doesn't have a download URL for them, consider redefining `languagetool_ngrams_langs` yourself with your own language-code to download URL mapping or submit a PR to the [languagetool Ansible role](https://gitlab.com/etke.cc/roles/languagetool).
```yaml
languagetool_ngrams_enabled: true
# See `languagetool_ngrams_langs` for a list of language-codes
# that the Ansible role supports.
languagetool_ngrams_langs_enabled: ['fr', 'en']
```
## Usage
After [installing](../installing.md), you can test your instance by making requests to [LanguageTool's HTTP API](https://dev.languagetool.org/public-http-api).
An example HTTP request can be made with [curl](https://curl.se/): `curl --data "language=en-US&text=a simple test" https://mash.example.com/languagetool/v2/check`
See the list of [software that supports LanguageTool as an add-on](https://dev.languagetool.org/software-that-supports-languagetool-as-a-plug-in-or-add-on) and set `https://mash.example.com/languagetool/v2` as the LanguageTool server (assuming you've installed at the `/languagetool` path prefix).

View file

@ -36,6 +36,7 @@
| [Jitsi](https://jitsi.org/) | A fully encrypted, 100% Open Source video conferencing solution | [Link](services/jitsi.md) |
| [Keycloak](https://www.keycloak.org/) | An open source identity and access management solution. | [Link](services/keycloak.md) |
| [Lago](https://www.getlago.com/) | Open-source metering and usage-based billing | [Link](services/lago.md) |
| [languageTool](https://languagetool.org/) | An open source online grammar, style and spell checker | [Link](services/languagetool.md) |
| [linkding](https://github.com/sissbruecker/linkding/) | Bookmark manager designed to be minimal and fast. | [Link](services/linkding.md) |
| [MariaDB](https://mariadb.org/) | A powerful, open source object-relational database system | [Link](services/mariadb.md) |
| [Matrix Rooms Search API](https://gitlab.com/etke.cc/mrs/api) | A fully-featured, standalone, matrix rooms search service. | [Link](services/mrs.md) |

View file

@ -362,6 +362,11 @@ mash_playbook_devture_systemd_service_manager_services_list_auto_itemized:
{{ ({'name': (lago_identifier + '-pdf.service'), 'priority': 1900, 'groups': ['mash', 'lago', 'lago-pdf']} if lago_enabled else omit) }}
# /role-specific:lago
# role-specific:languagetool
- |-
{{ ({'name': (languagetool_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'languagetool']} if languagetool_enabled else omit) }}
# /role-specific:languagetool
# role-specific:loki
- |-
{{ ({'name': (loki_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'loki']} if loki_enabled else omit) }}
@ -2267,6 +2272,16 @@ hubsite_service_keycloak_description: "An open source identity and access manage
hubsite_service_keycloak_priority: 1000
# /role-specific:keycloak
# role-specific:languagetool
# LanguageTool
hubsite_service_languagetool_enabled: "{{ languagetool_enabled }}"
hubsite_service_languagetool_name: LanguageTool
hubsite_service_languagetool_url: "https://{{ languagetool_hostname }}{{ languagetool_path_prefix }}"
hubsite_service_languagetool_logo_location: "{{ role_path }}/assets/languagetool.png"
hubsite_service_languagetool_description: "An open source online grammar, style and spell checker"
hubsite_service_languagetool_priority: 1000
# /role-specific:languagetool
# role-specific:miniflux
# Miniflux
hubsite_service_miniflux_enabled: "{{ miniflux_enabled }}"
@ -2562,6 +2577,19 @@ mash_playbook_hubsite_service_list_auto_itemized:
}}
# /role-specific:keycloak
# role-specific:languagetool
- |-
{{
({
'name': hubsite_service_languagetool_name,
'url': hubsite_service_languagetool_url,
'logo_location': hubsite_service_languagetool_logo_location,
'description': hubsite_service_languagetool_description,
'priority': hubsite_service_languagetool_priority,
} if hubsite_service_languagetool_enabled else omit)
}}
# /role-specific:languagetool
# role-specific:miniflux
- |-
{{
@ -3028,6 +3056,41 @@ lago_api_environment_variable_encryption_key_derivation_salt: "{{ '%s' | format(
# role-specific:languagetool
########################################################################
# #
# languagetool #
# #
########################################################################
languagetool_enabled: false
languagetool_identifier: "{{ mash_playbook_service_identifier_prefix }}languagetool"
languagetool_base_path: "{{ mash_playbook_base_path }}/{{ mash_playbook_service_base_directory_name_prefix }}languagetool"
languagetool_uid: "{{ mash_playbook_uid }}"
languagetool_gid: "{{ mash_playbook_gid }}"
languagetool_container_labels_traefik_enabled: "{{ mash_playbook_traefik_labels_enabled }}"
languagetool_container_labels_traefik_docker_network: "{{ mash_playbook_reverse_proxyable_services_additional_network }}"
languagetool_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}"
languagetool_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}"
languagetool_container_additional_networks_auto: |
{{
([mash_playbook_reverse_proxyable_services_additional_network] if mash_playbook_reverse_proxyable_services_additional_network else [])
}}
########################################################################
# #
# /languagetool #
# #
########################################################################
# /role-specific:languagetool
# role-specific:loki
########################################################################
# #

View file

@ -152,6 +152,10 @@
version: v0.50.0-0
name: lago
activation_prefix: lago_
- src: git+https://gitlab.com/etke.cc/roles/languagetool.git
version: v6.3-1
name: languagetool
activation_prefix: languagetool_
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-loki.git
version: v2.9.4-3
name: loki

View file

@ -230,6 +230,10 @@
- role: galaxy/lago
# /role-specific:lago
# role-specific:languagetool
- role: galaxy/languagetool
# /role-specific:languagetool
# role-specific:linkding
- role: galaxy/linkding
# /role-specific:linkding