parent
bfa1d71c49
commit
d514283cda
@ -13,10 +13,8 @@ RUN if [ "$USE_INTRANET" = "true" ]; then \
|
|||||||
echo 'Acquire::https::Verify-Host "false";' >> /etc/apt/apt.conf.d/99disable-ssl-check; \
|
echo 'Acquire::https::Verify-Host "false";' >> /etc/apt/apt.conf.d/99disable-ssl-check; \
|
||||||
else \
|
else \
|
||||||
echo "Configuring fast apt sources for external network..." && \
|
echo "Configuring fast apt sources for external network..." && \
|
||||||
# 查找并替换sources.list文件
|
|
||||||
find /etc/apt -name "sources.list*" -exec sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' {} \; && \
|
find /etc/apt -name "sources.list*" -exec sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' {} \; && \
|
||||||
find /etc/apt -name "sources.list*" -exec sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' {} \; && \
|
find /etc/apt -name "sources.list*" -exec sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' {} \; && \
|
||||||
# 使用阿里云源
|
|
||||||
echo "deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
|
echo "deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
|
||||||
echo "deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
|
echo "deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
|
||||||
echo "deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list; \
|
echo "deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list; \
|
||||||
@ -74,23 +72,25 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|||||||
|
|
||||||
# 启动脚本
|
# 启动脚本
|
||||||
COPY start-prometheus-supervised.sh /usr/local/bin/start-prometheus-supervised.sh
|
COPY start-prometheus-supervised.sh /usr/local/bin/start-prometheus-supervised.sh
|
||||||
RUN chmod +x /usr/local/bin/start-prometheus-supervised.sh
|
RUN chmod +x /usr/local/bin/start-prometheus-supervised.sh && \
|
||||||
|
chown nobody:nogroup /usr/local/bin/start-prometheus-supervised.sh
|
||||||
|
|
||||||
# targets 更新脚本
|
# targets 更新脚本
|
||||||
COPY start-targets-updater.sh /usr/local/bin/start-targets-updater.sh
|
COPY start-targets-updater.sh /usr/local/bin/start-targets-updater.sh
|
||||||
RUN chmod +x /usr/local/bin/start-targets-updater.sh
|
RUN chmod +x /usr/local/bin/start-targets-updater.sh && \
|
||||||
|
chown nobody:nogroup /usr/local/bin/start-targets-updater.sh
|
||||||
|
|
||||||
# targets 更新 Python 脚本
|
# targets 更新 Python 脚本
|
||||||
COPY update_targets.py /usr/local/bin/update_targets.py
|
COPY update_targets.py /usr/local/bin/update_targets.py
|
||||||
RUN chmod +x /usr/local/bin/update_targets.py
|
RUN chmod +x /usr/local/bin/update_targets.py && \
|
||||||
|
chown nobody:nogroup /usr/local/bin/update_targets.py
|
||||||
|
|
||||||
# exporter 配置文件
|
# exporter 配置文件 - 复制到内部目录
|
||||||
COPY exporter_config.json ${PROMETHEUS_BASE_PATH}/exporter_config.json
|
COPY exporter_config.json /usr/local/bin/exporter_config.json
|
||||||
|
|
||||||
# 自定义 prometheus 配置文件
|
|
||||||
COPY prometheus.yml /etc/prometheus/prometheus.yml
|
COPY prometheus.yml /etc/prometheus/prometheus.yml
|
||||||
|
|
||||||
RUN chown nobody:nogroup ${PROMETHEUS_BASE_PATH}/exporter_config.json /etc/prometheus/prometheus.yml
|
RUN chown nobody:nogroup /usr/local/bin/exporter_config.json /etc/prometheus/prometheus.yml
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
|
@ -18,8 +18,19 @@ echo "[INFO] Exporter config file: ${EXPORTER_CONFIG_FILE}"
|
|||||||
echo "[INFO] Check interval: ${CHECK_INTERVAL}s"
|
echo "[INFO] Check interval: ${CHECK_INTERVAL}s"
|
||||||
echo "[INFO] Log level: ${LOG_LEVEL}"
|
echo "[INFO] Log level: ${LOG_LEVEL}"
|
||||||
|
|
||||||
|
# 确保目录存在
|
||||||
mkdir -p "${TARGETS_DIR}"
|
mkdir -p "${TARGETS_DIR}"
|
||||||
|
|
||||||
|
# 检查 EXPORTER_CONFIG_FILE 是否存在,没有则从内部复制
|
||||||
|
if [ ! -f "${EXPORTER_CONFIG_FILE}" ]; then
|
||||||
|
echo "[INFO] exporter_config.json not found at ${EXPORTER_CONFIG_FILE}, copying from internal location..."
|
||||||
|
cp /usr/local/bin/exporter_config.json "${EXPORTER_CONFIG_FILE}"
|
||||||
|
chown nobody:nogroup "${EXPORTER_CONFIG_FILE}"
|
||||||
|
echo "[INFO] Successfully copied exporter_config.json to ${EXPORTER_CONFIG_FILE}"
|
||||||
|
else
|
||||||
|
echo "[INFO] exporter_config.json already exists at ${EXPORTER_CONFIG_FILE}, skipping copy"
|
||||||
|
fi
|
||||||
|
|
||||||
exec python3 /usr/local/bin/update_targets.py \
|
exec python3 /usr/local/bin/update_targets.py \
|
||||||
--config "${NODES_CONFIG_FILE}" \
|
--config "${NODES_CONFIG_FILE}" \
|
||||||
--targets-dir "${TARGETS_DIR}" \
|
--targets-dir "${TARGETS_DIR}" \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user