1
0

Compare commits

..

5 Commits

28 changed files with 164 additions and 59 deletions

View File

@ -20,28 +20,26 @@ compress_types:
- text/xml - text/xml
request_headers: request_headers:
## '$req_connection' is defined in /angie/autoconf.dist/http-request-headers-basic.conf.j2
Connection: '$req_connection'
Upgrade: '$http_upgrade'
Early-Data: '$ssl_early_data'
{% if env.NGX_HTTP_TRANSPARENT_PROXY == '0' %} {% if env.NGX_HTTP_TRANSPARENT_PROXY == '0' %}
Host: '$proxy_host' Host: '$proxy_host'
X-Real-IP: '$remote_addr' X-Real-IP: '$remote_addr'
## '$proxy_add_forwarded' is defined in /angie/autoconf.dist/http-request-headers-forwarded.conf ## '$proxy_add_forwarded' is defined in /angie/autoconf.dist/http-request-headers-forwarded.conf
Forwarded: '$proxy_add_forwarded' Forwarded: '$proxy_add_forwarded'
## do not pass Accept-Encoding to backend
Accept-Encoding: ""
## '$req_accept' is defined in /angie/autoconf.dist/http-request-headers-basic.conf.j2
Accept: '$req_accept'
## '$req_user_agent' is defined in /angie/autoconf.dist/http-request-headers-basic.conf.j2
User-Agent: '$req_user_agent'
{% elif env.NGX_HTTP_TRANSPARENT_PROXY == '1' %} {% elif env.NGX_HTTP_TRANSPARENT_PROXY == '1' %}
Host: '$host' Host: '$host'
X-Real-IP: '' X-Real-IP: ''
Forwarded: '' Forwarded: ''
{% endif %} {% endif %}
request_headers:
## do not pass Accept-Encoding to backend
Accept-Encoding: ""
## '$req_accept' is defined in /angie/autoconf.dist/http-request-headers-basic.conf.j2
Accept: '$req_accept'
## '$req_connection' is defined in /angie/autoconf.dist/http-request-headers-basic.conf.j2
Connection: '$req_connection'
Upgrade: '$http_upgrade'
Early-Data: '$ssl_early_data'
## '$req_user_agent' is defined in /angie/autoconf.dist/http-request-headers-basic.conf.j2
User-Agent: '$req_user_agent'
{% if env.NGX_HTTP_X_FORWARDED == 'pass' %} {% if env.NGX_HTTP_X_FORWARDED == 'pass' %}
X-Forwarded-Proto: '$scheme' X-Forwarded-Proto: '$scheme'
X-Forwarded-Host: '$host' X-Forwarded-Host: '$host'

View File

@ -2,7 +2,7 @@
set -ef set -ef
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.5}" IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
set -a set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -2,7 +2,7 @@
set -ef set -ef
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.5}" IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
set -a set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -2,7 +2,7 @@
set -ef set -ef
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.5}" IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
set -a set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}" BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"

View File

@ -6,3 +6,4 @@
- [print env via Perl](perl/README.md) - [print env via Perl](perl/README.md)
- [SSL with subdomains](ssl/README.md) - [SSL with subdomains](ssl/README.md)
- [generating config with templates](config-template/README.md) - [generating config with templates](config-template/README.md)
- [container configuration override](j2cfg-override/README.md)

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,5 +1,9 @@
# simple static site # simple static site
consult [Dockerfile](Dockerfile) or [docker-compose.yml](docker-compose.yml) - both are simple and fine enough.
---
configuration: configuration:
```nginx ```nginx
@ -8,13 +12,4 @@ server {
} }
``` ```
Dockerfile: simple as that! :)
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.5
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/
```
both are simple and fine enough.

View File

@ -0,0 +1,14 @@
version: "3.8"
services:
angie-conv-example-basic:
container_name: angie-conv-example-basic
image: docker.io/rockdrilla/angie-conv:v0.0.6
environment:
NGX_HTTP_NO_PROXY: 1
ports:
- "127.0.0.1:8080:8080"
volumes:
- "./site:/angie/site:ro"
- "./static:/angie/static:ro"

View File

@ -58,7 +58,7 @@ services:
my-cache: my-cache:
container_name: my-cache container_name: my-cache
image: docker.io/rockdrilla/angie-conv:v0.0.5 image: docker.io/rockdrilla/angie-conv:v0.0.6
restart: always restart: always
privileged: true privileged: true
stop_grace_period: 15s stop_grace_period: 15s

View File

@ -4,7 +4,7 @@ services:
my-cache: my-cache:
container_name: my-cache container_name: my-cache
image: docker.io/rockdrilla/angie-conv:v0.0.5 image: docker.io/rockdrilla/angie-conv:v0.0.6
restart: always restart: always
privileged: true privileged: true
stop_grace_period: 15s stop_grace_period: 15s

View File

@ -0,0 +1,14 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ]
COPY /j2cfg/ /etc/angie/j2cfg/
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/
ENV NGX_HTTP_CONFLOAD='gzip'
## same as above (adjusted to above variant by entrypoint):
## ENV NGX_HTTP_MODULES='gzip'
## enable support for brotli and zstd:
## ENV NGX_HTTP_MODULES='gzip brotli zstd'

View File

@ -0,0 +1,32 @@
# container configuration override
consult [Dockerfile](Dockerfile) or [docker-compose.yml](docker-compose.yml) - both are simple and fine enough.
---
mostly same as [simple static site](../basic/README.md) except container configuration file `j2cfg/override-compress-types.yml`.
`j2cfg/override-compress-types.yml`:
```yml
compress_types: []
---
compress_types:
- text/plain
```
this effectively disables response compression for all mime types except `text/plain`.
---
in order to enable (!) response compression specify environment variable `NGX_HTTP_CONFLOAD='gzip'` or `NGX_HTTP_MODULES='gzip brotli zstd'` (for gzip, brotli and zstd).
---
Test URI e.g. with `curl`:
```sh
curl -v --compressed http://127.0.0.1:8080/index.html
curl -v --compressed http://127.0.0.1:8080/index.txt
```

View File

@ -0,0 +1,15 @@
version: "3.8"
services:
angie-conv-example-cfg-override:
container_name: angie-conv-example-cfg-override
image: docker.io/rockdrilla/angie-conv:v0.0.6
environment:
NGX_HTTP_MODULES: 'gzip brotli zstd'
ports:
- "127.0.0.1:8080:8080"
volumes:
- "./j2cfg:/angie/j2cfg:ro"
- "./site:/angie/site:ro"
- "./static:/angie/static:ro"

View File

@ -0,0 +1,6 @@
compress_types: []
---
compress_types:
- text/plain

View File

@ -0,0 +1,3 @@
server {
listen 8080;
}

View File

@ -0,0 +1,5 @@
<hmtl>
<body>
<h1>Hello World</h1>
</body>
</hmtl>

View File

@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile: Dockerfile:
```dockerfile ```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -3,7 +3,7 @@
Dockerfile: Dockerfile:
```dockerfile ```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,16 +1,6 @@
# SSL with subdomains # SSL with subdomains
Dockerfile: consult [Dockerfile](Dockerfile) or [docker-compose.yml](docker-compose.yml) - both are simple and fine enough.
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.5
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/
COPY /tls/ /etc/angie/tls/
ENV NGX_HTTP_CONFLOAD='ssl'
```
--- ---

View File

@ -0,0 +1,16 @@
version: "3.8"
services:
angie-conv-example-ssl:
container_name: angie-conv-example-ssl
image: docker.io/rockdrilla/angie-conv:v0.0.6
environment:
NGX_HTTP_NO_PROXY: 1
NGX_HTTP_CONFLOAD: 'ssl v2'
ports:
- "127.0.0.1:8443:8443"
volumes:
- "./site:/angie/site:ro"
- "./static:/angie/static:ro"
- "./tls:/angie/tls:ro"

View File

@ -1,4 +1,4 @@
FROM docker.io/rockdrilla/angie-conv:v0.0.5 FROM docker.io/rockdrilla/angie-conv:v0.0.6
SHELL [ "/bin/sh", "-ec" ] SHELL [ "/bin/sh", "-ec" ]
COPY /site/ /etc/angie/site/ COPY /site/ /etc/angie/site/

View File

@ -1,5 +1,9 @@
# static site with templates # static site with templates
consult [Dockerfile](Dockerfile) or [docker-compose.yml](docker-compose.yml) - both are simple and fine enough.
---
mostly same as [simple static site](../basic/README.md) except environment variable `NGX_PROCESS_STATIC=1`. mostly same as [simple static site](../basic/README.md) except environment variable `NGX_PROCESS_STATIC=1`.
configuration: configuration:
@ -10,18 +14,6 @@ server {
} }
``` ```
Dockerfile:
```dockerfile
FROM docker.io/rockdrilla/angie-conv:v0.0.5
COPY /site/ /etc/angie/site/
COPY /static/ /etc/angie/static/
## instruct entrypoint to process static/ - unroll *.j2 templates, etc.
ENV NGX_PROCESS_STATIC=1
```
Also note that there's no `index.html` but `index.html.j2`: Also note that there's no `index.html` but `index.html.j2`:
```jinja ```jinja

View File

@ -0,0 +1,15 @@
version: "3.8"
services:
angie-conv-example-static-template:
container_name: angie-conv-example-static-template
image: docker.io/rockdrilla/angie-conv:v0.0.6
environment:
NGX_HTTP_NO_PROXY: 1
NGX_PROCESS_STATIC: 1
ports:
- "127.0.0.1:8080:8080"
volumes:
- "./site:/angie/site:ro"
- "./static:/angie/static:ro"

View File

@ -278,11 +278,19 @@ def merge_dict_recurse(d1, d2: dict) -> dict:
map_common = {k for k in map1 if is_mapping(d2.get(k))} map_common = {k for k in map1 if is_mapping(d2.get(k))}
for k in map_common: for k in map_common:
x[k] = merge_dict_recurse(x.get(k), d2.get(k)) y = d2.get(k)
if not y:
x[k] = {}
continue
x[k] = merge_dict_recurse(x.get(k), y)
seq_common = {k for k in seq1 if is_sequence(d2.get(k))} seq_common = {k for k in seq1 if is_sequence(d2.get(k))}
for k in seq_common: for k in seq_common:
x[k] = uniq(list(x.get(k)) + list(d2.get(k))) y = d2.get(k)
if not y:
x[k] = []
continue
x[k] = uniq(list(x.get(k)) + list(y))
unmerged = (map1 - map_common) | (seq1 - seq_common) unmerged = (map1 - map_common) | (seq1 - seq_common)
for k in unmerged: for k in unmerged: