The concept makes sense, but in practice I am lost. Which config am I adding to, apache or haproxy? Also, I don’t have control of the domain, I have xyz.abc.123.edu, and that’s it.
It’s in the HAProxy, I believe.
These lines are the magic:
acl host_discourse hdr(host) -i my_discourse_site.com # figure out which one to use use_backend discourse_docker if host_discourse
If you have lots of sites, you’ll need to add more
acl lines and more
use xx if host_yyy lines.
Here’s my current HAProxy:
timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 frontend http-in bind *:80 default_backend main_apache_sites/html # Define hosts acl host_discourse hdr(host) -i leet.arc.rpi.edu # figure out which one to use use_backend discourse_docker if host_discourse backend main_apache_sites server server1 127.0.0.1:8080 cookie A check backend discourse_docker server server2 127.0.0.1:8888 cookie A check
Note, host is not connected to internet, you must be on campus network to connect. All the other (existing) sites are behind Apache, so I don’t think I need more
I’d be stumped too.
Oh. Maybe you need to make sure that Apache isn’t doing something to enforce the port mapping? Are you sure that HAProxy and not Apache is what’s answering the door? (Maybe shutdown apache, restart HAPRoxy and then start apache?)
I’m not understanding the root problem. Why would "the correct URL would be
$hostname:8888/uploads – all access to the site should be via HAProxy, as I understand it, so why would the correct URL have the port in it?
I think I’m causing all the confusion here as I’m the one confused. Let me try and clear things up.
3 sites were hosted on a local server,
http://leet.arc.rpi.edu. quicklogs, mediawiki, and printers were located at
/printerpicker respectively. There was also an
index.html at the root of the server which included links to each of the 3 sites, as well as a few external resourses.
Installed Discourse using the 30-minute guide, then followed above linked guide to put alongside existing sites. End goal is for staff to continue using “leet” as their homepage, and linking to each tool. As such, Discourse would exist (somewhere) and would be linked by the index.html.
Currently I can only access Discourse by adding
:8888 to the url. I am unsure how to access it otherwise.
OK, what you need then is not the subdomain install you’re kinda-sorta putting together now, but a subfolder install. Then, it’d probably be best just to throw out haproxy altogether and configure Apache to proxy
<Location /forum> to
localhost:8888 (or wherever you’ve got Discourse mapped to).
So just to make sure I am understanding completely, I should do the following:
- Remove HAProxy entirely.
- Remove Listen commands from Apache config files.
- Follow Neil’s guide to put Discourse in a subfolder.
- Use apache to proxy to Discourse.
A more generalised step 1+2 would be, “revert everything you’ve done according to the “existing apache sites” howto”. But yes, what you’ve described is what needs to be done.
Matt, thanks for all your help (and Jay, and Rafael). I was able to successfully get my instance up and running, and have run into no further issues thus far!
…and it looks like I may have spoken too soon.
Unknown if this is related to subfolder install, discourse being on a custom port and proxied, or an actual bug - but when I went to /admin/upgrade and ran an update, the progress bar never filled nor did anything appear in the console below. After waiting 10 minutes, I reloaded the upgrade page and found that it had in fact upgraded.
Notifications got stuck a week ago
I’d have to say that by far the most likely cause of that would be a bug in the upgrade UI not handling subfolders with grace and aplomb. Any of my fellow @team members feel like spinning up a scratch subfolder install and seeing if this sucker’s reproducible?
I’m no apache expert, but I remeber sam saying that you need to go an extra mile so it plays well with message_bus too.
Any more details (or links) to share? I read the entire subfolder topic and the only thing Sam talked about was a new alias for Rails in docker
Edit: Did check that long polling is set (no ending slash) per this:
Edit 2: No CDN in play here, all on local hardware.
This might be it…seems I do need an ending slash here, unlike
app.yml which doesn’t want that slash. I agree with the points made here:
Seems that a PR wasn’t created a 18 months ago to fix this
I will report back when there is a new update to pull.
Edit: Unfortunately this did not fix it @sam - still no progress bar or console text on /admin/upgrade.
Edti 2: Looks like mini_profiler also doesn’t respect subfolder install- looks like that is Sam’s tool too.
Any success reproducing the
/admin/upgrade progress bar issue in subfolder installs?
As far as I know, nobody’s tried to.
Going to bump this again…with the recent Ember update we had a number of plugins to update along with Discourse. With the progress bar not working, we had to keep refreshing the page to see if each update was complete, making the process even longer. Would really appreciate seeing this lingering subfolder issue resolved .
Definitely agree, just found this out myself. It looks like the
long polling base url isn’t getting populated correctly on the upgrade pages.
(If it doesn’t conflict with any of your other routes, you can add a quick hacky workaround route for
/message-bus, but this is obviously a short-term solution)