Compare commits
2 commits
8f2828ea63
...
218fa6553e
Author | SHA1 | Date | |
---|---|---|---|
|
218fa6553e | ||
|
abec14663e |
16 changed files with 104 additions and 42 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
postgres/docker-compose.yml
|
docker/deloyment-example/files/library/*
|
||||||
|
docker/deloyment-example/files/postgresql/*
|
||||||
|
docker/deloyment-example/files/root/*
|
||||||
target/
|
target/
|
||||||
lib/
|
lib/
|
||||||
|
|
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
|
@ -2,13 +2,23 @@
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"type": "java",
|
"type": "java",
|
||||||
"name": "Spring Boot-MarinescoApplication<marinesco>",
|
"name": "Marinesco DEV",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
|
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
|
||||||
"projectName": "marinesco",
|
"projectName": "marinesco",
|
||||||
"args": "",
|
"args": "",
|
||||||
"envFile": "${workspaceFolder}/.env"
|
"envFile": "${workspaceFolder}/.env"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "Marinesco PROD",
|
||||||
|
"request": "launch",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
|
||||||
|
"projectName": "marinesco",
|
||||||
|
"args": "--spring.profiles.active=prod",
|
||||||
|
"envFile": "${workspaceFolder}/.env"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
5
docker/deloyment-example/README.MD
Normal file
5
docker/deloyment-example/README.MD
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
### How to
|
||||||
|
1. Place `marinesco.jar` to `files/root/`. Rename artifact if needed.
|
||||||
|
2. Extract `inpx`-file-containing folder into `files/library/`
|
||||||
|
3. Optionally remove `pgadmin` section from `docker-compose.yml` file
|
||||||
|
4. Run via `docker compose up`
|
9
docker/deloyment-example/build/Dockerfile
Normal file
9
docker/deloyment-example/build/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM openjdk:21-jdk-slim
|
||||||
|
|
||||||
|
ENV TZ=Europe/Moscow
|
||||||
|
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
CMD java -jar marinesco.jar
|
34
docker/deloyment-example/docker-compose.yml
Normal file
34
docker/deloyment-example/docker-compose.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
marinesco:
|
||||||
|
build: ./build
|
||||||
|
image: loper:marinesco
|
||||||
|
links:
|
||||||
|
- postgres
|
||||||
|
ports:
|
||||||
|
- 80:8080
|
||||||
|
volumes:
|
||||||
|
- ./files/root:/root
|
||||||
|
- ./files/library:/library
|
||||||
|
environment:
|
||||||
|
- SPRING_PROFILES_ACTIVE=prod
|
||||||
|
logging:
|
||||||
|
driver: syslog
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
volumes:
|
||||||
|
- ./files/postgresql:/var/lib/postgresql
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=mari
|
||||||
|
- POSTGRES_PASSWORD=example
|
||||||
|
- POSTGRES_DB=marinesco
|
||||||
|
pgadmin:
|
||||||
|
image: dpage/pgadmin4
|
||||||
|
links:
|
||||||
|
- postgres
|
||||||
|
ports:
|
||||||
|
- 3334:80
|
||||||
|
environment:
|
||||||
|
- PGADMIN_DEFAULT_EMAIL=root@srv.lan
|
||||||
|
- PGADMIN_DEFAULT_PASSWORD=example
|
6
pom.xml
6
pom.xml
|
@ -80,6 +80,12 @@
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -5,17 +5,12 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public class RootController {
|
public class RootController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String getPage(@ModelAttribute("search") String text) {
|
public String getPage(@ModelAttribute("search") String text) {
|
||||||
// TODO: SEARCH PAGE + CONTROLLER
|
|
||||||
log.info(text);
|
|
||||||
return "root";
|
return "root";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package ru.redrise.marinesco;
|
package ru.redrise.marinesco.library;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import ru.redrise.marinesco.data.AuthorRepository;
|
import ru.redrise.marinesco.data.AuthorRepository;
|
||||||
import ru.redrise.marinesco.data.BookRepository;
|
import ru.redrise.marinesco.data.BookRepository;
|
||||||
import ru.redrise.marinesco.library.Author;
|
|
||||||
import ru.redrise.marinesco.library.Book;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/author")
|
@RequestMapping("/author")
|
|
@ -1,4 +1,4 @@
|
||||||
package ru.redrise.marinesco;
|
package ru.redrise.marinesco.library;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
@ -7,7 +7,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import ru.redrise.marinesco.data.BookRepository;
|
import ru.redrise.marinesco.data.BookRepository;
|
||||||
import ru.redrise.marinesco.library.Book;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/book")
|
@RequestMapping("/book")
|
|
@ -134,22 +134,23 @@ public class InpxScanner implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseInp(File inpxFile) throws Exception {
|
private void parseInp(File inpxFile) throws Exception {
|
||||||
|
/*
|
||||||
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
|
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
|
||||||
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
|
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
|
||||||
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
|
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
|
||||||
boolean breaker = false;
|
boolean breaker = false;
|
||||||
|
*/
|
||||||
try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(inpxFile))) {
|
try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(inpxFile))) {
|
||||||
ZipEntry zipEntry = zipInputStream.getNextEntry();
|
ZipEntry zipEntry = zipInputStream.getNextEntry();
|
||||||
|
|
||||||
while (zipEntry != null) {
|
while (zipEntry != null) {
|
||||||
if (zipEntry.getName().toLowerCase().endsWith(".inp")) {
|
if (zipEntry.getName().toLowerCase().endsWith(".inp")) {
|
||||||
// *
|
/*
|
||||||
if (breaker) {
|
if (breaker) {
|
||||||
zipEntry = zipInputStream.getNextEntry();
|
zipEntry = zipInputStream.getNextEntry();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
breaker = true;//
|
breaker = true;
|
||||||
// */
|
// */
|
||||||
byte[] content = inpToByteArray(zipInputStream, zipEntry.getSize());
|
byte[] content = inpToByteArray(zipInputStream, zipEntry.getSize());
|
||||||
parseInpContent(content, zipEntry.getName());
|
parseInpContent(content, zipEntry.getName());
|
||||||
|
|
21
src/main/resources/application-prod.yml
Normal file
21
src/main/resources/application-prod.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
spring:
|
||||||
|
thymeleaf:
|
||||||
|
cache: true
|
||||||
|
datasource:
|
||||||
|
driver-class-name: org.postgresql.Driver
|
||||||
|
url: jdbc:postgresql://postgres:5432/marinesco
|
||||||
|
username: mari
|
||||||
|
password: example
|
||||||
|
jpa:
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
database-platform: org.hibernate.dialect.PostgreSQL94Dialect
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: update
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
org:
|
||||||
|
springframework: INFO
|
||||||
|
marinesco:
|
||||||
|
library:
|
||||||
|
filesLocation: "/library"
|
|
@ -156,12 +156,11 @@ header {
|
||||||
color: #74bfbd;
|
color: #74bfbd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header_entry_link:link {
|
.header_entry_link:link,
|
||||||
color: #74bfbd;
|
|
||||||
}
|
|
||||||
.header_entry_link:visited {
|
.header_entry_link:visited {
|
||||||
color: #74bfbd;
|
color: #74bfbd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header_entry_link:hover {
|
.header_entry_link:hover {
|
||||||
color: #b6a795;
|
color: #b6a795;
|
||||||
}
|
}
|
||||||
|
@ -175,10 +174,6 @@ header {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.entry {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header_title {
|
.header_title {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
|
@ -262,9 +257,6 @@ button:hover {
|
||||||
text-shadow: -1px -1px 0 #1e1e1e, 1px -1px 0 #1e1e1e, -1px 1px 0 #1e1e1e, 1px 1px 0 #1e1e1e;
|
text-shadow: -1px -1px 0 #1e1e1e, 1px -1px 0 #1e1e1e, -1px 1px 0 #1e1e1e, 1px 1px 0 #1e1e1e;
|
||||||
color: #74bfbd;
|
color: #74bfbd;
|
||||||
}
|
}
|
||||||
.copy_link:hover {
|
|
||||||
color: #b6a795;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* error */
|
/* error */
|
||||||
.error {
|
.error {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<a th:href="${'/author/' + author.id}" th:text="${author.authorName}"></a>
|
<a th:href="${'/author/' + author.id}" th:text="${author.authorName}"></a>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<span th:each="genre : ${book.genres}" th:text="${(genre.humanReadableDescription == '' ? genre.genreId : genre.humanReadableDescription) + ' '}"></span>
|
<span th:each="genre : ${book.genres}" th:text="${((genre.humanReadableDescription == null || genre.humanReadableDescription == '') ? genre.genreId : genre.humanReadableDescription) + ' '}"></span>
|
||||||
<p>
|
<p>
|
||||||
<a th:href="${'/download/?container=' + book.container + '&file=' + book.fsFileName}"
|
<a th:href="${'/download/?container=' + book.container + '&file=' + book.fsFileName}"
|
||||||
th:text="${'Download ' + book.fileExtension + ' (' + book.fileSizeForHumans + ')'}"></a>
|
th:text="${'Download ' + book.fileExtension + ' (' + book.fileSizeForHumans + ')'}"></a>
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="footer" th:fragment="footer">
|
<div class="footer" th:fragment="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<footer class="inner_footer">
|
<footer class="inner_footer copy_link">
|
||||||
<a class="entry" href="https://redrise.ru">
|
<a class="header_entry_link" href="https://redrise.ru">© 2023-2024 Dmitry Isaenko</a>
|
||||||
<div class="copy_link">© 2023-2024 Dmitry Isaenko</div>
|
|
||||||
</a>
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,9 +14,7 @@
|
||||||
<div class="block_inner">
|
<div class="block_inner">
|
||||||
<ul class="ul_right_block">
|
<ul class="ul_right_block">
|
||||||
<li class="li_header_block">
|
<li class="li_header_block">
|
||||||
<a class="entry" href="/login" th:href="@{/login}">
|
<a class="header_entry header_entry_link" href="/login" th:href="@{/login}">Sign in</a>
|
||||||
<span class="header_entry header_entry_link">Sign in</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,9 +51,7 @@
|
||||||
<span class="header_entry">|</span>
|
<span class="header_entry">|</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="li_header_block">
|
<li class="li_header_block">
|
||||||
<a class="entry" href="/logout">
|
<a class="header_entry header_entry_link" href="/logout">Logout</a>
|
||||||
<span class="header_entry header_entry_link">Logout</span>
|
|
||||||
</a>
|
|
||||||
<form style="visibility: hidden" id="form" method="post" action="#" th:action="@{/logout}"></form>
|
<form style="visibility: hidden" id="form" method="post" action="#" th:action="@{/logout}"></form>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -12,11 +12,7 @@
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
|
||||||
<div class="container base">
|
<div class="container base">
|
||||||
<br /><a href="/book/59992766">/book/59992766</a>
|
Welcome
|
||||||
<br /><a href="/author/1">/author/1</a>
|
|
||||||
<br /><a href="/h2">H2</a>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div th:replace="~{fragments/footer :: 'footer'}"></div>
|
<div th:replace="~{fragments/footer :: 'footer'}"></div>
|
||||||
|
|
Loading…
Reference in a new issue