Self-hosted installation behind a non-publicly routeable IP address

Hello,

For testing/validation purposes, I am installing Discourse on a local Ubuntu machine with a fixed local IP, let’s say 192.168.1.200.
It is behind a router with a public IP, let’s say A.B.C.D, which is not full-cone NAT. :roll_eyes:

For reasons beyond my control, I cannot change it to full-cone NAT. Therefore, my NAT configuration on the router is limited to a range of high-numbered incoming ports, meaning neither 443 nor 80 is available.

For example, let’s say I forward incoming port 50000 (TCP/UDP) to 192.168.1.200 on port 443.

In theory, a request arriving at the public IP A.B.C.D on port 50000 should be forwarded to 192.168.1.200:443.

I have a subdomain, let’s say: forum.mondomaine.me, with A and AAAA records pointing to the public IP A.B.C.D (for IPv4).

I added a redirect at this level from https://forum.mondomaine.me to my public IP A.B.C.D:50000.

When I try to access the aforementioned URL, I see the redirection to A.B.C.D:50000, and of course, a rejection since nothing is (yet) listening on 192.168.1.200:443.

The tricky part is that during the Docker installation of Discourse on my machine, the domain configuration verification step fails:

/!\ Port 443 of this computer does not appear to be accessible using hostname: forum.mondomaine.me
/!\ Connection to http://forum.mondomaine.me (port 80) also fails.

There must be a solution or a workaround, but for now, I can’t see one…

It’s a home network? Is it possible that your ISP is blocking traffic? Why not use a VPS instead?

(EDIT: Use a Cloudflare Tunnel recommend in the linked doc above)

Thanks for the replies.

Is this a home network?

Yes, as I initially wrote, I’m installing Discourse on an Ubuntu machine at home, so it is indeed a home network.

Could your ISP be blocking the traffic?

That’s exactly the case when the public IP is not full-stack. At this point, there’s nothing I can do about it.

Why not use a VPS instead?

Because for this test, I’m not planning to buy a VPS. But I agree: a VPS would be the solution if I already had one ready to go. And I wouldn’t have hesitated.

As for using a Cloudflare tunnel, from what I’ve just observed, it seems like overkill for so little… And then there’s Cloudflare…

If only it were as simple and quick to install Discourse on an isolated local network (or not)…

I did see there’s a guide somewhere (whose URL I’ve already lost) for an intranet, which also seemed quite heavy, especially compared to a standard installation!

Let’s drop it; it’s not vital, and I don’t want to spend hours on it. :laughing:

Thanks again for the replies.

can’t setup skip this step?

As explained in this post by Jay the port check can be skipped using:

 –skip-connection-test

do you need a connection from outside your lan to test or as part of your development?

sorry if I’m misunderstanding the issue

For the time spent fixing everything between your own network, Your ISP actually forwarding traffic correctly, and You ensuring you’re not leaving any doors open for a suspicious actor to hijack your home network, using cloudflare tunnels is pretty easy and straightforward imo. Particularly on a home network.

Discourse requires https. Unless you know how to get a certificate and install it as described elsewhere, your best bet is to Install Discourse on a residential internet with Cloudflare Tunnel

I think this is how to install your own certificate Allow SSL / HTTPS for your Discourse Docker setup

Thanks @Andrew_Rowe for the tip!

No, I don’t need a connection from outside my LAN to test.

So I ran install-discourse with --skip-connection-test, and as expected, the installation continued without getting stuck on the domain check.

Just remember to stop nginx if it’s already running (outside of Docker).

But it’s working! Discourse is running in its container!

But… apparently we now have a certificate issue.

nginx: [emerg] cannot load certificate "/shared/ssl/forum.mondomaine.me.cer": PEM_read_bio_X509_AUX() failed (SSL: error:0480006C:PEM routines::no start line:Expecting: TRUSTED CERTIFICATE)

Of course, I followed this topic and verified the existence of /var/discourse/shared/ssl/forum.mondomaine.me.cer, and it’s there, along with the .key and two other files: .me_ecc.cer and .key.

I rebuilt the container, but the issue persists.

I can confirm that installing Discourse on a local test machine is a real battle! :joy:

It’s clearly not encouraged.

And since there’s no simple solution (no, I will not use CloudFlare, no need to go down that road, thanks), I think this will be my last post on the subject. :grinning_face_with_smiling_eyes:

You don’t really buy one. You lease one.

No doubt @merefield, thanks for the clarification. I’ll also clarify what I meant: I don’t plan to spend any money on a VPS.

One more thing: I noticed that the docker run command included DISCOURSE_FORCE_HTTPS=true, so I tried setting it to false and then restarted after rebuilding the container.

No change.

If you don’t intend to use a Cloudfare style tunnel and just want to look around, use a dev-install

Thank you! I will indeed check that out.