Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Add pulp-ui to pulp image #677

Draft
wants to merge 1 commit into
base: latest
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably depend on PULP_UI_URL... Or let's just make PULP_UI_URL the env var?

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the new /var/www ?
It's OK...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should these files live? I was thinking I could put them in the pulp static directory (default: /var/lib/operator/static/), but I was worried if the user ran collectstatic with --clean then they would lose their UI as well.

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) -%}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be if ui_url != ""?

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
Loading