diff --git a/Readme.md b/Readme.md deleted file mode 100644 index 1da33b5837e7e6c4097d8f125472257d9904ebe5..0000000000000000000000000000000000000000 --- a/Readme.md +++ /dev/null @@ -1,57 +0,0 @@ -# dacap - -*Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough. - -## Requirements - -* node >= v8.2.1 -* npm >= v5.3.0 - -## Install the service - -```bash -$# npm install -g dacap -``` - -## Start the service -``` bash -$# dacap -``` - -The Admin Interface is now available under http://localhost:3000/admin - -You can customize multiple values, see [#Advanced Configuration] - -## Usage - -First of all one has to define a *Cache* where the requests to an API-Endpoint are stored. This is done from within the Admin Interface. - -One has to define the URL to the desired *API-Endpoint* (e.g. `http://foo.example.com/`) and a *Cache-Name* for this API-Endpoint (e.g. `foo`). All API-Requests which normally would go to - - http://foo.example.com/?query=foo&offset=0&limit=10 - -now you can request by accessing - - http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10 - -* *Be sure to append the Slash after the Cache-Name, otherwise the Endpoint cannot be resolved.* -* *Everything after the Cache-Name and Slash will be passed to the API-Endpoint.* - -## Advanced Configuration - -The service can be configured by environment variables. The following are available: - -* `data_dir`: specifies the folder where the cache is stored in intervals. This is only used to - make it more easy to restart the service without adding all Endpoints again. After restart the - service reads the saved cache-file and keeps it in memory. - By default this points to the `data`-folder where the process was invoked. Make sure it can be created if not existing and written if already existing. -* `proxy_path`: this is the path where the Endpoints will be accessable after registering. By default this is `/ep/` -* `proxy_port`: this is the port number where the service is listening. Defaults to `3000` -* `proxy_url`: this is the absolute url of the service with protocol and port if differing from the defaults (e.g. `http://api.example.com:8080`). Set this if you use a different domain name than `localhost` to connect to this service. -* `cache_ttl`: the time-to-live in seconds of a cached request. after this time the cache will be refreshed. Defaults to `600` -* `default_check_period`: specifies the interval in seconds the cache is checked for expiry. Defaults to `60` -* `array_value_size`: unkown configuration. Defaults to `40` -* `object_value_size`: unkown configuration. Defaults to `80` -* `autosave_interval`: specifies the interval the cache is stored to harddisk. defaults to `60`; -* `register_name`: specifies the name of the register where the cache is stored. Defaults to `api-cache`; - diff --git a/Readme.md b/Readme.md new file mode 120000 index 0000000000000000000000000000000000000000..55343a6a237b52ab0bf60a1d4dae679dc969aa78 --- /dev/null +++ b/Readme.md @@ -0,0 +1 @@ +docs/Readme.md \ No newline at end of file diff --git a/docs/Readme.md b/docs/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..9c36af5967cebdbdc3c8deee7a93859c5355f57b --- /dev/null +++ b/docs/Readme.md @@ -0,0 +1,68 @@ +# dacap + +*Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough. + +## Requirements + +* node >= v8.2.1 +* npm >= v5.3.0 + +## local Execution + +### Installation + +```bash +$# npm install -g dacap +``` +### Execution + +``` bash +$# dacap +``` + +## as Container + +```bash +$# docker run -p 3000:3000 -v /my/hosts/data/folder:/data ubleipzig/dacap +``` + +You can customize multiple values, see [Advanced Configuration](#Advanced Configuration) + +## Usage + +After Start the Admin-Interface is available under `http://localhost:3000/admin`. + +First of all one has to define a *Cache* where the requests to an API-Endpoint are stored. This is done from within the Admin Interface. + +One has to define the URL to the desired *API-Endpoint* (e.g. `http://foo.example.com/`) and a *Cache-Name* for this API-Endpoint (e.g. `foo`). + +All API-Requests which normally would go to + +`http://foo.example.com/?query=foo&offset=0&limit=10` + +now you can request by accessing + +`http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10` + +* *Be sure to append the Slash after the Cache-Name, otherwise the Endpoint cannot be resolved.* +* *Everything after the Cache-Name and Slash will be passed to the API-Endpoint.* + +## Advanced Configuration + +The service can be configured by environment variables. The following are available: + +* `data_dir`: Specifies the folder where the cache is stored in intervals. This is only used to + make it more easy to restart the service without adding all Endpoints again. After restart the + service reads the saved cache-file and keeps it in memory. + By default this points to the `data`-folder where the process was invoked. Make sure it can be created if not existing and written if already existing. +* `proxy_path`: Specifies the path where the Endpoints will be accessable after registering. By default this is `/ep/`. +* `proxy_port`: Specifies the port number where the service is listening. Defaults to `3000`. +* `proxy_url`: Specifies the absolute url of the service with protocol and port if differing from the defaults +(e.g. `https://api.example.com:8443/dacap`). Defaults to `http://localhost:${proxy_port}`. +* `cache_ttl`: Specifies the time-to-live in seconds of a cached request. after this time the cache will be refreshed. Defaults to `600` +* `default_check_period`: Specifies the interval in seconds the cache is checked for expiry. Defaults to `60` +* `array_value_size`: Unkown configuration. Defaults to `40` +* `object_value_size`: Unkown configuration. Defaults to `80` +* `autosave_interval`: Specifies the interval the cache is stored to harddisk. Defaults to `60`. +* `register_name`: Specifies the name of the register where the cache is stored. Defaults to `api-cache`. +* `strip_path`: Specifies whether the path should be stripped when processing requests. Defaults to `true`. diff --git a/docs/index.md b/docs/index.md index f76dce868420ba15f2d6259f531193b8d6fba1a3..d1ed6ba9f2cfaf382633fcfc39d29f3d95c9c90a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,57 +1,76 @@ # dacap -*Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough. +*Dynamic And Compressing Api Proxy* ist ein Dienst, der Ausgaben beliebiger API-Endpunkte zwischenspeichert. Der Dienst wurde erstellt, um API-Requests, welche durch den zur Verfügung stellenden Service nicht performant genug ausgeliefert werden können, zwischenzuspeichern und aus dem Cache auszuliefern zu können. Zusätzlich wird das Response gzip-komprimiert ausgeliefert und die Cache-Daten werden in einem eingestellten Interval im Hintergrund erneuert. -## Requirements +## Abhängigkeiten * node >= v8.2.1 * npm >= v5.3.0 -## Install the service +## lokale Ausführung + +### Installation ```bash $# npm install -g dacap ``` +### Ausführung -## Start the service ``` bash $# dacap ``` -The Admin Interface is now available under http://localhost:3000/admin +## als Container + +```bash +$# docker run -p 3000:3000 -v /my/hosts/data/folder:/data ubleipzig/dacap +``` + +Die Konfiguration wird über Umgebungsvariablen durchgeführt, siehe [erweiterte Konfiguration](#erweiterte Konfiguration) + +## Benutzung + +Nach dem Start ist das Admin-Interface unter `http://localhost:3000/admin` verfügbar -You can customize multiple values, see [#Advanced Configuration] +Als erstes wird ein *Cache* definiert, in dem die Ergebnisse der Anfragen an einen API-Endpunkt gespeichert werden. -## Usage +Unter *API-Endpoint* wird die URL eingetragen, die zum Service führt (z.B. `http://foo.example.com/`),Unter *Cache-Name* wird eine Bezeichnung für den Service eingetragen, (z.B. `foo`). -First of all one has to define a *Cache* where the requests to an API-Endpoint are stored. This is done from within the Admin Interface. +Alle Anfragen, die normalerweise an -One has to define the URL to the desired *API-Endpoint* (e.g. `http://foo.example.com/`) and a *Cache-Name* for this API-Endpoint (e.g. `foo`). All API-Requests which normally would go to +`http://foo.example.com/?query=foo&offset=0&limit=10` - http://foo.example.com/?query=foo&offset=0&limit=10 +gehen würden, können nun unter -now you can request by accessing +`http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10` - http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10 +abgefragt werden. -* *Be sure to append the Slash after the Cache-Name, otherwise the Endpoint cannot be resolved.* -* *Everything after the Cache-Name and Slash will be passed to the API-Endpoint.* +* *nach dem Cache-Name ist zwingend ein Slash erforderlich, andernfalls kann der Endpunkt nicht aufgelöst werden.* +* *alles, was nach Cache-Name und Slash folgt, wird an den API-Endpunkt angehängt.* -## Advanced Configuration +## Erweiterte Konfiguration -The service can be configured by environment variables. The following are available: +Der Dienst lässt sich über Umgebungsvariablen konfigurieren, die beim Start des Dienstes ausgewertet werden: -* `data_dir`: specifies the folder where the cache is stored in intervals. This is only used to - make it more easy to restart the service without adding all Endpoints again. After restart the - service reads the saved cache-file and keeps it in memory. - By default this points to the `data`-folder where the process was invoked. Make sure it can be created if not existing and written if already existing. -* `proxy_path`: this is the path where the Endpoints will be accessable after registering. By default this is `/ep/` -* `proxy_port`: this is the port number where the service is listening. Defaults to `3000` -* `proxy_url`: this is the absolute url of the service with protocol and port if differing from the defaults (e.g. `http://api.example.com:8080`). Set this if you use a different domain name than `localhost` to connect to this service. -* `cache_ttl`: the time-to-live in seconds of a cached request. after this time the cache will be refreshed. Defaults to `600` -* `default_check_period`: specifies the interval in seconds the cache is checked for expiry. Defaults to `60` -* `array_value_size`: unkown configuration. Defaults to `40` -* `object_value_size`: unkown configuration. Defaults to `80` -* `autosave_interval`: specifies the interval the cache is stored to harddisk. defaults to `60` -* `register_name`: specifies the name of the register where the cache is stored. Defaults to `api-cache` -* `strip_path`: specifies whether the path should be stripped when processing requests +* `data_dir`: Spezifiziert den Ordner, wo der Cache in regelmäßigen Abständen gespeichert wird. +Cache und Endpunkte werden im Arbeitspeicher gehalten. Nach dem Neustart des Dienstes wird die Datei ausgelesen +und vorhandene Endpunkte und Caches in den Arbeitspeicher geladen. +Standardmäßig ist dieser Ordner der `data`-Ordner in dem Ordner, aus dem der Prozess gestartet wurde (Im Container der Root-Ordner) +Es ist sicherzustellen, dass der erstellt werden kann oder für den Dienst schreibbar ist, wenn er bereits existiert. +* `proxy_path`: Spezifiziert den Pfad an dem der Endpunkt nach der Registrierung mit seinem Cache-Namen erreichbar ist. +Standardmäßig `/ep/`. +* `proxy_port`: Spezifiziert den Port, an dem der Dienst hört. Standardmäßig `3000` +* `proxy_url`: Spezifiziert die absolute URL des Dienstes mit Protokoll-Schema, Port und Pfad (z.B. `https://api.example.com:8443/dacap`) +Standardmäßig `http://localhost:${proxy_port}`. +* `cache_ttl`: Spezifiziert die time-to-live in Sekunden für ein Cache-Ergebnis. Nach dieser Zeit wird das +Ergebnis erneuert. Standardmäßig `600`. +* `default_check_period`: spezifiziert das Intervall in Sekunden, in dem die Ablauf-Frist aller Cache-Ergebnisse geprüft wird. +Standardmäßig `60`. +* `array_value_size`: Unbekannte Konfiguration. Defaults to `40` +* `object_value_size`: Unbekannte Konfiguration. Defaults to `80` +* `autosave_interval`: Spezifiziert das Intervall, in dem alle Cache-Ergebnisse und Endpunkt-Konfiguration in eine Datei +geschrieben werden. Standardmäßig `60`. +* `register_name`: Spezifiziert den Namen des Registers, in dem alle Cache-Ergebnisse und Endpunkt-Konfigurationen +gespeichert werden (ist gleichzeitig der Dateiname). Standardmäßig `api-cache`. +* `strip_path`: Spezifiziert, ob der Pfad der Url entfernt werden soll. Standardmäßig `true`. diff --git a/mkdocs.yml b/mkdocs.yml index 8ed4d43fc227511d84f2573b877fcc80377eeca7..1b1e68de99b7ab9644897c850c2d8e3f3557d953 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1 +1,5 @@ site_name: dacap + +pages: + - Deutsch: "index.md" + - English: "Readme.md" \ No newline at end of file