NOTES:
Thank you for installing Formbricks! Here's how you can access and manage your deployment:

1. Accessing Your Application:
{{- if .Values.traefik.enabled }}
   Traefik is enabled for ingress routing.
   Your application should be available at: https://{{ .Values.hostname }}
   Note: Ensure your DNS is properly configured to point to your cluster's IP.
{{- else if contains "ClusterIP" .Values.service.type }}
   Your application is running inside the cluster with ClusterIP service type.
   To access it locally, run the following command:
   kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ include "formbricks.fullname" . }} 8080:{{ .Values.service.port }}
   Then visit http://localhost:8080 in your browser.
{{- end }}

2. Database (PostgreSQL) Access:
{{- if .Values.postgresql.enabled }}
   PostgreSQL is deployed within your cluster.
   To get the PostgreSQL password, run:
   kubectl get secret --namespace {{ .Release.Namespace }} {{ .Release.Name }}-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode
   
   Database connection details:
   - Host: {{ .Release.Name }}-postgresql
   - Port: 5432
   - Database: {{ .Values.postgresql.auth.database }}
   - Username: {{ .Values.postgresql.auth.username }}
{{- else if .Values.postgresql.externalUrl }}
   You're using an external PostgreSQL database.
   Connection URL: {{ .Values.postgresql.externalUrl }}
{{- end }}

3. Redis Access:
{{- if .Values.redis.enabled }}
   Redis is deployed within your cluster.
   To get the Redis password, run:
   kubectl get secret --namespace {{ .Release.Namespace }} {{ .Release.Name }}-redis -o jsonpath="{.data.redis-password}" | base64 --decode
   
   Redis connection details:
   - Host: {{ .Release.Name }}-redis-master
   - Port: 6379
{{- else if .Values.redis.externalUrl }}
   You're using an external Redis instance.
   Connection URL: {{ .Values.redis.externalUrl }}
{{- else }}
   Redis is not enabled in your current configuration.
{{- end }}

4. Environment Variables:
   The following environment variables have been automatically generated:
   - NEXTAUTH_SECRET: A random 32-character string
   - ENCRYPTION_KEY: A random 32-character string
   - CRON_SECRET: A random 32-character string

   To view these secrets, run:
   kubectl get secret --namespace {{ .Release.Namespace }} {{ include "formbricks.fullname" . }}-secrets -o jsonpath="{.data.NEXTAUTH_SECRET}" | base64 --decode
   kubectl get secret --namespace {{ .Release.Namespace }} {{ include "formbricks.fullname" . }}-secrets -o jsonpath="{.data.ENCRYPTION_KEY}" | base64 --decode
   kubectl get secret --namespace {{ .Release.Namespace }} {{ include "formbricks.fullname" . }}-secrets -o jsonpath="{.data.CRON_SECRET}" | base64 --decode

5. Scaling:
{{- if .Values.autoscaling.enabled }}
   Horizontal Pod Autoscaling is enabled.
   - Minimum replicas: {{ .Values.autoscaling.minReplicas }}
   - Maximum replicas: {{ .Values.autoscaling.maxReplicas }}
   - Target CPU utilization: {{ .Values.autoscaling.metrics.averageUtilization }}%
   
   To check the current status of the HPA, run:
   kubectl get hpa -n {{ .Release.Namespace }} {{ include "formbricks.fullname" . }}
{{- else }}
   Horizontal Pod Autoscaling is not enabled. Your deployment has a fixed number of {{ .Values.replicaCount }} replicas.
   To scale manually, use:
   kubectl scale deployment -n {{ .Release.Namespace }} {{ include "formbricks.fullname" . }} --replicas=<desired_number>
{{- end }}

6. Persistence:
   - PostgreSQL data is persisted with a {{ .Values.postgresql.primary.persistence.size }} storage.
{{- if .Values.redis.enabled }}
   - Redis data is not persisted (persistence is disabled).
{{- end }}

7. Traefik Configuration:
{{- if .Values.traefik.enabled }}
   Traefik is configured with the following settings:
   - TLS enabled with Let's Encrypt
   - HTTP to HTTPS redirect enabled
   - ACME challenge type: HTTP
   - Entrypoints: web (80) and websecure (443)
{{- else }}
   Traefik is not enabled in your current configuration.
{{- end }}

8. Formbricks Documentation and Support:
   For more information, advanced configuration options, and support, please visit:
   - Official Formbricks website: https://formbricks.com
   - Documentation: https://formbricks.com/docs

If you encounter any issues or have questions, please refer to the Formbricks documentation 
or reach out to the Formbricks community for support.