1. Introduction

This guide is intended for administrators and developers who want to get a Coderadar server up and running.

2. Getting coderadar up and running

A Coderadar distribution contains a JAR file and a properties file that contains the default configuration.

2.1. Configuration Parameters

Coderadar can be configured by adjusting the parameters in the application.properties file (either before jar-packaging or by supplying the file alongside the jar).

2.1.1. Configuring the scan interval

coderadar.scanIntervalInSeconds=30

Adjusting this value will change how often projects are checked for new commits/branches.

2.1.2. Configuring the working directory

This is the directory projects will be cloned to. It’s path can be adjusted by changing the following property:

coderadar.workdir=coderadar-workdir

2.1.3. Configuring the access/refresh token validity duration

The following properties control how long a access/refresh token is valid:

coderadar.authentication.accessToken.durationInMinutes=15 coderadar.authentication.refreshToken.durationInMinutes=86400

2.1.4. Configuring authentication

Authentication can be enabled or disabled with the following property:

coderadar.authentication.enabled=true

2.1.5. Configuring CORS

CORS can be enabled or disabled with the following property:

coderadar.cors.enabled=true

2.1.6. Configuring logging levels

The logging levels can be adjusting with the following properties:

logging.level.io.reflectoring.coderadar=DEBUG logging.level.org.reflections=ERROR

2.1.7. Configuring the log file

The log file’s path can be adjusted with the following property:

logging.file=coderadar.log

2.1.8. Configuring the database connection

Coderadar works with Neo4j version 3.5.* and requires the APOC plugin to be installed. The easiest way to quickly configure a local Neo4j instance is by using Neo4j Desktop.

The credentials for the Neo4j database instance can be configured with the following properties:

spring.data.neo4j.username=neo4j spring.data.neo4j.password=neo3j

2.1.9. Configuring the git passwords key

Coderadar requires plaintext passwords in order to clone/update private repositories. This is problematic as these passwords are saved in the database. To mitigate this problem (at least to some extent), the passwords are encrypted (NOT hashed) before they are saved and decrypted when they are needed (again we are talking about per-project repository passwords, not Coderadar passwords, those are hashed using BCrypt). The encryption key can be set using the following property:

coderadar.gitPasswordsEncryptionKey=test-key

2.2. Coderadar platform admin

The first user to register will receive a platform admin flag. This gives the user the needed permission to shut down the app and access the "Manage users" page.

2.3. Starting Coderadar

Starting Coderadar requires a running Neo4j instance on port 7687. Once started, the Coderadar UI and REST-API will be available on port 8080. For more information on the REST-API, have a look at the documentation:

Alternatively, two Docker images can be used. Running the script run.bat/run.sh will automatically pull them and start them. These are the steps to run the images manually:

1.Pull the images:

docker pull neo4j:3.5.19
docker pull maxim615/coderadar

2.Start Neo4j

docker run -it --publish=7687:7687 --publish=7474:7474 --name neo4j --env NEO4J_dbms_connector_bolt_tls__level=DISABLED --env NEO4J_AUTH=neo4j/neo3j --env NEO4JLABS_PLUGINS=['\"apoc\"'] neo4j:3.5.19
If using CMD instead of PowerShell, the syntax for enabling the APOC plugin is as follows: --env NEO4JLABS_PLUGINS=[\"apoc\"]

To make the database persistent you should supply docker with the following argument:

--volume=%userprofile%/neo4j_docker/data:/data

Use the NEO4J_AUTH environment variable to set the username/password for the database.

3.Start Coderadar

docker run -it --name coderadar --network="host" maxim615/coderadar
If running on a Windows host, network mode should be set to "bridge" and spring.data.neo4j.uri to bolt://host.docker.internal:7687
docker run -it -p 8080:8080 --name coderadar --network="bridge" --env spring.data.neo4j.uri=bolt://host.docker.internal:7687 maxim615/coderadar:latest

2.4. Shutting down Coderadar

The platform admin has an additional Shutdown-button available in the main sidebar. Upon clicking it, all running analysis' will be stopped and all further authentication requests will be denied, meaning it is not possible to use the application after this point. Once all running tasks are completed, the application will shut down. This is needed in order to be able to cleanly shutdown Coderadar without causing any database corruption (for example in the middle of saving a new project).

2.5. Coderadar system requirements

For comfortable use, Coderadar itself requires about 2.5 Gb of System memory. Note that this largely depends on how large the projects you’re working with are and how many of them there are.

In order to save and analyze very large projects, Neo4j should be configured with at least 10GB of available heap memory and 10GB reserved for the page cache. Coderadar should be running smoothly with about 5 Gb of Java heap space. It is highly recommended to run both Coderadar and Neo4j on high-speed SSD storage. As an example, saving the entire Spring-Boot repository (~29000 commits) as of 25.09.2020 took 26 minutes and 22GB of disk space (i7-6820HQ; 32 Gb RAM; NVMe SSD).

For more information on how to configure Neo4j have a look at: https://neo4j.com/docs/operations-manual/current/performance/memory-configuration/