dongzhuo7291 2017-02-21 20:13 采纳率: 100%
浏览 164

将Prometheus部署到Cloud Foundry

I want to deploy Prometheus to Cloud Foundry without using Docker container. When I try to deploy it with the standard Cloud Foundry Go Buildpack I get the following error:

can't load package: package prometheus: no buildable Go source files in /tmp/tmp.vv4iyDzMvE/.go/src/prometheus

Which somehow makes sense, because there are actually no sources in the root directory and the project is compiled with the Prometheus utility tool.

Is there any way to deploy Prometheus to Cloud Foundry, like using another Buildpack or something?

  • 写回答

3条回答 默认 最新

  • douhuan1257 2017-02-22 16:16
    关注

    Ok, after digging around a bit I got the whole thing working as follows

    manifest.yml

    ---
    applications:
    - name: prometheus
      instances: 1
      buildpack: https://github.com/cloudfoundry/go-buildpack.git
      command: prometheus
      env:
        GOPACKAGENAME: github.com/prometheus/prometheus
        GO_INSTALL_PACKAGE_SPEC: github.com/prometheus/prometheus/cmd/prometheus
      memory: 1000M
    

    BUT in order to listen on the right port, the only solution I could find is adding the following to the cmd/prometheus/config.go file to the beginning of the init() function

    port := ":9090"
    if s := os.Getenv("PORT"); s != "" {
        port = ":"+s
    }
    

    and then changing the following part (also in the init() function)

    cfg.fs.StringVar(
        &cfg.web.ListenAddress, "web.listen-address", ":9090",
        "Address to listen on for the web interface, API, and telemetry.",
    )
    

    to

    cfg.fs.StringVar(
        &cfg.web.ListenAddress, "web.listen-address", port,
        "Address to listen on for the web interface, API, and telemetry.",
    )
    

    After that you can simply deploy the application with cf push and everything should work as a charm

    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧