美文网首页
docker-compose 部署 sonarqube

docker-compose 部署 sonarqube

作者: 偷油考拉 | 来源:发表于2023-02-16 09:50 被阅读0次

参考文档 - 官方

一、docker 环境准备

yum install -y yum-utils
yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker
curl -L "https://github.com/docker/compose/releases/download/1.28.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
  • 修改系统配置文件,如下:
cat > /etc/sysctl.d/99-sonarqube.conf  << EOF
vm.max_map_count = 524288
fs.file-max = 131072
EOF

执行 sysctl -p /etc/sysctl.d/99-sonarqube.conf 加载

  • 通过ulimit -nulimit -u 查看ulimit参数。如有必要,修改如下:
cat > /etc/security/limits.d/99-sonarqube.conf  << EOF
sonarqube   -   nofile   131072
sonarqube   -   nproc    8192
EOF

二、yml文件准备

version: "3"

services:
  sonarqube:
    image: sonarqube:lts-community
    depends_on:
      - db
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
    ports:
      - "9000:9000"
  db:
    image: postgres:12
    environment:
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

volumes:
  sonarqube_data:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /lvmdata/sonarqube/data 
  sonarqube_extensions:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /lvmdata/sonarqube/extensions 
  sonarqube_logs:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /lvmdata/sonarqube/logs 
  postgresql:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /lvmdata/pgsql/postgresql
  postgresql_data:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /lvmdata/pgsql/data 

三、启动服务

docker-compose up
docker-compose up -d

地址 : http://ip:9000
默认账户: admin / admin

相关文章

网友评论

      本文标题:docker-compose 部署 sonarqube

      本文链接:https://www.haomeiwen.com/subject/xriqkdtx.html