-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create vaadin project, add testcontainers, add workflow for deployment, add spotless, add pre-commit hook to hooks-folder Signed-off: [email protected]
- Loading branch information
aleks
committed
Nov 25, 2023
1 parent
fa95990
commit d4a990c
Showing
346 changed files
with
54,013 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Build and deploy JAR app | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Image version' | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Java version | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '21' | ||
|
||
- name: Build with Maven | ||
run: mvn clean package -Pproduction | ||
|
||
- name: Build container image | ||
run: docker build -t registry.digitalocean.com/testregistryaleks/javaexample:1 . | ||
|
||
- name: Install doctl | ||
uses: digitalocean/action-doctl@v2 | ||
with: | ||
token: ${{ secrets.DIGITAL_OCEAN }} | ||
|
||
- name: Log in to DigitalOcean Container Registry with short-lived credentials | ||
run: doctl registry login --expiry-seconds 600 | ||
|
||
- name: Push image to DigitalOcean Container Registry | ||
run: docker push registry.digitalocean.com/testregistryaleks/javaexample:1 | ||
|
||
- name: deploy application to droplet | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
passphrase: ${{ secrets.SSH_PASSPHRASE }} | ||
|
||
|
||
script: | | ||
export PATH=$PATH:/home/samic/bin | ||
source ~/.profile | ||
bash ./deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/target/ | ||
.idea/ | ||
.vscode/ | ||
|
||
|
||
.DS_Store | ||
|
||
# The following files are generated/updated by vaadin-maven-plugin | ||
node_modules/ | ||
frontend/generated/ | ||
pnpmfile.js | ||
vite.generated.ts | ||
|
||
# Browser drivers for local integration tests | ||
drivers/ | ||
# Error screenshots generated by TestBench for failed integration tests | ||
error-screenshots/ | ||
webpack.generated.js | ||
|
||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM eclipse-temurin:17-jre | ||
COPY target/*.jar app.jar | ||
EXPOSE 8080 | ||
ENTRYPOINT ["java", "-jar", "/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,61 @@ | ||
# Getting started | ||
# samic | ||
|
||
**Clone repository** | ||
This project can be used as a starting point to create your own Vaadin application with Spring Boot. | ||
It contains all the necessary configuration and some placeholder files to get you started. | ||
|
||
*Clones it in the current folder and creates the folder SAMInventoryControl. If a custom folder name is needed append a foldername after the command. (git clone ..... .git <foldername>* | ||
## Running the application | ||
|
||
*ssh* | ||
```sh | ||
[email protected]:anywaywayany/SAMInventoryControl.git | ||
``` | ||
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. | ||
|
||
*http* | ||
```sh | ||
https://github.com/anywaywayany/SAMInventoryControl.git | ||
``` | ||
You can also import the project to your IDE of choice as you would with any | ||
Maven project. Read more on [how to import Vaadin projects to different IDEs](https://vaadin.com/docs/latest/guide/step-by-step/importing) (Eclipse, IntelliJ IDEA, NetBeans, and VS Code). | ||
|
||
# Git Cheatsheet | ||
**Get from remote origin** | ||
## Deploying to Production | ||
|
||
*doesn't change local repository, displays differences between local and remote repository* | ||
```sh | ||
git fetch | ||
``` | ||
*changes local repository* | ||
```sh | ||
git pull | ||
``` | ||
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. | ||
|
||
**Push to remote origin** | ||
Once the JAR file is built, you can run it using | ||
`java -jar target/samic-1.0-SNAPSHOT.jar` | ||
|
||
*push local repository to remote origin* | ||
```sh | ||
git push | ||
``` | ||
## Project structure | ||
|
||
**Check local files whether there are any changes** | ||
```sh | ||
git status | ||
``` | ||
**Add files to staging area in order to commit them** | ||
- `MainLayout.java` in `src/main/java` contains the navigation setup (i.e., the | ||
side/top bar and the main menu). This setup uses | ||
[App Layout](https://vaadin.com/docs/components/app-layout). | ||
- `views` package in `src/main/java` contains the server-side Java views of your application. | ||
- `views` folder in `frontend/` contains the client-side JavaScript views of your application. | ||
- `themes` folder in `frontend/` contains the custom CSS styles. | ||
|
||
*add one or multiple files to the staging are* | ||
```sh | ||
git add <file> <file> | ||
``` | ||
## Useful links | ||
|
||
*adds complete folder and subfolders/files in subfolders* | ||
```sh | ||
git add . | ||
``` | ||
**commits** | ||
- Read the documentation at [vaadin.com/docs](https://vaadin.com/docs). | ||
- Follow the tutorial at [vaadin.com/docs/latest/tutorial/overview](https://vaadin.com/docs/latest/tutorial/overview). | ||
- Create new projects at [start.vaadin.com](https://start.vaadin.com/). | ||
- Search UI components and their usage examples at [vaadin.com/docs/latest/components](https://vaadin.com/docs/latest/components). | ||
- View use case applications that demonstrate Vaadin capabilities at [vaadin.com/examples-and-demos](https://vaadin.com/examples-and-demos). | ||
- Build any UI without custom CSS by discovering Vaadin's set of [CSS utility classes](https://vaadin.com/docs/styling/lumo/utility-classes). | ||
- Find a collection of solutions to common use cases at [cookbook.vaadin.com](https://cookbook.vaadin.com/). | ||
- Find add-ons at [vaadin.com/directory](https://vaadin.com/directory). | ||
- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join our [Discord channel](https://discord.gg/MYFq5RTbBn). | ||
- Report issues, create pull requests in [GitHub](https://github.com/vaadin). | ||
|
||
*commit with message/for short commit messages* | ||
```sh | ||
git commit -m "MESSAGE" | ||
``` | ||
*opens up an editor/for long commit messages* | ||
```sh | ||
git commit | ||
``` | ||
|
||
## branches/features TODO | ||
## merging (TODO) | ||
## git configuration localy (TODO) | ||
## Create ssh key and add to git locally and github account (TODO) | ||
## Deploying using Docker | ||
|
||
## Recommended worklow (still wop) | ||
To build the Dockerized version of the project, run | ||
|
||
- regularly fetch from remote origin | ||
- always fetch before pushing local repository to remote. In order to check whether there are any changes. If remote changed then pull changes. If there are any issues/errors -> if errors/issues -> fetch/pull again -> if ok then push | ||
``` | ||
mvn clean package -Pproduction | ||
docker build . -t samic:latest | ||
``` | ||
|
||
Once the Docker image is correctly built, you can test it locally using | ||
|
||
``` | ||
docker run -p 8080:8080 samic:latest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
This file is auto-generated by Vaadin. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<style> | ||
body, #outlet { | ||
height: 100vh; | ||
width: 100%; | ||
margin: 0; | ||
} | ||
</style> | ||
<!-- index.ts is included here automatically (either by the dev server or during the build) --> | ||
</head> | ||
<body> | ||
<!-- This outlet div is where the views are rendered --> | ||
<div id="outlet"></div> | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
frontend/themes/samic/components/vaadin-password-field.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
[part="input-field"] { | ||
box-shadow: inset 0 0 0 1px var(--lumo-contrast-30pct); | ||
background-color: var(--lumo-base-color); | ||
} | ||
|
||
:host([focus-ring]) [part="input-field"] { | ||
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct), inset 0 0 0 1px var(--lumo-primary-color); | ||
} | ||
|
||
:host([invalid]) [part="input-field"] { | ||
box-shadow: inset 0 0 0 1px var(--lumo-error-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
[part="input-field"] { | ||
box-shadow: inset 0 0 0 1px var(--lumo-contrast-30pct); | ||
background-color: var(--lumo-base-color); | ||
} | ||
|
||
:host([focus-ring]) [part="input-field"] { | ||
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct), inset 0 0 0 1px var(--lumo-primary-color); | ||
} | ||
|
||
:host([invalid]) [part="input-field"] { | ||
box-shadow: inset 0 0 0 1px var(--lumo-error-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
[part="input-field"] { | ||
box-shadow: inset 0 0 0 1px var(--lumo-contrast-30pct); | ||
background-color: var(--lumo-base-color); | ||
} | ||
|
||
:host([focus-ring]) [part="input-field"] { | ||
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct), inset 0 0 0 1px var(--lumo-primary-color); | ||
} | ||
|
||
:host([invalid]) [part="input-field"] { | ||
box-shadow: inset 0 0 0 1px var(--lumo-error-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
vaadin-scroller[slot="drawer"] { | ||
padding: var(--lumo-space-s); | ||
} | ||
|
||
vaadin-side-nav-item vaadin-icon { | ||
padding: 0; | ||
} | ||
|
||
[slot="drawer"]:is(header, footer) { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--lumo-space-s); | ||
padding: var(--lumo-space-s) var(--lumo-space-m); | ||
min-height: var(--lumo-size-xl); | ||
box-sizing: border-box; | ||
} | ||
|
||
[slot="drawer"]:is(header, footer):is(:empty) { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@import url('./main-layout.css'); | ||
|
||
@import url('@fontsource/inter/index.css'); html { | ||
--lumo-line-height-m: 1.4; | ||
--lumo-line-height-s: 1.2; | ||
--lumo-line-height-xs: 1.1; | ||
/* ORIGINAL SETUP VALUES | ||
--lumo-font-size: 1rem; | ||
--lumo-font-size-xxxl: 1.75rem; | ||
--lumo-font-size-xxl: 1.375rem; | ||
--lumo-font-size-xl: 1.125rem; | ||
--lumo-font-size-l: 1rem; | ||
--lumo-font-size-m: 0.875rem; | ||
--lumo-font-size-s: 0.8125rem; | ||
--lumo-font-size-xs: 0.75rem; | ||
--lumo-font-size-xxs: 0.6875rem; | ||
*/ | ||
--lumo-font-size: 1rem; | ||
--lumo-font-size-xxxl: 2.25rem; | ||
--lumo-font-size-xxl: 1.875rem; | ||
--lumo-font-size-xl: 1.5rem ; | ||
--lumo-font-size-l: 1.25rem; | ||
--lumo-font-size-m: 1.125rem; | ||
--lumo-font-size-s: 1rem ; | ||
--lumo-font-size-xs: 0.875rem ; | ||
--lumo-font-size-xxs: 0.75rem; | ||
|
||
--lumo-border-radius-s: calc(var(--lumo-size-m) / 6); | ||
--lumo-border-radius-m: calc(var(--lumo-size-m) / 2); | ||
--lumo-border-radius-l: var(--lumo-size-m); | ||
/* ORIGINAL SETUP VALUES | ||
--lumo-size-xl: 3rem; | ||
--lumo-size-l: 2.5rem; | ||
--lumo-size-m: 2rem; | ||
--lumo-size-s: 1.75rem; | ||
--lumo-size-xs: 1.5rem; | ||
*/ | ||
|
||
--lumo-size-xl: 2.75rem; | ||
--lumo-size-l: 2.25rem; | ||
--lumo-size-m: 1.75rem; | ||
--lumo-size-s: 1.25rem; | ||
--lumo-size-xs: 1rem; | ||
|
||
|
||
--lumo-space-xl: 1.875rem; | ||
--lumo-space-l: 1.25rem; | ||
--lumo-space-m: 0.625rem; | ||
--lumo-space-s: 0.3125rem; | ||
--lumo-space-xs: 0.1875rem; | ||
--lumo-font-family: Inter; | ||
|
||
} |
Oops, something went wrong.