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

Assuring static root for django collect static #270

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions roles/pulp-webserver/README.md
Expand Up @@ -22,10 +22,6 @@ Variables:
'127.0.0.1'.
* `pulp_configure_firewall` Install and configure a firewall. Valid values are 'auto', 'firewalld',
and 'none'. Defaults to 'auto' (which is the same as 'firewalld', but may change in the future).
* `pulp_static_url` equivalent to `STATIC_URL` from `pulpcore` i.e. url pattern to use when referring to
static files located in `pulp_webserver_static_dir`.
* `pulp_webserver_static_dir` equivalent to `STATIC_ROOT` from `pulpcore` i.e. absolute path where to find
static files.

Plugin Webserver Configs:
-------------------------
Expand Down Expand Up @@ -74,3 +70,7 @@ role.
must match the value used in the `pulp` role.

* `pulp_user_home`: equivalent to `MEDIA_ROOT` from `pulpcore` i.e. absolute path for pulp user home.
* `pulp_static_url` equivalent to `STATIC_URL` from `pulpcore` i.e. url pattern to use when referring to
static files located in `pulp_webserver_static_dir`.
* `pulp_webserver_static_dir` equivalent to `STATIC_ROOT` from `pulpcore` i.e. absolute path where to find
static files.
4 changes: 4 additions & 0 deletions roles/pulp/README.md
Expand Up @@ -14,6 +14,10 @@ Role Variables:
* `pulp_install_dir`: Location of a virtual environment for Pulp and its Python
dependencies. Defaults to "/usr/local/lib/pulp".
* `pulp_user_home`: equivalent to `MEDIA_ROOT` from `pulpcore` i.e. absolute path for pulp user home.
* `pulp_static_url` equivalent to `STATIC_URL` from `pulpcore` i.e. url pattern to use when referring to
static files located in `pulp_webserver_static_dir`.
* `pulp_webserver_static_dir` equivalent to `STATIC_ROOT` from `pulpcore` i.e. absolute path where to find
static files.
* `pulp_install_plugins`: A nested dictionary of plugin configuration options.
Defaults to "{}", which will not install any plugins.
* Dictionary Key: The pip installable plugin name. This is defined in each
Expand Down
2 changes: 2 additions & 0 deletions roles/pulp/defaults/main.yml
Expand Up @@ -30,6 +30,8 @@ pulp_user_id:
pulp_group: pulp
pulp_group_id:
pulp_user_home: '/var/lib/pulp'
pulp_static_url: 'assets'
Copy link
Member

Choose a reason for hiding this comment

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

I can see this default making sense although I think it's /assets/.

The one below though I don't think the installer needs to know about. Unless specifically set by the user pulp_webserver_static_dir would have it's default from pulpcore used so I expected the installer wouldn't carry a default.

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, it's used here:

root {{ pulp_webserver_static_dir }};

DocumentRoot {{ pulp_webserver_static_dir }}

(And other places in those 2 files.)

Is it possible for the installer to run a python command to obtain the value?

The pulp-webserver role is run very late in the install; after the packages are installed.

Copy link
Member Author

Choose a reason for hiding this comment

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

it is possible to get these values from dynaconf:

[vagrant@pulp3-source-fedora30 ~]$ dynaconf list | grep STATIC_ROOT | awk '{ print $2 }'
'/var/lib/pulp/assets/'

pulp_webserver_static_dir: "{{ pulp_user_home | regex_replace('\\/$', '') }}/{{ pulp_static_url | regex_replace('^\\/|\\/$', '') }}/"
pulp_pip_editable: yes
pulp_use_system_wide_pkgs: false
pulp_api_bind: '127.0.0.1:24817'
Expand Down
1 change: 1 addition & 0 deletions roles/pulp/handlers/main.yml
Expand Up @@ -22,3 +22,4 @@
notify: Restart pulpcore-api.service
environment:
PULP_SETTINGS: "{{ pulp_settings_file }}"
PULP_STATIC_ROOT: "{{ pulp_webserver_static_dir }}"