From 213b670f6833888b89d9895ebf91955b7d0eca90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 21 Jul 2022 11:04:19 +0200 Subject: [PATCH 1/7] Provide volume for backend log-files in Docker, move the ones of nginx from dev Docker Compose to main --- docker-compose.override.yml | 7 ++++--- docker-compose.yml | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3d63da9e3..57810ac6f 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -89,9 +89,10 @@ services: ######################################################### ## NGINX ################################################ ######################################################### - nginx: - volumes: - - ./logs/nginx:/var/log/nginx + # moved to 'docker-compose.yml' + # nginx: + # volumes: + # - ./logs/nginx:/var/log/nginx ######################################################### ## PHPMYADMIN ########################################### diff --git a/docker-compose.yml b/docker-compose.yml index 213b200cd..4de589e9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -103,6 +103,9 @@ services: # Application only envs #env_file: # - ./frontend/.env + volumes: + # : – mirror bidirectional path in local context with path in Docker container + - ./logs:/app/logs ######################################################## # DATABASE ############################################# @@ -144,6 +147,8 @@ services: - admin ports: - 80:80 + volumes: + - ./logs/nginx:/var/log/nginx networks: external-net: From 08d6cf77eb6e86d73fbe85d3c32d658820c50276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 21 Jul 2022 11:21:49 +0200 Subject: [PATCH 2/7] Provide volume for mariadb log-files in Docker --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4de589e9a..ec5a617d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,6 +72,7 @@ services: - 3306:3306 volumes: - db_vol:/var/lib/mysql + - ./logs/mariadb:/var/log ######################################################## # BACKEND ############################################## From 3e3770e5a95871fcacbfa6ef006a75b665e40d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 21 Jul 2022 13:33:10 +0200 Subject: [PATCH 3/7] Provide volume for database log-file in Docker --- docker-compose.yml | 3 +++ logs/.gitignore | 5 ++++- logs/database/typeorm.backend.log | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 logs/database/typeorm.backend.log diff --git a/docker-compose.yml b/docker-compose.yml index ec5a617d6..715661acc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -132,6 +132,9 @@ services: # Application only envs #env_file: # - ./frontend/.env + volumes: + # : – mirror bidirectional path in local context with path in Docker container + - ./logs/database/typeorm.backend.log:/app/typeorm.backend.log ######################################################### ## NGINX ################################################ diff --git a/logs/.gitignore b/logs/.gitignore index c96a04f00..578c6e2a3 100644 --- a/logs/.gitignore +++ b/logs/.gitignore @@ -1,2 +1,5 @@ * -!.gitignore \ No newline at end of file +!.gitignore +!database +database/* +!database/typeorm.backend.log diff --git a/logs/database/typeorm.backend.log b/logs/database/typeorm.backend.log new file mode 100644 index 000000000..7e1d1060e --- /dev/null +++ b/logs/database/typeorm.backend.log @@ -0,0 +1,3 @@ +# This has to be exitst in git! +# If not then the mirroring with Docker Compose volumes will fail and a folder will be created with this name instead. +# But then the type of folder and the type file of the file to mirror will lead to a type error. \ No newline at end of file From 7ead21ca695cb8322e27641556b4763de26350c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 21 Jul 2022 13:42:48 +0200 Subject: [PATCH 4/7] Add a comment for volume mount in Docker Compose database app --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index f20169da4..5901218f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -139,6 +139,7 @@ services: # - ./frontend/.env volumes: # : – mirror bidirectional path in local context with path in Docker container + # !!! this file has to exist !!! otherwise a folder is created at this path and we get a type error, because it's not a file - ./logs/database/typeorm.backend.log:/app/typeorm.backend.log ######################################################### From 5ee5aa0ab5b9065caa9576d6b7a7a956cec625b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 21 Jul 2022 15:20:02 +0200 Subject: [PATCH 5/7] Remove the volumes we don't need and some comments --- docker-compose.override.yml | 3 --- docker-compose.yml | 5 ----- logs/.gitignore | 5 +---- logs/database/typeorm.backend.log | 3 --- 4 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 logs/database/typeorm.backend.log diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 65644d039..2af3c41ee 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -94,10 +94,7 @@ services: ######################################################### ## NGINX ################################################ ######################################################### - # moved to 'docker-compose.yml' # nginx: - # volumes: - # - ./logs/nginx:/var/log/nginx ######################################################### ## PHPMYADMIN ########################################### diff --git a/docker-compose.yml b/docker-compose.yml index 5901218f5..b26e9f558 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -75,7 +75,6 @@ services: - 3306:3306 volumes: - db_vol:/var/lib/mysql - - ./logs/mariadb:/var/log ######################################################## # BACKEND ############################################## @@ -137,10 +136,6 @@ services: # Application only envs #env_file: # - ./frontend/.env - volumes: - # : – mirror bidirectional path in local context with path in Docker container - # !!! this file has to exist !!! otherwise a folder is created at this path and we get a type error, because it's not a file - - ./logs/database/typeorm.backend.log:/app/typeorm.backend.log ######################################################### ## NGINX ################################################ diff --git a/logs/.gitignore b/logs/.gitignore index 578c6e2a3..c96a04f00 100644 --- a/logs/.gitignore +++ b/logs/.gitignore @@ -1,5 +1,2 @@ * -!.gitignore -!database -database/* -!database/typeorm.backend.log +!.gitignore \ No newline at end of file diff --git a/logs/database/typeorm.backend.log b/logs/database/typeorm.backend.log deleted file mode 100644 index 7e1d1060e..000000000 --- a/logs/database/typeorm.backend.log +++ /dev/null @@ -1,3 +0,0 @@ -# This has to be exitst in git! -# If not then the mirroring with Docker Compose volumes will fail and a folder will be created with this name instead. -# But then the type of folder and the type file of the file to mirror will lead to a type error. \ No newline at end of file From bf407584fe753dcc04762fc2c0b42f58524c2a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Fri, 22 Jul 2022 06:37:59 +0200 Subject: [PATCH 6/7] Fix backend volume for logs in docker-compose file --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b26e9f558..5f0ab4dde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,7 +109,7 @@ services: # - ./frontend/.env volumes: # : – mirror bidirectional path in local context with path in Docker container - - ./logs:/app/logs + - ./logs/backend:/logs/backend ######################################################## # DATABASE ############################################# From af9d874fea27cdb1e69bf83a9b635686d6a7f53a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 25 Jul 2022 13:29:45 +0200 Subject: [PATCH 7/7] fix: Update contribution_date when Moved by Seed --- backend/src/seeds/factory/creation.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/seeds/factory/creation.ts b/backend/src/seeds/factory/creation.ts index 75a765fae..d3f0f78ca 100644 --- a/backend/src/seeds/factory/creation.ts +++ b/backend/src/seeds/factory/creation.ts @@ -35,12 +35,17 @@ export const creationFactory = async ( if (creation.confirmed) { await mutate({ mutation: confirmContribution, variables: { id: pendingCreation.id } }) + const confirmedCreation = await Contribution.findOneOrFail({ id: pendingCreation.id }) + if (creation.moveCreationDate) { const transaction = await Transaction.findOneOrFail({ where: { userId: user.id, creationDate: new Date(creation.creationDate) }, order: { balanceDate: 'DESC' }, }) if (transaction.decay.equals(0) && transaction.creationDate) { + confirmedCreation.contributionDate = new Date( + nMonthsBefore(transaction.creationDate, creation.moveCreationDate), + ) transaction.creationDate = new Date( nMonthsBefore(transaction.creationDate, creation.moveCreationDate), ) @@ -48,6 +53,7 @@ export const creationFactory = async ( nMonthsBefore(transaction.balanceDate, creation.moveCreationDate), ) await transaction.save() + await confirmedCreation.save() } } } else {