https://github.com/rajadilipkolli/hilla-modulith-folioman
https://github.com/rajadilipkolli/hilla-modulith-folioman
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/rajadilipkolli/hilla-modulith-folioman
- Owner: rajadilipkolli
- License: mit
- Created: 2024-11-30T06:13:10.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-12-07T18:50:55.000Z (5 months ago)
- Last Synced: 2024-12-07T19:19:59.650Z (5 months ago)
- Language: Java
- Size: 842 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Custom project from Hilla
This project can be used as a starting point to create your own Hilla application with Spring Boot.
It contains all the necessary configuration and some placeholder files to get you started.## Running the application
The project is a standard Maven project. To run it from the command line,
type `mvnw` (Windows), or `./mvnw` (Mac & Linux), then open
http://localhost:8080 in your browser.You can also import the project to your IDE of choice as you would with any
Maven project.## Deploying to Production
To create a production build, call `mvnw clean package -Pproduction` (Windows),
or `./mvnw clean package -Pproduction` (Mac & Linux).
This will build a JAR file with all the dependencies and front-end resources,
ready to be deployed. The file can be found in the `target` folder after the build completes.Once the JAR file is built, you can run it using
`java -jar target/myapp-1.0-SNAPSHOT.jar` (NOTE, replace
`myapp-1.0-SNAPSHOT.jar` with the name of your jar).## Project structure
DirectoryDescription
src/main/frontend/
Client-side source directory
index.html
HTML template
index.ts
Frontend
entrypoint, bootstraps a React application
routes.tsx
React Router routes definition
MainLayout.tsx
Main
layout component, contains the navigation menu, uses
App Layout
views/
UI view
components
themes/
Custom
CSS styles
src/main/java/<groupId>/
Server-side
source directory, contains the server-side Java views
Application.java
Server entry-point## Useful links
- Read the documentation at [hilla.dev/docs](https://hilla.dev/docs/).
- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join our [Forum](https://vaadin.com/forum).
- Report issues, create pull requests in [GitHub](https://github.com/vaadin/hilla).## Deploying using Docker
To build the Dockerized version of the project, run
```
mvn clean package -Pproduction
docker build . -t hilla-modulith-folioman:latest
```Once the Docker image is correctly built, you can test it locally using
```
docker run -p 8080:8080 hilla-modulith-folioman:latest
```## Deploying using Kubernetes
We assume here that you have the Kubernetes cluster from Docker Desktop running (can be enabled in the settings).
First build the Docker image for your application. You then need to make the Docker image available to you cluster. With Docker Desktop Kubernetes, this happens automatically. With Minikube, you can run `eval $(minikube docker-env)` and then build the image to make it available. For other clusters, you need to publish to a Docker repository or check the documentation for the cluster.
The included `kubernetes.yaml` sets up a deployment with 2 pods (server instances) and a load balancer service. You can deploy the application on a Kubernetes cluster using
```
kubectl apply -f kubernetes.yaml
```If everything works, you can access your application by opening http://localhost:8000/.
If you have something else running on port 8000, you need to change the load balancer port in `kubernetes.yaml`.Tip: If you want to understand which pod your requests go to, you can add the value of `VaadinServletRequest.getCurrent().getLocalAddr()` somewhere in your UI.
### Troubleshooting
If something is not working, you can try one of the following commands to see what is deployed and their status.
```
kubectl get pods
kubectl get services
kubectl get deployments
```If the pods say `Container image "hilla-modulith-folioman:latest" is not present with pull policy of Never` then you have not built your application using Docker or there is a mismatch in the name. Use `docker images ls` to see which images are available.
If you need even more information, you can run
```
kubectl cluster-info dump
```that will probably give you too much information but might reveal the cause of a problem.
If you want to remove your whole deployment and start over, run
```
kubectl delete -f kubernetes.yaml
```