-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update InfluxDB Integration to Version 2 & Simplify Dependencies #356
Conversation
WalkthroughThe changes involve significant updates to the InfluxDB Dockerfile and configuration file. The Dockerfile now installs InfluxDB version 2.7.1, removing previous components like Chronograf and Kapacitor, and streamlining the installation process. The configuration file has had two port mappings removed: Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (2)
influxdb/icon.png
is excluded by!**/*.png
influxdb/logo.png
is excluded by!**/*.png
📒 Files selected for processing (2)
influxdb/Dockerfile
(1 hunks)influxdb/config.yaml
(0 hunks)
💤 Files with no reviewable changes (1)
- influxdb/config.yaml
🔇 Additional comments (3)
influxdb/Dockerfile (3)
Line range hint 1-7
: LGTM! Base image and shell setup follow best practices.
The base image version is recent, and the shell is properly configured with pipefail for better error handling.
Line range hint 24-52
: LGTM! Labels and metadata are well-structured.
The labels follow OCI standards and include comprehensive metadata for container identification and documentation.
8-22
: Verify removal of all mentioned unnecessary packages.
The PR objectives mention removing several packages (libnginx-mod-http-lua
, luarocks
, lua-resty-http
, nginx
, procps
). Let's verify that these are not being installed elsewhere in the build process.
✅ Verification successful
All mentioned packages have been successfully removed
The verification confirms that none of the packages mentioned in the PR objectives (libnginx-mod-http-lua
, luarocks
, lua-resty-http
, nginx
, procps
) are being installed in the Dockerfile. The only package-related operations found are:
- An
apt-get update
command - Installation of the InfluxDB package via
dpkg
This aligns with the PR objectives of removing unnecessary packages while maintaining the core InfluxDB functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if any of the packages to be removed are still referenced
# Expected: No matches found
echo "Checking for references to removed packages..."
rg -i "nginx|luarocks|lua-resty|procps" --type dockerfile
Length of output: 197
Script:
#!/bin/bash
# Let's try a different approach to search for package installations
# Search for apt-get install, dpkg -i, or any package-related operations in Dockerfiles
# First, find all Dockerfiles
echo "=== Finding all Dockerfiles ==="
fd Dockerfile
echo -e "\n=== Checking package installations in Dockerfiles ==="
fd Dockerfile --exec cat {} \; | grep -i "apt-get\|dpkg\|packages\|nginx\|luarocks\|lua-resty\|procps"
Length of output: 402
# Setup InfluxDB v2 | ||
ARG BUILD_ARCH=amd64 | ||
ARG INFLUXDB_VERSION="1.8.10" | ||
ARG CHRONOGRAF_VERSION="1.10.2" | ||
ARG KAPACITOR_VERSION="1.5.9-1" | ||
ARG INFLUXDB_VERSION="2.7.1" | ||
RUN \ | ||
apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
libnginx-mod-http-lua=1:0.10.23-1 \ | ||
luarocks=3.8.0+dfsg1-1 \ | ||
nginx=1.22.1-9 \ | ||
procps=2:4.0.2-3 \ | ||
\ | ||
&& luarocks install lua-resty-http 0.15-0 \ | ||
\ | ||
&& ARCH="${BUILD_ARCH}" \ | ||
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \ | ||
&& if [ "${BUILD_ARCH}" = "armv7" ]; then ARCH="armhf"; fi \ | ||
\ | ||
&& curl -J -L -o /tmp/influxdb.deb \ | ||
"https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_${ARCH}.deb" \ | ||
\ | ||
&& curl -J -L -o /tmp/chronograf.deb \ | ||
"https://dl.influxdata.com/chronograf/releases/chronograf_${CHRONOGRAF_VERSION}_${ARCH}.deb" \ | ||
\ | ||
&& curl -J -L -o /tmp/kapacitor.deb \ | ||
"https://dl.influxdata.com/kapacitor/releases/kapacitor_${KAPACITOR_VERSION}_${ARCH}.deb" \ | ||
"https://dl.influxdata.com/influxdb/releases/influxdb2_${INFLUXDB_VERSION}_${ARCH}.deb" \ | ||
\ | ||
&& dpkg --install /tmp/influxdb.deb \ | ||
&& dpkg --install /tmp/chronograf.deb \ | ||
&& dpkg --install /tmp/kapacitor.deb \ | ||
\ | ||
&& rm -fr \ | ||
/tmp/* \ | ||
/etc/nginx \ | ||
/var/{cache,log}/* \ | ||
/var/lib/apt/lists/* \ | ||
\ | ||
&& mkdir -p /var/log/nginx \ | ||
&& touch /var/log/nginx/error.log | ||
|
||
&& rm -fr /tmp/* /var/lib/apt/lists/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider enhancing package verification and version pinning.
While the basic installation is correct, consider these security improvements:
- Verify the package signature or checksum
- Pin the apt package version explicitly
Here's how to implement these improvements:
RUN \
apt-get update \
+ && apt-get install -y --no-install-recommends gpg \
&& ARCH="${BUILD_ARCH}" \
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \
&& if [ "${BUILD_ARCH}" = "armv7" ]; then ARCH="armhf"; fi \
- \
+ && curl -sL https://repos.influxdata.com/influxdb.key | gpg --dearmor > /etc/apt/trusted.gpg.d/influxdb.gpg \
+ && echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/debian stable main" > /etc/apt/sources.list.d/influxdb.list \
+ && apt-get update \
+ && apt-get install -y --no-install-recommends influxdb2=${INFLUXDB_VERSION} \
- && curl -J -L -o /tmp/influxdb.deb \
- "https://dl.influxdata.com/influxdb/releases/influxdb2_${INFLUXDB_VERSION}_${ARCH}.deb" \
- \
- && dpkg --install /tmp/influxdb.deb \
- \
+ && apt-get purge -y --auto-remove gpg \
&& rm -fr /tmp/* /var/lib/apt/lists/*
Committable suggestion was skipped due to low confidence.
How is the migration handled?
As you have removed nginx, yet the config and services remain, it will fail to start. |
Think we will close this out, thanks for contributing. |
Hello @sinclairpaul! May I ask you if it's ever to plan on this integration to be a newer influx version? I'm missing some features from influxdb 2. Is it worth waiting or should I just switch to the other add-on? Thank you in advance. |
Hi @sinclairpaul, Thank you for your feedback on the pull request. You raise an important point regarding migration and the potential issues caused by removing nginx and the related config and services. I completely agree that ensuring a smooth transition for users is crucial. While maintaining the older version of InfluxDB does have its merits, it could lead to more users inadvertently installing an outdated version, especially since InfluxDB v1 is currently the only version listed by default in Home Assistant. This can be misleading for beginner users who may not realize they are starting with an obsolete version. To address these concerns, I propose the following steps:
By the way, I do not have a experience with building Add-ons for Home Assistant, so could you clarify what you mean by your first comment? |
Summary
This pull request updates the InfluxDB integration to use InfluxDB v2 and simplifies the Dockerfile by removing unnecessary dependencies. Key improvements and adjustments are outlined below.
Changes
Update to InfluxDB v2:
2.7.1
), which includes a new API and enhanced features.Removal of Deprecated Components:
Simplified Dockerfile:
libnginx-mod-http-lua
,luarocks
,lua-resty-http
,nginx
, andprocps
packages were removed as they are not required for basic InfluxDB functionality.Updated Configuration:
config.json
to enhance compatibility with InfluxDB v2 (removed uneccesary port configurations for v2).Related Issues:
Impact
This update aligns the integration with modern InfluxDB standards, reduces Docker image size, and enhances maintainability by removing redundant components. Existing users will need to follow updated setup instructions, as InfluxDB v2 uses a different authentication mechanism and configuration.
Tests