Skip to content
Open

Dev #61

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
13 changes: 13 additions & 0 deletions .env-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DATASOURCE_URL=jdbc:postgresql://localhost:5433/jira
DATASOURCE_USERNAME=jira
DATASOURCE_PASSWORD=JiraRush
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME=jira4jr@gmail.com
MAIL_PASSWORD=zdfzsrqvgimldzyj
MAIL_PORT=587
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
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM maven:3.9.6-amazoncorretto-17-debian
LABEL maintainer="Timofej"
LABEL description="JiraRush application"
LABEL version="1.0"
WORKDIR /opt/jirarush
COPY pom.xml .
COPY src ./src
COPY resources ./resources
COPY lombok.config ./lombok.config
COPY config/_application-prod.yaml ./src/main/resources/application-prod.yaml
RUN mvn clean install -DskipTests
RUN mv ./target/*.jar ./jirarush.jar
RUN rm -rf ./target
RUN rm -rf ./src
RUN rm lombok.config
RUN rm pom.xml
EXPOSE 8080
ENTRYPOINT [ "java", "-Dspring.profiles.active=prod", "-jar", "jirarush.jar" ]
186 changes: 186 additions & 0 deletions JiraApi.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"info": {
"_postman_id": "74e5f89d-f7f2-4559-b01a-44696cef0cd2",
"name": "JiraApi",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "29978865"
},
"item": [
{
"name": "postTags",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "admin",
"type": "string"
},
{
"key": "username",
"value": "admin@gmail.com",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "[\"baz\", \"qux\"]",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8080/api/tasks/1/tags",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"api",
"tasks",
"1",
"tags"
]
}
},
"response": []
},
{
"name": "getTags",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "admin",
"type": "string"
},
{
"key": "username",
"value": "admin@gmail.com",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8080/api/tasks/1/tags",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"api",
"tasks",
"1",
"tags"
]
}
},
"response": []
},
{
"name": "clearTags",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "admin",
"type": "string"
},
{
"key": "username",
"value": "admin@gmail.com",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8080/api/tasks/1/tags",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"api",
"tasks",
"1",
"tags"
]
}
},
"response": []
}
],
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "admin",
"type": "string"
},
{
"key": "username",
"value": "admin@gmail.com",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,31 @@

- https://habr.com/ru/articles/259055/

‼️Програма запускається черрез файл docker-compose.yml, або через команду docker compose up‼️


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

1.Розібратися зі структурою проєкту (onboarding)✅

2.Видалити соціальні мережі: vk, yandex✅

3.Винести чутливу інформацію до окремого проперті файлу✅

4.Переробити тести так, щоб під час тестів використовувалася in memory БД (H2), а не PostgreSQL✅

5.Написати тести для всіх публічних методів контролера ProfileRestController✅

6.Зробити рефакторинг методу com.javarush.jira.bugtracking.attachment.FileUtil#upload✅

7.Додати новий функціонал: додавання тегів до завдання (REST API + реалізація на сервісі)✅

8.Додати підрахунок часу: скільки завдання перебувало у роботі та тестуванні❌

9.Написати Dockerfile для основного сервера✅

10.Написати docker-compose файл для запуску контейнера сервера разом з БД та nginx✅

11.Додати локалізацію мінімум двома мовами❌

12.Переробити механізм розпізнавання «свій-чужий» між фронтом і беком з JSESSIONID на JWT❌
2 changes: 1 addition & 1 deletion config/_application-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ app:
host-url: http://localhost
spring:
datasource:
url: jdbc:postgresql://localhost:5432/jira
url: jdbc:postgresql://jirarush-db:5432/jira
username: jira
password: JiraRush

104 changes: 64 additions & 40 deletions config/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,40 +1,64 @@
# 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 {
worker_connections 1024;
}

http {
include mime.types;
sendfile on;

server {
listen 8080;
location / {
return 301 http://localhost$request_uri;
}
}

server {
listen 80;
listen [::]:80;

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;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;

root /opt/jirarush/resources;

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

location /static/ {
expires 30d;
access_log off;
}

location /robots.txt {
access_log off;
}

location ~ (/$|/view/|/ui/|/oauth2/|/backlog) {
expires 0m;
proxy_connect_timeout 30s;
proxy_read_timeout 30s;
proxy_pass http://jirarush-app:8080;

location ~ /oauth2/authorization/ {
proxy_set_header Host $host:$proxy_port;
proxy_pass http://jirarush-app:8080;
}
}

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

location / {
try_files /view/404.html =404;
}
}
}
Loading