Setting Up Appsmith with K8Sappsmithmagic: A Customizable Guide for Total Control.

December 21, 2024
0
ยท 0

Hello everyone! I'm Andrey, and I'm thrilled to share with you my first public technical article, specially dedicated to the Appsmith community. As a software engineer at a TI consultancy and a native of Costa Rica, I'm 20 years old and deeply passionate about technology. In my spare time, I love exploring new solutions and sharing my knowledge on online forums.

This article stemmed from a personal need I encountered in my daily work: managing Appsmith's YAML from my infrastructure on EKS (Elastic Kubernetes Service). I wanted to have full control over both the databases and Appsmith, from choosing replicas to incorporating custom cron jobs and secrets. I realized that this level of customization and control was more achievable than I initially thought, and I wanted to share it with you all.

So, inspired by my own experience and the desire to make the process easier for others, I wrote this article. I hope it proves useful to you and helps you customize your Appsmith environment in the way that best suits your needs.

Let's dive into the content!

Currently, in Appsmith, there exists integration with K8S using Helm and Minikube. It's highly useful and straightforward to integrate into your server, requiring only a couple of commands. However, if you're someone who prefers total control over what goes on your server and dislikes relying on third parties, this is the solution for you. In this technical guide, I'll show you the simple way to create your own integration of Appsmith in K8S, using local configuration files, enabling you to bring up the Appsmith server solely with the provided scripts defined in the repository. Additionally, I'll briefly explain each file and its purpose so you can customize this integration as needed.

One of the wonderful features of this guide is its complete customizability. You could swap your database for ones that consume fewer resources, create necessary namespaces, control database replicas, and easily set up testing, development, and production environments from the configuration files.

Let's start by looking at the prerequisites needed to follow this technical guide.

  1. Linux-based operating system, in this case, we're using Ubuntu 22.04.
  2. Kubernetes (K8S). You can follow this installation guide: Kubernetes Installation Guide
  3. Minikube: Minikube Installation Guide
  4. Docker: Docker Installation Guide
  5. Visual Studio Code: Visual Studio Code Installation Guide

File Configuration

  1. Once we meet these requirements, we can proceed to the first step, which is to create a new folder where we'll configure our Appsmith instance.
mkdir Appsmithfk8s && cd Appsmithk8s

          2. Now, let's clone the repository.

git clone <https://github.com/AndreyRojasD/K8sAppsmithMagic.git>

         3. Execute the script to start Appsmith with the following command.

cd K8sAppsmithMagic/ && ./deploy.sh

That's all to have our Appsmith running in K8S. Below, I'll briefly describe the files available in this repository, which can be modified to adapt the cluster to your needs.

The following files control Appsmith, where we'll store the data, which port it will run on, and where the backend databases come from.

appsmith-conf.yaml
appsmith-deployment.yaml
appsmith-service.yaml

The following files control the deployment of pods for the Mongo and Redis databases.

mongo-deployment.yaml
mongo-service.yaml
redis-deployment.yaml
redis-service.yaml

That's all for this simple, quick, and to-the-point guide. One thing to note is that the current scripts were only tested on Ubuntu. They may require some adjustments to run on macOS or Windows, but you can follow the commands in the scripts to modify them for your operating system. I'll soon update the repo to make the startup scripts more compatible.