Turning the Company’s PC Into a Personal “Vercel-Like” Platform

Written by goon | Published 2023/06/19
Tech Story Tags: kubernetes | web-development | devops | vercel | webdev | web-app-development | ubuntu | ubuntu-hacks

TLDRWith Kubernetes cluster, I (and my teammates) can deploy ANY apps. I use my company’s PC (Ubuntu Server OS, 1TB SSD drive, 8 core, 32GB of memory) to build web apps. To be able to deploy the web app to your MicroK8S cluster from your computer, you will need to install Diginext.via the TL;DR App

Why?

  • Because… why not? (it’s FREE, lol)

  • Utilize the power of my own PC to build web apps faster (with zero build time cost).

  • Kubernetes is hard & pushing developers to learn it even harder, well, I learned it so you don't have to.

  • Unlike Vercel, with a Kubernetes cluster, I (and my teammates) can deploy ANY apps.

Requirements

  • A computer (obviously!) with Ubuntu Server OS

    • Specification at least: 2 core, 4GB memory
    • Recommendation: 4 core, 8GB memory (because MicroK8S will take around 2,5GB of memory to run, but you will also need some for your applications)
    • DigitalOcean has some droplets with good pricing tiers.
  • MicroK8S to spin up a Kubernetes cluster

  • Lastly, this magical open-source tool: Diginext

Architecture

In this case, I use my company’s PC (Ubuntu Server OS, 1TB SSD drive, 8 core, 32GB of memory)

Install MicroK8S & deploy Diginext Server

curl -sfL https://diginext.site/install/microk8s | sh -

After it’s finished, you can try to access this URL: http://server-ip-address, if you can see the log in / sign-up screen, then your cluster is ready!

For example*: http://192.168.0.52*

Create new account

Navigate to: http://server-ip-address then create a new account.

Create your first workspace

Now you need a Diginext key, grab one here (no worries, it’s free).

Give your workspace a name and paste the key into it, then submit & you’re good to go.

Connect Diginext CLI to your workspace

To be able to deploy the web app to your MicroK8S cluster from your computer, you will need to install Diginext CLI and connect it to your Diginext workspace.

Open the terminal and install Diginext CLI with:

(If you don’t have Node.js 18+ installed, get it first)

npm i @topgroup/diginext --location=global

After it’s finished, you can use dx commands.

But first, let’s connect your Diginext CLI to the workspace:

dx login http://your-ip-address
# the browser will open up, copy & paste the access token here
# you will see a success message

Deploy a static webapp

  • Diginext Server needs permissions to pull the git repository and start building, so let’s navigate to http://server-ip-address/git and connect your Bitbucket or GitHub account.

  • Diginext Server also needs a container registry to store the build image, I will use Docker Hub in this example. Navigate to http://your-ip-address/infrastructure/registry/ and connect your Docker Hub with username & password.

  • When it’s done, back to your Terminal and create a new app with dx new command & fill in the form:

    • Project: Hello World

    • App: Static Site

    • Framework: pick “Static Site Framework”

    • Git provider: select the one you have connected to recently.

  • Navigate to the directory: cd ./app-directory and you will see the source code of the framework, nothing special here, just static HTML files and a Dockerfile

  • Deploy to our MicroK8S cluster using this command: dx deploy It will request the Diginext Server to pull the git repository of the webapp, then build the container image from the Dockerfile, and deploy it the MicroK8S cluster.

    • Cluster: pick “Default Cluster”

    • Use generated domain: YES

    • Port: 80

  • Now check out the link in the Terminal to see the build & deploy process, something like this:

When it’s finished, click on the auto-generated link, and you will see your web app now going live, woohoo!

👉 Since I have only set up this server for internal use, if you want to publish it on the internet, you may need to expose some ports on your internet router and configure traffic routing / security guards to your metal server. However, this is beyond the scope of this article.

Also published here.


Written by goon | Senior Copy-Paster 😋
Published by HackerNoon on 2023/06/19