Sonarqube running in Podman containers

This is a quick entry to show how to run sonarqube using Podman. Please note that I’m using windows powershell.

First, create the next directory structure and add the following SQL script into sql directory:

\SONARQUBE
\---sql
    init-dabase.sql

Script content:

-- Creating db user and database for sonarqube

CREATE USER mysonaruser PASSWORD 'mypassword';
CREATE DATABASE sonarqube OWNER mysonaruser;

Open that directory into the terminal, download the images from docker repository and create the volumes.

# Download images

podman pull postgres:15.4
podman pull sonarqube:9.9.2-community

# Create volumes

podman volume create sonarqube_data
podman volume create sonarqube_logs
podman volume create sonarqube_extensions
podman volume create postgres-data

There are two ways to run the containers, creating a network or run in the same pod, please choose only one of the next.

Seguir leyendo

Run the sonarqube analysis locally over a Java project (version 19) using a container

Recently I had to execute an static code analysis over a Maven Java project builded with the JDK 19, but I couldn’t do it because I have and old Sonarqube server (version 7.8) which don’t support that version of Java language.

In order to skip this limitation I’ve used a new version of Sonarqube executed into a container, and I want to share the steps here. Please note tha I have used Podman instead of Docker.

Seguir leyendo

Podman, basic steps for a Java project

Podman is an open source utility that can be used to create and mantain containers, and provides an good alternative to Docker.

In this entry I’m going to show how to execute some basic commands using a Java project. All source code is published in my GitHub repository.

Virtual machine management commands

Let’s take a look to the commands with the help parameter, I think they are very descriptive:

$ podman machine --help 
Manage a virtual machine

Description:
  Manage a virtual machine. Virtual machines are used to run Podman.

Usage:
  podman.exe machine [command]

Available Commands:
  info        Display machine host info
  init        Initialize a virtual machine
  inspect     Inspect an existing machine
  list        List machines
  rm          Remove an existing machine
  set         Sets a virtual machine setting
  ssh         SSH into an existing machine
  start       Start an existing machine
  stop        Stop an existing machine
Seguir leyendo