M4 Mac Mini: A guide for replacing the cloud stack
This is a continuation from my last post on https://read.ctmakes.com/the-new-m4-mac-mini-best-value-mac-on-the-market/
Having recently just bought a M4 Mac Mini, and using it for a week as of today, the performance to price ratio is simply too good (and this is coming from me, a lifelong Windows user).
Right now it is easily handing running a blockchain node as well as several of my personal web tools with ease. Previously running all of the apps plus the blockchain node, even on the cheapest DigitalOcean plans would set me back about 50 usd a month to run, so given that the M4 Mac Mini is 599 usd (basically one year of hosting), it is quite a no brainer. The only other consideration will be whether the internet service provider plan that we are using is stable enough to server the applications.
This next part is a guide for any developers looking to do the same, by serving the apps over https to end users using the M4 Mac Mini.
Firstly, signup or login to your Cloudflare account and go to Cloudflare Zero Trust:
Prerequisites:
- Add a website to Cloudflare. (This assumes you already have a domain name, if not buy one from Namecheap or any other domain provider)
- Change your domain nameservers to Cloudflare.
Create a Tunnel:
- Log in to Zero Trust and navigate to Networks > Tunnels.
- Select "Create a tunnel" and choose "Cloudflared" as the connector type.
- Enter a name for your tunnel and save it.
- Install and run Cloudflared on your machine.
Connect an Application:
- In the Public Hostnames tab, choose a domain and specify subdomain or path information.
- Specify a service that is running locally (e.g. for a Laravel app - https://localhost:8000).
- The way I usually run it is using
docker
ordocker compose
to simplify the deployment, however this does have downsides in terms of docker overhead so make sure that you have tested the app loading speed before deciding to go with docker.
- The way I usually run it is using
- Save the tunnel.
Connect a Network:
- In the Private Networks tab, add an IP or CIDR.
- Save the tunnel.
View Your Tunnel:
- After saving, the tunnel will be listed along with its active connector.
You can find more detailed instructions on the Cloudflare Zero Trust documentation page.
Some final notes, for large scale production ready apps, this approach will likely NOT be suitable due to knowledge and hardware required to scale the setup. As for hobbyist projects and running individual blockchain nodes, this is basically a perfect setup for now.
Other apps that you may want to use to complete this setup:
- UptimeKuma (https://github.com/louislam/uptime-kuma) or UptimeRobot (https://uptimerobot.com/) for monitoring your site uptime
- Teamviewer (https://www.teamviewer.com/) for managing the M4 Mac Mini remotely