mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-16 11:16:20 +00:00
fix: remove reasons of linting errors
This commit is contained in:
committed by
Rainer Killinger
parent
8fe6a2795f
commit
b624ed3426
29
README.md
29
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=<version of app>`
|
||||
|
||||
## 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 <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>`
|
||||
|
||||
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:
|
||||
|
||||
`<pfad analog zur imageURL aus der App>/<type>/<uid>-<size>.[jpg|png|gif]`
|
||||
|
||||
@@ -139,7 +139,6 @@ class ContainerInfoParsing {
|
||||
done();
|
||||
}
|
||||
|
||||
|
||||
@test
|
||||
checkIfContainerMatches(done: () => void) {
|
||||
expect(containerMatchesRegex(
|
||||
|
||||
Reference in New Issue
Block a user