PromucFlow_constructor/deploy/k8s/README.md
Arpit Mohan 39ab488193
Adding script for k8s deployment (#1359)
Also support feature for generating SSL certificate for domain when deploying on Kubernetes

Co-authored-by: GEEK Up Team <prj_legodevops@geekup.vn>
2020-10-30 09:51:05 +05:30

127 lines
5.9 KiB
Markdown

---
description: Appsmith stands for speed and getting started with Appsmith is just as fast.
---
# Getting started
You can begin using appsmith via our cloud instance or by deploying appsmith yourself
* [Using Appsmith Cloud](quick-start.md#appsmith-cloud) **\(recommended\):** Create a new application with just one click
* [Using Docker](quick-start.md#docker): Deploy anywhere using docker
## Appsmith Cloud
The fastest way to get started with appsmith is using our cloud-hosted version. It's as easy as
1. [Create an Account](https://app.appsmith.com/user/signup)
2. [Start Building](core-concepts/building-the-ui/)
## Prerequisites
* Ensure `kubectl` is installed and configured to connect to your cluster
* Install kubeclt: [kubernetes.io/vi/docs/tasks/tools/install-kubectl/](https://kubernetes.io/vi/docs/tasks/tools/install-kubectl/)
* Minikube: [Setup Kubectl](https://minikube.sigs.k8s.io/docs/handbook/kubectl/)
* Google Cloud Kubernetes: [Configuring cluster access for kubectl
](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl)
* Aws EKS: [Create a kubeconfig for Amazon EKS](https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html)
* Microk8s: [Working with kubectl](https://microk8s.io/docs/working-with-kubectl)
* Kubernetes NGINX Ingress Controller must be enable on your cluster by default. Please make sure that you install the right version for your cluster
* Minikube: [Set up Ingress on Minikube with the NGINX Ingress Controller](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/)
* Google Cloud Kubernetes: [Ingress with NGINX controller on Google Kubernetes Engine](https://kubernetes.github.io/ingress-nginx/deploy/)
* AWS EKS: [Install NGINX Controller for AWS EKS](https://kubernetes.github.io/ingress-nginx/deploy/#network-load-balancer-nlb)
* Microk8s: [Add on: Ingress](https://microk8s.io/docs/addon-ingress)
* Script tested on Minikube with Kubernetes v1.18.0
## Kubernetes
Appsmith also comes with an installation script that will help you configure Appsmith & deploy your app on Kubernetes cluster.
1. Fetch the **install.k8s.sh** script on the system you want to deploy appsmith
```bash
# Downloads install.sh
curl -O https://raw.githubusercontent.com/appsmithorg/appsmith/master/deploy/k8s/install.k8s.sh
```
2. Make the script executable
```bash
chmod +x install.k8s.sh
```
3. Run the script.
```bash
./install.k8s.sh
```
4. Check if all the pods are running correctly.
```bash
kubectl get pods
#Output should look like this
NAME READY STATUS RESTARTS AGE
appsmith-editor-cbf5956c4-2zxlz 1/1 Running 0 4m26s
appsmith-internal-server-d5d555dbc-qddmb. 1/1 Running 2 4m22s
imago-1602817200-g28b2 1/1 Running 0 4m39s
mongo-statefulset-0 1/1 Running 0 4m13s
redis-statefulset-0 1/1 Running 0 4m00s
```
5. Custom Appsmith's Configuration
* After you successfully run the script, all the configuration files have been downloaded and & stored into `<Installation Path>`
* If you want to update your app settings (ex: database host). Go to the `<Installation Path>/config-template`, update the corresponding value in the configmap file, then restart the pods.
* Below steps will help you update database hostname of your application:
* Open file `appsmith-configmap.yaml` in `<Installation Path>/config-template` folder
* Update the value of variable `APPSMITH_MONGODB_URI` to your database host name
* Run commands:
```
kubectl apply -f appsmith-configmap.yaml
kubectl scale deployment appsmith-internal-server --replicas=0
kubectl scale deployment appsmith-internal-server --replicas=1
```
{% hint style="success" %}
* You can access the running application on the **Ingress Endpoint** if you not chose to provide custom domain for your application .
```
kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
appsmith-ingress <none> * XXX.XXX.XX.XXX 80 2m
```
* You may need to wait 2-3 minutes before accessing the application to allow application start (depends on your cluster).
{% endhint %}
### Custom Domains
To host Appsmith on a custom domain, you can contact your domain registrar and update your DNS records. Most domain registrars have documentation on how you can do this yourself.
* [GoDaddy](https://in.godaddy.com/help/create-a-subdomain-4080)
* [Amazon Route 53](https://aws.amazon.com/premiumsupport/knowledge-center/create-subdomain-route-53/)
* [Digital Ocean](https://www.digitalocean.com/docs/networking/dns/how-to/add-subdomain/)
* [NameCheap](https://www.namecheap.com/support/knowledgebase/article.aspx/9776/2237/how-to-create-a-subdomain-for-my-domain)
* [Domain.com](https://www.domain.com/help/article/domain-management-how-to-update-subdomains)
{% hint style="warning" %}
* During the setup of Ingress Controller on your cloud. You will need to map your custom domain with the External IP of the controller before running the installation script
* Below is an example how to achieve the External IP of NGINX Ingress Controller
```
➜ kubectl get svc -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer XX.XXX.X.XX XX.XX.XX.XXX 80:XXXXX/TCP,443:XXXXX/TCP 17h
ingress-nginx-controller-admission ClusterIP XX.XXX.X.XX <none> 443/TCP 17h
```
{% endhint %}
## Troubleshooting
If at any time you encounter an error during the installation process, reach out to **support@appsmith.com** or join our [Discord Server](https://discord.com/invite/rBTTVJp)
If you know the error and would like to reinstall Appsmith, simply delete the installation folder and the templates folder and execute the script again