This is a Spring Boot, PostgreSQL, and Angular application which helps developers and stakeholders analyse the architectural structure of GitHub Java projects. It focuses on visualising cohesion and coupling in and between classes. The implementation relies on Hibernate for interacting with the database, while the migrations are handled by Flyway. On the frontend, the graphs are made using Cytoscape.js. The project uses an example Java Repository to evaluate ADA's accurecy.
In order to get the project started you will need to have the following software installed:
Moreover, if you intend to develop the project, you will need to have the following software as well:
- Java 11
- Node.js
- Lombok extension for your IDE; otherwise an error that certain methods have not been implemented will be shown in the IDE.
If you wish to deploy the application, this can be done easily as it has been fully dockerised.
In order deploy the software locally, simply follow these steps:
- Clone the repository
- Set the profile to production in the
application.properties
file by settingspring.profiles.active=prod
- In
ada-ui/src/environments/environment.prod.ts
setbackendBaseUrl
flag to the localhost address by edditing the corresponding line to:'backendBaseUrl: 'https://localhost:18080/api/v1'
- run
mvn clean install
- run
sudo docker-compose up
- You are ready to use the application on
localhost:80
In order deploy the software to a server, follow these steps:
- Clone the repository
- Change the
postgres
andpgadmin
credentials in thedocker-compose.yml
file - Set the profile to production in the
application.properties
file by settingspring.profiles.active=prod
- In
ada-ui/src/environments/environment.prod.ts
setbackendBaseUrl
flag to the address of the serverwww.server-address.com
by edditing the corresponding line to:'backendBaseUrl: 'https://www.server-address.com:18080/api/v1'
- Make sure that the the server allows incoming connections to the port 18080
- run
mvn clean install
- run
sudo docker-compose up
- You are ready to use the application on
www.server-address.com
In order to set up the project and get ready for development, follow these steps:
-
Pull the Git repository.
-
Import the project to your IDE using the
pom.xml
file. -
For the purposes of development, comment out the
web_app_backend
andweb_app_frontend
sections from thedocker-compose.yml
file. -
Set the profile to development in the
application.properties
file by editingspring.profiles.active=prod
tospring.profiles.active=dev
-
Execute the docker-compose.yml file via running the
docker-compose up -d
command. You should be able to see that both thepostgres
and thepgadmin
containers are running. -
Open
pgadmin
by visitinglocalhost:15050
. You can log in using the credidentials as stated in thedocker-compose.yml
.- Email:
[email protected]
- Password:
ada-team
- Email:
-
Once
pgadmin
is running connect to the dev database server, with the following credentials:Dev Database:
- Name: name the dev server as you wish.
- Host name/address:
db_dev
- Port:
5432
- Maintenance Database:
ada
- Username:
ada-team
- Password:
1234
and press
Save
. -
Run the application with the
./mvnw spring-boot:run
command. -
The address
localhost:18080
is now the entry for the backend. -
Change the directory to
ada-ui
. -
Run
npm install
. -
In order to serve the front end of your application, run
ng serve
. -
Finally, you will be able to access the application at
localhost:4200
.
If you are using IntelliJ, you can connect to PostgreSQL through it. The process is similair to the one described above, however, the only difference is that you will have to now use localhost
as the host, and 15432
as the port. This is due to the connection now being from the host to the container and not from within the docker network.
Also, it is worth mentioning that using Maven via IntelliJ is supported.
The project consists out of six modules:
ada-core
- the main part of the application, invoking and connecting all other componentsada-repository-downloader
- downloads the git repository and stores the metadataada-parser
- parses the source files and exposes the parsed dataada-metric-calculator
- calculates the metrics based on the output from the parser moduleada-model
- defines the data model which is used by all other modulesada-ui
- the user interface of the project
- Writing unit tests is mandatory for all features which are written.
- Code review and an approval are mandatory before a merge.
- Prefix your branch names with your initials. An example would be:
asj_simpleBranchExample
. - Adhere to the migration instructions found in the following section.
- Ask for help whenever you are stuck. Also, if you feel that you are progressing a bit slower, please feel free to mention it as soon as possible.
All of the migrations should be saved in a .sql
file and in the ada-core/src/main/resources/db/migration/development
folder.
Flyway is used for handling the migrations. The explanation and the documentation can be found on their website.
Keep in mind that the naming convention for the migrations should be as stated on the aforementioned website, with the emphasis on naming the versions by stating the year, month, day, hours and minutes in a dotted and zero-padded format. Again, also please take care to include the leading zeros. An example for a correct name would be: V2020.01.24.19.45__Example_migration.sql
.
These points must be performed in order to populate the database once the server is deployed, and in order to be able to restore the database schema in an event of a failure.
The unexecuted migrations will be ran automatically upon the start of spring project.
- Spring
- Spring Boot
- PostgreSQL
- Hibernate
- FlyWay
- Lombok
- Angular
- Node
- Cytoscape.js
- List all of the running containers
docker ps
- List all containers
docker ps -a
- Remove a container
docker container rm *container_id*
- List docker images
docker image ls
- Remove an image
docker image rm *image_id*
- Starting the database containers:
docker-compose up -d
- Stopping the database containers:
docker-compose stop
- Removing the database containers:
docker-compose down
- Pruning everything docker related:
docker system prune
- Pruning the volumes:
docker volume prune
Furthermore, a useful docker cheat sheet can be found here.