Skip to content

(BB-1402) Add support for setting up arbitrary subdomain.

Josue Balandrano Coronel requested to merge josuebc/BB-1402 into master

When creating an instance there's a few default subdomains that are configured by default. In this context configured means the correct configuration line in haproxy's config file as well as having cert-manager use let's encrypt to create the domain's certificate. The way this configuration works for default subdomains is that Ocim creates a consul k/v pair with the necessary information (instance and domain list) and there are two different consul watch processes running that configure OC's haproxy and run certbot when there's a change on consul's side. This PR leverages that by adding a text area in the instance's admin interface. In this text area a user can add multiple sub-domains (one in each line). Each subdomain is verified to be a subdomain of the main lms domain and added to the instance's consul configuration. The rest of the configuration (haproxy and cert-manager) works as expected.

Testing instructions

  1. Checkout this branch and run Ocim and consul locally.
  2. Create an instance and query consul. You should see a domain config key like this one:
Screen Shot 2019-07-05 at 5 57 35 PM 3. Go to Django's admin interface and add multiple sub-domains: Screen Shot 2019-07-05 at 5 57 03 PM 4. Save the updated instance. 5. Check consul for the updated domains list. Should look like this (note the extra sub-domains): Screen Shot 2019-07-05 at 6 16 30 PM

Merge request reports