Skip to content

Commit

Permalink
Merge pull request #179 from conorheffron/ghnv
Browse files Browse the repository at this point in the history
* Update AppNavbar.js

* #178 Update pom.xml

* #178 Update AppNavbar.js

* #137 Update pom.xml

* #171 Move static content file resolver stmt to DEBUG level & return null

* #177 Update home-page.png

* #180 Update ControlledCarousel.js

* #178 Update AppNavbar.js

remove unused imports

* #177 Update README.md

* #177 Create local-ui-proxy.png

* #180 Update package.json

* #180 Create package-lock.json

* #180 Update pom.xml, bump release version from minor to patch

* #144: Refactoring. Moved static content config to application yml

Added to & updated app test suite

* #184 Update pom.xml & README.md with Jacoco config/info

* #167 Migrate strava iframe to src img with hyper link, CSS refactor (indentation)

* #151 Update index.html meta tags

* Bump io.swagger.core.v3:swagger-annotations from 2.2.26 to 2.2.27 (#181)

* Bump io.swagger.core.v3:swagger-annotations from 2.2.26 to 2.2.27

Bumps io.swagger.core.v3:swagger-annotations from 2.2.26 to 2.2.27.

---
updated-dependencies:
- dependency-name: io.swagger.core.v3:swagger-annotations
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update pom.xml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Conor Heffron <conor.heffron@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
conorheffron and dependabot[bot] authored Dec 21, 2024
2 parents fb8e883 + 5cef292 commit eaf488f
Show file tree
Hide file tree
Showing 28 changed files with 21,293 additions and 101 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './frontend/package-lock.json'
- run: npm ci
working-directory: './frontend'
- run: npm run build --if-present
working-directory: './frontend'
- run: npm test
working-directory: './frontend'
- run: npm install
working-directory: './frontend'
200 changes: 167 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

[![Deploy to Amazon ECS](https://github.com/conorheffron/ironoc/actions/workflows/aws.yml/badge.svg)](https://github.com/conorheffron/ironoc/actions/workflows/aws.yml)

### Docker Image
- [ironoc Docker Hub Link](https://hub.docker.com/repository/docker/conorheffron/ironoc/general)
### Docker Image Repositories
- [ironoc Docker Hub Repository](https://hub.docker.com/repository/docker/conorheffron/ironoc/general)
- [ironoc GitHub Docker Container Registry](https://github.com/conorheffron/ironoc/pkgs/container/ironoc)

## Hosted at:
- [ironoc.net](https://me.ironoc.net)
Expand All @@ -17,23 +18,48 @@
Personal website / portfolio [https://www.ironoc.net/](https://www.ironoc.net/)

## Tech Stack
Java 21 (LTS), Spring Boot 3.3, ReactJs 18, Maven 3.8, HTML5+CSS,
Java 21 (LTS), Spring Boot 3.4, ReactJs 18, Maven 3.8 or later, HTML5+CSS,
Docker / Bash, AWS, minikube, & kubectl.

## Run without cloning project:
```
docker run -d --restart=always -p 8080:8080 conorheffron/ironoc
```

## Run after project checkout (JDK 21 & Maven 3.8.3 required)
Build / Run App:
## AWS CLI to pull required svc / user account credentials.
### Configure account, verify details & then generate ID/Keys/Tokens.
```shell
% aws configure

% aws iam get-user

% aws sts get-session-token
```

## Add localhost proxy to frontend config (do not commit - only for local runs).
![ui-config-screenshot](screen-grabs/local-ui-proxy.png)

## Run after project checkout (JDK 21 & Maven 3.8 or later required)
### Build frontend & server side, along with Java Code Coverage report.
```shell
mvn clean package
```

#### View Java Code Coverage reports in Browser or Preview tab in IDE.
##### Path to reports is `target/site/jacoco/index.html`

![ui-config-screenshot](screen-grabs/jacoco.png)

##### View in browser at `http://localhost:63342/ironoc/target/site/jacoco/index.html?_ijt=s0hqlj2p4s6554gldritju13qr&_ij_reload=RELOAD_ON_SAVE`
###### Note: Change port as needed/identifier as this is URL generated during build process & opened via IDE window.
![ui-config-screenshot](screen-grabs/jacoco-browser.png)

mvn -DAWS_ACCESS_KEY_ID=<val1> \
### Run app
```shell
mvn -DAWS_ACCESS_KEY_ID="<val1>" \
-DAWS_REGION=<val2> \
-DAWS_SECRET_ACCESS_KEY=<val3> \
-DAWS_SESSION_TOKEN=<val4> \
-DAWS_SECRET_ACCESS_KEY="<val3>" \
-DAWS_SESSION_TOKEN="<val4>" \
spring-boot:run
```

Expand Down Expand Up @@ -67,7 +93,7 @@ brew install virtualbox
brew install minikube
```

```
```shell
Oracle VirtualBox Manager v7.1.4

% kubectl version
Expand All @@ -91,45 +117,153 @@ Context: desktop-linux
```

- Open terminal
```
cd k8s/
# (clean-up & again after local testing complete)
minikube delete
minikube start --driver=docker
kubectl cluster-info
minikube dashboard
```shell
% minikube start --driver=docker
😄 minikube v1.34.0 on Darwin 15.1.1
❗ Both driver=docker and vm-driver=virtualbox have been set.

Since vm-driver is deprecated, minikube will default to driver=docker.

If vm-driver is set in the global config, please run "minikube config unset vm-driver" to resolve this warning.

✨ Using the docker driver based on user configuration
📌 Using Docker Desktop driver with root privileges
👍 Starting "minikube" primary control-plane node in "minikube" cluster
🚜 Pulling base image v0.0.45 ...
🔥 Creating docker container (CPUs=2, Memory=4000MB) ...
🐳 Preparing Kubernetes v1.31.0 on Docker 27.2.0 ...
▪ Generating certificates and keys ...
▪ Booting up control plane ...
▪ Configuring RBAC rules ...
🔗 Configuring bridge CNI (Container Networking Interface) ...
🔎 Verifying Kubernetes components...
▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟 Enabled addons: storage-provisioner, default-storageclass
🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default


% kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:62645
CoreDNS is running at https://127.0.0.1:62645/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.


% minikube dashboard
🔌 Enabling dashboard ...
▪ Using image docker.io/kubernetesui/dashboard:v2.7.0
▪ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
💡 Some dashboard features require the metrics-server addon. To enable all features please run:

minikube addons enable metrics-server

🤔 Verifying dashboard health ...
🚀 Launching proxy ...
🤔 Verifying proxy health ...
🎉 Opening http://127.0.0.1:62706/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
```

### Then change namespace in browser from default to ironoc-ns
- i.e. http://127.0.0.1:56414/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/pod?namespace=ironoc-ns
- i.e. http://127.0.0.1:62706/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/pod?namespace=ironoc-ns

### Open New tab in terminal & create deployment
```
docker image build -t ironoc .
minikube image load ironoc:latest
```shell
% docker image build -t ironoc .
[+] Building 100.5s (11/11) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 284B 0.0s
=> [internal] load metadata for docker.io/library/eclipse-temurin:21-jdk 2.0s
=> [auth] library/eclipse-temurin:pull token for registry-1.docker.io 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
.
.
.


kubectl create ns ironoc-ns
% minikube image load ironoc:latest

kubectl apply -f k8s/ironoc.yaml --namespace=ironoc-ns

kubectl get pods --namespace=ironoc-ns
kubectl get deployment --namespace=ironoc-ns
% kubectl create ns ironoc-ns
namespace/ironoc-ns created

kubectl expose deployment ironoc-app-deployment --type=NodePort --namespace=ironoc-ns

kubectl get svc --namespace=ironoc-ns
% kubectl apply -f k8s/ironoc.yaml --namespace=ironoc-ns
deployment.apps/ironoc-app-deployment created
horizontalpodautoscaler.autoscaling/ironoc-app-deployment-hpa-kbij created

minikube service ironoc-app-deployment --url --namespace=ironoc-ns

% kubectl get pods --namespace=ironoc-ns
NAME READY STATUS RESTARTS AGE
ironoc-app-deployment-6d84f75b44-5xvgj 1/1 Running 0 8s


% kubectl get deployment --namespace=ironoc-ns
NAME READY UP-TO-DATE AVAILABLE AGE
ironoc-app-deployment 1/1 1 1 105s


% kubectl expose deployment ironoc-app-deployment --type=NodePort --namespace=ironoc-ns

service/ironoc-app-deployment exposed


% kubectl get svc --namespace=ironoc-ns
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ironoc-app-deployment NodePort 10.98.229.246 <none> 8080:31602/TCP 6s


% minikube service ironoc-app-deployment --url --namespace=ironoc-ns
http://127.0.0.1:63455
❗ Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
```

### Open New tab in terminal & tail logs
```
```shell
% kubectl get pods --namespace=ironoc-ns
NAME READY STATUS RESTARTS AGE
ironoc-app-deployment-6d84f75b44-kpqpj 1/1 Running 0 3m37s
ironoc-app-deployment-6d84f75b44-5xvgj 1/1 Running 0 3m28s


% kubectl logs ironoc-app-deployment-6d84f75b44-5xvgj -f --namespace=ironoc-ns

java -jar /app.war

Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.4.0)
2024-12-14T17:50:40.926Z INFO 7 --- [ main] n.i.p.App : Starting App v5.4.6 using Java 21.0.5 with PID 7 (/app.war started by root in /)
2024-12-14T17:50:41.028Z INFO 7 --- [ main] n.i.p.App : No active profile set, falling back to 1 default profile: "default"
2024-12-14T17:50:48.042Z INFO 7 --- [ main] o.s.b.w.e.t.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-12-14T17:50:48.109Z INFO 7 --- [ main] o.a.c.c.StandardService : Starting service [Tomcat]
2024-12-14T17:50:48.112Z INFO 7 --- [ main] o.a.c.c.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
2024-12-14T17:51:26.598Z INFO 7 --- [ main] o.a.j.s.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2024-12-14T17:51:27.320Z INFO 7 --- [ main] o.a.c.c.C.[.[.[/] : Initializing Spring embedded WebApplicationContext
2024-12-14T17:51:27.323Z INFO 7 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 45872 ms
2024-12-14T17:51:28.210Z INFO 7 --- [ main] n.i.p.l.AbstractLogger : GitDetailsRunnable running for userIds=[conorheffron]
2024-12-14T17:51:28.696Z INFO 7 --- [ main] n.i.p.l.AbstractLogger : Triggering GET request: url=https://api.github.com/users/conorheffron/repos?per_page=100&page=1
2024-12-14T17:51:34.776Z WARN 7 --- [ main] n.i.p.c.GitClient : GIT token not set, the lower request rate will apply
2024-12-14T17:51:35.912Z WARN 7 --- [ main] n.i.p.l.AbstractLogger : Input stream already closed.
2024-12-14T17:51:35.912Z INFO 7 --- [ main] n.i.p.l.AbstractLogger : Running GIT details job for userIds=[conorheffron], repositoryDetailDtos=[]
2024-12-14T17:51:35.914Z INFO 7 --- [ main] n.i.p.l.AbstractLogger : GitDetailsRunnable completed for userIds=[conorheffron]
2024-12-14T17:51:36.925Z INFO 7 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2024-12-14T17:51:40.857Z INFO 7 --- [ main] o.s.b.w.e.t.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2024-12-14T17:51:40.911Z INFO 7 --- [ main] n.i.p.App : Started App in 62.867 seconds (process running for 68.625)
```
kubectl logs ironoc-app-deployment-6d84f75b44-kpqpj -f --namespace=ironoc-ns
### (clean-up & again after local testing complete)
```shell
% minikube delete
🔥 Deleting "minikube" in docker ...
🔥 Deleting container "minikube" ...
🔥 Removing /Users/conorheffron/.minikube/machines/minikube ...
💀 Removed all traces of the "minikube" cluster.
```
Loading

0 comments on commit eaf488f

Please sign in to comment.