Canonical version of this article at https://gitlab.com/ptman/matrix-docs/tree/master/free-matrix-server
Get one from Freenom for free or any other place you wish. Freenom only gives free domains for a year. A Matrix server cannot be migrated from one domain to another, so you might want to get a longer-lived one.
You also need to specify subdomains (which is why most dynamic dns services aren't sufficient). To do this I added the domain on the free Cloudflare plan. You can also use freenom dns management if you prefer.
Comparison of free cloud offerings (2019/10):
|Vendor||Time-limit||Count||RAM (GB)||Storage (GB)||Transfer (GB)|
|AWS||12 months||1 t2.micro||1||30||15|
|Azure||12 months||1 B1S||1||2x 64||15|
|GCP||no limit||1 f1-micro||0.6||30||1|
|Oracle||no limit||2 VM.Standard.E2.1.Micro||1||100||10000|
If you choose to, register on Oracle Cloud (requires credit card for verification) and create a free VM:
ssh-keygenif you don't have one)
View resources and make sure the instance and boot volume are "Always Free" if you don't intent to pay for them.
Make sure you can ssh to the server (using the ssh key you generated/picked)
using the user 'ubuntu' and can use
TURN/STUN is used for audio and video stream NAT/firewall traversal. coturn implements the protocol. If you don't need 1-on-1 video/audio calls, or if you're sure NAT and firewall won't be a problem (e.g. you only do calls on networks where you're sure traffic can flow) you can disable coturn to save some more RAM. Generally using coturn gives you much more reliable audio/video calls.
View resources -> Instances -> Select instance -> Virtual Cloud Network -> Public Subnet -> Security Lists -> Default -> Ingress
Open incoming for CIDR 0.0.0.0/0:
The Oracle Cloud Ubuntu images come with somewhat restrictive iptables rules by default. Docker manages the instance firewall and we have the Oracle Cloud firewall in front, so let's remove the current firewall to avoid trouble:
apt purge netfilter-persistent iptables-persistent
Oracle cloud includes a somewhat heavy monitoring daemon. We have better use for that memory since current versions of Synapse, the Matrix homeserver, can be memory hungry.
snap remove oracle-cloud-agent apt purge snapd open-iscsi lxd lxcfs
I suggest enabling swap, since there's only 1 GB of RAM.
dd if=/dev/zero of=/swap bs=1M count=1k chmod 0600 /swap mkswap /swap swapon /swap echo '/swap none swap sw 0 0' >> /etc/fstab
Assuming you're using a new domain only for this you need the following DNS records:
Follow the guide, with some tweaks:
git clone https://github.com/spantaleev/matrix-docker-ansible-deploy/ cd matrix-docker-ansible-deploy mkdir inventory/host_vars/matrix.$domain cp examples/host-vars.yml inventory/host_vars/matrix.$domain/vars.yaml cp examples/hosts inventory/hosts $EDITOR inventory/hosts $EDITOR inventory/host_vars/matrix.$domain/vars.yaml # you'll need to rerun setup-all and start tags again if you edit vars later ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start ansible-playbook -i inventory/hosts setup.yml --tags=self-check ansible-playbook -i inventory/hosts setup.yml -e username=$user -e password=$pass -e admin=yes --tags=register-user
matrix_mxisd_enabled: false matrix_mailer_enabled: false matrix_coturn_enabled: true # disable to save more RAM
matrix_synapse_configuration_extension_yaml: | limit_remote_rooms: enabled: true complexity: 1.0 # this limits joining complex (~large) rooms, can be # increased, but larger values can require more RAM
Remember to keep your VM up to date!
apt update apt upgrade reboot # e.g. kernel,dbus,systemd updates
To keep the matrix services upgraded, start by reading the maintenance docs, but really, take a brief look at all the documentation.