woonizzooni

Docker PostgreSQL, pgAdmin4, SonarQube설치 및 연동 본문

Docker

Docker PostgreSQL, pgAdmin4, SonarQube설치 및 연동

woonizzooni 2019. 6. 19. 12:09

| 목표 : 내부 DB PostgreSQL과 연동하는 SonarQube 구동

| 순서

   PostgresSQL설치 / 관리 목적의 pgAdmin4설치

  SonarQube설치 + PosgresSQL연동

 

 

PostgreSQL :  https://hub.docker.com/_/postgres

    "Initialization scripts", 'Where to STreo Data", "Environment Variables" 등 참고

docker create --name pgdata -v /mnt/sdb1/pgdata postgres

docker run -d --name mypostgres \
  --volumes-from pgdata \
  -v /mnt/sdb1/pgdata:/var/lib/postgresql/data \ 
  -e POSTGRES_USER=admin \ 
  -e POSTGRES_PASSWORD=sonar \ 
  -e POSTGRES_DB=sonar \ 
  postgres 

 

pgAdmin4 : https://hub.docker.com/r/dpage/pgadmin4

docker pull dpage/pgadmin4 
docker run -d --name pgadmin4 \ 
 -p 49002:80 \
 -e "PGADMIN_DEFAULT_EMAIL=admin@domain.com" \ 
 -e "PGADMIN_DEFAULT_PASSWORD=admin" \ 
 dpage/pgadmin4

 

SonarQube : https://hub.docker.com/_/sonarqube

sudo mkdir -p /mnt/sdb1/sonarqube/conf 
sudo mkdir -p /mnt/sdb1/sonarqube/data 
sudo mkdir -p /mnt/sdb1/sonarqube/logs 
sudo mkdir -p /mnt/sdb1/sonarqube/extensions 
sudo chown -R 999:999 /mnt/sdb1/sonarqube 

docker run -d --name mysonarqube \ 
  -p 9000:9000 \ 
  --link mypostgres:postgres \ 
  -e SONARQUBE_JDBC_USERNAME=admin \ 
  -e SONARQUBE_JDBC_PASSWORD=sonar \ 
  -e SONARQUBE_JDBC_URL=jdbc:postgresql://postgres:5432/sonar \ 
  -v /mnt/sdb1/sonarqube/conf:/opt/sonarqube/conf \ 
  -v /mnt/sdb1/sonarqube/data:/opt/sonarqube/data \ 
  -v /mnt/sdb1/sonarqube/logs:/opt/sonarqube/logs \ 
  -v /mnt/sdb1/sonarqube/extensions:/opt/sonarqube/extensions \ 
  sonarqube

 

pgAdmin4는 실행시 설정한 계정으로 로그인 (admin@domain.com / admin),

SonarQube는 admin/admin.

$ psql -h 192.168.99.100 -p 5432 -U admin -W sonar
Password for user admin:
psql (9.5.17, server 11.3 (Debian 11.3-1.pgdg90+1))
WARNING: psql major version 9.5, server major version 11.
         Some psql features might not work.
Type "help" for help.

sonar=# \dt
                 List of relations
 Schema |           Name            | Type  | Owner
--------+---------------------------+-------+-------
 public | active_rule_parameters    | table | admin
 public | active_rules              | table | admin
 public | alm_app_installs          | table | admin
 public | analysis_properties       | table | admin
 public | ce_activity               | table | admin
 public | ce_queue                  | table | admin
 public | ce_scanner_context        | table | admin
 public | ce_task_characteristics   | table | admin
 public | ce_task_input             | table | admin
 public | ce_task_message           | table | admin
 ....

Comments