Skip to content

Commit

Permalink
Fix #534: add kickstart http config to rsconf (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-carlin authored Dec 19, 2024
1 parent 5cb26f7 commit d5f53d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
8 changes: 5 additions & 3 deletions rsconf/component/rsconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
:copyright: Copyright (c) 2018 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdp
from pykern import pkcompat
from pykern import pkio
from pykern import pkjson
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdp
from rsconf import component
from urllib.parse import urlparse
Expand All @@ -22,13 +22,15 @@ def internal_build_compile(self):
from rsconf import db

# docker is required to build container-perl
self.buildt.require_component("docker", "nginx")
self.buildt.require_component("docker", "network", "nginx")
self.j2_ctx = self.hdb.j2_ctx_copy()
jc = self.j2_ctx
nc = self.buildt.get_component("network")
jc.rsconf = PKDict(
auth_f=nginx.CONF_D.join(PASSWD_SECRET_F),
srv_d=jc.rsconf_db.srv_d,
host_subdir=jc.rsconf_db.srv_host_d.basename,
kickstart_hosts=jc.rsconf.get("kickstart_hosts", []),
)

def internal_build_write(self):
Expand Down
4 changes: 3 additions & 1 deletion rsconf/package_data/dev/db/000.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ default:
postgrey:
port: 10023
whitelist_recipients: []
rsconf: {}
rsconf:
kickstart_hosts:
- 10.10.10.0/24
rsconf_db:
#TODO(robnagler) POSIT dev/nginx/nginx.conf.jinja
# defunct elvin_server https://en.wikipedia.org/wiki/Elvin
Expand Down
8 changes: 8 additions & 0 deletions rsconf/package_data/rsconf/nginx.conf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ server {
}
root {{ rsconf.srv_d }};
}

location /kickstart {
{% for i in rsconf.kickstart_hosts %}
allow {{ i }};
{% endfor %}

deny all;
}
}
5 changes: 4 additions & 1 deletion tests/pkcli/build1_data/1.in/db/000.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ default:
whitelist_recipients: []
raydata_scan_monitor:
docker_image: radiasoft/sirepo
rsconf: {}
rsconf:
kickstart_hosts:
- 10.10.10.0/24
- 192.168.1.22
rsconf_db:
#TODO(robnagler) POSIT dev/nginx/nginx.conf.jinja
# defunct elvin_server https://en.wikipedia.org/wiki/Elvin
Expand Down

0 comments on commit d5f53d1

Please sign in to comment.