Prepare for open source and stopped tracking application-local.yaml
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
# User and timezone settings
|
||||||
|
PUID=1000
|
||||||
|
PGID=1000
|
||||||
|
TZ=Etc/UTC
|
||||||
|
|
||||||
|
# Database credentials (Replace with a secure password)
|
||||||
|
MYSQL_ROOT_PASSWORD=your_secure_password
|
||||||
|
|
||||||
|
# Paths for Docker volumes (Update these paths as per your system)
|
||||||
|
BOOKLORE_DATA_PATH=/path/to/booklore/data # Example: /home/user/booklore/data
|
||||||
|
BOOKLORE_BOOKS_PATH=/path/to/booklore/books # Example: /home/user/booklore/books
|
||||||
|
MARIADB_CONFIG_PATH=/path/to/mariadb/config # Example: /home/user/booklore/mariadb/config
|
||||||
@@ -35,3 +35,6 @@ out/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
local/
|
||||||
|
|
||||||
|
src/main/resources/application-local.yaml
|
||||||
|
|||||||
+15
-13
@@ -25,7 +25,7 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Spring Boot
|
// --- Spring Boot ---
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
@@ -35,34 +35,36 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-configuration-processor'
|
implementation 'org.springframework.boot:spring-boot-configuration-processor'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
|
|
||||||
// Lombok
|
// --- Database & Migration ---
|
||||||
|
implementation 'org.mariadb.jdbc:mariadb-java-client:3.5.2'
|
||||||
|
implementation 'org.flywaydb:flyway-mysql:11.3.4'
|
||||||
|
|
||||||
|
// --- Security & Authentication ---
|
||||||
|
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
|
||||||
|
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.6'
|
||||||
|
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6'
|
||||||
|
|
||||||
|
// --- Lombok (For Clean Code) ---
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.36'
|
compileOnly 'org.projectlombok:lombok:1.18.36'
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.36'
|
annotationProcessor 'org.projectlombok:lombok:1.18.36'
|
||||||
|
|
||||||
// Database & Flyway
|
// --- Book & Image Processing ---
|
||||||
implementation 'com.h2database:h2:2.3.232'
|
|
||||||
implementation 'org.flywaydb:flyway-mysql:11.3.4'
|
|
||||||
|
|
||||||
// Book and Image Libraries
|
|
||||||
implementation 'org.apache.pdfbox:pdfbox:3.0.4'
|
implementation 'org.apache.pdfbox:pdfbox:3.0.4'
|
||||||
implementation 'org.apache.pdfbox:jbig2-imageio:3.0.4'
|
implementation 'org.apache.pdfbox:jbig2-imageio:3.0.4'
|
||||||
implementation 'com.github.jai-imageio:jai-imageio-core:1.4.0'
|
implementation 'com.github.jai-imageio:jai-imageio-core:1.4.0'
|
||||||
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:1.4.0'
|
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:1.4.0'
|
||||||
implementation 'io.documentnode:epub4j-core:4.2.2'
|
implementation 'io.documentnode:epub4j-core:4.2.2'
|
||||||
|
|
||||||
// JSON & Web
|
// --- JSON & Web Scraping ---
|
||||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.3'
|
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.3'
|
||||||
implementation 'org.jsoup:jsoup:1.19.1'
|
implementation 'org.jsoup:jsoup:1.19.1'
|
||||||
|
|
||||||
// MapStruct
|
// --- Mapping (DTOs & Entities) ---
|
||||||
implementation 'org.mapstruct:mapstruct:1.6.3'
|
implementation 'org.mapstruct:mapstruct:1.6.3'
|
||||||
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
|
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
|
||||||
|
|
||||||
|
// --- API Documentation ---
|
||||||
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5'
|
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5'
|
||||||
|
|
||||||
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
|
|
||||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.6'
|
|
||||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hibernate {
|
hibernate {
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ public class SecurityConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
public CorsConfigurationSource corsConfigurationSource() {
|
public CorsConfigurationSource corsConfigurationSource() {
|
||||||
CorsConfiguration configuration = new CorsConfiguration();
|
CorsConfiguration configuration = new CorsConfiguration();
|
||||||
configuration.setAllowedOrigins(List.of("http://localhost:4200"));
|
configuration.setAllowedOrigins(List.of("http://localhost:4200", "http://localhost:5050"));
|
||||||
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
|
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
|
||||||
configuration.setAllowedHeaders(List.of("Authorization", "Cache-Control", "Content-Type"));
|
configuration.setAllowedHeaders(List.of("Authorization", "Cache-Control", "Content-Type"));
|
||||||
configuration.setExposedHeaders(List.of("Content-Disposition"));
|
configuration.setExposedHeaders(List.of("Content-Disposition"));
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
app:
|
|
||||||
path-book: '/Users/aditya.chandel/my-library-temp/books'
|
|
||||||
path-config: '/Users/aditya.chandel/my-library-temp/config/local'
|
|
||||||
|
|
||||||
spring:
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
enabled: true
|
|
||||||
max-file-size: 100MB
|
|
||||||
max-request-size: 100MB
|
|
||||||
mvc:
|
|
||||||
async:
|
|
||||||
request-timeout: 600000
|
|
||||||
application:
|
|
||||||
name: booklore-api
|
|
||||||
datasource:
|
|
||||||
driver-class-name: org.h2.Driver
|
|
||||||
url: 'jdbc:h2:tcp://localhost:8040/~/my-library-temp/config/local/db/booklore'
|
|
||||||
username: sa
|
|
||||||
password: password
|
|
||||||
jpa:
|
|
||||||
hibernate:
|
|
||||||
naming:
|
|
||||||
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
|
||||||
show-sql: false
|
|
||||||
properties:
|
|
||||||
hibernate:
|
|
||||||
jdbc:
|
|
||||||
batch_size: 500
|
|
||||||
order_inserts: true
|
|
||||||
order_updates: true
|
|
||||||
flyway:
|
|
||||||
enabled: true
|
|
||||||
locations: classpath:db/migration
|
|
||||||
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
root: INFO
|
|
||||||
org.apache.fontbox: ERROR
|
|
||||||
org.apache.pdfbox: ERROR
|
|
||||||
|
|
||||||
server:
|
|
||||||
port: 7050
|
|
||||||
@@ -14,11 +14,12 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: booklore-api
|
name: booklore-api
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.h2.Driver
|
driver-class-name: org.mariadb.jdbc.Driver
|
||||||
url: 'jdbc:h2:/app/config/db/booklore'
|
url: jdbc:mariadb://mariadb:3306/booklore?createDatabaseIfNotExist=true
|
||||||
username: sa
|
username: root
|
||||||
password: password
|
password: ${MYSQL_ROOT_PASSWORD}
|
||||||
jpa:
|
jpa:
|
||||||
|
database-platform: org.hibernate.dialect.MariaDBDialect
|
||||||
hibernate:
|
hibernate:
|
||||||
naming:
|
naming:
|
||||||
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ import {inject, Injectable, Injector} from '@angular/core';
|
|||||||
import {HttpClient} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {Observable, tap} from 'rxjs';
|
import {Observable, tap} from 'rxjs';
|
||||||
import {RxStompService} from '../../shared/websocket/rx-stomp.service';
|
import {RxStompService} from '../../shared/websocket/rx-stomp.service';
|
||||||
|
import {API_CONFIG} from '../../config/api-config';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
private apiUrl = 'http://localhost:7050/api/v1/auth';
|
|
||||||
|
private apiUrl = `${API_CONFIG.BASE_URL}/api/v1/auth`;
|
||||||
private rxStompService?: RxStompService;
|
private rxStompService?: RxStompService;
|
||||||
|
|
||||||
private http = inject(HttpClient);
|
private http = inject(HttpClient);
|
||||||
@@ -40,10 +42,6 @@ export class AuthService {
|
|||||||
localStorage.setItem('refreshToken', refreshToken);
|
localStorage.setItem('refreshToken', refreshToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveToken(token: string): void {
|
|
||||||
localStorage.setItem('accessToken', token);
|
|
||||||
}
|
|
||||||
|
|
||||||
getToken(): string | null {
|
getToken(): string | null {
|
||||||
return localStorage.getItem('accessToken');
|
return localStorage.getItem('accessToken');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Define variables
|
|
||||||
PROJECT_ROOT=$(pwd)
|
|
||||||
UI_DIR="$PROJECT_ROOT/booklore-ui"
|
|
||||||
API_DIR="$PROJECT_ROOT/booklore-api"
|
|
||||||
H2_JAR="$PROJECT_ROOT/h2-2.3.232.jar"
|
|
||||||
DOCKER_IMAGE_NAME="booklore-app"
|
|
||||||
|
|
||||||
# Step 1: Build Angular frontend
|
|
||||||
echo "Building Angular frontend..."
|
|
||||||
cd "$UI_DIR" || exit
|
|
||||||
npm install
|
|
||||||
npm run build --prod || { echo "Angular build failed"; exit 1; }
|
|
||||||
echo "Angular build completed."
|
|
||||||
|
|
||||||
# Step 2: Package Spring Boot API
|
|
||||||
echo "Packaging Spring Boot API..."
|
|
||||||
cd "$API_DIR" || exit
|
|
||||||
mvn clean package -DskipTests || { echo "Spring Boot build failed"; exit 1; }
|
|
||||||
API_JAR=$(find target -name "*.jar" | head -n 1)
|
|
||||||
echo "Spring Boot API packaged: $API_JAR"
|
|
||||||
|
|
||||||
# Step 3: Build Docker image
|
|
||||||
cd "$PROJECT_ROOT" || exit
|
|
||||||
echo "Building Docker image..."
|
|
||||||
docker build -t "$DOCKER_IMAGE_NAME" . || { echo "Docker build failed"; exit 1; }
|
|
||||||
echo "Docker image built: $DOCKER_IMAGE_NAME"
|
|
||||||
|
|
||||||
# Step 4: Clean up (optional)
|
|
||||||
echo "Cleaning up intermediate files..."
|
|
||||||
rm -rf "$UI_DIR/node_modules"
|
|
||||||
|
|
||||||
echo "Build process completed successfully!"
|
|
||||||
+18
-5
@@ -1,10 +1,23 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
services:
|
services:
|
||||||
booklore-app:
|
booklore:
|
||||||
|
image: localhost:5000/booklore-app:latest
|
||||||
container_name: booklore
|
container_name: booklore
|
||||||
image: localhost:5000/booklore-app:v8
|
env_file:
|
||||||
|
- .env
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
ports:
|
ports:
|
||||||
- "5050:6060"
|
- "6060:6060"
|
||||||
volumes:
|
volumes:
|
||||||
- /Users/aditya.chandel/my-library-temp/config/docker:/app/config
|
- ${BOOKLORE_DATA_PATH}:/app/data
|
||||||
- /Users/aditya.chandel/my-library-temp/books:/app/books
|
- ${BOOKLORE_BOOKS_PATH}:/books
|
||||||
|
|
||||||
|
mariadb:
|
||||||
|
image: lscr.io/linuxserver/mariadb:11.4.5
|
||||||
|
container_name: mariadb
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- ${MARIADB_CONFIG_PATH}:/config
|
||||||
|
restart: unless-stopped
|
||||||
Reference in New Issue
Block a user