Skip to content

AruneshDwivedi/wcc-backend-docker

 
 

Repository files navigation

Women Coding Community Platform Backend Service

Setup

JAVA 21 with SDKMAN

This project uses Java 21, you can run in 21.0.2 or 21.0.3. If you have installed a different version on your machine and don't want to remove it, you can use SDKMAN development tool.

  • Install SDKMAN

Open your terminal and run the following command:

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
  • Check the list of available Java versions:
sdk list java
  • Install the desired Java version
sdk install java 21.0.2-open 
  • Use the specific java version in the current session on your terminal
sdk use java 21.0.2-open

Set the default Java version for your system:

  • To set the newly installed Java version as the default:
sdk default java 21.0.2-open
  • To verify if the java version is correct use:
java -version

Setup IntelliJ

Lombok

Install lombok plugin and enable Annotation Processing, as the image below:

image

Enable Save Actions

image

Enable Checkstyle Warnings

Install checkstyle plugin and the configuration will be enabled

Google Format

A google-java-format IntelliJ plugin is available from the plugin repository. To install it, go to your IDE's settings and select the Plugins category. Click the Marketplace tab, search for the google-java-format plugin, and click the Install button.

The plugin will be disabled by default. To enable it in the current project, go to File→Settings...→google-java-format Settings (or IntelliJ IDEA→Preferences...→Other Settings→google-java-format Settings on macOS) and check the Enable google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for you.)

To enable it by default in new projects, use File→Other Settings→Default Settings....

When enabled, it will replace the normal Reformat Code and Optimize Imports actions.

image

IntelliJ JRE Config

The google-java-format plugin uses some internal classes that aren't available without extra configuration. To use the plugin, go to Help→Edit Custom VM Options... and paste in these lines:

--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

Once you've done that, restart the IDE.

Run Locally

  • Build and run tests
./gradlew clean build
  • Create Jar
./gradlew clean bootJar
  • Start Spring Boot Application:
./gradlew bootRun

Open API Documentation

Quality Checks

Jacoco

./gradlew test jacocoTestReport
  • Check coverage minimum of 70%
./gradlew clean test jacocoTestCoverageVerification

PMD

  • Run pmd for src
./gradlew pmdMain
  • Run pmd for test
./gradlew pmdTest

SONAR

Install sonarqube docker image locally

  • Make sure you have docker installed on your machine - Download the installer using the url https://docs.docker.com/get-docker/. ( Prefer Docker Desktop Application )
  • Start the docker application. Double-click Docker.app to start Docker.

Get the “SonarQube” image using the command

docker pull sonarqube

Start the "SonarQube" instance

docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest

Ref: https://docs.sonarsource.com/sonarqube/latest/try-out-sonarqube/

Set-up wcc-backend project on local sonarQube instance

Step 1

  1. Select create a local project
  2. "Project display name" = wcc-backend
  3. "Project key" = wcc-backend
  4. "Main branch name" = *

Step 2

  1. Choose the baseline for new code for this project
    select "Use the global setting"
  2. Click "Create Project" at the bottom

Step 3

Generate token to replace in the project.

  1. Click "Locally" on the main dashboard
  2. Generate a token on the next screen ( choose Expires in - No expiration) [ Click Generate]
  3. Copy the token = "sqp_XXXXXXX" and replace in the file build.gradle.kts
    property("sonar.token", "PLACE_YOUR_TOKEN_HERE")

Perform SONAR ANALYSIS

./gradlew sonarQubeAnalysis -PlocalProfile

Sure, here it is formatted to fit into a README:


🐋 Docker Setup

Docker Compose

This project uses Docker Compose to manage and run the application services. Follow these steps to set up and run the services:

  1. Install Docker and Docker Compose

    Make sure you have Docker and Docker Compose installed on your machine. You can download Docker from here.

  2. Build and start the services

    In the root directory of the project, run the following command to build and start the services:

    docker-compose up --build
  3. Access the services

  4. Stop the services

    To stop the services, use the following command:

    docker-compose down

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%