-
Notifications
You must be signed in to change notification settings - Fork 151
Run ironic-api as WSGI when standalone with TLS capability #230
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
| # not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| Listen 6385 | ||
|
|
||
| {% if env.LISTEN_ALL_INTERFACES | lower == "true" %} | ||
| <VirtualHost *:6385> | ||
| {% else %} | ||
| <VirtualHost {{ env.IRONIC_URL_HOST }}:6385> | ||
| {% endif %} | ||
|
|
||
| WSGIDaemonProcess ironic user=ironic group=ironic threads=10 display-name=%{GROUP} | ||
| WSGIScriptAlias / /usr/bin/ironic-api-wsgi | ||
|
|
||
| SetEnv APACHE_RUN_USER ironic | ||
| SetEnv APACHE_RUN_GROUP ironic | ||
| WSGIProcessGroup ironic | ||
|
|
||
| ErrorLog /dev/stderr | ||
| LogLevel debug | ||
| CustomLog /dev/stdout combined | ||
|
|
||
| {% if env.IRONIC_TLS_SETUP == "true" %} | ||
| ServerName {{ env.IRONIC_IP }} | ||
| SSLEngine on | ||
| SSLCertificateFile {{ env.IRONIC_CERT_FILE }} | ||
| SSLCertificateKeyFile {{ env.IRONIC_KEY_FILE }} | ||
| {% endif %} | ||
|
|
||
| <Directory /usr/bin > | ||
| WSGIProcessGroup ironic | ||
| WSGIApplicationGroup %{GLOBAL} | ||
| AllowOverride All | ||
| Require all granted | ||
|
|
||
| {% if "HTTP_BASIC_HTPASSWD" in env and env.HTTP_BASIC_HTPASSWD | length %} | ||
| AuthType Basic | ||
| AuthName "Restricted WSGI area" | ||
| AuthUserFile "/etc/ironic/htpasswd" | ||
| Require valid-user | ||
| {% endif %} | ||
| </Directory> | ||
| </VirtualHost> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ dnsmasq | |
| gdisk | ||
| genisoimage | ||
| httpd | ||
| python3-mod_wsgi | ||
| mod_ssl | ||
| httpd-tools | ||
| ipmitool | ||
| iproute | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/bash | ||
|
|
||
| IRONIC_CERT_FILE=${IRONIC_CERT_FILE:-/certs/ironic/tls.crt} | ||
| HTTP_PORT=${HTTP_PORT:-"80"} | ||
|
|
||
| # Whether to enable fast_track provisioning or not | ||
| IRONIC_FAST_TRACK=${IRONIC_FAST_TRACK:-true} | ||
|
|
||
| wait_for_interface_or_ip | ||
|
|
||
| mkdir -pm 0777 /shared/html | ||
|
|
||
| if [ -f "$IRONIC_CERT_FILE" ]; then | ||
| IRONIC_BASE_URL="https://${IRONIC_URL_HOST}" | ||
| else | ||
| IRONIC_BASE_URL="http://${IRONIC_URL_HOST}" | ||
| fi | ||
|
|
||
| if [[ $IRONIC_FAST_TRACK == true ]]; then | ||
| INSPECTOR_EXTRA_ARGS=" ipa-api-url=${IRONIC_BASE_URL}:6385 ipa-inspection-callback-url=${IRONIC_BASE_URL}:5050/v1/continue" | ||
| else | ||
| INSPECTOR_EXTRA_ARGS=" ipa-inspection-callback-url=${IRONIC_BASE_URL}:5050/v1/continue" | ||
| fi | ||
|
|
||
| # Copy files to shared mount | ||
| render_j2_config /tmp/inspector.ipxe.j2 /shared/html/inspector.ipxe | ||
| cp /tmp/dualboot.ipxe /tmp/uefi_esp.img /shared/html/ | ||
|
|
||
| # Use configured values | ||
| sed -i -e s/IRONIC_IP/${IRONIC_URL_HOST}/g \ | ||
| -e s/HTTP_PORT/${HTTP_PORT}/g \ | ||
| -e "s|EXTRA_ARGS|${INSPECTOR_EXTRA_ARGS}|g" \ | ||
| /shared/html/inspector.ipxe | ||
|
|
||
| sed -i 's/^Listen .*$/Listen [::]:'"$HTTP_PORT"'/' /etc/httpd/conf/httpd.conf | ||
| sed -i -e 's|\(^[[:space:]]*\)\(DocumentRoot\)\(.*\)|\1\2 "/shared/html"|' \ | ||
| -e 's|<Directory "/var/www/html">|<Directory "/shared/html">|' \ | ||
| -e 's|<Directory "/var/www">|<Directory "/shared">|' /etc/httpd/conf/httpd.conf | ||
|
|
||
| # Log to std out/err | ||
| sed -i -e 's%^ \+CustomLog.*% CustomLog /dev/stderr combined%g' /etc/httpd/conf/httpd.conf | ||
| sed -i -e 's%^ErrorLog.*%ErrorLog /dev/stderr%g' /etc/httpd/conf/httpd.conf | ||
|
Comment on lines
+35
to
+42
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I like managing config files via sed, what if the config file changes just enough that the regex no longer matches? Can we just ship a minimal /etc/httpd/conf/httpd.conf for this, possibly a jinja template?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I can do that, but should we do this in a separate PR? These sed commands already existed before, and I just move it from one place to another.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure that's fine, I didn't realize this was pre-existing. |
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.