You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/xfenix/spellcheck-microservice/releases)
@@ -13,73 +14,89 @@ It runs blazingly fast due to the use of pychant in its kernel, LRU cache usage
13
14
Also it supports feature called «user dictionaries» — user can add his own word-exceptions to personal dictionary.
14
15
15
16
## Quickstart
16
-
*`docker run -p 10113:10113 -t --mount source=spellcheck-dicts,target=/data/ xfenix/spellcheck-microservice:4.1.0`
17
-
* check http://localhost:10113/docs/ for full REST documentation
18
-
* main REST endpoint you will be needed is http://localhost:10113/api/check/ (this will be available without authorization)
17
+
18
+
-`docker run -p 10113:10113 -t --mount source=spellcheck-dicts,target=/data/ xfenix/spellcheck-microservice:4.1.0`
19
+
- check http://localhost:10113/docs/ for full REST documentation
20
+
- main REST endpoint you will be needed is http://localhost:10113/api/check/ (this will be available without authorization)
19
21
20
22
## Configuration
23
+
21
24
### Config options
25
+
22
26
You can change config of the service by changing the environment variables. Here is a list of them:
23
-
*`SPELLCHECK_SENTRY_DSN` Sentry DSN for integration. Empty field disables integration. Default value is empty string.
24
-
*`SPELLCHECK_API_KEY` define api key for users dictionaries mostly. Please, provide, if you want to enable user dictionaries API. Default value is empty string.
25
-
*`SPELLCHECK_ENABLE_CORS` enable CORS for all endpoints. In docker container this option is disabled. Default value is `True`.
26
-
*`SPELLCHECK_STRUCTURED_LOGGING` enables structured (json) logging. Default value is `True`.
27
-
*`SPELLCHECK_WORKERS` define application server workers count. If you plan to use k8s and only scale with replica sets, you might want to reduce this value to `1`. Default value is `8`. Restrictions: `Gt(gt=0)`, `Lt(lt=301)`
28
-
*`SPELLCHECK_PORT` binding port. Default value is `10113`. Restrictions: `Gt(gt=1023)`, `Lt(lt=65536)`
29
-
*`SPELLCHECK_CACHE_SIZE` define LRU cache size for misspelled word/suggestions cache. Any value less than `1` makes the cache size unlimited, so be careful with this option. Default value is `10000`.
30
-
*`SPELLCHECK_API_PREFIX` define all API's URL prefix. Default value is `/api/`.
31
-
*`SPELLCHECK_DOCS_URL` define documentation (swagger) URL prefix. Default value is `/docs/`.
32
-
*`SPELLCHECK_MAX_SUGGESTIONS` defines how many maximum suggestions for each word will be available. 0 means unlimitied. Default value is `0`. Restrictions: `Ge(ge=0)`
33
-
*`SPELLCHECK_DICTIONARIES_PATH` define directory where user dicts is stored. This is inner directory in the docker image, please map it to volume as it shown in the quickstart part of this readme. Default value is `/data`.
34
-
*`SPELLCHECK_DICTIONARIES_STORAGE_PROVIDER` define wich engine will store user dictionaries. Default value is `StorageProviders.FILE`.
35
-
*`SPELLCHECK_DICTIONARIES_DISABLED` switches off user dictionaries API no matter what. Default value is `False`.
36
-
*`SPELLCHECK_USERNAME_MIN_LENGTH` minimum length of username. Default value is `3`.
37
-
*`SPELLCHECK_USERNAME_MAX_LENGTH` maximum length of username. Default value is `60`.
38
-
*`SPELLCHECK_EXCLUSION_WORDS_STR` String with list of words which will be ignored in /api/check endpoint each request. Example: `'foo, bar'`. Default value is empty string.
27
+
28
+
-`SPELLCHECK_SENTRY_DSN` Sentry DSN for integration. Empty field disables integration. Default value is empty string.
29
+
-`SPELLCHECK_API_KEY` define api key for users dictionaries mostly. Please, provide, if you want to enable user dictionaries API. Default value is empty string.
30
+
-`SPELLCHECK_ENABLE_CORS` enable CORS for all endpoints. In docker container this option is disabled. Default value is `True`.
31
+
-`SPELLCHECK_STRUCTURED_LOGGING` enables structured (json) logging. Default value is `True`.
32
+
-`SPELLCHECK_WORKERS` define application server workers count. If you plan to use k8s and only scale with replica sets, you might want to reduce this value to `1`. Default value is `8`. Restrictions: `Gt(gt=0)`, `Lt(lt=301)`
33
+
-`SPELLCHECK_PORT` binding port. Default value is `10113`. Restrictions: `Gt(gt=1023)`, `Lt(lt=65536)`
34
+
-`SPELLCHECK_CACHE_SIZE` define LRU cache size for misspelled word/suggestions cache. Any value less than `1` makes the cache size unlimited, so be careful with this option. Default value is `10000`.
35
+
-`SPELLCHECK_API_PREFIX` define all API's URL prefix. Default value is `/api/`.
36
+
-`SPELLCHECK_DOCS_URL` define documentation (swagger) URL prefix. Default value is `/docs/`.
37
+
-`SPELLCHECK_MAX_SUGGESTIONS` defines how many maximum suggestions for each word will be available. 0 means unlimitied. Default value is `0`. Restrictions: `Ge(ge=0)`
38
+
-`SPELLCHECK_DICTIONARIES_PATH` define directory where user dicts is stored. This is inner directory in the docker image, please map it to volume as it shown in the quickstart part of this readme. Default value is `/data`.
39
+
-`SPELLCHECK_DICTIONARIES_STORAGE_PROVIDER` define wich engine will store user dictionaries. Default value is `StorageProviders.FILE`.
40
+
-`SPELLCHECK_DICTIONARIES_DISABLED` switches off user dictionaries API no matter what. Default value is `False`.
41
+
-`SPELLCHECK_USERNAME_MIN_LENGTH` minimum length of username. Default value is `3`.
42
+
-`SPELLCHECK_USERNAME_MAX_LENGTH` maximum length of username. Default value is `60`.
43
+
-`SPELLCHECK_EXCLUSION_WORDS_STR` String with list of words which will be ignored in /api/check endpoint each request. Example: `'foo, bar'`. Default value is empty string.
39
44
40
45
### Deployment
46
+
41
47
Note: all docker & docker-compose variants use named volumes to store user dictionaries.
48
+
42
49
#### Plain docker
50
+
43
51
`docker run -p 10113:10113 -t --mount source=spellcheck-dicts,target=/data/ xfenix/spellcheck-microservice:4.1.0`
52
+
44
53
#### Docker-compose
45
-
* Save this example configuration as `docker-compose.yml`:
54
+
55
+
- Save this example configuration as `docker-compose.yml`:
56
+
46
57
```yml
47
58
version: "3.9"
48
59
services:
49
-
spellcheck:
50
-
image: xfenix/spellcheck-microservice:4.1.0
51
-
ports:
52
-
- "10113:10113"
53
-
volumes:
54
-
- spellcheck-dicts:/data/
60
+
spellcheck:
61
+
image: xfenix/spellcheck-microservice:4.1.0
62
+
ports:
63
+
- "10113:10113"
64
+
volumes:
65
+
- spellcheck-dicts:/data/
55
66
56
67
volumes:
57
-
spellcheck-dicts:
68
+
spellcheck-dicts:
58
69
```
59
-
* Then run `docker-compose up`
70
+
71
+
- Then run `docker-compose up`
60
72
61
73
## Changelog
74
+
62
75
You cand find it here https://github.com/xfenix/spellcheck-microservice/releases
63
76
64
77
## Development
78
+
65
79
### Quickstart
66
-
* Clone this repo
67
-
* For MacOS X `brew install enchant`
68
-
* For Debian/Ubuntu `apt-get install -y enchant-2 hunspell-ru`
69
-
* `uv sync --group dev`
70
-
* `source .venv/bin/activate`
71
-
* Run `touch .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit`
72
-
* Paste following contents in file `.git/hooks/pre-commit`:
73
-
```sh
74
-
uv run make update-readme
75
-
git add README.md
76
-
```
77
-
* Execute `make` command to run local development server
80
+
81
+
- Clone this repo
82
+
- For MacOS X `brew install enchant`
83
+
- For Debian/Ubuntu `apt-get install -y enchant-2 hunspell-ru`
84
+
- `uv sync --group dev`
85
+
- `source .venv/bin/activate`
86
+
- Run `touch .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit`
87
+
- Paste following contents in file `.git/hooks/pre-commit`:
88
+
```sh
89
+
uv run make update-readme
90
+
git add README.md
91
+
```
92
+
- Execute `make` command to run local development server
78
93
79
94
### Notes
95
+
80
96
Default api-key for local development is `debug` (you will need this to work with user dictionaries API).
81
97
82
98
Please check [./Makefile](./Makefile) for more details
83
99
84
100
### Troubleshooting
101
+
85
102
For MacOS X on Apple Silicon add `PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.dylib` to your `.zprofile`
0 commit comments