Skip to content

Commit

Permalink
Fix jupyterhub with new reverse_proxy setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-ntrf committed Jul 14, 2023
1 parent fef7c48 commit 6513e80
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ profile::nfs::client::server_ip: "%{alias('terraform.tag_ip.nfs.0')}"
profile::nfs::server::devices: "%{alias('terraform.volumes.nfs')}"

profile::reverse_proxy::domain_name: "%{alias('terraform.data.domain_name')}"

profile::reverse_proxy::subdomains:
ipa: "ipa.int.%{lookup('terraform.data.domain_name')}"
mokey: "%{lookup('terraform.tag_ip.mgmt.0')}:%{lookup('profile::freeipa::mokey::port')}"
jupyter: "https://127.0.0.1:8000"

profile::jupyterhub::register_url: "https://mokey.%{lookup('terraform.data.domain_name')}/auth/signup"
profile::jupyterhub::reset_pw_url: "https://mokey.%{lookup('terraform.data.domain_name')}/auth/forgotpw"
14 changes: 6 additions & 8 deletions site/profile/manifests/jupyterhub.pp
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
class profile::jupyterhub::hub {
class profile::jupyterhub::hub (
Optional[String[1]] $register_url = undef,
Optional[String[1]] $reset_pw_url = undef,
) {
contain jupyterhub
include profile::sssd::service

Yumrepo['epel'] -> Class['jupyterhub']

$enable_user_signup = lookup('profile::freeipa::mokey::enable_user_signup')
$domain_name = lookup('profile::freeipa::base::domain_name')
$mokey_subdomain = lookup('profile::reverse_proxy::mokey_subdomain')
$mokey_hostname = "${mokey_subdomain}.${domain_name}"

file { '/etc/jupyterhub/templates/login.html':
content => epp('profile/jupyterhub/login.html', {
'mokey_hostname' => $mokey_hostname,
'enable_user_signup' => $enable_user_signup,
'register_url' => $register_url,
'reset_pw_url' => $reset_pw_url,
}
),
}
Expand Down
12 changes: 8 additions & 4 deletions site/profile/templates/jupyterhub/login.html.epp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@ Powered by Magic Castle
{% endblock %}

{% block script %}
<% if $enable_user_signup { -%>
<% if $register_url != undef or $reset_pw_url != undef { -%>
<script>
$(".auth-form-body").after(`
<div class="auth-form-footer">
<% if $register_url != '' { -%>
<div style="width: 45%; float:left">
<a href="https://<%= $mokey_hostname %>/auth/signup" target="_new">Create Account</a>
<a href="<%= $register_url %>" target="_new">Create Account</a>
</div>
|
<% } -%>
<% if $register_url != undef and $reset_pw_url != undef { %> | <% } %>
<% if $reset_pw_url != undef { -%>
<div style="width: 45%; float:right">
<a href="https://<%= $mokey_hostname %>/auth/forgotpw" target="_new">Reset Password</a>
<a href="<= $reset_pw_url %>" target="_new">Reset Password</a>
</div>
<% } -%>
</div>`
);
</script>
Expand Down

0 comments on commit 6513e80

Please sign in to comment.