Skip to content

Commit dda2972

Browse files
authored
Merge pull request #53 from cgreggtcd/dev
Release 1
2 parents 1635420 + d7775f0 commit dda2972

49 files changed

Lines changed: 4546 additions & 50 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
MYSQLDB_USER=root
2+
MYSQLDB_ROOT_PASSWORD=123456
3+
MYSQLDB_DATABASE=metrics_db
4+
MYSQLDB_LOCAL_PORT=3307
5+
MYSQLDB_DOCKER_PORT=3306
6+
7+
SPRING_LOCAL_PORT=8080
8+
SPRING_DOCKER_PORT=8080
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Docker Image CI
2+
3+
on:
4+
create:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Check out Repo
16+
uses: actions/checkout@v3
17+
18+
- name: Login to Docker Hub
19+
uses: docker/login-action@v1
20+
with:
21+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
22+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
23+
24+
- name: Set up Docker Buildx
25+
id: buildx
26+
uses: docker/setup-buildx-action@v1
27+
28+
- name: Build and push
29+
id: docker_build
30+
uses: docker/build-push-action@v2
31+
with:
32+
context: ./
33+
file: ./Dockerfile
34+
push: true
35+
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/software-engineering-metrics:release-1
36+
37+
- name: Image digest
38+
run: echo ${{ steps.docker_build.outputs.digest }}
39+

.github/workflows/maven.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Java CI with Maven
55

66
on:
77
push:
8-
branches: [ "main" ]
8+
branches: [ "main", "dev" ]
99
pull_request:
10-
branches: [ "main" ]
10+
branches: [ "main","dev" ]
1111

1212
jobs:
1313
build:
@@ -18,5 +18,13 @@ jobs:
1818
- uses: actions/setup-java@v1
1919
with:
2020
java-version: 17
21+
- name: Write application properties (Github API key)
22+
uses: DamianReeves/write-file-action@master
23+
with:
24+
path: src/main/resources/application.properties
25+
write-mode: overwrite
26+
contents: |
27+
github.access.token=${{ secrets.ACCESS_TOKEN }}
28+
2129
- name: Build with Maven
22-
run: mvn -B package --file pom.xml
30+
run: mvn test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
HELP.md
22
target/
3+
.m2/
34
!.mvn/wrapper/maven-wrapper.jar
45
!**/src/main/**/target/
56
!**/src/test/**/target/
@@ -31,3 +32,4 @@ build/
3132

3233
### VS Code ###
3334
.vscode/
35+
src/main/resources/application.properties

Demo.mp4

26 MB
Binary file not shown.

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM openjdk:17
1+
FROM maven:3.8.3-openjdk-17
2+
23
WORKDIR /app
3-
EXPOSE 8080
4-
COPY target/*.jar /app/app.jar
5-
CMD ["java", "-jar", "app.jar"]
4+
COPY . .
5+
RUN mvn clean install
6+
7+
CMD mvn spring-boot:run

README.md

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,11 @@
22
This project is to develop a dashboard for the presentation of a range of metrics and visualisations useful to software engineers.
33

44
## Setup Instructions
5-
### Run Version on GitHub
65

7-
To run the version on GitHub, clone the repo to your desktop.
6+
If you haven't done this yet, create a file named `application.properties` and inside, put the following
87

9-
#### Run by Script (recommended)
8+
github.access.token=<your-github-access-token>
9+
10+
You can make a GitHub access token as described [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-fine-grained-personal-access-token).
1011

11-
Run the webapp by right-clicking on setup.bat and selecting `run`.
12-
13-
Then, you can open the web app on localhost:8080. This will also run tests!
14-
15-
16-
#### Run from Command Line
17-
18-
Open a terminal in the directory of the repo. Then, run
19-
20-
./mvnw clean install spring-boot:run
21-
22-
Then, you can open the web app on localhost:8080. This will also run tests!
23-
24-
### Run Containerised
25-
26-
If you want to run the web app in a container, first clone the repo to your desktop. Open a terminal in the directory of the repo. Then, run
27-
28-
./mvnw clean install spring-boot:run
29-
30-
This will create the jar file. Then, run the following to build the image.
31-
32-
docker build -t metrics-image .
33-
34-
To run the webapp, run
35-
36-
docker run --name=metrics-container --rm -d -p 8080:8080 metrics-image
37-
38-
Then, you can open the web app on localhost:8080.
12+
Then, usually, you can run by running run.bat or just typing `docker-compose up` into terminal. If you're making changes to the app however, you will need to run setup.bat or type `docker-compose build` then `docker-compose up` into terminal.

docker-compose.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: '3.8'
2+
3+
services:
4+
mysqldb:
5+
image: mysql:5.7
6+
restart: unless-stopped
7+
env_file: ./.env
8+
environment:
9+
- MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD
10+
- MYSQL_DATABASE=$MYSQLDB_DATABASE
11+
ports:
12+
- $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT
13+
volumes:
14+
- db:/var/lib/mysql
15+
app:
16+
depends_on:
17+
- mysqldb
18+
build: .
19+
restart: on-failure
20+
ports:
21+
- $SPRING_LOCAL_PORT:$SPRING_DOCKER_PORT
22+
environment:
23+
- 'SPRING_APPLICATION_JSON={
24+
"spring.datasource.url" : "jdbc:mysql://mysqldb:$MYSQLDB_DOCKER_PORT/$MYSQLDB_DATABASE?useSSL=false",
25+
"spring.datasource.username" : "$MYSQLDB_USER",
26+
"spring.datasource.password" : "$MYSQLDB_ROOT_PASSWORD",
27+
"spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQL5InnoDBDialect",
28+
"spring.jpa.hibernate.ddl-auto" : "update",
29+
"spring.datasource.driver-class-name" : "com.mysql.cj.jdbc.Driver"
30+
}'
31+
32+
volumes:
33+
- .m2:/root/.m2
34+
stdin_open: true
35+
tty: true
36+
37+
volumes:
38+
db:
268 KB
Loading

documentation/Sidebar_mockup.png

71.3 KB
Loading

0 commit comments

Comments
 (0)