Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
47 changes: 47 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tests

on:
pull_request:
branches:
- master

jobs:
testing:
name: Run tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Set up Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: src/main/frontend

- name: Build Application
run: ./mvnw clean test -B

- name: Store Cypress Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: cypress-test-results
path: ${{ github.workspace }}/*/target/test-classes/e2e/cypress/test-results
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

**/node_modules/

### STS ###
.apt_generated
.classpath
Expand Down
44 changes: 39 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
# Multi Module Template
# WebApp Template

This project is a setup for multimodule repositories, specifically for at least a SpringBoot Backend and an Angular Frontend.
This project is a setup for a web application, specifically for a SpringBoot application with an Angular frontend.

# How to build
By running maven build from the builder module, it builds the frontend and backend and then adds the frontend files to the backend where it serves them on the root /.
It also has a builtin retry for index.html, so a custom nginx config to retry index.html if it does not find the html file is not needed.
## Build from source

Building the project requires Java, Maven, NodeJS, PNPM and Docker installed on your system.

To build the project from source, run this command:

```bash
mvn clean install
```

## Development

To run the application in development mode, you can use the following commands:

1. Start the backend server:
```bash
mvn spring-boot:run
```
2. Start the frontend server:
```bash
cd src/main/frontend
pnpm install
pnpm start
```

### E2e Testing

For e2e testing, you can use Cypress. To run the e2e tests, follow these steps:

1. Navigate to the frontend directory:
```bash
cd src/main/frontend
```
2. Run the e2e tests:
```bash
pnpm e2e
```
35 changes: 0 additions & 35 deletions backend/.gitignore

This file was deleted.

54 changes: 0 additions & 54 deletions backend/pom.xml

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions backend/src/main/resources/application.properties

This file was deleted.

25 changes: 0 additions & 25 deletions builder/pom.xml

This file was deleted.

8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
webapp:
image: webapp-template:latest
build:
dockerfile: ./docker/Dockerfile
context: .
ports:
- "8080:8080"
25 changes: 25 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM eclipse-temurin:21-jdk-jammy AS builder
WORKDIR /workspace

COPY . .

RUN ./mvnw -B -q -DskipTests clean package

FROM eclipse-temurin:21-jre-jammy AS runner
ARG GID=2000
ARG UID=2000
WORKDIR /app

ENV SPRING_PROFILES_ACTIVE=prod

RUN addgroup --gid ${GID} spring && \
adduser --uid ${UID} --gid ${GID} --shell /usr/sbin/nologin spring

USER spring

COPY --chown=spring ./docker/scripts/ /scripts/
COPY --chown=spring --from=builder /workspace/target/webapp-template*.jar /app/webapp.jar

EXPOSE 8080

CMD ["java","-jar","/app/app.jar"]
10 changes: 10 additions & 0 deletions docker/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e

export JAVA_OPTS="\
-XX:MaxRAMPercentage=75 \
-XX:+ExitOnOutOfMemoryError
-XX:+HeapDumpOnOutOfMemoryError \
$JAVA_OPTS"

exec "$@"
4 changes: 0 additions & 4 deletions frontend/.vscode/extensions.json

This file was deleted.

20 changes: 0 additions & 20 deletions frontend/.vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions frontend/.vscode/tasks.json

This file was deleted.

Loading