在CI / CD管道中运行带有Docker的SonarQube

时间:2016-01-20 18:00:41

标签: postgresql amazon-ec2 docker sonarqube docker-compose

我试图让SonarQube站起来,通过EC2实例上的Docker容器扫描应用程序。我在过去的一天里一直在研究SonarQube和Postgres的文档,而且运气很少。

我发现的最明智的指南是SonarSource维护的{​​{3}}。更具体地说,我正在关注docker-sonarqube project

我的docker-compose.yml文件看起来与SonarSource提供的文件相同:

sonarqube:
  build: "5.2"
  ports:
   - "9000:9000"
  links:
   - db
  environment:
   - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
  volumes_from:
   - plugins

db:
  image: postgres
  volumes_from:
    - datadb
  environment:
   - POSTGRES_USER=sonar
   - POSTGRES_PASSWORD=sonar

datadb:
  image: postgres
  volumes:
    - /var/lib/postgresql
  command: /bin/true

plugins:
  build: "5.2"
  volumes:
   - /opt/sonarqube/extensions
   - /opt/sonarqube/lib/bundled-plugins
  command: /bin/true

docker ps -a收益:

CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                           PORTS                    NAMES
2d003aef18f2        dockersonarqube_sonarqube   "./bin/run.sh"           47 seconds ago      Up 46 seconds                    0.0.0.0:9000->9000/tcp   dockersonarqube_sonarqube_1
c7d5043f4381        dockersonarqube_plugins     "./bin/run.sh /bin/tr"   48 seconds ago      Exited (0) 46 seconds ago                                 dockersonarqube_plugins_1
590c72b4a723        postgres                    "/docker-entrypoint.s"   48 seconds ago      Up 47 seconds                    5432/tcp                 dockersonarqube_db_1
c105e6aebe09        postgres                    "/docker-entrypoint.s"   49 seconds ago      Exited (0) 48 seconds ago                                 dockersonarqube_datadb_1

sonarqube_1容器的最新输出是:

sonarqube_1 | 2016.01.20 17:49:09 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
sonarqube_1 | 2016.01.20 17:49:09 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
sonarqube_1 | 2016.01.20 17:49:09 INFO  app[o.s.p.m.Monitor] Process[web] is up

我关心的是db_1容器的最新输出:

PostgreSQL init process complete; ready for start up.

LOG:  database system was shut down at 2016-01-20 17:48:40 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
ERROR:  relation "schema_migrations" does not exist at character 21
STATEMENT:  select version from schema_migrations
ERROR:  relation "schema_migrations" does not exist at character 21
STATEMENT:  select version from schema_migrations
ERROR:  relation "schema_migrations" does not exist at character 21
STATEMENT:  select version from schema_migrations
ERROR:  relation "schema_info" does not exist at character 15
STATEMENT:  SELECT * FROM "schema_info"  LIMIT 1

导航到SonarQube/Postgres guide using docker-compose失败。我可以从同一台机器上点击其他正在运行的容器的相应端口。

任何人都可以帮我指出正确的方向吗?任何其他可能更好地为我服务的指南或文档?我还看到文档中的问题,说明分析项目始于mvn sonar:sonar,但我现在推迟。非常感谢你提前!

1 个答案:

答案 0 :(得分:0)

Use this image 我修改了这个图像以与RDS实例通信。

EC2(搬运工-声纳)LT; ==> RDS postgres