A complete solution guide for self-hosting Typesense elastic search database on Amazon EKS (Elastic Kubernetes Service)
This README provides step-by-step instructions for setting up an Amazon EKS (Elastic Kubernetes Service) cluster using the setup_eks_cluster.sh script.
eksctl installedkubectl installed (ensure it supports kustomize)helm installedSet Environment Variables
Open setup_eks_cluster.sh and update the following variables:
CLUSTER_NAME: Set your desired cluster name (e.g., "sample")REGION: Set your desired AWS region (e.g., "us-east-1")ACCOUNT_ID: Replace with your AWS account ID (e.g., "12345678")VERSION: Set Kubernetes version (e.g., "1.31")Node Group Settings:
WORKER_NODE_TYPE: Instance type for worker nodes (e.g., "r6i.xlarge")WORKER_NODES: Initial number of nodes (e.g., 2)WORKER_NODES_MIN: Minimum nodes for autoscaling (e.g., 1)WORKER_NODES_MAX: Maximum nodes for autoscaling (e.g., 5)NODE_GROUP_NAME: Name of the node group (e.g., "standard-workers")Create EKS Cluster
cluster.yaml before proceedingConfigure Node Groups
WORKER_NODE_TYPE)WORKER_NODES_MIN, max: WORKER_NODES_MAX)Associate IAM OIDC Provider
Set Up EBS CSI Driver
Set Up AWS Load Balancer Controller
Verify Installation
Make the script executable:
chmod +x setup_eks_cluster.sh
Run the script:
./setup_eks_cluster.sh
Follow the output to ensure each step completes successfully
Follow these steps to deploy Typesense using Kustomize:
Review Configuration
application directorykustomization.yaml: Main configuration fileConfigure Typesense Settings
Set Up Secrets
kubectl kustomize environment/development/. or kubectl kustomize environment/production/.Deploy Typesense
# Deploy to development environment
kubectl apply -k environment/development/.
# Deploy to production environment
kubectl apply -k environment/production/.
# Verify the deployment
kubectl get pods -n your-namespace # Check pod status
kubectl get pvc -n your-namespace # Verify storage provisioning
kubectl get svc -n your-namespace # Check service creation
kubectl get ingress -n your-namespace # Verify ingress configurationAccess Typesense
Monitoring
kubectl exec -it typesense-0 -n your-namespace -- curl http://localhost:8108/healthkubectl logs -f typesense-0 -n your-namespaceCI/CD Pipeline Setup
.github/workflows/aws.ymlname: Deploy to EKS
on:
push:
branches: [ development, main ]
jobs:
build:
name: Deployment
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
steps:
- name: Set short git commit SHA
id: commit
uses: prompt/actions-commit-hash@v2
- name: Check out code
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Update kube config
env:
EKS_CLUSTER_NAME: ${{ secrets.EKS_CLUSTER_NAME }}
AWS_REGION: ${{ secrets.AWS_REGION }}
run: aws eks update-kubeconfig --name $EKS_CLUSTER_NAME --region $AWS_REGION
- name: Deploy to EKS
run: |
kubectl apply -k environments/${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}/.Required GitHub Secrets:
AWS_ACCESS_KEY_ID: AWS IAM user access keyAWS_SECRET_ACCESS_KEY: AWS IAM user secret keyEKS_CLUSTER_NAME: EKS cluster nameAWS_REGION: AWS regionPipeline Features:
To set up the pipeline:
To delete the EKS cluster and associated resources when no longer needed:
We welcome contributions to improve the typesense-eks project! Here's how you can contribute:
Fork the Repository
Create a Branch
feature/add-monitoring or fix/nodegroup-scaling)Make Your Changes
Submit a Pull Request
Code Review
If you find a bug or have a feature request:
For questions or discussions, please use the repository's Discussions section.