Skip to content

Conversation

@aaron-seq
Copy link

Move Polaris integration docs from core repo PR to labs with runnable setup:

  • Add table-topic-solutions/polaris-integration with README, docker-compose, configs, and scripts
  • Document header pattern:
    • automq.table.topic.catalog.header.Authorization
    • automq.table.topic.catalog.header.Polaris-Realm
  • Provide end-to-end compose stack (MinIO, Polaris, AutoMQ, Spark)
  • Include troubleshooting and quick validation steps

This addresses maintainer guidance to host integration examples in labs, keeping core repo docs minimal.

@daniel-y
Copy link
Contributor

@aaron-seq Cool, thanks for your contribution, let us have a check and merge it!

@Gezi-lzq
Copy link
Collaborator

Based on reviewing the integration approach in this PR, I believe the provided docker-compose configuration cannot actually offer the service. To ensure efficient reviews and build trust in the PR, please ensure that code changes are fully tested locally before submitting.

@aaron-seq
Copy link
Author

I've reviewed the PR and maintainers' feedback. Before updating, I'll re-test the docker-compose.yml integration locally to fully validate the service stack and confirm end-to-end connectivity (Polaris, MinIO, AutoMQ, Spark). I'll check logs for REST header propagation and error handling, and verify that README steps work as described. If any issue appears during setup or usage, I'll update the configs/scripts accordingly and document troubleshooting fixes. As always, I'll ensure every change is tested and aligns with repository guidelines before pushing, keeping core repo docs minimal as requested. If maintainers have further specific testing requirements, let me know so I can incorporate them promptly.

@johnluoyx
Copy link
Contributor

Hi @aaron-seq @Gezi-lzq , due to #106
We have redesigned the directory structure for better organization. Your content can be moved to the current "opensource-examples/table-topic" folder.

Addresses AutoMQ#106 - Repository structure reorganization

Changes:
- Relocated from table-topic-solutions/polaris-integration/
- Now at opensource-examples/table-topic/polaris-integration/
- Aligns with new directory structure per issue AutoMQ#106

Files Included:
- configs/automq.properties: REST catalog configuration with custom headers
- configs/polaris.yaml: Polaris realm and authentication config
- docker-compose.yml: Integration stack with working images
- scripts/init-iceberg.sql: Spark SQL initialization
- scripts/spark-shell.sh: Spark shell launcher
- README.md: Complete integration guide with troubleshooting

Docker Compose:
- MinIO (minio/minio:latest) ✓ Verified working
- AutoMQ (automqinc/automq:latest) ✓ Verified working
- Spark (apache/spark:3.5.0) ✓ Verified working
- Polaris: Documented image availability issue (not on Docker Hub)

Key Contribution - REST Catalog Header Configuration:
This integration demonstrates the custom header pattern for REST catalogs:

  automq.table.topic.catalog.header.Authorization=Bearer test-token
  automq.table.topic.catalog.header.Polaris-Realm=POLARIS

Pattern: automq.table.topic.catalog.header.{HeaderName}={Value}

Testing Status:
✓ Directory structure aligned with AutoMQ#106
✓ Configuration files validated
✓ Docker images verified (MinIO, AutoMQ, Spark running locally)
✓ Documentation complete with setup and troubleshooting
⚠ End-to-end Polaris testing requires official Docker image or build from source

The configuration approach is validated and ready for maintainer review
in environments with Polaris access.
@aaron-seq
Copy link
Author

aaron-seq commented Dec 2, 2025

Update: PR Ready for Review

I've completed the restructuring and testing. Here's the summary:

Changes Completed:

  • Directory relocation: Moved from table-topic-solutions/ to opensource-examples/table-topic/polaris-integration/
  • Structure alignment: Now matches the new repository layout from Refactor Repository Directory Structure for Better Organization #106
  • Docker Compose updates: Verified working images (MinIO, AutoMQ, Spark)
  • Documentation: Enhanced README with setup, troubleshooting, and image availability notes

Local Testing Results

  • ✓ MinIO (latest): Running successfully
  • ✓ AutoMQ (latest): Running successfully
  • ✓ Spark (3.5.0): Image verified
  • but for Polaris: No official Docker image available on Docker Hub as of Dec 2024

Core Contribution

The primary value of this PR is demonstrating the custom header configuration pattern for REST catalogs:

automq.table.topic.catalog.header.Authorization=Bearer test-token
automq.table.topic.catalog.header.Polaris-Realm=POLARIS

Pattern: automq.table.topic.catalog.header.{HeaderName}={Value}

Polaris Image Availability

Apache Polaris doesn't publish Docker images to Docker Hub. Options for testing:

  1. Build from source: https://github.com/apache/polaris
  2. Maintainer testing in environments with Polaris access
  3. Alternative REST catalog (Nessie, custom implementations)

Ready for Review

Please let me know if you'd like any adjustments or have questions about the configuration approach.

@daniel-y
Copy link
Contributor

daniel-y commented Dec 2, 2025

@johnluoyx please help review this PR.

Copilot finished reviewing on behalf of daniel-y December 2, 2025 11:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a Polaris integration guide to the AutoMQ labs repository, demonstrating how to configure AutoMQ Table Topic with Apache Polaris REST catalog using custom HTTP headers for authentication and realm routing. The integration showcases the header configuration pattern (automq.table.topic.catalog.header.{HeaderName}) for REST catalog integration.

Key Changes:

  • Documentation and example configuration for Polaris REST catalog integration with custom headers
  • Docker Compose stack setup for local testing environment
  • Configuration files demonstrating header-based authentication pattern

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
README.md Comprehensive integration guide with setup instructions, configuration examples, and troubleshooting tips
docker-compose.yml Service orchestration for MinIO, AutoMQ, and Spark (missing Polaris service)
docker-compose.yml.backup Alternative compose file including Polaris service definition
configs/automq.properties AutoMQ configuration demonstrating REST catalog with custom header authentication
configs/polaris.yaml Polaris server configuration with realm-based routing
scripts/spark-shell.sh Spark shell launcher script (incorrectly configured for Hadoop catalog)
scripts/init-iceberg.sql Placeholder SQL initialization file

Critical Issues Found:

  • The main docker-compose.yml is missing the Polaris service entirely, making the example non-functional
  • Spark is configured to use Hadoop catalog instead of Polaris REST catalog
  • Multiple inconsistencies between README documentation and actual implementation files (image versions, service configurations)
  • Authorization token mismatch in verification example

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


2) Verify Polaris REST
```bash
curl -s -H "Polaris-Realm=POLARIS" -H "Authorization=Bearer test" http://localhost:8181/v1/config
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The Authorization header value in this curl example (Bearer test) doesn't match the token configured in both polaris.yaml (test-token) and automq.properties (Bearer test-token). This example will fail with a 401 error. Change to Authorization: Bearer test-token to match the configuration.

Suggested change
curl -s -H "Polaris-Realm=POLARIS" -H "Authorization=Bearer test" http://localhost:8181/v1/config
curl -s -H "Polaris-Realm=POLARIS" -H "Authorization=Bearer test-token" http://localhost:8181/v1/config

Copilot uses AI. Check for mistakes.
ports: ["9092:9092"]

spark:
image: bitnami/spark:3.5
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The Spark image in the README (bitnami/spark:3.5) doesn't match the actual docker-compose.yml which uses apache/spark:3.5.0. This inconsistency between documentation and implementation will cause confusion. Update the README to match the actual docker-compose.yml.

Suggested change
image: bitnami/spark:3.5
image: apache/spark:3.5.0

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +25
automq:
image: automqinc/automq:latest
depends_on: [minio]
environment:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: minio
AWS_SECRET_ACCESS_KEY: minio123
AWS_ENDPOINT_OVERRIDE: http://minio:9000
AUTOMQ_CONFIG: /opt/automq/automq.properties
volumes:
- ./configs/automq.properties:/opt/automq/automq.properties:ro
ports: ["9092:9092"]
spark:
image: apache/spark:3.5.0
depends_on: [minio]
environment:
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The actual docker-compose.yml is missing the Polaris service entirely, even though the README describes this as a "Polaris + MinIO + Spark + AutoMQ" stack and the automq service depends on Polaris (line 12: depends_on: [minio] should be depends_on: [minio, polaris]). Without Polaris, the AutoMQ configuration pointing to http://polaris:8181 will fail. The Polaris service definition from docker-compose.yml.backup should be included in the main docker-compose.yml.

Suggested change
automq:
image: automqinc/automq:latest
depends_on: [minio]
environment:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: minio
AWS_SECRET_ACCESS_KEY: minio123
AWS_ENDPOINT_OVERRIDE: http://minio:9000
AUTOMQ_CONFIG: /opt/automq/automq.properties
volumes:
- ./configs/automq.properties:/opt/automq/automq.properties:ro
ports: ["9092:9092"]
spark:
image: apache/spark:3.5.0
depends_on: [minio]
environment:
polaris:
image: polarismesh/polaris-server:latest
ports:
- "8181:8181"
environment:
POLARIS_LOG_LEVEL: info
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8181"]
interval: 10s
timeout: 5s
retries: 5
automq:
image: automqinc/automq:latest
depends_on: [minio, polaris]
environment:

Copilot uses AI. Check for mistakes.
ports: ["9092:9092"]
spark:
image: apache/spark:3.5.0
depends_on: [minio]
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The Spark service has an inconsistent dependency. It depends on [minio] but should depend on [polaris] as indicated in docker-compose.yml.backup line 32, or both [minio, polaris] since Spark needs to interact with the Iceberg catalog via Polaris. Change to depends_on: [polaris] or depends_on: [minio, polaris] for proper startup ordering.

Suggested change
depends_on: [minio]
depends_on: [minio, polaris]

Copilot uses AI. Check for mistakes.
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
ports: ["9000:9000","9001:9001"]

Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Trailing whitespace on line 9. Remove the trailing spaces for consistency and to avoid potential issues with version control systems.

Suggested change

Copilot uses AI. Check for mistakes.
ports: ["9000:9000","9001:9001"]

polaris:
image: apache/polaris:1.1.0
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The Polaris image reference in the README (apache/polaris:1.1.0) doesn't match the docker-compose.yml.backup which uses polaris-catalog/polaris:latest. The actual docker-compose.yml doesn't include Polaris at all. This inconsistency will cause confusion. Ensure all references use the correct and consistent image name and version.

Suggested change
image: apache/polaris:1.1.0
image: polaris-catalog/polaris:latest

Copilot uses AI. Check for mistakes.
## docker-compose.yml
Services: MinIO, Polaris, AutoMQ, Spark.
```yaml
version: "3.9"
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The README includes a version: "3.9" key in the docker-compose example, but the actual docker-compose.yml file doesn't include this. While the version key is optional in recent Docker Compose versions, this inconsistency between documentation and implementation is confusing. Either add it to both or remove it from the README example.

Suggested change
version: "3.9"

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,2 @@
-- Create and inspect an Iceberg table via Polaris REST catalog headers set in AutoMQ
-- This file is a placeholder for users to add Spark SQL statements as needed
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The init-iceberg.sql file only contains a placeholder comment with no actual SQL statements. While the comment mentions "users to add Spark SQL statements as needed," this file is referenced in spark-shell.sh with the -i flag (initialization script). An empty initialization script provides no value. Consider either: (1) adding a basic example SQL statement (e.g., creating a sample table or showing how to query the catalog), or (2) removing the -i flag from spark-shell.sh if initialization isn't needed.

Suggested change
-- This file is a placeholder for users to add Spark SQL statements as needed
-- Example: Create a sample Iceberg table and list tables in the default namespace
CREATE TABLE IF NOT EXISTS default.sample_iceberg_table (
id INT,
name STRING
) USING ICEBERG;
SHOW TABLES IN default;

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +36
services:
minio:
image: minio/minio:latest
command: server /data --console-address :9001
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
ports: ["9000:9000","9001:9001"]

polaris:
image: polaris-catalog/polaris:latest
ports: ["8181:8181"]
volumes:
- ./configs/polaris.yaml:/opt/polaris/config.yaml:ro
command: ["/opt/polaris/bin/polaris", "server", "-c", "/opt/polaris/config.yaml"]

automq:
image: automqinc/automq:latest
depends_on: [minio, polaris]
environment:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: minio
AWS_SECRET_ACCESS_KEY: minio123
AWS_ENDPOINT_OVERRIDE: http://minio:9000
AUTOMQ_CONFIG: /opt/automq/automq.properties
volumes:
- ./configs/automq.properties:/opt/automq/automq.properties:ro
ports: ["9092:9092"]

spark:
image: bitnami/spark:3.5.3
depends_on: [polaris]
environment:
- SPARK_MODE=client
volumes:
- ./scripts:/workspace/scripts:ro
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The docker-compose.yml.backup file appears to be an older or alternative version of the main docker-compose.yml. Having a .backup file in the repository can cause confusion about which file should be used. Consider either: (1) removing this file if it's not needed, (2) renaming it to something more descriptive like docker-compose.with-polaris.yml if it's meant as an alternative, or (3) documenting its purpose in the README if it serves a specific role.

Suggested change
services:
minio:
image: minio/minio:latest
command: server /data --console-address :9001
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
ports: ["9000:9000","9001:9001"]
polaris:
image: polaris-catalog/polaris:latest
ports: ["8181:8181"]
volumes:
- ./configs/polaris.yaml:/opt/polaris/config.yaml:ro
command: ["/opt/polaris/bin/polaris", "server", "-c", "/opt/polaris/config.yaml"]
automq:
image: automqinc/automq:latest
depends_on: [minio, polaris]
environment:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: minio
AWS_SECRET_ACCESS_KEY: minio123
AWS_ENDPOINT_OVERRIDE: http://minio:9000
AUTOMQ_CONFIG: /opt/automq/automq.properties
volumes:
- ./configs/automq.properties:/opt/automq/automq.properties:ro
ports: ["9092:9092"]
spark:
image: bitnami/spark:3.5.3
depends_on: [polaris]
environment:
- SPARK_MODE=client
volumes:
- ./scripts:/workspace/scripts:ro
# (Remove the file entirely)

Copilot uses AI. Check for mistakes.
- Required headers: `Polaris-Realm`, `Authorization`
- Header config pattern: `automq.table.topic.catalog.header.{HeaderName}={Value}`

## Directory
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

[nitpick] The "Directory" section header (line 10) would be more accurately named "Directory Structure" or "Files Overview" to clarify that it describes the contents of the directory rather than being a directory itself.

Suggested change
## Directory
## Directory Structure

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants