Configure CARTO AI Prerequisites (Kots)

This guide provides instructions for enabling the necessary prerequisites to run CARTO AI features in a Self-Hosted environment managed via KOTS. It covers configuration changes, deployment steps, and validation of the AI proxy resources.

1. Requirements

Before modifying the KOTS configuration, you must prepare your database and network environment.

1.1. Create 'aiproxy' database

The AI Proxy service requires its own dedicated logical database within your PostgreSQL instance. The default recommended name is aiproxy.

  • Connect to your PostgreSQL instance and run:

CREATE DATABASE aiproxy;

1.2. Identify the database user

You must identify the specific database user currently configured for your deployment to grant it permissions later.

  • Login to the KOTS Admin Console.

  • Navigate to the Config tab.

  • Locate the Metadata Database configuration section.

  • Note the value in the User field.

1.3 Grant owner permissions

The database user identified in the previous step must have ownership permissions over the new AI database. Replace <carto_user> with the user you identified in step 1.2.

GRANT ALL PRIVILEGES ON DATABASE aiproxy TO <carto_user>;
ALTER DATABASE aiproxy OWNER TO <carto_user>;

1.4 Increase load balancer timeout

AI-generated responses often require longer processing times than standard HTTP requests. As those requests usually take less than 1 minute, but they can go up to 5 minutes, it's required to allow longer requests in the CARTO Self-Hosted platform.

Therefore, you'll have to increase the idle timeout on the Load Balancer exposing the CARTO service to allow requests taking up to 300 seconds (5 minutes).

CARTO already manages expected timeouts for each API at the service level to ensure that requests taking longer than expected don't block the operations performed by the platform, so it's not required to specify different timeout values depending on the request at your load balancer level.

Note: This configuration varies by provider (e.g., idle_timeout.timeout_seconds in AWS ALB, or keepalive_timeout in NGINX). You need to handle this configuration in your respective setup.

2. Modify Configuration

Once the infrastructure prerequisites are met, you must enable the CARTO AI Pre-requisites in the Admin Console config section.

2.1 Enable CARTO AI Pre-requisites

  • Navigate to the Config tab in the Admin Console.

  • Scroll down to the Advanced Config section.

  • Locate the CARTO AI Pre-requisites subsection. Check the box ✔️.

  • Go to the bottom of the page and click on Save Config.

  • Click on Go to updated version.

2.2 Optional: Setup a Custom Database name for AI Proxy

By default, the system expects the database name to be aiproxy. If you created a database with a different name in Step 1.1, you must specify it here.

  • In the same Advanced Config section, locate the AI Proxy Database name field.

  • Enter your custom database name (e.g., aiproxy_custom_database).

  • Go to the bottom of the page and click on Save Config.

  • Click on Go to updated version.

3. Deploy updated version

Saving the configuration generates a new version sequence that must be deployed to apply the changes.

3.1 Initiate Deployment

  • Go to the Version history tab.

  • Locate the new version Available.

3.2 Preflight checks

KOTS will automatically run preflight checks to ensure connectivity and requirements are met.

  • Check that the Preflight checks ran correctly.

  • If you click on the View Preflight checks icon you'll be able to see all details

3.3 Deploy

Now that we enabled the new settings, and made sure that the Preflight Checks are healthy we can go ahead and deploy it to the cluster.

  • Click on the Deploy Icon, and then click on Yes, Deploy. b

  • Now the new CARTO version is being deployed with the AI Pre-requisites enabled!

3.4 Monitor deploy

Once you deployed the new version you must check that everything gets deployed sucessfully and that your application is healthy.

  • In the Dashboard section, click on Details.

  • You'll see that your Resources are updating:

  • Once the the upgrade finishes you will see all Resources in Ready state.

Last updated

Was this helpful?