Deploying discourse on server already running another rails app


I am trying to deploy a docker discourse on a linux server already running an apache + passenger + rails application. First I thought it would be easy – just setup docker to use another port (8080), but then I found out that serving from non-default port creates some issues with assets like avatars Hosting on a non-default port causes catch-22.

So, do you had similar issue? How did you resolved it? All suggestions are welcomed :smile:

The usual setup is to use a reverse proxy listening on port 80 that (maybe does SSL and) routes requests to the different applications. It’s not too hard to set up, and we have a nice tutorial by @riking for this:

Thanks! I will have a look into this. One remark: my server is only accessible via IP number, so I would like to deploy discourse into a subfolder. Do you think this setup will work with reverse proxy apache module?

This should work, although Apache needs additional configuration for long polling to work, if I recall correctly. Nginx is easier to setup and likely a bit faster.

So, I installed HAproxy and configured my discourse Docker for subfolder support. I took an idea of configuring apache to listen to 8080 and docker on 8088 - not sure if it is possible to leave eg. docker on port 80 and somehow configure HAproxy to listen port 80 but route requests for subfolder docker installation to port 80. At first it seems like asking for an infinite loop, but I am not en expert with HAproxy :blush:

Hovewer, my server is behing proxy blocking all outgoing internet traffic. I noticed that system assigned avatars are broken. Question now is it possible to restore this avatars with local assets or a proxy config for accessing outside of my local network?

You can generate letter avatars locally – just disable the site setting external system avatars enabled. Note that this will slightly increase CPU load.

1 Like

Thanks! that resolved my avatar issue.

1 Like

Note that also means that all embeds, eg YouTube videos, will not work.

(Actually YouTube might still work, but that’s an outlier, all the other embeds like Twitter and WordPress will be broken)

That’s OK. I have no plan to take advantage of linking to resources outside my local network.