Although you can get started with the Hasura k8s platform with just about 2 commands and in a few minutes, underneath it all, the platform is a fairly hairy monster.
I’m going to try and explain how the Hasura k8s platform works, so that you can see how all the different moving parts come together to give you a kickass stack — out-of-the-box!
1. This is a Hasura cluster
You can see that it has all the services that give you instant backend APIs and a DevOps automation component that can deploy your source code with
git. Doubtlessly, you’re astounded at how vague that diagram is. For eg: why is this even called a cluster? Read on…
2. Where does a Hasura cluster run?
Whenever you create a Hasura cluster, we provision a dedicated cluster of VMs and disks and run the Hasura platform on it. On the free plan, we run the Hasura platform on a shared cluster. This is so that we can reduce global warming and avoid bankruptcy.
3. You can choose to run on any cloud, anywhere in the world
Because each user’s Hasura cluster is an independent snowflake, as a user you can choose the underlying cloud vendor you want to run your particular cluster on.
And you can migrate automatically between any of them too. Of course, by any we mean DigitalOcean, Google Cloud Platform, AWS, Microsoft Azure. 😜 If you really want to run Hasura on another cloud vendor, get in touch! This is because every Hasura cluster, is actually just a kubernetes cluster and we’ve written vendor specific things to make the entire cluster portable 🍻
4. Talking to a Hasura cluster
For every Hasura cluster, we configure a dedicated load-balancer native to the cloud vendor, and point it to the Hasura cluster’s API gateway. We then point a default
*.hasura-app.io domain to it, so that you get a funky default domain name to remember it by.
An SSL certificate agent that lives inside the cluster furiously gets to work and asks LetsEncrypt to mint shiny new SSL certs for this domain (and any other domain names you add to it).
5. All the Hasura platform’s backend components run on this cluster
These are the components that help you avoid writing backend code for common use-cases. This is the “BaaS” bit of the Hasura platform.
6. Deploy your code on this cluster
It’s hard to get away without writing any backend code. The cooler your app is, the more likely you have some secret sauce you used to make it happen. And hence: every Hasura cluster runs an agent that has a git remote that listens to your
git push and deploys your code as container on your Hasura cluster.
We call this a GitOps agent (because you do DevOps with git!) and we’ve open-sourced it at gitkube.sh. If you have a Kubernetes cluster you can get this git magiks too. 💃
This is the “PaaS” bit of the Hasura platform.
Talking about your code, let’s talk about…
7. A Hasura project
It’s nice that there’s something cool running on the cloud somewhere, but where is its configuration coming from? Where’s the code you deploy to it? Can you just take some random code and
git push it?
A Hasura project is the answer to these existential questions. It is the single source of truth of what runs on a Hasura cluster. A Hasura project is a git-repo on your computer that is linked to a Hasura cluster via a
git remote and gets deployed to the Hasura cluster when you
git push it.
A Hasura project needs to have a certain structure so that the GitOps tooling knows where to look for stuff and how to deploy them on the Hasura cluster.
8. How do you start using Hasura?
- Find yourself a boilerplate project on hasura.io/hub.
- Follow the guide on the hasura.io/hub project page to learn how to use the Hasura backend components and how to deploy your code/host your webapps
You will have your first Hasura app deployed within minutes!
Now, go build something awesome and tell us about it @HasuraHQ!