Skip to content

feat: add Apache Kafka#1871

Open
tanansatpal wants to merge 6 commits into
community-scripts:mainfrom
tanansatpal:feat/kafka
Open

feat: add Apache Kafka#1871
tanansatpal wants to merge 6 commits into
community-scripts:mainfrom
tanansatpal:feat/kafka

Conversation

@tanansatpal

Copy link
Copy Markdown

Scripts which are clearly AI generated and not further revised by the Author of this PR (in terms of Coding Standards and Script Layout) may be closed without review.

✍️ Description

Adds a new script that installs Apache Kafka in KRaft mode (single-node
combined broker + controller) on Debian 12. Runs natively under OpenJDK 17,
exposes :9092 (clients) and :9093 (controller, internal). CLI tools are
linked into /usr/local/bin for global use. Cluster info is saved to
/root/kafka.creds.

🔗 Related PR / Issue

Link: #

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No breaking changes – Existing functionality remains intact.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

arm64 Support (X in brackets)

  • arm64 supported - Tested and supported on arm64.
  • arm64 not tested - Assumed to work on arm64, but testing has not been done.
  • arm64 not supported - Confirmed upstream dependencies or binaries do not support arm64.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔍 Code & Security Review (X in brackets)

  • Follows Code_Audit.md & CONTRIBUTING.md guidelines
  • Uses correct script structure (AppName.sh, AppName-install.sh, AppName.json)
  • No hardcoded credentials

📋 Additional Information (optional)


📦 Application Requirements (for new scripts)

Required for 🆕 New script submissions.
Pull requests that do not meet these requirements may be closed without review.

  • The application is at least 6 months old
  • The application is actively maintained
  • The application has 600+ GitHub stars
  • Official release tarballs are published
  • I understand that not all scripts will be accepted due to various reasons and criteria by the community-scripts ORG

🌐 Source

Apache Kafka
Apache Kafka | GitHub

>>
>> Adds a new script:
>>
>> - kafka: Apache Kafka 4.x in KRaft mode (no ZooKeeper), single-node
>>   broker + controller, OpenJDK 21 on Debian 13. CLI tools linked into
>>   /usr/local/bin. Cluster info saved to /root/kafka.creds
>>
>> The script is tested end-to-end on Proxmox VE 9.1.
1. Rename from Kafka to Apache kafka
2. Remove comments
3. Add user and group by default for new installation
4. remove hardcoded scala version
1. Fix the installer issue because of name change
2. remove hardcode scala version from kafka.sh as well
3. EnvironmentFile issue with export not supported, only key value
User facing logs prints Apache Kafka instead of just kafka
Rename Kafka to Apache Kafka
@tanansatpal tanansatpal requested a review from a team as a code owner May 28, 2026 15:27
Comment thread ct/apache-kafka.sh
CURRENT=$(cat /opt/kafka/.version 2>/dev/null || echo "0.0.0")

if [[ "$RELEASE" == "$CURRENT" ]]; then
msg_ok "Apache Kafka is already at v${CURRENT}."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No update available

Comment thread ct/apache-kafka.sh
msg_ok "Stopped Apache Kafka"

msg_info "Backing up configuration"
cp -a /opt/kafka/config /opt/kafka-config.bak

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

points in folder names are not really ideal

Comment thread ct/apache-kafka.sh
Comment on lines +56 to +57
cd /tmp
curl -fsSLO "https://downloads.apache.org/kafka/${RELEASE}/kafka_${SCALA_VERSION}-${RELEASE}.tgz"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

move to tmp instead of of cd to tmp

Comment thread ct/apache-kafka.sh
Comment on lines +59 to +66
mv /opt/kafka /opt/kafka.old
tar -xzf "kafka_${SCALA_VERSION}-${RELEASE}.tgz" -C /opt
mv "/opt/kafka_${SCALA_VERSION}-${RELEASE}" /opt/kafka
cp -a /opt/kafka-config.bak/. /opt/kafka/config/
echo "${RELEASE}" >/opt/kafka/.version
chown -R kafka:kafka /opt/kafka
rm -f "/tmp/kafka_${SCALA_VERSION}-${RELEASE}.tgz"
rm -rf /opt/kafka-config.bak /opt/kafka.old

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment on lines +102 to +105
cat <<'EOF' >/opt/kafka/config/kafka-env.sh
KAFKA_HEAP_OPTS="-Xms512M -Xmx1G"
KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -XX:MaxInlineLevel=15 -Djava.awt.headless=true"
LOG_DIR=/var/log/kafka

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

possibly add this to a website note, if people add more ram


msg_info "Saving cluster info"
{
echo "Apache Kafka Version: ${KAFKA_VERSION}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this offset?

echo "Config: /opt/kafka/config/server.properties"
} >/root/kafka.creds
chmod 600 /root/kafka.creds
msg_ok "Saved cluster info to /root/kafka.creds"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

an msg block for things that take like 1 second doesn't really make sense, can you reduce the usage a bit?

@github-actions github-actions Bot added the stale label Jun 12, 2026
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.

2 participants