Skip to content

BrainsDevOps/sonarqube-udemy-docker-compose

Repository files navigation

Docker compose files to run Sonarqube, Jenkins and expose with Ngrok to the Internet

This repository contains docker-compose file to easily run to the code examples in the udemy courses

Other languages / Otros idiomas / En autres langues

en es fr

Context

This repository is part of my udemy courses:

If you're interested in learning more about Sonarqube or Github actions, you can check if the are any discount coupons available in the course section of devopsbrains.com

Requirements

  • Docker
  • Docker compose
  • ngrok account (Optional. Needed only if you want to expose the services in Internet)

Switching SonarQube versions

You can check out other branches of the repository to launch other versions of SonarQube than that of the main branch. Check other branches available in the repository.

If you had a previous version and you want to modify it, I advise you to erase the volumes associated with the previous installation of docker compose.

Ngrok configuration

  • If you want to expose any of the services in Internet with ngrok, you'll need:
    • An ngrok account with an authentication token and a domain.
    • If you want to know more about ngrok, there is a Youtube vídeo available (Spanish), with a quick guide on the subject
    • Create a .env file at the repo root folder to declare your ngrok domain and token
NGROK_AUTHTOKEN=<your token>
NGROK_DOMAIN=<your domain>

Launch modes

  • Sonarqube: docker-compose up
  • Sonarqube with postgres: docker-compose -f compose.yaml -f compose.postgres.yaml up
  • Sonarqube + ngrok: docker-compose --profile public up
  • Jenkins: docker compose -f compose.jenkins.yaml up
  • Jenkins + ngrok: docker compose -f compose.jenkins.yaml --profile public up

NOTE: You'll have a single domain with free ngrok account and you can only have a single ngrok session. So you can only expose either SonarQube or Jenkins at the same time

First conexion to Jenkins

  • After launching Jenkins, you can open in the web browser http://localhost:8080/
  • We can skip plugin installation, since the plugins needed for the course exercises are already installed. "Select plugins to install" > "None" > "Install"
  • We create an admin user
  • We choose the default server URL: "http://localhost:8080/"
  • The configuration of credentials and tools such as NodeJs and SonarScanner is explained during the course

Known problems

A student had this problem and managed to solve it, by adding this instruction in the Dockerfile after the FROM insttruction

RUN git config --global --add safe.directory "*"

The plugin download from Jenkins mirrors fail sporadically. In my case I had problems with ftp.halifax.rwth-aachen.de. That is why I ended up including the plugin installation in the Dockerfile with jenkins-plugin-cli

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published