Skip to content
Open
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
19 changes: 19 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Datasource
DATASOURCE_URL=jdbc:postgresql://postgres-db:5432/jira
DATASOURCE_USERNAME=jira
DATASOURCE_PASSWORD=JiraRush

# OAuth
OAUTH2_GITHUB_CLIENT_ID=3d0d8738e65881fff266
OAUTH2_GITHUB_CLIENT_SECRET=0f97031ce6178b7dfb67a6af587f37e222a16120

OAUTH2_GOOGLE_CLIENT_ID=329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com
OAUTH2_GOOGLE_CLIENT_SECRET=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

OAUTH2_GITLAB_CLIENT_ID=b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494
OAUTH2_GITLAB_CLIENT_SECRET=e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004

# Mail
MAIL_USERNAME=jira4jr@gmail.com
MAIL_PASSWORD=zdfzsrqvgimldzyj
MAIL_PORT=587
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ attachments
*.patch


/src/test/resources/pgdata-test/
/src/main/resources/pgdata/
/pgdata-test/
/pgdata/
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM maven:3.8.4-amazoncorretto-17 as build
WORKDIR app/
COPY . .
RUN mvn clean package -DskipTests

FROM openjdk:17-jdk-slim
WORKDIR /app
COPY --from=build /app/target/JiraRush.jar /app/
COPY ./resources /app/resources
EXPOSE 8080
CMD ["java", "-jar", "JiraRush.jar"]
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## Концепция:

- Spring Modulith
- [Spring Modulith: достигли ли мы зрелости модульности](https://habr.com/ru/post/701984/)
- [Introducing Spring Modulith](https://spring.io/blog/2022/10/21/introducing-spring-modulith)
- [Spring Modulith - Reference documentation](https://docs.spring.io/spring-modulith/docs/current-SNAPSHOT/reference/html/)
- [Spring Modulith: достигли ли мы зрелости модульности](https://habr.com/ru/post/701984/)
- [Introducing Spring Modulith](https://spring.io/blog/2022/10/21/introducing-spring-modulith)
- [Spring Modulith - Reference documentation](https://docs.spring.io/spring-modulith/docs/current-SNAPSHOT/reference/html/)

```
url: jdbc:postgresql://localhost:5432/jira
Expand All @@ -14,9 +14,9 @@
```

- Есть 2 общие таблицы, на которых не fk
- _Reference_ - справочник. Связь делаем по _code_ (по id нельзя, тк id привязано к окружению-конкретной базе)
- _UserBelong_ - привязка юзеров с типом (owner, lead, ...) к объекту (таска, проект, спринт, ...). FK вручную будем
проверять
- _Reference_ - справочник. Связь делаем по _code_ (по id нельзя, тк id привязано к окружению-конкретной базе)
- _UserBelong_ - привязка юзеров с типом (owner, lead, ...) к объекту (таска, проект, спринт, ...). FK вручную будем
проверять

## Аналоги

Expand All @@ -27,4 +27,18 @@
- https://habr.com/ru/articles/259055/

Список выполненных задач:
...

| # | info | Done |
|----|------------------------------------------------------------------------------------------------------|------|
| 1 | Розібратися зі структурою проєкту (onboarding) | ✅ |
| 2 | Видалити соціальні мережі: vk, yandex. | ✅ |
| 3 | Винести чутливу інформацію до окремого проперті файлу | ✅ |
| 4 | Переробити тести так, щоб під час тестів використовувалася in memory БД (H2) | ✅ |
| 5 | Написати тести для всіх публічних методів контролера ProfileRestController | ✅ |
| 6 | Зробити рефакторинг методу com.javarush.jira.bugtracking.attachment.FileUtil#upload | ✅ |
| 7 | Додати новий функціонал: додавання тегів до завдання | ✅ |
| 8 | Додати підрахунок часу: скільки завдання перебувало у роботі та тестуванні | ✅ |
| 9 | Написати Dockerfile для основного сервера | ✅ |
| 10 | Написати docker-compose файл для запуску контейнера сервера разом з БД та nginx | ✅ |
| 11 | Додати локалізацію мінімум двома мовами для шаблонів листів (mails) та стартовою сторінки index.html | ✅ |
| 12 | Переробити механізм розпізнавання «свій-чужий» між фронтом і беком з JSESSIONID на JWT | ✅ |
87 changes: 50 additions & 37 deletions config/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
# https://losst.ru/ustanovka-nginx-ubuntu-16-04
# https://pai-bx.com/wiki/nginx/2332-useful-redirects-in-nginx/#1
# sudo iptables -A INPUT ! -s 127.0.0.1 -p tcp -m tcp --dport 8080 -j DROP
server {
listen 80;

# https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration
gzip on;
gzip_types text/css application/javascript application/json;
gzip_min_length 2048;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root /opt/jirarush/resources;

if ($request_uri ~ ';') {return 404;}

# proxy_cookie_flags ~ secure samesite=none;

# static
location /static/ {
expires 30d;
access_log off;
}
location /robots.txt {
access_log off;
}

location ~ (/$|/view/|/ui/|/oauth2/) {
expires 0m;
proxy_pass http://localhost:8080;
proxy_connect_timeout 30s;
}
location ~ (/api/|/doc|/swagger-ui/|/v3/api-docs/) {
proxy_pass http://localhost:8080;
proxy_connect_timeout 150s;
}
location / {
try_files /view/404.html = 404;
}
}
events {

}
http {
server {
listen 80;

# https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration
gzip on;
gzip_types text/css application/javascript application/json;
gzip_min_length 2048;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root app/resources;

if ($request_uri ~ ';') {return 404;}

# proxy_cookie_flags ~ secure samesite=none;

# static
location /static/ {
expires 0m;
proxy_pass http://jiraRush:8080;
proxy_connect_timeout 30s;
access_log off;
}

location /robots.txt {
expires 0m;
proxy_pass http://jiraRush:8080;
proxy_connect_timeout 30s;
access_log off;
}

location ~ (/$|/view/|/ui/|/oauth2/) {
expires 0m;
proxy_pass http://jiraRush:8080;
proxy_connect_timeout 30s;
}

location ~ (/api/|/doc|/swagger-ui/|/v3/api-docs/) {
proxy_pass http://jiraRush:8080;
proxy_connect_timeout 150s;
}

location / {
try_files /view/404.html = 404;
}
}
}
52 changes: 52 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: '3'

services:
jiraRush:
image: jira-rush:latest
extra_hosts:
- "host.docker.internal:host-gateway"
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
ports:
- "8080:8080"
depends_on:
postgres-db:
condition: service_healthy
postgres-db-test:
condition: service_healthy

postgres-db:
image: postgres
environment:
POSTGRES_USER: jira
POSTGRES_PASSWORD: JiraRush
ports:
- "5432:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]

postgres-db-test:
image: postgres
environment:
POSTGRES_USER: jira
POSTGRES_PASSWORD: JiraRush
ports:
- "5433:5432"
volumes:
- ./pgdata-test:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]

nginx:
image: nginx
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf
ports:
- "80:80"
depends_on:
- jiraRush
43 changes: 43 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<mapstruct.version>1.5.3.Final</mapstruct.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jsonwebtoken>0.12.5</jsonwebtoken>
</properties>

<dependencies>
Expand Down Expand Up @@ -142,9 +143,30 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jsonwebtoken}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jsonwebtoken}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jsonwebtoken}</version>
</dependency>
</dependencies>

<build>
<finalName>JiraRush</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -178,6 +200,15 @@
</build>

<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>default</spring.profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
Expand All @@ -195,5 +226,17 @@
</plugins>
</build>
</profile>
<profile>
<id>postgres</id>
<properties>
<spring.profiles.active>postgres</spring.profiles.active>
</properties>
</profile>
<profile>
<id>h2</id>
<properties>
<spring.profiles.active>h2</spring.profiles.active>
</properties>
</profile>
</profiles>
</project>
9 changes: 4 additions & 5 deletions resources/mails/email-confirmation.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>JiraRush - подтверждение почты</title>
<title th:text="#{email.confirmation.title}"></title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
</head>
<body>
<p th:text="'Привет, ' + ${user.firstName} + '.'"/>
<p>Чтобы завершить настройку учетной записи и начать пользоваться JiraRush, подтвердите, что вы правильно указали вашу
электронную почту.</p>
<a th:href="${confirmationUrl}">Подтвердить почту</a>
<p th:text="#{email.confirmation.p1(${user.firstName})}"/>
<p th:text="#{email.confirmation.p2}"></p>
<a th:href="${confirmationUrl}" th:text="#{email.confirmation.a1}"></a>
</body>
</html>
8 changes: 4 additions & 4 deletions resources/mails/password-reset.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head">
<title>JiraRush - установить новый пароль</title>
<title th:text="#{password.reset.title}"></title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
</head>
<body>
<p th:text="'Привет, ' + ${user.firstName} + '.'"/>
<p th:text="'Мы получили запрос на установку нового пароля JiraRush для учетной записи: ' + ${user.email} + '.'"/>
<a th:href="${resetUrl}">Установить пароль</a>
<p th:text="#{password.reset.p1(${user.firstName})}"/>
<p th:text="#{password.reset.p2(${user.email})}"/>
<a th:href="${resetUrl}" th:text="#{password.reset.p3}"></a>
</body>
</html>
12 changes: 0 additions & 12 deletions resources/static/fontawesome/css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -8603,10 +8603,6 @@ readers do not read off random characters that represent icons */
content: "\f3e8";
}

.fa-vk:before {
content: "\f189";
}

.fa-untappd:before {
content: "\f405";
}
Expand Down Expand Up @@ -9955,10 +9951,6 @@ readers do not read off random characters that represent icons */
content: "\f3bc";
}

.fa-yandex:before {
content: "\f413";
}

.fa-readme:before {
content: "\f4d5";
}
Expand Down Expand Up @@ -10183,10 +10175,6 @@ readers do not read off random characters that represent icons */
content: "\f7c6";
}

.fa-yandex-international:before {
content: "\f414";
}

.fa-cc-amex:before {
content: "\f1f3";
}
Expand Down
Loading