As I was looking for ways to deploy a node & react site for intranet, I was looking for a self-hosted PaaS (Platform as a Service) I can deploy internally.
I was reading thru "Heroku vs self-hosted PaaS", I decided to go with Dokku (even though CapRover looked quite appealing as well) because I don't need to scale up to multiple servers for intranet pages.
I will show you how to install Dokku on Kubuntu (Ubuntu but with KDE Plasma Desktop Environment instead of Gnome) running on Windows Hyper-V.
My linux skill is lacking so will be using KDE to configure some Dokku features. You don't need Hyper-V to follow but can also use linux (even though Dokku recommends installing it on a VM) or use Linux VM such as KVM or Virtual Box, etc.
Be warned. I am just writing down these steps for me to come back so it might not be an optimal/recommended to follow these steps.
but please don't hesitate to let me know how to improve the flow (especially without using KDE).
You can create a VM manually or using a Wizard ("Quick Create") but as it's a prerequisite, let's create it using a Wizard. (At work, I will delegate this task to a ops manager as I am not so familiar with this frankly 😅).
This pops up a modal and select the Kubuntu ISO downloaded from the previous step. (If you are familiar with regular Ubuntu, you don't have to download Kubuntu at all...).
⚠Make sure to turn off "This Virtual Machine will run Windows (enables secure boot)".
Lastly "Create Virtual Machine" and you are done.
By default the VM name is"New Virtual Machine". (I renamed it to "Kubuntu 18.04 LTS x64 for Dokku" by right clicking on it and choose "rename").
You'd need to start the VM as it's off by default as well.
◼ Install Kubuntu
On connecting to VM, click on "start" to fire up a Kubuntu installation wizard (by default, the VM is in "Off" state as shown in the previous image).
Click on "Installation Kubuntu" to start the process.
Set up the language, keyboard, timezone, etc and the user account (clicking next, next, next...).
It might take a while, so let's go and grab a cup of coffee ☕ and come back...
After installation has finished, restart Kubuntu (not the VM).
"Deploying to Dokku" shows how to deploy a Ruby on Rails app but as I am not familiar with it at all, I will deploy a Node app (an Express server). And this also enables me not having to install postgres and other dependent services, making it simpler to demonstrate the deploy process.
Let's create ~/src folder (not to pollute the home directly, ~) and clone "node-js-getting-started" repository (repo, hereafter) from GitHub.
You might be wondering, "You are pasting code? You suck". Yes I know. But explaining how to create a Dokku deployable source with Procfile would be better left in another post as this post is titled "Installing Dokku on Kubuntu".
For now, you don't have to install packages as publishing to Dokku will take care of it automatically.
You need to create an application on where Dokku is hosted. (You can do so by SSH'ing to the host or just run it in Konsole within VM).
dokku apps:create node-js-getting-started
You will be asked to enter the root password.
Then a message will be shown that an app has been created successfully.
Dokku is compatible with Heroku and works similiarly. That means the deployment can be done via git.