issue-47 #60

Merged
sebastian merged 13 commits from issue-47 into master 2023-11-13 18:54:08 +01:00
18 changed files with 65 additions and 63 deletions
Showing only changes of commit 157126d404 - Show all commits

View File

@ -5,9 +5,17 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix wrong date"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix wrong date">
<change afterPath="$PROJECT_DIR$/../frontend/nginx.conf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../frontend/proxy.conf.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/AdvancedTaskSchedule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/AdvancedTaskSchedule.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../docker-compose.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/Dockerfile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/angular.json" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/angular.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/nginx/nginx.conf.template" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/nginx/run_nginx.sh" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -26,7 +34,7 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY"> <option name="RECENT_BRANCH_BY_REPOSITORY">
<map> <map>
<entry key="$PROJECT_DIR$/.." value="test-failing" /> <entry key="$PROJECT_DIR$/.." value="master" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
@ -34,6 +42,9 @@
<component name="JpbToolWindowState"> <component name="JpbToolWindowState">
<option name="isToolWindowVisible" value="false" /> <option name="isToolWindowVisible" value="false" />
</component> </component>
<component name="MavenRunner">
<option name="skipTests" value="true" />
</component>
<component name="ProjectColorInfo">{ <component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;, &quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 6 &quot;associatedIndex&quot;: 6

View File

@ -31,7 +31,7 @@ spring.jpa.open-in-view=false
spring.data.rest.base-path=/api spring.data.rest.base-path=/api
# Spring Server setup # Spring Server setup
server.address=127.0.0.1 server.address=0.0.0.0
server.port=8080 server.port=8080
server.compression.enabled=true server.compression.enabled=true
server.http2.enabled=true server.http2.enabled=true
@ -42,3 +42,4 @@ spring.servlet.multipart.max-request-size=4196KB
demo.webapp.jwtSecret=demoWebappSecretKey demo.webapp.jwtSecret=demoWebappSecretKey
demo.webapp.jwtExpirationMS=86400000 demo.webapp.jwtExpirationMS=86400000
spring.jackson.time-zone=UTC spring.jackson.time-zone=UTC
server.servlet.session.cookie.samesite=None

View File

@ -4,7 +4,7 @@ services:
db: db:
image: mariadb:latest image: mariadb:latest
container_name: template_mysql container_name: timemanager-db
environment: environment:
MYSQL_ROOT_PASSWORD: edkvcjReDxJ9Z8hq MYSQL_ROOT_PASSWORD: edkvcjReDxJ9Z8hq
backend: backend:
@ -14,12 +14,15 @@ services:
links: links:
- "db:app_db" - "db:app_db"
environment: environment:
SERVER_ADDRESS: 0.0.0.0
SPRING_DATASOURCE_USERNAME: root SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: edkvcjReDxJ9Z8hq SPRING_DATASOURCE_PASSWORD: edkvcjReDxJ9Z8hq
SPRING_DATASOURCE_URL: jdbc:mariadb://app_db:3306/restservice?createDatabaseIfNotExist=true&autoReconnect=true SPRING_DATASOURCE_URL: jdbc:mariadb://app_db:3306/restservice?createDatabaseIfNotExist=true&autoReconnect=true
depends_on: depends_on:
- "db" - "db"
restart: always restart: always
ports:
- "8080:8080"
frontend: frontend:
build: build:
context: ./frontend context: ./frontend
@ -27,6 +30,8 @@ services:
restart: always restart: always
links: links:
- backend:backend - backend:backend
depends_on:
- "backend"
ports: ports:
- "4200:80" - "4200:80"
environment: environment:

View File

@ -1,29 +1,18 @@
FROM node:16-alpine as builder ### STAGE 1: Build ###
FROM node:18.17.1 AS build
WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install
RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app
WORKDIR /ng-app
COPY . . COPY . .
RUN npm run build --prod
RUN $(npm bin)/ng build --configuration=production --build-optimizer ### STAGE 2: Deploy ###
FROM nginx:latest
RUN apt-get update
FROM nginx:stable-alpine RUN apt-get upgrade -y
RUN apt-get install iputils-ping -y
COPY --from=build /app/dist/frontend /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
COPY nginx/nginx.conf.template /
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /ng-app/dist/frontend/ /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html/
COPY nginx/run_nginx.sh /
CMD ["sh", "/run_nginx.sh"]

View File

@ -38,8 +38,8 @@
"budgets": [ "budgets": [
{ {
"type": "initial", "type": "initial",
"maximumWarning": "500kb", "maximumWarning": "2mb",
"maximumError": "1mb" "maximumError": "5mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",

View File

@ -1,7 +1,6 @@
user nginx; user nginx;
worker_processes 1; worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
@ -14,12 +13,6 @@ http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
log_format main '${DOLLAR}remote_addr - ${DOLLAR}remote_user [${DOLLAR}time_local] "${DOLLAR}request" '
'${DOLLAR}status ${DOLLAR}body_bytes_sent "${DOLLAR}http_referer" '
'"${DOLLAR}http_user_agent" "${DOLLAR}http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on; sendfile on;
#tcp_nopush on; #tcp_nopush on;
@ -40,12 +33,17 @@ http {
add_header "Access-Control-Allow-Methods" 'GET, POST, OPTIONS, PUT, DELETE'; add_header "Access-Control-Allow-Methods" 'GET, POST, OPTIONS, PUT, DELETE';
add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin'; add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin';
location / { location /api {
try_files ${DOLLAR}uri ${DOLLAR}uri/ /index.html; proxy_pass http://backend/;
add_header "Access-Control-Allow-Origin" "*";
add_header "Access-Control-Allow-Methods" 'GET, POST, OPTIONS, PUT, DELETE';
add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin';
} }
location /api { location / {
proxy_pass ${BACKEND_URL}; try_files $uri $uri/ /index.html =404;
} }
} }
} }

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
# generate nginx-configuration (insert env variables)
export DOLLAR='$'
envsubst < ./nginx.conf.template > /etc/nginx/nginx.conf
# start nginx
exec nginx -g "daemon off;"

6
frontend/proxy.conf.json Normal file
View File

@ -0,0 +1,6 @@
{
"/api": {
"target": "http://backend",
"secure": false
}
}

View File

@ -35,7 +35,7 @@ import { Configuration } from '../configurat
}) })
export class AccountService { export class AccountService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -31,7 +31,7 @@ import { Configuration } from '../configurat
}) })
export class HistoryService { export class HistoryService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -36,7 +36,7 @@ import { Configuration } from '../configurat
}) })
export class LoginService { export class LoginService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -34,7 +34,7 @@ import { Configuration } from '../configurat
}) })
export class PropertiesService { export class PropertiesService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -36,7 +36,7 @@ import { Configuration } from '../configurat
}) })
export class ScheduleService { export class ScheduleService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -35,7 +35,7 @@ import { Configuration } from '../configurat
}) })
export class TaskService { export class TaskService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -36,7 +36,7 @@ import { Configuration } from '../configurat
}) })
export class TaskgroupService { export class TaskgroupService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -34,7 +34,7 @@ import { Configuration } from '../configurat
}) })
export class UsersService { export class UsersService {
protected basePath = 'http://localhost:8080/api'; protected basePath = 'http://127.0.0.1:8080/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
public encoder: HttpParameterCodec; public encoder: HttpParameterCodec;

View File

@ -1,3 +1,4 @@
export const environment = { export const environment = {
production: true production: true,
api: "/api"
}; };

View File

@ -3,7 +3,7 @@ info:
title: API Title title: API Title
version: '1.0' version: '1.0'
servers: servers:
- url: http://localhost:8080/api - url: http://127.0.0.1:8080/api
paths: paths:
/auth/signin: /auth/signin:
post: post: