|
| 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 | +. Login 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/image-proxy-tiny:<VERSION> |
| 22 | +---- |
| 23 | ++ |
| 24 | +Replace `<VERSION>` with `latest` or the specific version number. |
| 25 | + |
| 26 | +[NOTE] |
| 27 | +Currently, the Docker images are only supported on x86-64 (also known as AMD64) architecture processors. |
| 28 | +=== Specify Configurations |
| 29 | + |
| 30 | +After completing the previous steps, run the Docker container from the pulled image: |
| 31 | + |
| 32 | +[source, sh, subs="attributes+"] |
| 33 | +---- |
| 34 | +docker run -p 19040:19040 registry.containers.tiny.cloud/image-proxy-tiny:<VERSION> |
| 35 | +---- |
| 36 | + |
| 37 | +This triggers `-p 19040:19040`, exposing the service on `localhost:19040`. The service runs on port `19040` inside the Docker container, and this maps it to the same port on your localhost. |
| 38 | + |
| 39 | +If set up correctly, the logs should display output similar to the following: |
| 40 | + |
| 41 | +[source, log] |
| 42 | +---- |
| 43 | +2025-01-08 12:03:15 [io-compute-3] INFO emissary - emissary |
| 44 | +... |
| 45 | +2025-01-08 12:03:16 [io-compute-blocker-3] INFO emissary - -> Raw Config assembled from various sources: ConfigOrigin(merge of /ephox-image-proxy/ephox-image-proxy-docker-env.conf: 1,system properties,reference.conf @ jar:file:/ephox-image-proxy/ephox-image-proxy.jar!/reference.conf: 1) |
| 46 | +2025-01-08 12:03:16 [io-compute-blocker-3] WARN c.e.d.config.AllowedOriginsConfig$ - No allowed-origins specified in config! |
| 47 | +2025-01-08 12:03:16 [io-compute-blocker-3] INFO emissary - emissary config loaded successfully: EmissaryConfig(SdkHttpConfig(HttpConfig(100,10,10,3,HttpConfigTimeouts(10,10,10),JvmTrustModel()),None),OriginWhitelist(List(),OriginPrecision(true)),Some(10000000)) |
| 48 | +2025-01-08 12:03:17 [io-compute-1] INFO o.h.b.c.nio1.NIO1SocketServerGroup - Service bound to address /0:0:0:0:0:0:0:0:19040 |
| 49 | +2025-01-08 12:03:17 [io-compute-1] INFO o.h.blaze.server.BlazeServerBuilder - |
| 50 | + _ _ _ _ _ |
| 51 | + | |_| |_| |_ _ __| | | ___ |
| 52 | + | ' \\ _| _| '_ \\_ _(_-< |
| 53 | + |_||_\\__|\\__| .__/ |_|/__/ |
| 54 | + |_| |
| 55 | +2025-01-08 12:03:17 [io-compute-1] INFO o.h.blaze.server.BlazeServerBuilder - http4s v0.23.27 on blaze v0.23.16 started at http://[::]:19040/ |
| 56 | +---- |
| 57 | + |
| 58 | +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. |
| 59 | + |
| 60 | +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]. |
| 61 | + |
| 62 | +This configuration file requires at least the following information: |
| 63 | + |
| 64 | +* allowed-origins - Specifies the domains allowed to communicate with server-side editor features. This is **mandatory** for all server-side components. |
| 65 | + |
| 66 | +The following settings for the premium server-side components are optional and will apply to all services that make outgoing HTTP/HTTPS requests using the configuration file. |
| 67 | + |
| 68 | +* link:https://www.tiny.cloud/docs/tinymce/latest/configure-common-settings-services/#proxy[proxy configuration] |
| 69 | +* link:https://www.tiny.cloud/docs/tinymce/latest/configure-common-settings-services/#http[http configuration] |
| 70 | + |
| 71 | +The following settings for the Image Proxy service premium server-side component are optional: |
| 72 | + |
| 73 | +* link:https://www.tiny.cloud/docs/tinymce/latest/configure-imageproxy-service/#image-proxy[image-proxy configuration] |
| 74 | + |
| 75 | +=== Run the Docker Container |
| 76 | + |
| 77 | +The Docker container can also be run with `docker compose`. In this example, the following directory structure is assumed: |
| 78 | + |
| 79 | +[source,sh] |
| 80 | +---- |
| 81 | +tiny-image-proxy/ |
| 82 | +└── docker-compose.yaml # Docker Compose file to define and run the service |
| 83 | +└── application.conf # Configuration file for allowed origins and other settings |
| 84 | +---- |
| 85 | + |
| 86 | +Here is an example of the `application.conf` file with the basic configurations: |
| 87 | + |
| 88 | +[source, conf] |
| 89 | +---- |
| 90 | +ephox { |
| 91 | + allowed-origins { |
| 92 | + origins = [ |
| 93 | + "<http://example.com>", |
| 94 | + "<http://good.com> ", |
| 95 | + "*.my.company.org" |
| 96 | + ] |
| 97 | + } |
| 98 | +} |
| 99 | +---- |
| 100 | + |
| 101 | +Once the application configuration file is ready, proceed with the Docker Compose setup to configure and run the service. |
| 102 | + |
| 103 | +. Create the `docker-compose.yaml` file: |
| 104 | + |
| 105 | ++ |
| 106 | +[source, yaml] |
| 107 | +---- |
| 108 | +services: |
| 109 | + image-proxy-tiny: |
| 110 | + image: registry.containers.tiny.cloud/image-proxy-tiny:[version] |
| 111 | + ports: |
| 112 | + - "19040:19040" |
| 113 | + restart: always |
| 114 | + init: true |
| 115 | + volumes: |
| 116 | + - type: bind |
| 117 | + source: ./application.conf #change this to the path on your local machine |
| 118 | + target: /ephox-image-proxy/ephox-image-proxy-docker-env.conf |
| 119 | + read_only: true |
| 120 | +---- |
| 121 | + |
| 122 | +. Run the service (within the same directory where `docker-compose.yaml` was placed): |
| 123 | + |
| 124 | ++ |
| 125 | +[source, sh] |
| 126 | +---- |
| 127 | +docker compose up |
| 128 | +---- |
| 129 | + |
| 130 | ++ |
| 131 | +If the setup is correct, the initiation logs should appear as follows: |
| 132 | + |
| 133 | ++ |
| 134 | +[source, log] |
| 135 | +---- |
| 136 | + ✔ Container image-proxy-tiny-image-proxy-tiny-1 Created 0.0s |
| 137 | +Attaching to image-proxy-tiny-1 |
| 138 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-8] INFO emissary - emissary |
| 139 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-8] INFO emissary - * External Configuration |
| 140 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-8] INFO emissary - * External configuration via System Properties |
| 141 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * parseConfigSources |
| 142 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * looking up property: ephox.config.url |
| 143 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - -> Property not set |
| 144 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * looking up property: config.url |
| 145 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - -> Property not set |
| 146 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * parseConfigSources |
| 147 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * looking up property: ephox.config.file |
| 148 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - -> Found value for property: /ephox-image-proxy/ephox-image-proxy-docker-env.conf |
| 149 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * Parsing config defined by /ephox-image-proxy/ephox-image-proxy-docker-env.conf from property: ephox.config.file |
| 150 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - -> Processing file: /ephox-image-proxy/ephox-image-proxy-docker-env.conf |
| 151 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * External application.conf => /opt/ephox/application.conf |
| 152 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * Optional File (/opt/ephox/application.conf). Defaults to empty if file not found |
| 153 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * Internal Configuration |
| 154 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - -> No extra internal configuration specified - skipping |
| 155 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * Default (Reference) Configuration |
| 156 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - * Loading configuration files from classpath (reference.conf and integration.conf). Neither is required. |
| 157 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - -> Raw Config assembled from various sources: ConfigOrigin(merge of /ephox-image-proxy/ephox-image-proxy-docker-env.conf: 1,system properties,reference.conf @ jar:file:/ephox-image-proxy/ephox-image-proxy.jar!/reference.conf: 1) |
| 158 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO c.e.d.config.AllowedOriginsConfig$ - Read allowed-origins config (ignoring ports = true) as: |
| 159 | +image-proxy-tiny-1 | - good.com |
| 160 | +image-proxy-tiny-1 | - example.com |
| 161 | +image-proxy-tiny-1 | 2025-01-08 15:02:36 [io-compute-blocker-8] INFO emissary - emissary config loaded successfully: EmissaryConfig(SdkHttpConfig(HttpConfig(100,10,10,3,HttpConfigTimeouts(10,10,10),JvmTrustModel()),None),OriginWhitelist(List(good.com, example.com),OriginPrecision(true)),Some(10000000)) |
| 162 | +image-proxy-tiny-1 | 2025-01-08 15:02:37 [io-compute-1] INFO o.h.b.c.nio1.NIO1SocketServerGroup - Service bound to address /0:0:0:0:0:0:0:0:19040 |
| 163 | +image-proxy-tiny-1 | 2025-01-08 15:02:37 [io-compute-1] INFO o.h.blaze.server.BlazeServerBuilder - |
| 164 | +image-proxy-tiny-1 | _ _ _ _ _ |
| 165 | +image-proxy-tiny-1 | | |_| |_| |_ _ __| | | ___ |
| 166 | +image-proxy-tiny-1 | | ' \\ _| _| '_ \\_ _(_-< |
| 167 | +image-proxy-tiny-1 | |_||_\\__|\\__| .__/ |_|/__/ |
| 168 | +image-proxy-tiny-1 | |_| |
| 169 | +image-proxy-tiny-1 | 2025-01-08 15:02:37 [io-compute-1] INFO o.h.blaze.server.BlazeServerBuilder - http4s v0.23.27 on blaze v0.23.16 started at http://[::]:19040/ |
| 170 | +---- |
| 171 | + |
| 172 | +=== Next Steps |
| 173 | + |
| 174 | +. Test the service via cURL command |
| 175 | + |
| 176 | ++ |
| 177 | +To verify that the Image Proxy service is set up and functioning correctly within the container, ensure the service is running on port `19040`. 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. |
| 178 | + |
| 179 | ++ |
| 180 | +To check the service is running use: |
| 181 | + |
| 182 | ++ |
| 183 | +[source, sh] |
| 184 | +---- |
| 185 | +curl http://localhost:19040/version |
| 186 | +---- |
| 187 | + |
| 188 | ++ |
| 189 | +An example output is: `2.111.1` |
| 190 | + |
| 191 | ++ |
| 192 | +To confirm that a request is being sent to the Image Proxy service, use: |
| 193 | + |
| 194 | ++ |
| 195 | +[source, sh] |
| 196 | +---- |
| 197 | +curl --location 'http://localhost:19040/2/image?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsrikomm%2FBMP-EDITING%2Frefs%2Fheads%2Fmaster%2Fsrc%2FInputs%2Ffish.bmp' \\ |
| 198 | +--header 'Origin: http://good.com' |
| 199 | +---- |
| 200 | + |
| 201 | ++ |
| 202 | +Finally, to verify if a request is unauthorized and originates from an incorrect origin, use: |
| 203 | + |
| 204 | ++ |
| 205 | +[source, sh] |
| 206 | +---- |
| 207 | +curl --location 'http://localhost:19040/2/image?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsrikomm%2FBMP-EDITING%2Frefs%2Fheads%2Fmaster%2Fsrc%2FInputs%2Ffish.bmp' \\ |
| 208 | +--header 'Origin: http://bad.com' |
| 209 | +---- |
| 210 | + |
| 211 | ++ |
| 212 | +If an error occurs, the expected message is: `{ "message": "The supplied authentication is not authorized to access this resource" }`. |
| 213 | + |
| 214 | +. Test directly in {productname} |
| 215 | + |
| 216 | ++ |
| 217 | +Before deploying, it is recommended to test this service within the {productname} editor itself. |
| 218 | + |
| 219 | ++ |
| 220 | +To do this, configure the xref:editimage.adoc[{pluginname}] feature in the editor and call it via `tinymce.init`. If running locally on the default port `19040`, use the following settings: |
| 221 | + |
| 222 | ++ |
| 223 | +[source, js] |
| 224 | +---- |
| 225 | +tinymce.init({ |
| 226 | + selector: 'textarea', // change this value according to your HTML |
| 227 | + toolbar: 'image', |
| 228 | + plugins: 'image editimage', |
| 229 | + editimage_cors_hosts: [ 'example.com', 'good.com' ], |
| 230 | + editimage_proxy_service_url: "http://localhost:19040" |
| 231 | +}); |
| 232 | +---- |
0 commit comments