【问题标题】:How to deploy Sonarqube Server on Heroku Dyno如何在 Heroku Dyno 上部署 Sonarqube 服务器
【发布时间】:2019-11-10 08:32:23
【问题描述】:

我必须在 Heroku Web Dyno 上部署 SonarQube 服务器。

为此,我尝试了以下项目:

  1. 从以下位置下载 SonarQube 社区版 https://www.sonarqube.org/downloads/

  2. 然后我解压文件夹并进入/sonarqube-7.8/文件夹

  3. 然后我创建了具有以下内容的 Procfile:

web: chmod u+x bin/linux-x86-64/sonar.sh && ./bin/linux-x86-64/sonar.sh

  1. 然后我创建了 system.properties 文件,内容如下:
java.runtime.version=1.8
  1. 然后我运行下面的命令来检查 Heroku Git 上的 SonarQube 服务器和 运行服务器:
git init
git add.
git commit -m "initial commit"
git push heroku master

运行上述命令后,git bash 控制台显示如下:

Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 391 bytes | 39.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> SonarQubeFramework app detected
remote: -----> Create setupSonar.sh
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 195.5M
remote: -----> Launching...
remote:        Released v8
remote:        https://<app_name>.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/<app_name>.git
   cad2f14..55d4bcd  master -> master

我正在从 heroku 获得以下日志

2019-06-28T10:54:19.321815+00:00 heroku[web.1]: Starting process with command `chmod u+x bin/linux-x86-64/sonar.sh && ./bin/linux-x86-64/sonar.sh`
2019-06-28T10:54:21.360549+00:00 heroku[web.1]: Process exited with status 1
2019-06-28T10:54:21.380868+00:00 heroku[web.1]: State changed from starting to crashed
2019-06-28T10:54:21.313195+00:00 app[web.1]: Usage: ./bin/linux-x86-64/sonar.sh { console | start | stop | force-stop | restart | status | dump }

谁能帮我在 Heroku Cloud 上部署 SonarQube 服务器?

【问题讨论】:

  • 错误信息中明确指出了眼前的问题:Usage: ./bin/linux-x86-64/sonar.sh { console | start | stop | force-stop | restart | status | dump }。您的 Procfile 只是尝试运行 ./bin/linux-x86-64/sonar.sh 而没有任何参数。但是你确定 SonarQube 会在 Heroku 上正常运行吗?它是否尊重PORT 环境变量?它会对临时文件系统感到满意吗?
  • 感谢@Chris 强调这一点。我不确定 SonarQube 是否能够在 Heroku 中正常运行,我必须弄清楚您强调的 PORT 问题的解决方案。
  • 我怀疑 Heroku 不适合这里。使用 VPS 会带来更好的运气。但是,如果您想继续尝试,请先更新您的 Procfile 以添加命令。我猜它应该包含web: chmod u+x bin/linux-x86-64/sonar.sh &amp;&amp; ./bin/linux-x86-64/sonar.sh start
  • 其实我在做PoC,我必须判断SonarQube是否可以在Heroku上运行,所以我必须尝试所有可能的方法来在Heroku上运行它。我已更新 Procfile 并运行它,现在我收到另一个错误 Failed to start SonarQube.。我认为它与 SonarQube 配置有关,可能是 JVM 设置或 PORT 设置。我正在检查它,如果我发现了什么,我会在这里更新。谢谢@Chris
  • 还可以查看 SonarQube 日志文件以获取更多(失败)信息。

标签: heroku sonarqube


【解决方案1】:

我能够在 Heroku Cloud 上部署 SonarQube 服务器: 以下是按相同顺序执行的命令:

heroku create <appName>
heroku addons:create heroku-postgresql:hobby-dev -a <appName>
heroku buildpacks:set https://github.com/NayaraCaetano/heroku-buildpack-sonarqube.git -a <appName>
mkdir <appName> && cd <appName>
touch README
git init
heroku git:remote -a <appName>
git add .
git commit -am "initial commit"
git push heroku master
heroku dyno:resize performance-m -a <appName>

注意:由于一些内存限制,您必须在 Heroku 上使用 performance-m dyno(不是免费的)。还有免费版 Postgres 将在 1 或 2 次扫描内耗尽,所以你必须 根据您的需要升级它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-13
    • 2017-06-07
    • 2018-04-18
    • 2016-08-30
    • 1970-01-01
    • 2019-07-07
    • 1970-01-01
    相关资源
    最近更新 更多