1
0

Compare commits

..

No commits in common. "1dda7066c969c566838eeadb34dff34b3fb81218" and "5d3307fe57655af0c3b9c71e7c562c9d6a6d95bd" have entirely different histories.

8 changed files with 25 additions and 160 deletions

View File

@ -1,8 +1,8 @@
FROM docker.io/rockdrilla/angie-conv:deps-v1 AS deps
FROM docker.io/rockdrilla/angie-conv:deps-v1 as deps
## ---
FROM deps AS certs
FROM deps as certs
SHELL [ "/bin/sh", "-ec" ]
COPY /scripts/* /usr/local/sbin/
@ -20,7 +20,7 @@ RUN pkg='curl' ; \
## ---
FROM deps AS pycache
FROM deps as pycache
SHELL [ "/bin/sh", "-ec" ]
COPY /scripts/* /usr/local/sbin/
@ -50,9 +50,9 @@ RUN libpython="${PYTHON_SITE_PACKAGES%/*}" ; \
python3 -m compileall -q -j 2
## Python cache warmup
RUN j2cfg-single /usr/local/lib/j2cfg/test.j2 /tmp/test ; \
cat /tmp/test ; echo ; \
rm -f /tmp/test
RUN echo > /tmp/f.j2 ; \
j2cfg-single /tmp/f.j2 ; \
rm -f /tmp/f /tmp/f.j2
## Python cache adjustments
RUN d="@$(date '+%s')" ; \
@ -136,7 +136,7 @@ RUN install -d -o angie -g angie -m 03777 /angie /run/angie ; \
ln -sv /run/angie/lib /var/lib/angie ; \
ln -sv /run/angie/log /var/log/angie ; \
## adjust paths in config directory
cd /etc/angie || exit 1 ; \
cd /etc/angie/ ; \
ln -sv /run/angie run ; \
ln -sv /run/angie/lock lock.d ; \
ln -sv ${ANGIE_MODULES_DIR} modules.dist ; \
@ -161,7 +161,7 @@ RUN find /etc/angie/ -name .gitkeep -delete ; \
## preseed builtin modules list
RUN x='angie-builtin-modules.sh' ; \
"$x" ; \
chmod a-x "$(which "$x")"
chmod a-x $(which "$x")
## misc tools
RUN apt-install.sh \
@ -196,7 +196,8 @@ COPY /image-entry.d/ /image-entry.d/
## misc defaults
ENV DUMB_INIT_SETSID=0 \
MALLOC_ARENA_MAX=4
MALLOC_ARENA_MAX=4 \
GOMAXPROCS=4
STOPSIGNAL SIGQUIT

View File

@ -1,8 +1,8 @@
# FROM docker.io/debian:bookworm-slim as base-upstream
ARG PYTHONTAG=3.11.9-slim-bookworm
FROM docker.io/python:${PYTHONTAG} AS base-upstream
FROM docker.io/python:${PYTHONTAG} as base-upstream
FROM base-upstream AS base
FROM base-upstream as base
SHELL [ "/bin/sh", "-ec" ]
COPY /Dockerfile.base /usr/local/share/
@ -52,8 +52,8 @@ RUN apt-env.sh apt-get update ; \
## perl-base: hardlink->symlink
RUN d=/usr/bin ; \
find "$d/" -wholename "$d/perl5*" -exec ln -fsv perl {} ';' ; \
ls -li "$d/perl"*
find $d/ -wholename "$d/perl5*" -exec ln -fsv perl {} ';' ; \
ls -li $d/perl*
## remove unwanted binaries
RUN set -f ; \

View File

@ -1,8 +1,8 @@
FROM docker.io/rockdrilla/angie-conv:base-v1 AS base
FROM docker.io/rockdrilla/angie-conv:base-v1 as base
## ---
FROM base AS setup
FROM base as setup
SHELL [ "/bin/sh", "-ec" ]
COPY /scripts/* /usr/local/sbin/
@ -29,7 +29,7 @@ ENV CIBUILDWHEEL=1
# pyyaml
ENV PYYAML_FORCE_CYTHON=1
RUN w=$(mktemp -d) ; : "${w:?}" ; \
RUN w=$(mktemp -d) ; \
{ apt-mark showauto ; apt-mark showmanual ; } | sort -uV > "$w/t0" ; \
printf '%s\n' ${DEV_PACKAGES} | sort -uV > "$w/t1" ; \
apt-install.sh ${DEV_PACKAGES} ; \
@ -61,7 +61,7 @@ RUN w=$(mktemp -d) ; : "${w:?}" ; \
## ---
FROM base AS deps
FROM base as deps
SHELL [ "/bin/sh", "-ec" ]
COPY /Dockerfile.deps /usr/local/share/

View File

@ -117,14 +117,13 @@ class J2cfg:
def merge_dict_default():
search_pattern = '|'.join(['*.' + ext for ext in J2CFG_CONFIG_EXT])
search_flags = wcmatch.wcmatch.SYMLINKS
search_flags = wcmatch.wcmatch.RECURSIVE | wcmatch.wcmatch.SYMLINKS
for d in self.config_path:
if not os.path.isdir(d):
continue
m = wcmatch.wcmatch.WcMatch(d, search_pattern,
flags=search_flags)
for f in sorted(m.match()):
for f in wcmatch.wcmatch.WcMatch(d, search_pattern,
flags=search_flags).imatch():
merge_dict_from_file(f)
if self.config_file is None:
@ -204,9 +203,6 @@ class J2cfg:
continue
self.ensure_fs_loader_for(d)
dirs.insert(0, d)
if f_in.startswith('/'):
self.ensure_fs_loader_for('/')
dirs.append('/')
j2_environ = self.j2env.overlay(loader=jinja2.ChoiceLoader([
self.j2fs_loaders[d] for d in dirs

View File

@ -74,7 +74,7 @@ def str_list_re_sub(a: list, pattern, repl, count=0, flags=0) -> list:
def sh_like_file_to_list(j2env, file_in: str) -> list:
tpl = j2env.get_template(file_in)
text = pathlib.Path(tpl.filename).read_text(encoding='utf-8')
lines = re.split(r'[\r\n]', text)
lines = re.split(r'\r\n', text)
return list(itertools.filterfalse(
lambda x: re.match(r'\s*#', x), lines
))

View File

@ -1,9 +1,9 @@
J2CFG_TEMPLATE_EXT = '.j2'
J2CFG_PATH = [
'/angie/j2cfg',
'/etc/angie/j2cfg',
'/etc/angie/j2cfg.dist',
'/etc/angie/j2cfg',
'/angie/j2cfg',
]
J2CFG_PYTHON_MODULES = [

View File

@ -1,132 +0,0 @@
j2cfg:
{{ j2cfg }}
{% set x = [2,3,1,2] %}
x = {{ x }}
uniq_list:
{{ x | uniq_list }}
{% set x = ['2',3,'1','2'] %}
x = {{ x }}
list_remove_non_str:
{{ x | list_remove_non_str }}
{% set x = ['2','','1','2'] %}
x = {{ x }}
list_remove_empty_str:
{{ x | list_remove_empty_str }}
{% set x = ['2','3','1','2'] %}
x = {{ x }}
uniq_str_list:
{{ x | uniq_str_list }}
{% set x = '2 3 1 2 ' %}
"x = {{ x }}"
str_split_to_list:
{{ x | str_split_to_list }}
{% set x = '2:3::1:2:' %}
"x = {{ x }}"
str_split_to_list(':'):
{{ x | str_split_to_list(':') }}
{% set x = [1,2,3,4] %}
x = {{ x }}
is_sequence:
{{ x | is_sequence }}
{% set x = {1:2,3:4} %}
x = {{ x }}
is_sequence:
{{ x | is_sequence }}
{% set x = [1,2,3,4] %}
x = {{ x }}
is_mapping:
{{ x | is_mapping }}
{% set x = {1:2,3:4} %}
x = {{ x }}
is_mapping:
{{ x | is_mapping }}
{% set x = '1 2 3 4' %}
"x = {{ x }}"
any_to_str_list:
{{ x | any_to_str_list }}
{% set x = [1,2,3,4] %}
x = {{ x }}
any_to_str_list:
{{ x | any_to_str_list }}
{% set x = 3.1415926 %}
x = {{ x }}
any_to_str_list:
{{ x | any_to_str_list }}
{% set x = ['a2','b3','c1','d2'] %}
x = {{ x }}
is_str_list_re_match('[ab]'):
{{ x | is_str_list_re_match('[ab]') }}
is_str_list_re_match('[mn]'):
{{ x | is_str_list_re_match('[mn]') }}
{% set x = ['a2','b3','c1','d2'] %}
x = {{ x }}
is_str_list_re_fullmatch('[ab]'):
{{ x | is_str_list_re_fullmatch('[ab]') }}
is_str_list_re_fullmatch('[ab][12]'):
{{ x | is_str_list_re_fullmatch('[ab][12]') }}
{% set x = ['a2','b3','c1','d2'] %}
x = {{ x }}
str_list_re_match('[ab]'):
{{ x | str_list_re_match('[ab]') }}
str_list_re_match('[mn]'):
{{ x | str_list_re_match('[mn]') }}
{% set x = ['a2','b3','c1','d2'] %}
x = {{ x }}
str_list_re_fullmatch('[ab]'):
{{ x | str_list_re_fullmatch('[ab]') }}
str_list_re_fullmatch('[ab][12]'):
{{ x | str_list_re_fullmatch('[ab][12]') }}
{% set x = ['a2b','b3b','c1f','d2g'] %}
x = {{ x }}
str_list_re_sub('[ab]', '_'):
{{ x | str_list_re_sub('[ab]', '_') }}
str_list_re_sub('[mn]', '_'):
{{ x | str_list_re_sub('[mn]', '_') }}
{% set x = 'j2cfg-multi.py' %}
x = {{ x }}
sh_like_file_to_list:
{{ 'j2cfg-multi.py' | sh_like_file_to_list }}
{% set x = 'Accept-Encoding' %}
x = {{ x }}
as_cgi_header:
{{ x | as_cgi_header }}
{% set x = '_Permissions-Policy--' %}
x = {{ x }}
as_cgi_header:
{{ x | as_cgi_header }}
{% set x = 'VAR1=Etc/UTC' %}
x = {{ x }}
env_any_to_str_list:
{{ x | env_any_to_str_list }}
{% set x = ['VAR1=Etc/UTC', 'VAR2=', 'VAR3', '4VAR4=yeah', 'VAR5=yeah', 'VAR5=not-yeah'] %}
x = {{ x }}
env_any_to_str_list:
{{ x | env_any_to_str_list }}
{% set x = { 'VAR1': 'Etc/UTC', 'VAR2': '', 'VAR3': None, '4VAR4': 'yeah', 'VAR5=not': 'yeah', 'VAR5=real yeah': None, 'VAR6': {'pi': 3.1415926}, 'VAR7': ['pi', 3.1415926] } %}
x = {{ x }}
env_any_to_str_list:
{{ x | env_any_to_str_list }}

View File

@ -5,7 +5,7 @@ conf_dir='/etc/angie'
conf_file="${conf_dir}/.none.conf"
pid_file='/run/angie/none.pid'
angie -q -e /dev/stderr -g "error_log /dev/stderr warn; pid ${pid_file};" -c "${conf_file}" -t
angie -g "error_log /dev/stderr warn; pid ${pid_file};" -c "${conf_file}" -t
r=$?
rm -f "${pid_file}"
[ $r -eq 0 ] || exit $r