From b624ed342657f6a574059734f0399ba8539d6c82 Mon Sep 17 00:00:00 2001 From: Rainer Killinger Date: Wed, 13 Mar 2019 10:57:58 +0100 Subject: [PATCH] fix: remove reasons of linting errors --- README.md | 29 ++++++++++++++++++++--------- test/Main.spec.ts | 1 - 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2f5fdc41..ffd0bd43 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # proxy + This proxy is based on NGINX. The NGINX configuration is generated by a simple Node.js script which parses the docker socket. NGINX acts as a reverse proxy server. The Node.js script reads the docker socket file to generate a configuration for each running docker container. The base template for configuration is `nginx.conf.template` @@ -6,42 +7,50 @@ All `*.template` files are written with [mustache-js](https://github.com/janl/mu The templates are assembled by the Node.js program. ## Docker Mapping + The Node.js script reads out the `/var/run/docker.sock` to get the containers of the host system via [dockerode](https://github.com/apocas/dockerode "GitHub"). **Important:** The proxy expects your backend containers to provide following structure: + * `stapps.version`-label of docker container to be set to a valid active version. See configuration.... -* Service name for the backend container should be `backend` in docker-compose.yml. If you don't use docker-compose +* Service name for the backend container should be `backend` in docker-compose.yml. If you don't use docker-compose set `com.docker.compose.service`-label to `backend`. * The proxy container to run with `--net="host"` * A port exposed to the host machine. If you want to expose it only to the host machines internal loopback use following + syntax: `127.0.0.1:3000-3500:3000` in docker-compose or docker ports configuration. This will attach the internal 3000 port to the host's loopback on any port between 3000-3500. The proxy will see in the docker.sock which port and ip was chosen. Internal loopback should be 127.0.0.1 tho. ## Configuration (Status Codes) + Config files can be added by multiple universities (adding files like `config/default-b-tu`) and selected via the `NODE_APP_INSTANCE` environment variable. -- OutdatedVersions return a `HTTP 404` -- ActiveVersions return a `HTTP 503` if currently unavailable or the given code by running backend-node -- Unsupported versions (not configured as outdated or active) return a `HTTP 404` -- No version header given returns a `HTTP 300` +* OutdatedVersions return a `HTTP 404` +* ActiveVersions return a `HTTP 503` if currently unavailable or the given code by running backend-node +* Unsupported versions (not configured as outdated or active) return a `HTTP 404` +* No version header given returns a `HTTP 300` **NOTE:** The default configuration expects the client to set a version header: `X-StApps-Version=` ## Logger -The proxy uses [@stapps/logger](https://gitlab.tubit.tu-berlin.de/stapps/logger). You can provide `NODE_ENV=production` -and SMTP-Configuration via environment-variables for monitoring in production use. -# Usage +The proxy uses [@stapps/logger](https://gitlab.tubit.tu-berlin.de/stapps/logger). You can provide `NODE_ENV=production` +and SMTP-Configuration via environment-variables for monitoring in production use. + +## Usage + Without ssl: + ```sh docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --net="host" gitlab-registry.tubit.tu-berlin.de/stapps/proxy/master ``` With ssl: + ```sh docker run --rm --net="host" \ -v /var/run/docker.sock:/var/run/docker.sock \ @@ -52,12 +61,14 @@ docker run --rm --net="host" \ gitlab-registry.tubit.tu-berlin.de/stapps/proxy/master ``` -# Static Folder (docker run option: `-v :/static`) +## Static Folder (docker run option: `-v :/static`) + Der Zugriff erfolgt über: `http(s):///_static/` Beispiel Proxy auf Localhost für die Datei `static/test.json`: `http://localhost/_static/test.json` ## Bilder im Static Folder + Bilder sollten folgendermaßen abgelegt und benannt werden: `//-.[jpg|png|gif]` diff --git a/test/Main.spec.ts b/test/Main.spec.ts index 8a11005d..6d7f1fe8 100644 --- a/test/Main.spec.ts +++ b/test/Main.spec.ts @@ -139,7 +139,6 @@ class ContainerInfoParsing { done(); } - @test checkIfContainerMatches(done: () => void) { expect(containerMatchesRegex(