Self hosting for free (with caveats!) with Oracle Cloud

By default, you can’t install Discourse because connections to port 80 and 443 aren’t allowed. You need to allow them both in the security list (in the Oracle control panel) and the instance firewall (via SSH).

Here’s how to do that on a regular Ubuntu installation (it’s slightly different from their official guide which uses another Linux image).

In the Oracle panel:

After creating your Ubuntu instance, go to Instance Details and click the Subnet link:

Click the Security List:

Click Add Ingress Rules, select the TCP protocol, set Source CIDR as 0.0.0.0/0, and Destination port range as 80,443.
Validate by clicking “Add Ingress Rules”.

Verify that the rules are added in the security list:

In your server command line through SSH:

Add these rules to iptables :

iptables -I INPUT 5 -i ens3 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 5 -i ens3 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT

The command will add the rules in the right place. If you simply append them to existing rules without specifying the line number (5), that won’t work because they’ll be overriden by a previous existing “reject all” rule.

Save the rules so they’ll still be here after a reboot:

netfilter-persistent save

Now you can install Discourse! :tada:

8 Likes