Skip to main content
Version: 96.4

Configuration

Kafka resources

Refer to Kpow's Kafka cluster configuration for documentation on how to configure Kafka resources for Factor Platform.

Supported Kafka resources include:

Kafka cluster configuration

Factor Platform internal topics

Factor Platform checks for the following internal topics in your primary cluster (the first bootstrap in your configuration) on startup and will attempt to automatically create them if required:

fh.metrics-fh_metric_store_pt1m-changelog
fh_metrics_pt1m
fh.snapshots-fh_snapshot_store-changelog
fh_snapshots
fh_audit_log

You can manually create these topics if you prefer, see Create internal topics.

Once started, Factor Platform creates two internal streaming compute applications:

fh.metrics
fh.snapshots

Minimum required ACLs

At a minimum, Factor Platform must have ACL permission to describe clusters, topics, configuration, and groups.

A basic set of Kafka ACLs that allows Factor Platform to operate provides ALLOW on the following:

Kafka ResourceKafka ACLDetail
ClusterDescribe*
ClusterDescribeConfigs*
ClusterCreate* (if not manually creating Factor Platform topics)
TopicDescribe*
TopicDescribeConfigs*
TopicRead* (or Factor Platform topics only)
TopicWrite* (or Factor Platform topics only)
GroupDescribe*
GroupRead* (or Factor Platform groups only)

Factor Platform does not read from or write to topics other than internal ones as a part of normal operation.

Feature specific ACLS

The following ACLS are optional and only required if you intend to permit the associated Factor Platform action.

Kafka ResourceKafka ACLRequired for user action
ClusterAlterACL_EDIT
ClusterAlterConfigsBROKER_EDIT
ClusterCreateTOPIC_CREATE
TopicAlterConfigsTOPIC_EDIT
TopicCreateTOPIC_CREATE
TopicDeleteTOPIC_DELETE, TRUNCATE_TOPIC
TopicReadTOPIC_INSPECT
TopicWriteTOPIC_PRODUCE
TopicReadTOPIC_CLONE_SOURCE
TopicWriteTOPIC_CLONE_SINK
GroupRead / DeleteGROUP_EDIT

Configuring Kafka ACLS

info

Creating ACLs on a cluster with no existing ACL configuration can cause issues.

Consult your cluster provider documentation first.

For example the Amazon MSK ACL Guide describes extra ACLs required to allow inter-broker replication, and suggests not to set CLUSTER level ACLs.

Create a file containing client configuration for a user who has permissions to create ACLs.

security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-secret";

Basic ACL creation script

Use the kafka-acls.sh script provided by Apache Kafka to create the basic set of ACLs described above. This allows Factor Platform to operate plus the ALTER CLUSTER ACL allowing Factor Platform to create and delete ACLs.

./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Describe --cluster '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation DescribeConfigs --cluster '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Create --cluster '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Write --topic '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Read --topic '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Describe --topic '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation DescribeConfigs --topic '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Describe --group '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Read --group '*'
./kafka-acls.sh --bootstrap-server 127.0.0.1:9092 --command-config client.conf --add --allow-principal User:factorplatform --operation Alter --cluster '*'

That set of ACLs can then be listed using kafka-acls.sh.

./kafka-acls.sh -bootstrap-server 127.0.0.1:9092 --command-config client.conf --list
Current ACLs for resource `ResourcePattern(resourceType=GROUP, name=*, patternType=LITERAL)`:
(principal=User:factorplatform, host=*, operation=READ, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=DESCRIBE, permissionType=ALLOW)

Current ACLs for resource `ResourcePattern(resourceType=TOPIC, name=*, patternType=LITERAL)`:
(principal=User:factorplatform, host=*, operation=READ, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=DESCRIBE, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=WRITE, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=DESCRIBE_CONFIGS, permissionType=ALLOW)

Current ACLs for resource `ResourcePattern(resourceType=CLUSTER, name=kafka-cluster, patternType=LITERAL)`:
(principal=User:factorplatform, host=*, operation=DESCRIBE_CONFIGS, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=DESCRIBE, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=CREATE, permissionType=ALLOW)
(principal=User:factorplatform, host=*, operation=ALTER, permissionType=ALLOW)

Create Factor Platform topics

info

Note: this step is completely optional as Factor Platform will automaticlly create these topics on first launch. However, you can manually create them if you would prefer.

Using the same client configuration file as above, the following script correctly creates the required internal Factor Platform topics. You can run this script and create these topics on the primary cluster in which you expect Factor Platform to keep data.

./kafka-topics.sh --create \
--bootstrap-server 127.0.0.1:9092 \
--command-config client.conf \
--topic fh_audit_log \
--replication-factor 3 \
--partitions 12 \
--config compression.type=gzip \
--config segment.bytes=104857600 \
--config retention.ms=-1
./kafka-topics.sh --create \
--bootstrap-server 127.0.0.1:9092 \
--command-config client.conf \
--topic fh_metrics_pt1m \
--replication-factor 3 \
--partitions 12 \
--config compression.type=gzip \
--config segment.bytes=104857600 \
--config retention.ms=7200000 \
--config segment.ms=5400000
./kafka-topics.sh --create \
--bootstrap-server 127.0.0.1:9092 \
--command-config client.conf \
--topic fh_snapshots \
--replication-factor 3 \
--partitions 12 \
--config compression.type=gzip \
--config segment.bytes=104857600 \
--config retention.ms=7200000 \
--config message.timestamp.type=LogAppendTime \
--config segment.ms=5400000
./kafka-topics.sh --create \
--bootstrap-server 127.0.0.1:9092 \
--command-config client.conf \
--topic fh.metrics-fh_metric_store_pt1m-changelog \
--replication-factor 3 \
--partitions 12 \
--config compression.type=gzip \
--config cleanup.policy=compact,delete \
--config segment.bytes=52428800 \
--config retention.ms=5400000 \
--config message.timestamp.type=CreateTime \
--config segment.ms=1800000
./kafka-topics.sh --create \
--bootstrap-server 127.0.0.1:9092 \
--command-config client.conf \
--topic fh.snapshots-fh_snapshot_store-changelog \
--replication-factor 3 \
--partitions 12 \
--config compression.type=gzip \
--config cleanup.policy=compact,delete \
--config segment.bytes=52428800 \
--config retention.ms=604800000 \
--config message.timestamp.type=CreateTime \
--config segment.ms=604800000

Refer to Flex's Flink cluster configuration for documentation on how to configure Kafka resources for Factor Platform.

Supported deployments include:

Factor Platform configuration

For now, you can refer to Kpow's environment variable reference for reference on how to configure Factor Platform's web server, as well as authentication, authorization and tenancy capabilities.

tip

Factor Platform is still in early access.

Future work on dynamic configuration will mean that a lot of Platform configuration currently exposed via environment variables will move to persistent configuration stored in PostgreSQL, and configured through either Factor Platform's user interface or API.

PostgreSQL configuration

Factor Platform persists its configuration and state to a PostgreSQL database.

Prerequisites

Factor Platform requires PostgreSQL >=14.

Factor Platform requires no extensions or manual schema setup. All database migrations run automatically on initialization of the product.

Database preparation

Create a database and user for Factor Platform. If you're using a managed service (e.g. AWS RDS, Google Cloud SQL, Azure Database for PostgreSQL), follow your provider's instructions to create the database and user, then skip to PostgreSQL environment variables

For self-managed PostgreSQL you will need to create both a role and database for Factor Platform:

CREATE ROLE factor_platform WITH LOGIN PASSWORD 'secure-password-here';
CREATE DATABASE factor_platform WITH OWNER factor_platform TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';

Ensure the user can connect from the Factor Platform host by configuring pg_hba.conf as appropriate for your network.

Factor Platform configuration

Configure the PostgreSQL connection using the following environment variables:

VariableDescriptionRequiredDefault
POSTGRES_USERPostgreSQL usernameYes-
POSTGRES_PASSWORDPostgreSQL passwordYes-
POSTGRES_DB_NAMEDatabase name for Factor PlatformNofactor_platform
POSTGRES_HOSTPostgreSQL server hostname or IPYes-
POSTGRES_PORTPostgreSQL server portNo5432
POSTGRES_SSLEnable SSL for PostgreSQL connectionNofalse
POSTGRES_SSLMODESSL mode (e.g. disable, prefer, require)Noprefer
POSTGRES_SSLROOTCERTPath to SSL root certificateNo-
POSTGRES_SSLCERTPath to SSL client certificateNo-
POSTGRES_SSLKEYPath to SSL client keyNo-
POSTGRES_AWS_WRAPPERWhether to enable the aws-advanced-jdbc-wrapper if using RDS with IAM authenticationNofalse

Connection notes

Amazon RDS connection notes

Factor Platform supports IAM database authentication for Amazon RDS and Aurora PostgreSQL instances.

Refer to the official AWS documentation to enable IAM authentication and create an IAM policy for Factor Platform.

Setting POSTGRES_AWS_WRAPPER=true configures Factor Platform to use the AWS Advanced JDBC Wrapper with the following defaults:

  • failover,efm2 wrapper plugins for cluster failover and host monitoring
  • A maximum connection pool lifetime of 10 minutes, ensuring connections are recycled before IAM auth tokens expire

Note: RDS requires SSL connections by default. Set POSTGRES_SSL=true when using the AWS wrapper.

Application name

The connection is established with ApplicationName set to Factor Platform. This can be useful for identifying Factor Platform connections when debugging or monitoring active sessions in PostgreSQL (e.g. via pg_stat_activity).

Database connection over TLS

For connections over a public network, enable TLS by setting the SSL environment variables above. Most managed database providers handle server-side certificate configuration automatically - you'll typically just need to set POSTGRES_SSL=true and POSTGRES_SSLMODE to your desired level (e.g. require or verify-full).

For self-managed PostgreSQL or mutual TLS (mTLS), provide the client certificate paths via POSTGRES_SSLROOTCERT, POSTGRES_SSLCERT, and POSTGRES_SSLKEY.