twenty/packages/twenty-docker/k8s
azaurus1 bb5cc7e30c
Update PG_DATABASE_URL to match Service name in k8s manifests (#8989)
### Issue Summary
The `service` name in the Kubernetes manifest for the PostgreSQL
database is defined as `twentycrm-db`. However, the `DSN` configuration
in the Server and Worker `deployments` incorrectly references
`twenty-db`. This mismatch causes the pods to fail during initialization
and crash on boot.

### Fix Description
- Updated the `DSN` values in both the Server and Worker `deployments`
to correctly reference `twentycrm-db`, ensuring alignment with the
database `service` name.
- Verified the deployments to ensure the pods start without issues after
the fix.

### Testing
- Deployed the updated manifests in a development environment.
- Confirmed that both Server and Worker pods initialize correctly and
connect to the database service as expected.
2024-12-10 08:21:38 +01:00
..
manifests Update PG_DATABASE_URL to match Service name in k8s manifests (#8989) 2024-12-10 08:21:38 +01:00
terraform Begin moving to postgres spilo + adding pgvector (#8309) 2024-11-15 09:38:30 +01:00
README.md Support for Kubernetes via Terraform and Manifests (#5721) 2024-07-10 13:54:27 +02:00

README

Overview

This repository contains Kubernetes manifests and Terraform files to help you deploy and manage the TwentyCRM application. The files are located in the packages/twenty-docker/k8s directory.

Prerequisites

Before using these files, ensure you have the following installed and configured on your system:

  • Kubernetes cluster (e.g., Minikube, EKS, GKE)
  • kubectl
  • Terraform
  • Docker

Setup Instructions

Step 1: Clone the Repository

Clone the repository to your local machine:

git clone https://github.com/twentyhq/twenty.git
cd twentycrm/packages/twenty-docker/k8s

Step 2: Customize the Manifests and Terraform Files

Important: These files require customization for your specific implementation. Update the placeholders and configurations according to your environment and requirements.

Step 3: Deploy with Terraform

  1. Navigate to the Terraform directory:

    cd terraform
    
  2. Initialize Terraform:

    terraform init
    
  3. Plan the deployment:

    terraform plan
    
  4. Apply the deployment:

    terraform apply
    

OR

Step 3: Deploy with Kubernetes Manifests

  1. Navigate to the Kubernetes manifests directory:

    cd ../k8s
    
  2. Create Server Secret

    kubectl create secret generic -n twentycrm tokens --from-literal accessToken=changeme --from-literal loginToken="changeme" --from-literal refreshToken="changeme" --from-literal fileToken="changeme"
    
  3. Apply the manifests:

    kubectl apply -f .
    

Customization

Kubernetes Manifests

  • Namespace: Update the namespace in the manifests as needed.
  • Resource Limits: Adjust the resource limits and requests according to your application's requirements.
  • Environment Variables: Configure server tokens in the Secret command above.

Terraform Files

  • Variables: Update the variables in the variables.tf file to match your environment.
  • Locals: Update the locals in the main.tf file to match your environment.
  • Providers: Ensure the provider configurations (e.g., AWS, GCP) are correct for your setup.
  • Resources: Modify the resource definitions as needed to fit your infrastructure.

Troubleshooting

Common Issues

  • Connectivity: Ensure your Kubernetes cluster is accessible and configured correctly.
  • Permissions: Verify that you have the necessary permissions to deploy resources in your cloud provider.
  • Resource Limits: Adjust resource limits if you encounter issues related to insufficient resources.

Logs and Debugging

  • Use kubectl logs to check the logs of your Kubernetes pods.
  • Use terraform show and terraform state to inspect your Terraform state and configurations.

Conclusion

This setup provides a basic structure for deploying the TwentyCRM application using Kubernetes and Terraform. Ensure you thoroughly customize the manifests and Terraform files to suit your specific needs. For any issues or questions, please refer to the official documentation of Kubernetes and Terraform or seek support from your cloud provider.


Feel free to contribute and improve this repository by submitting pull requests or opening issues. Happy deploying!