Bootstrapping a discourse docker image with SSO URL as environment variable

(shahid) #1


Is it possible to set the SSO url in the docker build file (YAML file) for discourse, as opposed to using console scripts or via the discourse dashboard once deployed?

I have seen articles on this site mentioning other ways of doing it, but I would like to know if this is possible via the config files and at stage the docker image is created.


(Sam Saffron) #2

We are fine with a PR that makes the setting shadowed by env, then you can supply them via env

(shahid) #3

@sam Hi sam, what would i need to do to get this feature added?
Not sure how this works, do I submit a request?

(Jay Pfaffman) #4

Is there some way to pass a site setting to Discourse through an Environment variable? (That’s what he seems to be asking).

My best solution to what I think his problem is is to use my discourse-settings-uploader, but the problem there is that I’ve not yet found a way to call create_master_key from a command line outside the container.

(Sam Saffron) #5

So… for example per: discourse/site_settings.yml at master · discourse/discourse · GitHub


Will set SiteSetting.notification_email to

(shahid) #6

Hi Guys

sorry, seems like i wasnt clear in explaining what I needed.
I am building a docker image of discourse and want to supply the site setting for the SSO URL via my docker build scripts.

So what I am now understanding after these responses is that only settings that are marked true for the “shadowed_by_global” setting can be set in the way I want.
For other fields (including the SSO url) I either need to submit a PR to get the SSO field config updated so that i can be “shadowed”, or change my settings via the dashboard, or use the uploader suggested above?

Is this correct?

PS: My docker discourse project has a “discourse.conf” file which i believe is doing the settings in discourse e.g.

# username for smtp server
smtp_user_name = <%= ENV['SMTP_USERNAME'] ? ENV['SMTP_USERNAME'] : '' %>


(Jay Pfaffman) #7

Hi, @shahidmir. I just got around to paying closer attention to this.

Yes, my read of Sam’s message is that you’d need to submit a PR that adds shadowed_by_global: true to the SSO field(s) that you want to set with an environment variable and that he’d likely accept it. That seems like the cleanest solution to your problem.

My uploader would also be a solution, but the trick with it is that you need the API key, which is something of a bother to set/get.

If you have a github account, you can simply visit the site_settings.yml link above, click the pencil icon, edit the file, save, and submit a PR. Spaces are very, very important in yml files, so it would be safest to copy-paste another “shadowed_by_global: true” line so that you don’t inadvertently enter a tab or the wrong number of spaces.