Remember Heroku? I bet you do! I wouldn’t be surprised if you entire app is being powered by Heroku right now!

Heroku took the world by storm by its magical Platform as a Service. Though it was originally for Ruby, they now have expanded to cover most of the languages. They have a ton of integrations and other managed server offerings.

A single command to deploy your app makes operations a hell lot easier. I guess that was why Heroku took off in the first place.

In a not so distant land reigns Google Firebase. It’s an amazing backend as a Service which advocates backendless apps. Firebase sets the bar super high by eliminating the need to deploy any form of a backend. All database interaction logic sits on the frontend. The backend is fully managed by Google.

Deploying apps is a nightmare

No matter where you come from. If you have deployed any app in production, and were responsible to make sure its always up, you know what I’m talking about.

That’s the beauty of platforms like Heroku and Firebase. They let us sleep at night.

However, Heroku turns out to be really expensive at scale, and not all logic can be written on the frontend right?

We need a platform which gives us the power to do both. Moreover, we must have the flexibility to choose our database and the cloud we want to work in.

Let’s build a solution

Kubernetes to the rescue

Kubernetes is an open source container orchestration tool. You basically give it a container to run, specify some constraints like replicas, resources, etc., and off you go.

It will run your container, and make sure it keeps running.

The problem is that it runs containers. It’s not too much to ask. But I’d prefer to deploy my apps directly without having to worry about dockerize everything.

In comes Space Cloud

Space Cloud is a web server which provides a realtime data access layer. Basically it’s an open source firebase alternative which can run on any cloud and works with any database.

It also provides a framework to write microservices in the form of functions. Think of this as an AWS Lambda, running as a long lived process. So basically you can now run long lived tensor flow models in your microservices while maintaining an API similar to lambda.

All of the features described above are completely open source.

Space Cloud Enterprise comes with a deployment module which natively connects with kubernetes. This means you can now host your frontend and run you microservices on kubernetes with a simple CLI command.

The best part? Space Cloud Enterprise costs just $10 for this feature.

Let’s get hacking!

Enough of talks. Let’s get straight to it.

Yes! We are gonna be building our own Heroku + Firebase over the next 30 minutes.

I’ll be available at the SpaceUpTech Discord server to help you accomplish this mission just in case you need any help.

So what all do we need?

Single node kubernetes cluster on DigitalOcean. Cost $20 per month

Space Cloud Enterprise. Cost: $10 per month

Courage to ride the serverless wave!

To run you through all the steps really quick, we will be:

Creating a kubernetes cluster on DigitalOcean. You’ll need a DO account for that.

Installing and configuring kubectl to talk to our newly created cluster.

to talk to our newly created cluster. Deploying MongoDB to our cluster using kubectl

Deploying Space Cloud to our cluster. This will be done using the kubectl tool.

tool. Configuring Space Cloud to enable the deploy module . And activate the deploy module by making a free account on Space Up Tech.

. And activate the deploy module by making a free account on Space Up Tech. Downloading Space CLI and deploying a web based to-do app using that.

Head over to the DigitalOcean website, sign up and create a Kuberntes cluster. Here’s a super awesome guide to create a kubernetes cluster on DigitalOcean.

Create a Kube Clusters

To create a Kubernetes cluster:

From the Create menu in the control panel, click Clusters .Choose San Francisco 2 as the datacenter region.

menu in the control panel, click .Choose as the datacenter region. Customize the default node pool, choose the 2CPU instance type , and set the number of nodes to 1 . This will cost you $20 per month.

, and set the . This will cost you $20 per month. Name the cluster kube-sc and, optionally, add a tag.

and, optionally, add a tag. Click Create Cluster . Provisioning the cluster takes several minutes.

. Provisioning the cluster takes several minutes. Note down the Public IP of the droplet just created. We’ll need this public IP later.

Configure Kubectl

Install kubectl . It’s the tool used to talk to the kubernetes cluster. We will need it just once to deploy Space Cloud to kubernetes.

. It’s the tool used to talk to the kubernetes cluster. We will need it just once to deploy Space Cloud to kubernetes. Download the cluster configuration file from the DigitalOcean Control Panel. It’s going to be on the kubernetes page. Download this file to the .kube directory inside your home folder and save by the name config . Remove the .yaml extension

from the DigitalOcean Control Panel. It’s going to be on the kubernetes page. to the directory and save by the name . Remove the .yaml extension To create a default cluster-admin role run kubectl create clusterrolebinding default-cluster-admin --clusterrole=cluster-admin --serviceaccount=default:default

Deploy MongoDB

Space Cloud doesn’t yet support deploying stateful services. So we’ll be deploying MongoDB using kubectl .

To deploy mongo db run kubectl run mongodb --image=mongo --port 27017 .

. Now to make it accessible in the cluster run kubectl expose deployment mongodb --port 27017 --target-port 27017

Run Space Cloud on kubernetes

Now we need to deploy the SC

Run the following command to run SC: kubectl create deployment space-cloud --image=spaceuptech/space-cloud

Expose SC to the external world: kubectl create service nodeport space-cloud --tcp=4122 --node-port=30122

Configure Space Cloud

All features resembling Firebase are completely open source in Space Cloud. However, the kubernetes integration is an enterprise level feature.

Open http://PUBLIC_IP:30122/mission-control and log in.

and log in. The default user is admin while the password is 123 . In an upcoming tutorial, I will be talking about configuring Mission Control which talks about changing the default credentials as well.

while the . In an upcoming tutorial, I will be talking about configuring Mission Control which talks about changing the default credentials as well. Create a new Project . Name it test-kube . Choose MongoDB as the default database.

. Name it . Choose MongoDB as the default database. In the User Management section, enable Mail Authentication.

section, enable Authentication. Head over to the Database section. Edit the MongoDB connection string to mongodb://mongodb:27017 and hit save.

section. Edit the MongoDB connection string to and hit save. In the Static Hosting section, add a route and enter the following config: { "prefix": "/", "proxy": "http://todo-app:8000" }

section, add a route and enter the following config: Go to the Plans section and select Standard .

section and select . It will prompt you to sign into SpaceUpTech. Create a free account. Without this you will not be able to use the deployment module.

Next step is to enable the deploy module. You can do this in the Deploy section.

Deploy the Frontend

Mahn! Those have been a lot of steps. Maybe I should write a shell script to do all of this next time. Just one more step to go guys.

The final step is deploying the frontend. For this we will need Space CLI. Download the package for your OS and don’t forget to make it executable and add it to your path: Windows, Linux, Mac OS

Now download the frontend archive I’ve created for you.

Extract it and cd into the folder.

into the folder. Run the space-cli init command and enter the name todo-app . The project is test-kube . Kind is a Web App . Leave the rest to defaults.

command and enter the name . The project is . Kind is a . Leave the rest to defaults. Run space-cli cluster add test-kube http://PUBLIC_IP:30122 followed by space-cli login test-kube . The username is admin and the password is 123 . This is the same username and password we used to log into mission-control.

followed by . The username is and the password is . This is the same username and password we used to log into mission-control. To deploy, all you need to do is run space-cli deploy test-kube command. This will package your app and ship it out to you cluster.

Check the app out http://PUBLIC_IP:30122 . Open it in multiple tabs to checkout the crazy realtime feature.

From here on, you can deploy any service or web app directly without having to deal with kubectl .

Wrapping Up

That was one heck of a tutorial. In the days ahead, my goal will be simplifying this entire process.

Space Cloud is a pretty cool tool. I know I’m talking about my own project here, but you must give it a try. You can follow the quick start page to get things up and running or get your hands dirty with the getting started guide.

If you like what we are doing, do star us on GitHub. We would love to get you onboard as well! You can start by posting about a bug or suggest improvements. Also, you can join our discord server to get in touch with us directly.