|
| 1 | +[[installation]] |
| 2 | +== Installation |
| 3 | + |
| 4 | +[IMPORTANT] |
| 5 | +A valid access token is **required** in order to retrieve On-Premises services images from {companyname} Cloud Docker Registry. |
| 6 | +link:https://www.tiny.cloud/contact/[Contact {companyname} Support^] to request the access token. |
| 7 | + |
| 8 | +=== Retrieve Docker Image |
| 9 | + |
| 10 | +. Log into the {companyname} Cloud Docker Registry: |
| 11 | ++ |
| 12 | +[source, sh, subs="attributes+"] |
| 13 | +---- |
| 14 | +docker login -u tiny -p [access-token] registry.containers.tiny.cloud |
| 15 | +---- |
| 16 | + |
| 17 | +. Pull the Docker Image from the Docker registry: |
| 18 | ++ |
| 19 | +[source, sh, subs="attributes+"] |
| 20 | +---- |
| 21 | +docker pull registry.containers.tiny.cloud/spelling-tiny:<VERSION> |
| 22 | +---- |
| 23 | + |
| 24 | ++ |
| 25 | +Replace `<VERSION>` with `latest` or the specific version number. |
| 26 | ++ |
| 27 | +[NOTE] |
| 28 | +Currently, the Docker images are only supported on x86-64 (also known as AMD64) architecture processors. |
| 29 | + |
| 30 | +=== Specify Configurations |
| 31 | + |
| 32 | +After completing the previous steps, run the Docker container from the pulled image: |
| 33 | + |
| 34 | +[source, sh, subs="attributes+"] |
| 35 | +---- |
| 36 | +docker run -p 18080:18080 registry.containers.tiny.cloud/spelling-tiny:<VERSION> |
| 37 | +---- |
| 38 | + |
| 39 | +This triggers `-p 18080:18080`, exposing the service on `localhost:18080`. The service runs on port `18080` inside the Docker container, and this maps it to the same port on your localhost. |
| 40 | + |
| 41 | +If set up correctly, the logs should display output similar to the following: |
| 42 | + |
| 43 | +[source, log] |
| 44 | +---- |
| 45 | +2024-12-05 11:30:50.813Z [io-compute-9] INFO ironbark - ironbark |
| 46 | +... |
| 47 | +2024-12-05 11:30:51.166Z [io-compute-blocker-9] INFO ironbark - -> Raw Config assembled from various sources: ConfigOrigin(merge of /ephox-spelling/ephox-spelling-docker-env.conf: 1,system properties,reference.conf @ jar:file:/ephox-spelling/ephox-spelling.jar!/reference.conf: 1) |
| 48 | +2024-12-05 11:30:51.206Z [io-compute-blocker-9] WARN c.e.d.config.AllowedOriginsConfig$ - No allowed-origins specified in config! |
| 49 | +2024-12-05 11:30:51.219Z [io-compute-blocker-9] INFO ironbark - ironbark config loaded successfully: IronbarkConfig(Logger[ironbark],SpellingConfig(None,Some(200),None,false),OriginWhitelist(List(),OriginPrecision(true)),None,None,StaticCustomDictionaryScanConfig) |
| 50 | +2024-12-05 11:30:51.275Z [io-compute-blocker-9] INFO com.ephox.nectar.data.Bees$ - Loading all dictionaries from WinterTree |
| 51 | +2024-12-05 11:30:51.677Z [io-compute-blocker-6] INFO com.ephox.nectar.data.Bees$ - Loading all dictionaries from WinterTree |
| 52 | +2024-12-05 11:30:52.127Z [io-compute-7] INFO o.h.b.c.nio1.NIO1SocketServerGroup - Service bound to address /0:0:0:0:0:0:0:0:18080 |
| 53 | +2024-12-05 11:30:52.131Z [io-compute-7] INFO o.h.blaze.server.BlazeServerBuilder - |
| 54 | + _ _ _ _ _ |
| 55 | + | |_| |_| |_ _ __| | | ___ |
| 56 | + | ' \\ _| _| '_ \\_ _(_-< |
| 57 | + |_||_\\__|\\__| .__/ |_|/__/ |
| 58 | + |_| |
| 59 | +2024-12-05 11:30:52.145Z [io-compute-7] INFO o.h.blaze.server.BlazeServerBuilder - http4s v0.23.27 on blaze v0.23.16 started at http://[::]:18080/ |
| 60 | +---- |
| 61 | + |
| 62 | +Running this command will generate a log warning about `allowed-origins` not being configured. This is expected, as it will be set up in the next step. |
| 63 | + |
| 64 | +The {productname} server-side components require a configuration file to function correctly. By convention, this file is named `application.conf`. For more information, refer to link:https://www.tiny.cloud/docs/tinymce/latest/configure-required-services/[Required configuration for the server-side components]. |
| 65 | + |
| 66 | +This configuration file requires at least the following information: |
| 67 | + |
| 68 | +* `allowed-origins`: Specifies the domains allowed to communicate with server-side editor features. This is **mandatory** for all server-side components. |
| 69 | + |
| 70 | +By default, the {pluginname} plugin comes with Hunspell dictionaries for link:https://www.tiny.cloud/docs/tinymce/latest/introduction-to-tiny-spellchecker/#supported-languages[supported languages]. For additional configurations, the service supports the following options in the `application.conf` file: |
| 71 | + |
| 72 | +* `custom-dictionaries-path`: Sets the path to where the file or directory is mounted in the container. For more information on how to set up custom dictionaries, refer to link:https://www.tiny.cloud/docs/tinymce/latest/custom-dictionaries-for-tiny-spellchecker/[Adding custom dictionaries]. |
| 73 | +* `dynamic-custom-dictionaries`: When set to true, the {pluginname} service periodically checks the dictionary files in `custom-dictionaries-path` for changes and updates the custom dictionaries at runtime without requiring a service restart. The default value is `false`. |
| 74 | + |
| 75 | +[NOTE] |
| 76 | +Enabling the `dynamic-custom-dictionaries` option introduces some performance overhead, which may result in a wait time for the custom dictionaries to load. |
| 77 | + |
| 78 | +=== Run the Docker Container |
| 79 | + |
| 80 | +The Docker container can also be run with `docker compose`. In this example, the following directory structure is assumed: |
| 81 | + |
| 82 | +[source,sh] |
| 83 | +---- |
| 84 | +spelling-service/ |
| 85 | +└── resources/ |
| 86 | + ├── custom-dictionaries |
| 87 | + └── hunspell-dictionaries |
| 88 | +└── application.conf |
| 89 | +└── docker-compose.yaml |
| 90 | +---- |
| 91 | + |
| 92 | +Here is an example of the `application.conf` file with the basic configurations: |
| 93 | + |
| 94 | +[source, conf] |
| 95 | +---- |
| 96 | +ephox { |
| 97 | +
|
| 98 | + allowed-origins { |
| 99 | + origins = [ |
| 100 | + "<http://example.com>", |
| 101 | + "<http://good.com> ", |
| 102 | + "*.my.company.org" |
| 103 | + ] |
| 104 | + } |
| 105 | + |
| 106 | + spelling { |
| 107 | + custom-dictionaries-path = "/app/resources/custom-dictionaries" |
| 108 | + hunspell-dictionaries-path = "/app/resources/hunspell-dictionaries" |
| 109 | + } |
| 110 | +} |
| 111 | +---- |
| 112 | + |
| 113 | +. Create the `docker-compose.yaml` file: |
| 114 | + |
| 115 | ++ |
| 116 | +Here is an example of how to set up the file given the above directory structure and `application.conf` file: |
| 117 | + |
| 118 | ++ |
| 119 | +[source, yaml] |
| 120 | +---- |
| 121 | +services: |
| 122 | + spelling-tiny: |
| 123 | + image: registry.containers.tiny.cloud/spelling-tiny:<VERSION> |
| 124 | + ports: |
| 125 | + - "18080:18080" |
| 126 | + restart: always |
| 127 | + init: true |
| 128 | + volumes: |
| 129 | + - type: bind |
| 130 | + source: ./application.conf |
| 131 | + target: /ephox-spelling/ephox-spelling-docker-env.conf |
| 132 | + read_only: true |
| 133 | + - type: bind |
| 134 | + source: ./resources/custom-dictionaries |
| 135 | + target: /app/resources/custom-dictionaries |
| 136 | + read_only: true |
| 137 | + - type: bind |
| 138 | + source: ./resources/hunspell-dictionaries |
| 139 | + target: /app/resources/custom-dictionaries |
| 140 | + read_only: true |
| 141 | +---- |
| 142 | + |
| 143 | ++ |
| 144 | +[NOTE] |
| 145 | +Ensure the `target` path in the `volumes` option matches the `custom-dictionaries-path` and `hunspell-dictionaries-path` in the `application.conf` file. |
| 146 | + |
| 147 | +. Run the service (within the same directory where `docker-compose.yaml` was placed): |
| 148 | + |
| 149 | ++ |
| 150 | +[source, sh] |
| 151 | +---- |
| 152 | +docker compose up |
| 153 | +---- |
| 154 | + |
| 155 | ++ |
| 156 | +If the allowed origins, Hunspell, and custom dictionaries folders are configured correctly, the initiation logs should appear as follows: |
| 157 | + |
| 158 | ++ |
| 159 | +[source, log] |
| 160 | +---- |
| 161 | +[+] Running 2/2 |
| 162 | + ✔ Network spelling-tiny_default Created 0.0s |
| 163 | + ✔ Container spelling-tiny-spelling-tiny-1 Created 0.1s |
| 164 | +Attaching to spelling-tiny-1 |
| 165 | +spelling-tiny-1 | 2025-02-11 09:51:10.332Z [io-compute-5] INFO ironbark - ironbark |
| 166 | +... |
| 167 | +spelling-tiny-1 | 2025-02-11 09:51:10.736Z [io-compute-blocker-5] INFO ironbark - -> Raw Config assembled from various sources: ConfigOrigin(merge of /ephox-spelling/ephox-spelling-docker-env.conf: 1,system properties,reference.conf @ jar:file:/ephox-spelling/ephox-spelling.jar!/reference.conf: 1) |
| 168 | +spelling-tiny-1 | 2025-02-11 09:51:10.814Z [io-compute-blocker-5] INFO c.e.d.config.AllowedOriginsConfig$ - Read allowed-origins config (ignoring ports = true) as: |
| 169 | +spelling-tiny-1 | - example.com |
| 170 | +spelling-tiny-1 | - good.com |
| 171 | +spelling-tiny-1 | - my.company.org |
| 172 | +spelling-tiny-1 | 2025-02-11 09:51:10.822Z [io-compute-blocker-5] INFO ironbark - ironbark config loaded successfully: IronbarkConfig(Logger[ironbark],SpellingConfig(None,Some(200),None,5,0.8),OriginWhitelist(List(example.com, good.com, my.company.org),OriginPrecision(true)),Some(CustomDictionaryPath(/app/resources/custom-dictionaries)),Some(HunspellDictionaryPath(/app/resources/hunspell-dictionaries)),StaticCustomDictionaryScanConfig) |
| 173 | +spelling-tiny-1 | 2025-02-11 09:51:11.101Z [io-compute-blocker-6] INFO c.e.i.d.StaticCustomDictionaries$ - Using custom dictionary: [global] = 2 words in engine Hunspell |
| 174 | +spelling-tiny-1 | 2025-02-11 09:51:11.104Z [io-compute-blocker-6] INFO c.e.i.d.StaticCustomDictionaries$ - Using custom dictionary: [global] = 2 words in engine WinterTree |
| 175 | +spelling-tiny-1 | 2025-02-11 09:51:11.161Z [io-compute-blocker-6] INFO com.ephox.nectar.data.Bees$ - Loading all dictionaries from WinterTree |
| 176 | +spelling-tiny-1 | 2025-02-11 09:51:11.482Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale es |
| 177 | +spelling-tiny-1 | 2025-02-11 09:51:11.536Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for es |
| 178 | +spelling-tiny-1 | 2025-02-11 09:51:11.537Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale pt_BR |
| 179 | +spelling-tiny-1 | 2025-02-11 09:51:11.881Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for pt_BR |
| 180 | +... |
| 181 | +spelling-tiny-1 | 2025-02-11 09:51:13.593Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale de_DE |
| 182 | +spelling-tiny-1 | 2025-02-11 09:51:13.651Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for de_DE |
| 183 | +spelling-tiny-1 | 2025-02-11 09:51:14.142Z [io-compute-9] INFO o.h.b.c.nio1.NIO1SocketServerGroup - Service bound to address /0:0:0:0:0:0:0:0:18080 |
| 184 | +spelling-tiny-1 | 2025-02-11 09:51:14.146Z [io-compute-9] INFO o.h.blaze.server.BlazeServerBuilder - |
| 185 | +spelling-tiny-1 | _ _ _ _ _ |
| 186 | +spelling-tiny-1 | | |_| |_| |_ _ __| | | ___ |
| 187 | +spelling-tiny-1 | | ' \\ _| _| '_ \\_ _(_-< |
| 188 | +spelling-tiny-1 | |_||_\\__|\\__| .__/ |_|/__/ |
| 189 | +spelling-tiny-1 | |_| |
| 190 | +spelling-tiny-1 | 2025-02-11 09:51:14.162Z [io-compute-9] INFO o.h.blaze.server.BlazeServerBuilder - http4s v0.23.27 on blaze v0.23.16 started at http://[::]:18080/ |
| 191 | +---- |
| 192 | + |
| 193 | +=== Next Steps |
| 194 | + |
| 195 | +. Test the service via `cURL` command |
| 196 | + |
| 197 | ++ |
| 198 | +To verify that the {pluginname} service is set up and functioning correctly within the container, ensure the service is running on port `18080`. Once active, it should be ready to receive requests. The expected outputs below confirm proper configuration, assuming `http://good.com` is in the allowed origins and `http://bad.com` is not. |
| 199 | + |
| 200 | ++ |
| 201 | +To check the service is running, use: |
| 202 | + |
| 203 | ++ |
| 204 | +[source, sh] |
| 205 | +---- |
| 206 | +curl http://localhost:18080/version |
| 207 | +---- |
| 208 | + |
| 209 | ++ |
| 210 | +An example output is: `2.127.0` |
| 211 | + |
| 212 | ++ |
| 213 | +To confirm that a request is being sent to the {pluginname} service, use: |
| 214 | + |
| 215 | ++ |
| 216 | +[source, sh] |
| 217 | +---- |
| 218 | +curl http://localhost:18080/2/check -d '{"words": ["teh"], "language": "en_US"}' -H "Origin: http://good.com" -H "Content-Type: application/json" |
| 219 | +---- |
| 220 | + |
| 221 | ++ |
| 222 | +Finally, to verify if a request is unauthorized and originates from an incorrect origin, use: |
| 223 | + |
| 224 | ++ |
| 225 | +[source, sh] |
| 226 | +---- |
| 227 | +curl http://localhost:18080/2/check -d '{"words": ["teh"], "language": "en_US"}' -H "Origin: http://bad.com" -H "Content-Type: application/json" |
| 228 | +---- |
| 229 | + |
| 230 | ++ |
| 231 | +If an error occurs, the expected message is: `{ "message": "The supplied authentication is not authorized to access this resource" }`. |
| 232 | + |
| 233 | +. Test directly in {productname} |
| 234 | + |
| 235 | ++ |
| 236 | +Before deploying, it is recommended to test this service within the {productname} editor itself. |
| 237 | + |
| 238 | ++ |
| 239 | +To do this, configure the link:https://www.tiny.cloud/docs/tinymce/latest/introduction-to-tiny-spellchecker/[{pluginname}] feature in the editor and call it via `tinymce.init`. If running locally on the default port `18080`, use the following settings: |
| 240 | + |
| 241 | ++ |
| 242 | +[source, js] |
| 243 | +---- |
| 244 | +tinymce.init({ |
| 245 | + selector: 'textarea#spellchecker', // change this value according to your HTML |
| 246 | + plugins: 'code tinymcespellchecker link', |
| 247 | + toolbar: 'spellchecker language spellcheckdialog', |
| 248 | + spellchecker_language: 'en_US', |
| 249 | + spellchecker_rpc_url: "http://localhost:18080" |
| 250 | +}); |
| 251 | +---- |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
| 256 | + |
0 commit comments