Andy Balaam from Andy Balaam's Blog
I just streamed about 40 minutes of me playing Trials Fusion using Owncast. Owncast is a self-hosted alternative to streaming services like Twitch and YouTube live.
Normally, you would need to pay for a computer to self-host it on. Owncast suggest this will cost about $5/month.
But, Oracle Cloud has a “Always Free” tier that includes a “Compute Instance” (a virtual machine running Linux) that is capable of running Owncast.
Here’s how I did it:
Register for Oracle Cloud
This was probably the worst bit.
I went to oraclecloud.com and clicked “Sign up for free cloud tier”. It didn’t work in Firefox(!) so I had to use Chromium.
I had to enter my name, address, email address, phone number and credit card details. The email was verified, the phone number was verified (with a text message), and the credit card was verified (with a real transaction), so there was no getting around any of it.
They promise that they won’t charge my card. I’ll let you know if I discover differently.
Create a Compute Instance
Once I was logged in to the Oracle “console” (web site), I clicked the burger menu in the top left, chose “Compute” and then “Instances” to create a new instance. I followed all the default settings (including using the default “image”, which meant my instance was running Oracle Linux, which I think is similar to Red Hat), and when I got to the ssh keys part, I supplied the public key of my existing SSH key pair. Read the docs there if you don’t have one of these.
As soon as that was done, and I waited for the instance to be created and started, I was able to SSH in to my instance using a username of opc and the Public IP Address listed:
(Note: here and below, if I say “PUBLIC_IP”, I mean the IP address listed in the information about your compute instance. It should be a list of four numbers separated by dots.)
Allow connecting to the instance on different ports
Owncast listens for HTTP connections on port 8080, and RTMP streams on 1935, so I needed to do two things to make that work.
Modify the Security List to add Ingress Rules
- On the information about my instance, I clicked on the name of the Subnet (under Primary VNIC).
- In the subnet, I clicked the name of the Security List (“Default Security List for …”) in the Security Lists list.
- In the Security List I clicked Add Ingress Rules and entered:
Source Type: CIDR
Source CIDR: 0.0.0.0/0
IP Protocol: TCP
Source Port Range: (blank)
Destination Port Range: 8080
and then clicked Add Ingress Rules to create the rule.
- I then added another Ingress Rule that was identical, except Destination Port Range was 1935.
Allow ports 8080 and 1935 on the instance’s own firewall
It took me a long time to figure out, but it turns out the Oracle Linux running on the Compute Instance has its own firewall. Eventually, thanks to a blog post by meinside: When Oracle Cloud’s Ubuntu instance doesn’t accept connections to ports other than 22, and some Oracle docs on ways to secure resources, I found that I needed to SSH in to the machine (like I showed above) and run these commands:
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --zone=public --permanent --add-port=1935/tcp
sudo firewall-cmd --reload
Now I was able to connect to the services I ran on the machine on those ports.
The Owncast install was incredibly easy. I just followed the instructions at Owncast Quickstart. I SSHd in to the instance as before, and ran:
curl -s https://owncast.online/install.sh | bash
and then edited the file owncast/config.yaml to have a custom stream key in it. You can do that by typing:
There is information about this file at: owncast.online/docs/configuration.
I ran the service like this:
In future, if I want to leave it running, I may run it inside screen, or even use systemd or similar.
Open the web site
I could now see the web site by typing this into my browser’s address bar:
(Where PUBLIC_IP is the Public IP copied from the Instance info as before.)
Stream some video
Finally, in OBS‘s Settings I chose the Stream section and entered:
Stream key: STREAM_KEY
Where “STREAM_KEY” means the stream key I added to config.yaml earlier.
Now, when I clicked “Start Streaming” in OBS, my stream appeared on the web site!
Costs and limits
Oracle stated during sign-up that I would not be charged unless I explicitly chose to use a different tier.
The Compute Instance is part of the “Always Free” tier, so in theory it should stay up and working.
However, if you use lots of resources (which streaming for a long time probably does), I would expect services would be throttled and/or stopped completely. I have no idea whether they will allow enough resources for regular streaming, or whether this is all waste of time. We shall see.