Skip to content

Commit

Permalink
WIP Add pulp-ui to pulp image
Browse files Browse the repository at this point in the history
  • Loading branch information
gerrod3 committed Oct 11, 2024
1 parent be28a4c commit 464f68b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions images/pulp/stable/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ ARG PULP_MAVEN_VERSION=""
ARG PULP_PYTHON_VERSION=""
ARG PULP_RPM_VERSION=""
ARG PULP_OSTREE_VERSION=""
ARG PULP_UI_URL=""

ENV PULP_UI=true
COPY images/assets/requirements.extra.txt /requirements.extra.txt

RUN pip3 install --upgrade \
Expand All @@ -39,3 +41,10 @@ USER root:root
RUN ln $(pip3 show pulp_ansible | sed -n -e 's/Location: //p')/pulp_ansible/app/webserver_snippets/nginx.conf /etc/nginx/pulp/pulp_ansible.conf
RUN ln $(pip3 show pulp_container | sed -n -e 's/Location: //p')/pulp_container/app/webserver_snippets/nginx.conf /etc/nginx/pulp/pulp_container.conf
RUN ln $(pip3 show pulp_python | sed -n -e 's/Location: //p')/pulp_python/app/webserver_snippets/nginx.conf /etc/nginx/pulp/pulp_python.conf

RUN <<EOF
if [[ "$PULP_UI_URL" ]]; then
mkdir -p /usr/share/nginx/static/pulp_ui
curl -Ls $PULP_UI_URL | tar -xzv -C /usr/share/nginx/static/pulp_ui
fi
EOF
11 changes: 11 additions & 0 deletions images/s6_assets/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ http {

include pulp/*.conf;

{% if ui | default(false) -%}
location /static/pulp_ui/ {
root /usr/share/nginx/;
try_files $uri /static/pulp_ui/index.html;
}
location /ui/ {
alias /usr/share/nginx/static/pulp_ui/;
try_files $uri /static/pulp_ui/index.html
}
{%- endif %}

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
Expand Down
2 changes: 2 additions & 0 deletions images/s6_assets/template_nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
args = parser.parse_args()

https = os.getenv("PULP_HTTPS", "false")
ui = os.getenv("PULP_UI", "false")
values = {
"https": https.lower() == "true",
"api_root": "/pulp/",
"content_path": "/pulp/content/",
"domain_enabled": False,
"ui": ui != "false",
}

try:
Expand Down

0 comments on commit 464f68b

Please sign in to comment.