mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 05:52:57 +00:00
fix: remove reasons of linting errors
This commit is contained in:
committed by
Rainer Killinger
parent
8fe6a2795f
commit
b624ed3426
23
README.md
23
README.md
@@ -1,4 +1,5 @@
|
|||||||
# proxy
|
# proxy
|
||||||
|
|
||||||
This proxy is based on NGINX. The NGINX configuration is generated by a simple Node.js script which parses
|
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
|
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`
|
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.
|
The templates are assembled by the Node.js program.
|
||||||
|
|
||||||
## Docker Mapping
|
## Docker Mapping
|
||||||
|
|
||||||
The Node.js script reads out the `/var/run/docker.sock` to get the containers of the host system via
|
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").
|
[dockerode](https://github.com/apocas/dockerode "GitHub").
|
||||||
|
|
||||||
**Important:**
|
**Important:**
|
||||||
The proxy expects your backend containers to provide following structure:
|
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....
|
* `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`.
|
set `com.docker.compose.service`-label to `backend`.
|
||||||
* The proxy container to run with `--net="host"`
|
* 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
|
* 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
|
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 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.
|
port and ip was chosen. Internal loopback should be 127.0.0.1 tho.
|
||||||
|
|
||||||
## Configuration (Status Codes)
|
## Configuration (Status Codes)
|
||||||
|
|
||||||
Config files can be added by multiple universities (adding files like `config/default-b-tu`) and selected via the
|
Config files can be added by multiple universities (adding files like `config/default-b-tu`) and selected via the
|
||||||
`NODE_APP_INSTANCE` environment variable.
|
`NODE_APP_INSTANCE` environment variable.
|
||||||
|
|
||||||
- OutdatedVersions return a `HTTP 404`
|
* OutdatedVersions return a `HTTP 404`
|
||||||
- ActiveVersions return a `HTTP 503` if currently unavailable or the given code by running backend-node
|
* 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`
|
* Unsupported versions (not configured as outdated or active) return a `HTTP 404`
|
||||||
- No version header given returns a `HTTP 300`
|
* No version header given returns a `HTTP 300`
|
||||||
|
|
||||||
**NOTE:** The default configuration expects the client to set a version header: `X-StApps-Version=<version of app>`
|
**NOTE:** The default configuration expects the client to set a version header: `X-StApps-Version=<version of app>`
|
||||||
|
|
||||||
## Logger
|
## Logger
|
||||||
|
|
||||||
The proxy uses [@stapps/logger](https://gitlab.tubit.tu-berlin.de/stapps/logger). You can provide `NODE_ENV=production`
|
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.
|
and SMTP-Configuration via environment-variables for monitoring in production use.
|
||||||
|
|
||||||
# Usage
|
## Usage
|
||||||
|
|
||||||
Without ssl:
|
Without ssl:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --net="host" gitlab-registry.tubit.tu-berlin.de/stapps/proxy/master
|
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:
|
With ssl:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run --rm --net="host" \
|
docker run --rm --net="host" \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-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
|
gitlab-registry.tubit.tu-berlin.de/stapps/proxy/master
|
||||||
```
|
```
|
||||||
|
|
||||||
# Static Folder (docker run option: `-v <path to static folder>:/static`)
|
## Static Folder (docker run option: `-v <path to static folder>:/static`)
|
||||||
|
|
||||||
Der Zugriff erfolgt über: `http(s)://<url>/_static/<path-to-file>`
|
Der Zugriff erfolgt über: `http(s)://<url>/_static/<path-to-file>`
|
||||||
|
|
||||||
Beispiel Proxy auf Localhost für die Datei `static/test.json`: `http://localhost/_static/test.json`
|
Beispiel Proxy auf Localhost für die Datei `static/test.json`: `http://localhost/_static/test.json`
|
||||||
|
|
||||||
## Bilder im Static Folder
|
## Bilder im Static Folder
|
||||||
|
|
||||||
Bilder sollten folgendermaßen abgelegt und benannt werden:
|
Bilder sollten folgendermaßen abgelegt und benannt werden:
|
||||||
|
|
||||||
`<pfad analog zur imageURL aus der App>/<type>/<uid>-<size>.[jpg|png|gif]`
|
`<pfad analog zur imageURL aus der App>/<type>/<uid>-<size>.[jpg|png|gif]`
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ class ContainerInfoParsing {
|
|||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test
|
@test
|
||||||
checkIfContainerMatches(done: () => void) {
|
checkIfContainerMatches(done: () => void) {
|
||||||
expect(containerMatchesRegex(
|
expect(containerMatchesRegex(
|
||||||
|
|||||||
Reference in New Issue
Block a user