Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Kubernetes via Terraform and Manifests #5721

Conversation

LumosViridi
Copy link
Contributor

Support for Kubernetes via Terraform and Manifests

Adding basic support for the following Kubernetes resources

  • persistent volume
    • server
    • database
  • persistent volume claim
    • server
    • database
  • deployment
    • server
    • database
  • ingress
    • server
  • service
    • server
    • database
  • secret
    • server

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Added Kubernetes deployments for server and database
  • Introduced services for server and database
  • Configured persistent volumes and claims for server and database
  • Set up Ingress for external access
  • Added Terraform configurations for Kubernetes resources

@FelixMalfait
Copy link
Member

Oh nice thanks :). I've never done any Terraform so I'm not able to review this but I know some people will be happy to see this

@sysaeon
Copy link

sysaeon commented Jun 9, 2024

Thanks for adding this! It motivated me to get Twenty setup in my k3s cluster for testing.

I ended up using the bjw-s App Template Helm Chart with many of the values you provided here in the manifests. Also, using Flux instead of Terraform.

Had to define FRONT_BASE_URL due to this error:

- property FRONT_BASE_URL has failed the following constraints: isUrl

Also, the service for twenty-postgres shows up as twenty-twenty-postgres, which changed the URL (for me) to:

postgres://twenty:[email protected]/default

Does anyone know if it's possible to change the postgres password without building a new docker image? It would make sense to put the postgres password and URL into secrets and call them with something like this (under each deployment):

- name: POSTGRES_PASSWORD
  valueFrom:
    secretKeyRef:
      name: twenty-config-secrets
      key: pgPassword
---
- name: PG_DATABASE_URL
  valueFrom:
    secretKeyRef:
      name: twenty-config-secrets
      key: pgDatabaseUrl

Otherwise, everything appears to be running well.

@LumosViridi
Copy link
Contributor Author

Thanks for adding this! It motivated me to get Twenty setup in my k3s cluster for testing.

I ended up using the bjw-s App Template Helm Chart with many of the values you provided here in the manifests. Also, using Flux instead of Terraform.

Had to define FRONT_BASE_URL due to this error:

- property FRONT_BASE_URL has failed the following constraints: isUrl

Also, the service for twenty-postgres shows up as twenty-twenty-postgres, which changed the URL (for me) to:

postgres://twenty:[email protected]/default

Does anyone know if it's possible to change the postgres password without building a new docker image? It would make sense to put the postgres password and URL into secrets and call them with something like this (under each deployment):

- name: POSTGRES_PASSWORD
  valueFrom:
    secretKeyRef:
      name: twenty-config-secrets
      key: pgPassword
---
- name: PG_DATABASE_URL
  valueFrom:
    secretKeyRef:
      name: twenty-config-secrets
      key: pgDatabaseUrl

Otherwise, everything appears to be running well.

Thanks for your comment @sysaeon!

The pg password caused a lot of trouble for me as well. I spent a few hours banging my head on my keyboard trying to get any value other than twenty to work. I was only able to establish a connection with the hardcoded / default value. 🫤

I had issues with the FRONT_BASE_URL as well but it looks like you were able to work through it.

@sashahilton00
Copy link

I'd just add, the use of ReadWriteMany for the persistent volumes will cause problems with most cloud providers. It may work in a k3s setup, but iirc GCP, AWS and DO do not support it for their storage classes.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated useTasks hook to improve task fetching and filtering
  • Enhanced useWorkspaceFromInviteHash for better workspace invite handling
  • Modified RecordTableCellContainer to handle edit/display modes and hotkeys
  • Improved useFindManyRecords for efficient record fetching
  • Added useHandleToggleColumnFilter and useHandleToggleColumnSort for column filter/sort management

10 file(s) reviewed, no comment(s)

@LumosViridi
Copy link
Contributor Author

I'd just add, the use of ReadWriteMany for the persistent volumes will cause problems with most cloud providers. It may work in a k3s setup, but iirc GCP, AWS and DO do not support it for their storage classes.

Good call! Most default cases like AWS EBS-CSI don't support ReadWriteMany but AWS EFS-CSI now has native support.

I tried to convey in the README that storage is highly opinionated to the users environment and should be expected to be modified.

I update this to ReadWriteOnce since it will work in more use-cases than ReadWriteMany. Hopefully it helps others use this more easily! 🚀

@lucasbordeau lucasbordeau self-assigned this Jun 21, 2024
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added Kubernetes deployment section using Terraform and manifests in packages/twenty-website/src/content/developers/self-hosting/cloud-providers.mdx
  • Included link to community-led documentation for Kubernetes deployment
  • Added disclaimers for Render, RepoCloud, and Azure Container Apps documentation being community-led and potentially outdated

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@FelixMalfait
Copy link
Member

Hey sorry we left this open for so long.
We are still focused on product development/stability and getting out of alpha/beta asap so deployment isn't a core priority yet, but hopefully it will be once things become more stable. Even though we didn't do a proper review, I'm adding this to the doc and adding this as a "community-led effort" as I'm sure it can be very helpful to many! Thanks a lot!

@FelixMalfait FelixMalfait merged commit 43016db into twentyhq:main Jul 10, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants