From 181138d21db0f9fcaa76105a85ece316c66be5bd Mon Sep 17 00:00:00 2001 From: powerzenbob Date: Tue, 30 Nov 2021 15:22:22 +0100 Subject: [PATCH 001/326] onboarding process setup --- docu/onboarding_process.odt | Bin 0 -> 2952 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docu/onboarding_process.odt diff --git a/docu/onboarding_process.odt b/docu/onboarding_process.odt new file mode 100644 index 0000000000000000000000000000000000000000..bd25a7c2e3dee7352c6878fc6ebc510963dd0820 GIT binary patch literal 2952 zcmZ`*c{CJi8=n!vkij%WiI6Q!t_mqxqsdZ4W4RfOkeRWJ>@;>#L>bvamP(R6%g8dB ztYI*eZ9>+ujiy5SM&JET_jd00yyrdd^T+dh&Uv5ndw=iG9KMGg0@w|kz)*`n+f;dF zS^4hfVr{e=8ifn+L?JyrJ=~m-I5#Xts@PN zOavS(a;($y(Jg}VN%s$}luk&>eDH2CO=DKR`Q#9ji51U$h?U-Cj#(gbN?=y*zEpTh zC_ncbH3BQ$+FIk+nkQ!b@GK_4+eryGtO&XqU6tOech1?4Af$+kgNEH|RsB5>rKl{8 zlavSMdrJ_)XF!eVhZdOzm4N`isw{u+vJUZ}Lb&i+_MTV8-F#zj6oQUPR~0u7ly#U@ zH^KQ3DvAr!6>`};Pfz+0t9%9%lEyHErFH#`{l-NUdG3Cvrlr_ocMEpNb$v+7=?ZC+ z%ic|?Eq%jZwW`IEpLIsT`kv70a$4{lj&rlPo z>B&5j*%yB3j~AV#GJKx$Kz69@L?OBDOWaFqh-!aqqC;nC`p)dmlx#Ir<_vyj(c#zw zU(0V@l~Qz%yFL7RKHL?8D)K^UAgkeTXv!iPJ@7oFdpR&H-cd2r8O&4p8EDzzIPu`# zH>Fw^;#g4?r8hE}=CCt&GB~?7*eHm;Ir$_n`UP*v&|aX&*QbY}ulhFG&(995jyJDf z;CDn!|n=#@ncVbI*$ti0RJUl+=gIr8zw7jVGjQlU*budbenIKmJW zfe7DlFyArJx-70TUe>TOUUkkfZl3o_HL_pKvDUwV2!%@?Z0K`ZCAF-ueJ7D|sb8tV zo5hSE`+K)eEk-Uz481*GQ$0r?(Vxyp`-em|Py2B++7 z3i%S%G>m%px*EsGIknip4ir(j&{C0$j+_N8b1GNMbg2gs$VtrSYaZV_YPBbMylqsH z1d#Er73WWNaV?N^*zkLr4<^I&)iRynD4OkYRbVT7vqhJBCB zZ~;jD!e^NZs>e4oOS_xCxxBsRrZnn?#49NZ6~fDV1NB}>d`Q^FJQotd)Obe3gq;OE zyFy@d>BWsC``SsH3R;%~vP#Eln@`;N=%BF>H zM;fHAKTfjyCgZ=u@lW;JG0v-e&ISPJa{~Z8EcNrj1$dx*cEzv2suS}825$JG$UBCz zF$PJ8(?=T_h{UDn$BVb*0v=DR)^@j9VGG$9*0dFblX_T$?-A@0e&{GPTZ@3Vrna z0?6pVK)Pl?^T&K=Mk8Ed7H4Wi^<7-{;wzLMVKDyS9*Kixc-Eaz$WfQl<(}wD_Q<*? zU<*1=SZ55UU8W4}MMB|vhlq7of{qDeNo5UEe8o=?4Prp8*W>3Kw*wCc*x6cGkJYBg zuE)2p&VHr_2wx;t639LIj)n_woS1X3!~sX2HRgon;Fnun7+D(=0(D!E@dNXbag$3H z>W|}1;`Kt{Y9ti9z*F_j6DC#>QC%K4v;!@Hb7mZahDE@GS1zp8ff+EHo8k`d*!zo-e#lpUf zX&|rg(GonU3N9jNP-U>SwbJ$!znrIG=*XtNQV-VjHRrJo5Y8)!C>1611$_&Byp$=L zJxXkoY=%@p=V>7%&>zZetMkS=@|Y+&5civGcQOo*4MMgi*>oG}#-Pr$1hI>+g8+2TV2S^P1C-$xnmvCOT&-NGQ?Bl z8?8g`cRq1(T1~!)yA()qy5D|5w6|1oJw3IeZ{24(^T(4B`2robixg7PUejETOIP-H zQTC&kqQu&IyDgo7r@QtEunWH|*Pw;zp_rP20`>{2jgi^(e#{jAf( zz*0xa*wj!3jl{UQpnQJ1oRWKG?yRvyf6_nq?v&n@zNclV|Y{E}=X3=7HSRlqVLS+&^u}7~oqHM>!sWG5O9BKbzz5dy_+TnVo z#rri%hRL0HI@7FFMU3+y*f+5eV_SSLh9;puXt{)Lm#GGS@N;-+=cUIfxSjqmdVQ_v zn8U#aUWNB^#0A)eepP7#ci>WQ%61lkAvzPE)m-A6Rxk;(KX$9_Swf*W$UJ1_xz&Af zor6T$gmUQ9$w=97AHUO@gwOG3L12j;nGEA2Cflb>_L@~-_l+itxp|9V@6wY7*t*{g znx$SdhXdIlfdB6)SaA*gW$9 literal 0 HcmV?d00001 From 5959146073c18c3e6d59a9b8a106242f8265fb10 Mon Sep 17 00:00:00 2001 From: powerzenbob Date: Tue, 30 Nov 2021 19:20:15 +0100 Subject: [PATCH 002/326] file format changed to md --- docu/onboarding_process.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docu/onboarding_process.md diff --git a/docu/onboarding_process.md b/docu/onboarding_process.md new file mode 100644 index 000000000..767dd54e1 --- /dev/null +++ b/docu/onboarding_process.md @@ -0,0 +1,25 @@ +# Onboarding process +## Meeting with Bernd (zoom) +## Meeting with Claus-Peter and perhaps concerning team member (zoom) +## Presentation to all team members (discord) +## Grant access to +- Nextcloud server +- Add to github repository (create github account if not available) +## Start working +- install docker desktop +- install git: https://git-scm.com/book/de/v2/Erste-Schritte-Git-installieren +- add new ssh key: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account +- download gradido repository: git clone git@github.com:gradido/gradido.git --recursive +- install visual studio code +- docker-compose build +- docker-compose up +http://localhost/vue should be same as https://gdd1.gradido.com/vue + +##git basics to update this document +- git status +- git branch onboarding_process +- git checkout onboarding_process +- git add onboarding_process.md +- git commit +- git push +- git push --set-upstream origin onboarding_process From 9ca497255d7df0c6b09b1b16be5ed9c807d4d0e5 Mon Sep 17 00:00:00 2001 From: powerzenbob Date: Tue, 30 Nov 2021 19:39:01 +0100 Subject: [PATCH 003/326] udate --- docu/onboarding_process.md | 2 +- docu/onboarding_process.odt | Bin 2952 -> 0 bytes 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 docu/onboarding_process.odt diff --git a/docu/onboarding_process.md b/docu/onboarding_process.md index 767dd54e1..8b748a33f 100644 --- a/docu/onboarding_process.md +++ b/docu/onboarding_process.md @@ -15,7 +15,7 @@ - docker-compose up http://localhost/vue should be same as https://gdd1.gradido.com/vue -##git basics to update this document +## git basics to update this document - git status - git branch onboarding_process - git checkout onboarding_process diff --git a/docu/onboarding_process.odt b/docu/onboarding_process.odt deleted file mode 100644 index bd25a7c2e3dee7352c6878fc6ebc510963dd0820..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2952 zcmZ`*c{CJi8=n!vkij%WiI6Q!t_mqxqsdZ4W4RfOkeRWJ>@;>#L>bvamP(R6%g8dB ztYI*eZ9>+ujiy5SM&JET_jd00yyrdd^T+dh&Uv5ndw=iG9KMGg0@w|kz)*`n+f;dF zS^4hfVr{e=8ifn+L?JyrJ=~m-I5#Xts@PN zOavS(a;($y(Jg}VN%s$}luk&>eDH2CO=DKR`Q#9ji51U$h?U-Cj#(gbN?=y*zEpTh zC_ncbH3BQ$+FIk+nkQ!b@GK_4+eryGtO&XqU6tOech1?4Af$+kgNEH|RsB5>rKl{8 zlavSMdrJ_)XF!eVhZdOzm4N`isw{u+vJUZ}Lb&i+_MTV8-F#zj6oQUPR~0u7ly#U@ zH^KQ3DvAr!6>`};Pfz+0t9%9%lEyHErFH#`{l-NUdG3Cvrlr_ocMEpNb$v+7=?ZC+ z%ic|?Eq%jZwW`IEpLIsT`kv70a$4{lj&rlPo z>B&5j*%yB3j~AV#GJKx$Kz69@L?OBDOWaFqh-!aqqC;nC`p)dmlx#Ir<_vyj(c#zw zU(0V@l~Qz%yFL7RKHL?8D)K^UAgkeTXv!iPJ@7oFdpR&H-cd2r8O&4p8EDzzIPu`# zH>Fw^;#g4?r8hE}=CCt&GB~?7*eHm;Ir$_n`UP*v&|aX&*QbY}ulhFG&(995jyJDf z;CDn!|n=#@ncVbI*$ti0RJUl+=gIr8zw7jVGjQlU*budbenIKmJW zfe7DlFyArJx-70TUe>TOUUkkfZl3o_HL_pKvDUwV2!%@?Z0K`ZCAF-ueJ7D|sb8tV zo5hSE`+K)eEk-Uz481*GQ$0r?(Vxyp`-em|Py2B++7 z3i%S%G>m%px*EsGIknip4ir(j&{C0$j+_N8b1GNMbg2gs$VtrSYaZV_YPBbMylqsH z1d#Er73WWNaV?N^*zkLr4<^I&)iRynD4OkYRbVT7vqhJBCB zZ~;jD!e^NZs>e4oOS_xCxxBsRrZnn?#49NZ6~fDV1NB}>d`Q^FJQotd)Obe3gq;OE zyFy@d>BWsC``SsH3R;%~vP#Eln@`;N=%BF>H zM;fHAKTfjyCgZ=u@lW;JG0v-e&ISPJa{~Z8EcNrj1$dx*cEzv2suS}825$JG$UBCz zF$PJ8(?=T_h{UDn$BVb*0v=DR)^@j9VGG$9*0dFblX_T$?-A@0e&{GPTZ@3Vrna z0?6pVK)Pl?^T&K=Mk8Ed7H4Wi^<7-{;wzLMVKDyS9*Kixc-Eaz$WfQl<(}wD_Q<*? zU<*1=SZ55UU8W4}MMB|vhlq7of{qDeNo5UEe8o=?4Prp8*W>3Kw*wCc*x6cGkJYBg zuE)2p&VHr_2wx;t639LIj)n_woS1X3!~sX2HRgon;Fnun7+D(=0(D!E@dNXbag$3H z>W|}1;`Kt{Y9ti9z*F_j6DC#>QC%K4v;!@Hb7mZahDE@GS1zp8ff+EHo8k`d*!zo-e#lpUf zX&|rg(GonU3N9jNP-U>SwbJ$!znrIG=*XtNQV-VjHRrJo5Y8)!C>1611$_&Byp$=L zJxXkoY=%@p=V>7%&>zZetMkS=@|Y+&5civGcQOo*4MMgi*>oG}#-Pr$1hI>+g8+2TV2S^P1C-$xnmvCOT&-NGQ?Bl z8?8g`cRq1(T1~!)yA()qy5D|5w6|1oJw3IeZ{24(^T(4B`2robixg7PUejETOIP-H zQTC&kqQu&IyDgo7r@QtEunWH|*Pw;zp_rP20`>{2jgi^(e#{jAf( zz*0xa*wj!3jl{UQpnQJ1oRWKG?yRvyf6_nq?v&n@zNclV|Y{E}=X3=7HSRlqVLS+&^u}7~oqHM>!sWG5O9BKbzz5dy_+TnVo z#rri%hRL0HI@7FFMU3+y*f+5eV_SSLh9;puXt{)Lm#GGS@N;-+=cUIfxSjqmdVQ_v zn8U#aUWNB^#0A)eepP7#ci>WQ%61lkAvzPE)m-A6Rxk;(KX$9_Swf*W$UJ1_xz&Af zor6T$gmUQ9$w=97AHUO@gwOG3L12j;nGEA2Cflb>_L@~-_l+itxp|9V@6wY7*t*{g znx$SdhXdIlfdB6)SaA*gW$9 From 9237f139f28aecb6a30de1a20d5d4cef74daae89 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 9 Dec 2021 11:13:07 +0100 Subject: [PATCH 004/326] Error in UpdatePendingCreationArgs changed export name, Added an InputType over the ArgsType for the CreatePendingCreationArgs, added a createPendingCreations mutation that creates multiple PendingCreation. --- .../graphql/arg/CreatePendingCreationArgs.ts | 3 +- .../graphql/arg/UpdatePendingCreationArgs.ts | 2 +- backend/src/graphql/resolver/AdminResolver.ts | 29 +++++++++---------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/backend/src/graphql/arg/CreatePendingCreationArgs.ts b/backend/src/graphql/arg/CreatePendingCreationArgs.ts index d2c17abf1..06a5369ac 100644 --- a/backend/src/graphql/arg/CreatePendingCreationArgs.ts +++ b/backend/src/graphql/arg/CreatePendingCreationArgs.ts @@ -1,5 +1,6 @@ -import { ArgsType, Field, Int } from 'type-graphql' +import { ArgsType, Field, InputType, Int } from 'type-graphql' +@InputType() @ArgsType() export default class CreatePendingCreationArgs { @Field(() => String) diff --git a/backend/src/graphql/arg/UpdatePendingCreationArgs.ts b/backend/src/graphql/arg/UpdatePendingCreationArgs.ts index bde7133aa..471519956 100644 --- a/backend/src/graphql/arg/UpdatePendingCreationArgs.ts +++ b/backend/src/graphql/arg/UpdatePendingCreationArgs.ts @@ -1,7 +1,7 @@ import { ArgsType, Field, Int } from 'type-graphql' @ArgsType() -export default class CreatePendingCreationArgs { +export default class UpdatePendingCreationArgs { @Field(() => Int) id: number diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 3c03227d5..43ca19aea 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -62,6 +62,19 @@ export class AdminResolver { return await getUserCreations(user.id) } + // @Authorized([RIGHTS.SEARCH_USERS]) + @Mutation(() => Boolean) + async createPendingCreations( + @Arg('pendingCreations', () => [CreatePendingCreationArgs]) + pendingCreations: CreatePendingCreationArgs[], + ): Promise { + pendingCreations.forEach((pendingCreation) => { + console.log('pendingCreation', pendingCreation) + this.createPendingCreation(pendingCreation) + }) + return true + } + // @Authorized([RIGHTS.SEARCH_USERS]) @Mutation(() => UpdatePendingCreation) async updatePendingCreation( @@ -90,22 +103,6 @@ export class AdminResolver { result.creation = await getUserCreations(user.id) return result - - // const creations = await getUserCreations(user.id) - // const creationDateObj = new Date(creationDate) - // if (isCreationValid(creations, amount, creationDateObj)) { - // const pendingCreationRepository = getCustomRepository(PendingCreationRepository) - // const loginPendingTaskAdmin = pendingCreationRepository.create() - // loginPendingTaskAdmin.userId = user.id - // loginPendingTaskAdmin.amount = BigInt(amount * 10000) - // loginPendingTaskAdmin.created = new Date() - // loginPendingTaskAdmin.date = creationDateObj - // loginPendingTaskAdmin.memo = memo - // loginPendingTaskAdmin.moderator = moderator - // - // pendingCreationRepository.save(loginPendingTaskAdmin) - // } - // return await getUserCreations(user.id) } @Query(() => [PendingCreation]) From 5ca221a0c09f05470083795dc034c73611f3dbc0 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 9 Dec 2021 11:53:21 +0100 Subject: [PATCH 005/326] Added the new mutation to the admin, Implemented the send massCreation in admin, changed the log entries for not created pendingcreation. --- admin/src/components/CreationFormular.vue | 49 ++++++++++++++----- admin/src/graphql/createPendingCreations.js | 7 +++ backend/src/graphql/resolver/AdminResolver.ts | 5 +- 3 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 admin/src/graphql/createPendingCreations.js diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index d73ea3c81..d84056f18 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -122,6 +122,7 @@ - + From 9d29c00ebbade58d71c0fd1a029a0b6f6c130322 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 13 Jan 2022 08:58:26 +0100 Subject: [PATCH 246/326] Remove route from apolloProvider.test and changed the test that checks the redirect on wallet login. --- admin/src/plugins/apolloProvider.test.js | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/admin/src/plugins/apolloProvider.test.js b/admin/src/plugins/apolloProvider.test.js index ab8b01f28..637efd1be 100644 --- a/admin/src/plugins/apolloProvider.test.js +++ b/admin/src/plugins/apolloProvider.test.js @@ -4,12 +4,10 @@ import CONFIG from '../config' import VueApollo from 'vue-apollo' import store from '../store/store' -import router from '../router/router' import i18n from '../i18n' jest.mock('vue-apollo') jest.mock('../store/store') -jest.mock('../router/router') jest.mock('../i18n') jest.mock('apollo-boost', () => { @@ -59,13 +57,6 @@ describe('apolloProvider', () => { errors: [{ message: '403.13 - Client certificate revoked' }], } - // mock router - const routerPushMock = jest.fn() - router.push = routerPushMock - router.currentRoute = { - path: '/overview', - } - const windowLocationMock = jest.fn() delete window.location window.location = { @@ -133,16 +124,8 @@ describe('apolloProvider', () => { expect(storeDispatchMock).toBeCalledWith('logout', null) }) - describe('current route is not logout', () => { - it('redirects to logout', () => { - expect(windowLocationMock).toBeCalledWith('http://localhost/vue/login') - }) - }) - - describe('current route is logout', () => { - it('does not redirect to logout', () => { - expect(windowLocationMock).toBeCalledWith('http://localhost/vue/login') - }) + it('redirects to logout', () => { + expect(windowLocationMock).toBeCalledWith('http://localhost/vue/login') }) }) From b513ea7906363c53c33dae7169b5120b92efaea2 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 09:30:27 +0100 Subject: [PATCH 247/326] set timezone to UTC for unti tests --- backend/jest.config.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/backend/jest.config.js b/backend/jest.config.js index 9d99c68f6..981475807 100644 --- a/backend/jest.config.js +++ b/backend/jest.config.js @@ -1,15 +1,18 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ -module.exports = { - verbose: true, - preset: 'ts-jest', - collectCoverage: true, - collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**'], - moduleNameMapper: { - '@entity/(.*)': '/../database/build/entity/$1', - // This is hack to fix a problem with the library `ts-mysql-migrate` which does differentiate between its ts/js state - '@dbTools/(.*)': - process.env.NODE_ENV === 'development' - ? '/../database/src/$1' - : '/../database/build/src/$1', - }, +module.exports = async () => { + process.env.TZ = 'UTC' + return { + verbose: true, + preset: 'ts-jest', + collectCoverage: true, + collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**'], + moduleNameMapper: { + '@entity/(.*)': '/../database/build/entity/$1', + // This is hack to fix a problem with the library `ts-mysql-migrate` which does differentiate between its ts/js state + '@dbTools/(.*)': + process.env.NODE_ENV === 'development' + ? '/../database/src/$1' + : '/../database/build/src/$1', + }, + } } From 4bac268de394ea99f21e05c4fe89ce0fbdcad071 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 09:30:53 +0100 Subject: [PATCH 248/326] test setPassword with success --- backend/src/apis/KlicktippController.ts | 2 +- .../src/graphql/resolver/KlicktippResolver.ts | 4 +- .../src/graphql/resolver/UserResolver.test.ts | 103 ++++++++++++++++++ backend/src/graphql/resolver/UserResolver.ts | 9 +- backend/src/middleware/klicktippMiddleware.ts | 4 +- 5 files changed, 115 insertions(+), 7 deletions(-) diff --git a/backend/src/apis/KlicktippController.ts b/backend/src/apis/KlicktippController.ts index 544b39d97..0777211ad 100644 --- a/backend/src/apis/KlicktippController.ts +++ b/backend/src/apis/KlicktippController.ts @@ -5,7 +5,7 @@ import CONFIG from '../config' const klicktippConnector = new KlicktippConnector() -export const signIn = async ( +export const klicktippSignIn = async ( email: string, language: string, firstName?: string, diff --git a/backend/src/graphql/resolver/KlicktippResolver.ts b/backend/src/graphql/resolver/KlicktippResolver.ts index fdffb940a..0ba2387e3 100644 --- a/backend/src/graphql/resolver/KlicktippResolver.ts +++ b/backend/src/graphql/resolver/KlicktippResolver.ts @@ -6,7 +6,7 @@ import { getKlickTippUser, getKlicktippTagMap, unsubscribe, - signIn, + klicktippSignIn, } from '../../apis/KlicktippController' import { RIGHTS } from '../../auth/RIGHTS' import SubscribeNewsletterArgs from '../arg/SubscribeNewsletterArgs' @@ -36,6 +36,6 @@ export class KlicktippResolver { async subscribeNewsletter( @Args() { email, language }: SubscribeNewsletterArgs, ): Promise { - return await signIn(email, language) + return await klicktippSignIn(email, language) } } diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 1f0bce30f..fb4e42bf6 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -13,6 +13,7 @@ import { LoginEmailOptIn } from '@entity/LoginEmailOptIn' import { User } from '@entity/User' import CONFIG from '../../config' import { sendAccountActivationEmail } from '../../mailer/sendAccountActivationEmail' +import { klicktippSignIn } from '../../apis/KlicktippController' jest.mock('../../mailer/sendAccountActivationEmail', () => { return { @@ -21,6 +22,13 @@ jest.mock('../../mailer/sendAccountActivationEmail', () => { } }) +jest.mock('../../apis/KlicktippController', () => { + return { + __esModule: true, + klicktippSignIn: jest.fn(), + } +}) + let mutate: any let con: any @@ -220,6 +228,101 @@ describe('UserResolver', () => { }) }) }) + + describe('setPassword', () => { + const createUserMutation = gql` + mutation ( + $email: String! + $firstName: String! + $lastName: String! + $language: String! + $publisherId: Int + ) { + createUser( + email: $email + firstName: $firstName + lastName: $lastName + language: $language + publisherId: $publisherId + ) + } + ` + + const createUserVariables = { + email: 'peter@lustig.de', + firstName: 'Peter', + lastName: 'Lustig', + language: 'de', + publisherId: 1234, + } + + const setPasswordMutation = gql` + mutation ($code: String!, $password: String!) { + setPassword(code: $code, password: $password) + } + ` + + describe('valid optin code and valid password', () => { + let emailOptIn: string + let result: any + let loginUser: any + let newLoginUser: any + let newUser: any + + beforeAll(async () => { + await mutate({ mutation: createUserMutation, variables: createUserVariables }) + const loginEmailOptIn = await getRepository(LoginEmailOptIn) + .createQueryBuilder('login_email_optin') + .getMany() + loginUser = await getRepository(LoginUser).createQueryBuilder('login_user').getMany() + emailOptIn = loginEmailOptIn[0].verificationCode.toString() + result = await mutate({ + mutation: setPasswordMutation, + variables: { code: emailOptIn, password: 'Aa12345_' }, + }) + newLoginUser = await getRepository(LoginUser).createQueryBuilder('login_user').getMany() + newUser = await getRepository(User).createQueryBuilder('state_user').getMany() + }) + + afterAll(async () => { + await resetDB() + }) + + it('updates the password', () => { + expect(newLoginUser[0].password).toEqual('3917921995996627700') + }) + + it('updates the public Key on both user tables', () => { + expect(newLoginUser[0].pubKey).toEqual(expect.any(Buffer)) + expect(newLoginUser[0].pubKey).not.toEqual(loginUser[0].pubKey) + expect(newLoginUser[0].pubKey).toEqual(newUser[0].pubkey) + }) + + it('updates the private Key', () => { + expect(newLoginUser[0].privKey).toEqual(expect.any(Buffer)) + expect(newLoginUser[0].privKey).not.toEqual(loginUser[0].privKey) + }) + + it('removes the optin', async () => { + await expect( + getRepository(LoginEmailOptIn).createQueryBuilder('login_email_optin').getMany(), + ).resolves.toHaveLength(0) + }) + + it('calls the klicktipp API', () => { + expect(klicktippSignIn).toBeCalledWith( + loginUser[0].email, + loginUser[0].language, + loginUser[0].firstName, + loginUser[0].lastName, + ) + }) + + it('returns true', () => { + expect(result).toBeTruthy() + }) + }) + }) }) afterAll(async () => { diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index b751eb633..c17bb06e9 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -23,7 +23,7 @@ import { LoginEmailOptIn } from '@entity/LoginEmailOptIn' import { sendResetPasswordEmail } from '../../mailer/sendResetPasswordEmail' import { sendAccountActivationEmail } from '../../mailer/sendAccountActivationEmail' import { LoginElopageBuysRepository } from '../../typeorm/repository/LoginElopageBuys' -import { signIn } from '../../apis/KlicktippController' +import { klicktippSignIn } from '../../apis/KlicktippController' import { RIGHTS } from '../../auth/RIGHTS' import { ServerUserRepository } from '../../typeorm/repository/ServerUser' import { ROLE_ADMIN } from '../../auth/ROLES' @@ -641,7 +641,12 @@ export class UserResolver { // TODO do we always signUp the user? How to handle things with old users? if (optInCode.emailOptInTypeId === EMAIL_OPT_IN_REGISTER) { try { - await signIn(loginUser.email, loginUser.language, loginUser.firstName, loginUser.lastName) + await klicktippSignIn( + loginUser.email, + loginUser.language, + loginUser.firstName, + loginUser.lastName, + ) } catch { // TODO is this a problem? // eslint-disable-next-line no-console diff --git a/backend/src/middleware/klicktippMiddleware.ts b/backend/src/middleware/klicktippMiddleware.ts index 69a74480d..d0fde8195 100644 --- a/backend/src/middleware/klicktippMiddleware.ts +++ b/backend/src/middleware/klicktippMiddleware.ts @@ -1,5 +1,5 @@ import { MiddlewareFn } from 'type-graphql' -import { /* signIn, */ getKlickTippUser } from '../apis/KlicktippController' +import { /* klicktippSignIn, */ getKlickTippUser } from '../apis/KlicktippController' import { KlickTipp } from '../graphql/model/KlickTipp' import CONFIG from '../config/index' @@ -12,7 +12,7 @@ import CONFIG from '../config/index' // // Do Something here before resolver is called // const result = await next() // // Do Something here after resolver is completed -// await signIn(result.email, result.language, result.firstName, result.lastName) +// await klicktippSignIn(result.email, result.language, result.firstName, result.lastName) // return result // } From 8d800fc7da3b06caadb2db1277be9a0c52a77581 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 09:55:09 +0100 Subject: [PATCH 249/326] test some error cases --- .../src/graphql/resolver/UserResolver.test.ts | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index fb4e42bf6..1a535ae72 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -261,10 +261,10 @@ describe('UserResolver', () => { setPassword(code: $code, password: $password) } ` + let result: any + let emailOptIn: string describe('valid optin code and valid password', () => { - let emailOptIn: string - let result: any let loginUser: any let newLoginUser: any let newUser: any @@ -288,6 +288,10 @@ describe('UserResolver', () => { await resetDB() }) + it('sets email checked to true', () => { + expect(newLoginUser[0].emailChecked).toBeTruthy() + }) + it('updates the password', () => { expect(newLoginUser[0].password).toEqual('3917921995996627700') }) @@ -322,6 +326,58 @@ describe('UserResolver', () => { expect(result).toBeTruthy() }) }) + + describe('no valid password', () => { + beforeAll(async () => { + await mutate({ mutation: createUserMutation, variables: createUserVariables }) + const loginEmailOptIn = await getRepository(LoginEmailOptIn) + .createQueryBuilder('login_email_optin') + .getMany() + emailOptIn = loginEmailOptIn[0].verificationCode.toString() + result = await mutate({ + mutation: setPasswordMutation, + variables: { code: emailOptIn, password: 'not-valid' }, + }) + }) + + afterAll(async () => { + await resetDB() + }) + + it('throws an error', () => { + expect(result).toEqual( + expect.objectContaining({ + errors: [ + new GraphQLError( + 'Please enter a valid password with at least 8 characters, upper and lower case letters, at least one number and one special character!', + ), + ], + }), + ) + }) + }) + + describe('no valid optin code', () => { + beforeAll(async () => { + await mutate({ mutation: createUserMutation, variables: createUserVariables }) + result = await mutate({ + mutation: setPasswordMutation, + variables: { code: 'not valid', password: 'Aa12345_' }, + }) + }) + + afterAll(async () => { + await resetDB() + }) + + it('throws an error', () => { + expect(result).toEqual( + expect.objectContaining({ + errors: [new GraphQLError('Could not login with emailVerificationCode')], + }), + ) + }) + }) }) }) From 3bef3f3b946f9e936d6ca40e80ab1f5c71fc9ff7 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 09:56:11 +0100 Subject: [PATCH 250/326] coverage backend to 45% --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e243c9184..863f433db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -520,7 +520,7 @@ jobs: report_name: Coverage Backend type: lcov result_path: ./backend/coverage/lcov.info - min_coverage: 41 + min_coverage: 45 token: ${{ github.token }} ############################################################################## From 173a25dc3ac8489c4a8de26322081139dd312cd9 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 13 Jan 2022 10:19:20 +0100 Subject: [PATCH 251/326] Removed href='#!' and replaced it with class='cursor-pointer' --- .../src/views/Pages/UserProfile/UserCard_FormUserData.vue | 5 ++++- .../views/Pages/UserProfile/UserCard_FormUserPasswort.vue | 5 ++++- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index 9dbdd5c3d..555e3e78b 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -3,7 +3,10 @@
- + {{ $t('settings.name.change-name') }} diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue index 749f1f3ce..7e993bc75 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue @@ -3,7 +3,10 @@
- + {{ $t('settings.password.change-password') }} diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index de9af9994..c10648efa 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -3,7 +3,10 @@
- + {{ $t('settings.language.changeLanguage') }} From bfd40a0ca783ad2f5aee3706936f4945d9e3b013 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 11:49:29 +0100 Subject: [PATCH 252/326] seed 96 random users --- database/src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/database/src/index.ts b/database/src/index.ts index 033a36d8b..181a4e59b 100644 --- a/database/src/index.ts +++ b/database/src/index.ts @@ -7,6 +7,7 @@ import { CreateBibiBloxbergSeed } from './seeds/users/bibi-bloxberg.seed' import { CreateRaeuberHotzenplotzSeed } from './seeds/users/raeuber-hotzenplotz.seed' import { CreateBobBaumeisterSeed } from './seeds/users/bob-baumeister.seed' import { CreateGarrickOllivanderSeed } from './seeds/users/garrick-ollivander.seed' +import { CreateUserSeed } from './seeds/create-user.seed' import { DecayStartBlockSeed } from './seeds/decay-start-block.seed' import { resetDB, pool, migration } from './helpers' @@ -45,6 +46,9 @@ const run = async (command: string) => { await runSeeder(CreateBibiBloxbergSeed) await runSeeder(CreateRaeuberHotzenplotzSeed) await runSeeder(CreateBobBaumeisterSeed) + Array.apply(null, Array(96)).forEach(async () => { + await runSeeder(CreateUserSeed) + }) await runSeeder(CreateGarrickOllivanderSeed) break default: From 44e3e38937133f6b0c2dc45811c0ceb4c7a6c338 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 12:16:22 +0100 Subject: [PATCH 253/326] link email addresses --- database/src/index.ts | 4 +++- database/src/seeds/create-user.seed.ts | 7 ++----- database/src/seeds/helpers/user-helpers.ts | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/database/src/index.ts b/database/src/index.ts index 181a4e59b..ff14e9238 100644 --- a/database/src/index.ts +++ b/database/src/index.ts @@ -46,7 +46,9 @@ const run = async (command: string) => { await runSeeder(CreateBibiBloxbergSeed) await runSeeder(CreateRaeuberHotzenplotzSeed) await runSeeder(CreateBobBaumeisterSeed) - Array.apply(null, Array(96)).forEach(async () => { + // eslint-disable-next-line no-case-declarations + const arr = new Array(96) + arr.forEach(async () => { await runSeeder(CreateUserSeed) }) await runSeeder(CreateGarrickOllivanderSeed) diff --git a/database/src/seeds/create-user.seed.ts b/database/src/seeds/create-user.seed.ts index ca3a182c4..69488a790 100644 --- a/database/src/seeds/create-user.seed.ts +++ b/database/src/seeds/create-user.seed.ts @@ -1,11 +1,8 @@ import { Factory, Seeder } from 'typeorm-seeding' -import { User } from '../../entity/User' -// import { LoginUser } from '../../entity/LoginUser' +import { userSeeder } from './helpers/user-helpers' export class CreateUserSeed implements Seeder { public async run(factory: Factory): Promise { - // const loginUser = await factory(LoginUser)().make() - // console.log(loginUser.email) - await factory(User)().create() + await userSeeder(factory, {}) } } diff --git a/database/src/seeds/helpers/user-helpers.ts b/database/src/seeds/helpers/user-helpers.ts index bd46ecdee..e1e33a94b 100644 --- a/database/src/seeds/helpers/user-helpers.ts +++ b/database/src/seeds/helpers/user-helpers.ts @@ -27,6 +27,7 @@ import { Factory } from 'typeorm-seeding' export const userSeeder = async (factory: Factory, userData: UserInterface): Promise => { const user = await factory(User)(createUserContext(userData)).create() + if (!userData.email) userData.email = user.email const loginUser = await factory(LoginUser)(createLoginUserContext(userData)).create() await factory(LoginUserBackup)(createLoginUserBackupContext(userData, loginUser)).create() From 8c031a562a118e505cb440115684688d647948d8 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 12:27:58 +0100 Subject: [PATCH 254/326] fix linting --- database/src/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/database/src/index.ts b/database/src/index.ts index ff14e9238..fefdea217 100644 --- a/database/src/index.ts +++ b/database/src/index.ts @@ -46,9 +46,8 @@ const run = async (command: string) => { await runSeeder(CreateBibiBloxbergSeed) await runSeeder(CreateRaeuberHotzenplotzSeed) await runSeeder(CreateBobBaumeisterSeed) - // eslint-disable-next-line no-case-declarations - const arr = new Array(96) - arr.forEach(async () => { + // eslint-disable-next-line prefer-spread + Array.apply(null, Array(96)).forEach(async () => { await runSeeder(CreateUserSeed) }) await runSeeder(CreateGarrickOllivanderSeed) From 2b6dd2af87ae0b159de2ea4b4d6e750d2235027f Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 13 Jan 2022 17:00:01 +0100 Subject: [PATCH 255/326] implement fake pagination for searchUsers --- backend/src/graphql/arg/SearchUsersArgs.ts | 16 ++++++++++++++++ backend/src/graphql/resolver/AdminResolver.ts | 10 +++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 backend/src/graphql/arg/SearchUsersArgs.ts diff --git a/backend/src/graphql/arg/SearchUsersArgs.ts b/backend/src/graphql/arg/SearchUsersArgs.ts new file mode 100644 index 000000000..5b40fd9ca --- /dev/null +++ b/backend/src/graphql/arg/SearchUsersArgs.ts @@ -0,0 +1,16 @@ +import { ArgsType, Field, Int } from 'type-graphql' + +@ArgsType() +export default class SearchUsersArgs { + @Field(() => String) + searchText: string + + @Field(() => Int, { nullable: true }) + currentPage?: number + + @Field(() => Int, { nullable: true }) + pageSize?: number + + @Field(() => Boolean, { nullable: true }) + notActivated?: boolean +} diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 11d8c99cd..1cf50197c 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -14,6 +14,7 @@ import { LoginPendingTasksAdminRepository } from '../../typeorm/repository/Login import { UserRepository } from '../../typeorm/repository/User' import CreatePendingCreationArgs from '../arg/CreatePendingCreationArgs' import UpdatePendingCreationArgs from '../arg/UpdatePendingCreationArgs' +import SearchUsersArgs from '../arg/SearchUsersArgs' import moment from 'moment' import { Transaction } from '@entity/Transaction' import { TransactionCreation } from '@entity/TransactionCreation' @@ -27,10 +28,12 @@ import { LoginUserRepository } from '../../typeorm/repository/LoginUser' export class AdminResolver { @Authorized([RIGHTS.SEARCH_USERS]) @Query(() => [UserAdmin]) - async searchUsers(@Arg('searchText') searchText: string): Promise { + async searchUsers( + @Args() { searchText, currentPage = 1, pageSize = 25, notActivated = false }: SearchUsersArgs, + ): Promise { const userRepository = getCustomRepository(UserRepository) const users = await userRepository.findBySearchCriteria(searchText) - const adminUsers = await Promise.all( + let adminUsers = await Promise.all( users.map(async (user) => { const adminUser = new UserAdmin() adminUser.userId = user.id @@ -42,7 +45,8 @@ export class AdminResolver { return adminUser }), ) - return adminUsers + if (notActivated) adminUsers = adminUsers.filter((u) => !u.emailChecked) + return adminUsers.slice(currentPage - 1, currentPage + pageSize - 1) } @Authorized([RIGHTS.CREATE_PENDING_CREATION]) From f3a949f2782790d3d103f39bb48649564407e462 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 22:30:53 +0100 Subject: [PATCH 256/326] new enhanced .env for deployment --- deployment/bare_metal/.env.dist | 39 +++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 70cc95521..b4f76a98a 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -1,14 +1,29 @@ -NGINX_SERVER_NAME=_ +DEPLOY_SEED_DATA=false -#Example data +NGINX_REWRITE_LEGACY_URLS=true +NGINX_SSL=true +NGINX_SERVER_NAME=stage1.gradido.net +NGINX_SSL_CERTIFICATE=/etc/letsencrypt/live/stage1.gradido.net/fullchain.pem +NGINX_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/stage1.gradido.net/privkey.pem +NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem +NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf +NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page -#DEPLOY_SEED_DATA=true -# -#NGINX_REWRITE_LEGACY_URLS=true -#NGINX_SSL=true -#NGINX_SERVER_NAME=stage1.gradido.net -#NGINX_SSL_CERTIFICATE=/etc/letsencrypt/live/stage1.gradido.net/fullchain.pem -#NGINX_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/stage1.gradido.net/privkey.pem -#NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem -#NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf -#NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page \ No newline at end of file + +# backend +EMAIL=true +EMAIL_USERNAME=peter@lustig.de +EMAIL_SENDER=peter@lustig.de +EMAIL_PASSWORD=1234 +EMAIL_SMTP_URL=smtp.lustig.de +EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$1 + +WEBHOOK_ELOPAGE_SECRET=secret + +# frontend +GRAPHQL_URI=https://stage1.gradido.net/graphql +ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token=$1 + +# admin +WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token=$1 +WALLET_URL=https://stage1.gradido.net/login \ No newline at end of file From 2f04b1470a95fabb2764d492b38138be1074e676 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 22:31:54 +0100 Subject: [PATCH 257/326] removed frontend port from configs - no longer needed --- frontend/.env.dist | 3 +-- frontend/src/config/index.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/.env.dist b/frontend/.env.dist index 80dafb7f9..3602c4dd2 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,4 +1,3 @@ -GRAPHQL_URI=http://localhost:4000/graphql +GRAPHQL_URI=http://localhost/graphql DEFAULT_PUBLISHER_ID=2896 -#BUILD_COMMIT=0000000 ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$1 \ No newline at end of file diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index b3a9366b7..000d5fb37 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -19,7 +19,7 @@ const environment = { } const endpoints = { - GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', + GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql', ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$1', } From 4079e6818fe04267c32a33450206ad8c7217748c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 22:32:23 +0100 Subject: [PATCH 258/326] updated setup.md --- deployment/bare_metal/setup.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/deployment/bare_metal/setup.md b/deployment/bare_metal/setup.md index 31db1f42a..9c0824e2d 100644 --- a/deployment/bare_metal/setup.md +++ b/deployment/bare_metal/setup.md @@ -4,12 +4,12 @@ > ssh root@gddhost.tld -# change default shell -chsh +# change root default shell +> chsh -s /bin/bash # Create user `gradido` > useradd -d /home/gradido -m gradido > passwd gradido ->> enter new +>> enter new password twice # Gives the user priviledges - this might be omitted in order to harden security # Care: This will require another administering user if you don't want root access. @@ -18,6 +18,8 @@ chsh # You might lock yourself out, if done wrong. > usermod -a -G sudo gradido +# change gradido default shell +> chsh -s /bin/bash gradido # Install sudo > apt-get install sudo # switch to the new user @@ -67,11 +69,18 @@ chsh > sudo ufw enable ## fail2ban -> sudo apt-get install fail2ban +> sudo apt-get install -y fail2ban > sudo /etc/init.d/fail2ban restart # Install gradido > sudo apt-get install git > git clone https://github.com/gradido/gradido.git > cd gradido/deployment/bare_metal + +# Adjust .env +> cd gradido/deployment/bare_metal +> cp .env.dist .env +> nano .env +>> Adjust values accordingly +# TODO the install.sh is not yet ready to run directly - consider to use it as pattern to do it manually > ./install.sh \ No newline at end of file From 8fcc3b31adf0809272eb8679c8cd4462b6661317 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 22:34:17 +0100 Subject: [PATCH 259/326] improved installscript alot - proper order - templates for all configs to fill in automatically --- admin/.env.template | 4 + backend/.env .template | 33 ++++++++ database/.env.template | 8 ++ deployment/bare_metal/install.sh | 135 +++++++++++++++---------------- frontend/.env.template | 3 + 5 files changed, 114 insertions(+), 69 deletions(-) create mode 100644 admin/.env.template create mode 100644 backend/.env .template create mode 100644 database/.env.template create mode 100644 frontend/.env.template diff --git a/admin/.env.template b/admin/.env.template new file mode 100644 index 000000000..d785705f0 --- /dev/null +++ b/admin/.env.template @@ -0,0 +1,4 @@ +GRAPHQL_URI=${GRAPHQL_URI} +WALLET_AUTH_URL=${WALLET_AUTH_URL} +WALLET_URL=${WALLET_URL} +DEBUG_DISABLE_AUTH=false \ No newline at end of file diff --git a/backend/.env .template b/backend/.env .template new file mode 100644 index 000000000..09e58f5f5 --- /dev/null +++ b/backend/.env .template @@ -0,0 +1,33 @@ +PORT=4000 +JWT_SECRET=${JWT_SECRET} +JWT_EXPIRES_IN=10m +GRAPHIQL=false +GDT_API_URL=https://gdt.gradido.net +DB_HOST=localhost +DB_PORT=3306 +DB_USER=${DB_USER} +DB_PASSWORD=${DB_PASSWORD} +DB_DATABASE=gradido_community + +EMAIL=${EMAIL} +EMAIL_USERNAME=${EMAIL_USERNAME} +EMAIL_SENDER=${EMAIL_SENDER} +EMAIL_PASSWORD=${EMAIL_PASSWORD} +EMAIL_SMTP_URL=§{EMAIL_SMTP_URL} +EMAIL_SMTP_PORT=587 +#RESEND_TIME=1 minute, 60 => 1hour, 1440 (60 minutes * 24 hours) => 24 hours +RESEND_TIME=10 + +EMAIL_LINK_VERIFICATION=${EMAIL_LINK_VERIFICATION} + +#KLICKTIPP_USER= +#KLICKTIPP_PASSWORD= +#KLICKTIPP_APIKEY_DE= +#KLICKTIPP_APIKEY_EN= +#KLICKTIPP=true +COMMUNITY_NAME= +COMMUNITY_URL= +COMMUNITY_REGISTER_URL= +COMMUNITY_DESCRIPTION= + +WEBHOOK_ELOPAGE_SECRET=${WEBHOOK_ELOPAGE_SECRET} \ No newline at end of file diff --git a/database/.env.template b/database/.env.template new file mode 100644 index 000000000..bee25c9ea --- /dev/null +++ b/database/.env.template @@ -0,0 +1,8 @@ +DB_HOST=localhost +DB_PORT=3306 +DB_USER=${DB_USER} +DB_PASSWORD=${DB_PASSWORD} +DB_DATABASE=gradido_community +MIGRATIONS_TABLE=migrations + +TYPEORM_SEEDING_FACTORIES=src/factories/**/*{.ts,.js} diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 3d1d44a2c..3c999b501 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -3,15 +3,26 @@ # This install script requires the minimum requirements already installed. # How to do this is described in detail in [setup.md](./setup.md) +# Find current directory & configure paths +set -o allexport +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) +PROJECT_ROOT=$SCRIPT_DIR/../.. +set +o allexport + # Load .env or .env.dist if not present set -o allexport -if [ -f ".env" ]; then - source .env +#TODO +if [ -f "$SCRIPT_DIR/.env" ]; then + source $SCRIPT_DIR/.env else - source .env.dist + source $SCRIPT_DIR/.env.dist fi set +o allexport +# Configure git +git config pull.ff only + # Install mariadb sudo apt-get install -y mariadb-server sudo mysql_secure_installation @@ -23,57 +34,24 @@ sudo mysql_secure_installation # Remove test database and access to it? [Y/n] Y # Reload privilege tables now? [Y/n] Y -# create db user -DB_USER=gradido -DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); -# create table -#create database gradido_community -# DEFAULT CHARACTER SET utf8mb4 -# DEFAULT COLLATE utf8mb4_unicode_ci; -# GRANT ALL PRIVILEGES ON gradido_community.* TO '$DB_USER'@'localhost'; -sudo mysql < gradido ALL=(ALL) NOPASSWD: /etc/init.d/nginx start,/etc/init.d/nginx stop,/etc/init.d/nginx restart +sudo chmod a+rw /etc/nginx/sites-enabled + +# Install node 16.x +curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - +sudo apt-get install -y nodejs +sudo apt-get install -y build-essential # Install yarn sudo apt-get install -y curl @@ -83,32 +61,22 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/source sudo apt-get update sudo apt-get install -y yarn -# Install node 16.x -curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - -sudo apt-get install -y nodejs -sudo apt-get install -y build-essential - # Install pm2 sudo yarn global add pm2 # Install certbot +sudo /etc/init.d/nginx stop sudo apt-get install -y certbot -sudo apt-get install -y python3-certbot-nginx -sudo certbot --certonly +sudo certbot certonly > Enter email address (used for urgent renewal and security notices) > support@gradido.net > Please read the Terms of Service at > Y > Would you be willing, once your first certificate is successfully issued, to > N > No names were found in your configuration files. Please enter in your domain > stage1.gradido.net +sudo /etc/init.d/nginx start -git config pull.ff only - -# Allow nginx configuration and restart for gradido -sudo nano /etc/sudoers.d/gradido -> gradido ALL=(ALL) NOPASSWD: /etc/init.d/nginx start,/etc/init.d/nginx stop,/etc/init.d/nginx restart -sudo chmod a+rw /etc/nginx/sites-enabled - -# Webhooks (optional) +# Webhooks (optional) (for development) sudo apt install webhook +# TODO generate nano ~/hooks.json ``` [ @@ -118,7 +86,7 @@ nano ~/hooks.json "pass-arguments-to-command": [ { "source": "string", - "name": "new_deployment" + "name": "master" }, ], "command-working-directory": "/home/gradido/gradido/deployment/bare_metal", @@ -137,7 +105,7 @@ nano ~/hooks.json { "match": { "type": "value", - "value": "refs/heads/new_deployment", + "value": "refs/heads/master", "parameter": { "source": "payload", "name": "ref" @@ -152,4 +120,33 @@ nano ~/hooks.json webhook -hooks ~/hooks.json & # or for debugging -webhook -hooks ~/hooks.json -verbose \ No newline at end of file +webhook -hooks ~/hooks.json -verbose + +# create db user +DB_USER=gradido +DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); +# create table +#create database gradido_community +# DEFAULT CHARACTER SET utf8mb4 +# DEFAULT COLLATE utf8mb4_unicode_ci; +# GRANT ALL PRIVILEGES ON gradido_community.* TO '$DB_USER'@'localhost'; +sudo mysql < $PROJECT_ROOT/database/.env + +# Configure backend +JWT_SECRET=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/backend/.env.template > $PROJECT_ROOT/backend/.env + +# Configure frontend +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/frontend/.env.template > $PROJECT_ROOT/frontend/.env + +# Configure admin +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/admin/.env.template > $PROJECT_ROOT/admin/.env + +#TODO import old database \ No newline at end of file diff --git a/frontend/.env.template b/frontend/.env.template new file mode 100644 index 000000000..5d370fb9d --- /dev/null +++ b/frontend/.env.template @@ -0,0 +1,3 @@ +GRAPHQL_URI=${GRAPHQL_URI} +DEFAULT_PUBLISHER_ID=2896 +ADMIN_AUTH_URL=${ADMIN_AUTH_URL} \ No newline at end of file From dda39550ab5f0fdd268aec8f6122cfe5fb71e098 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 22:48:25 +0100 Subject: [PATCH 260/326] corrected templates --- admin/.env.template | 6 +++--- backend/.env .template | 20 ++++++++++---------- database/.env.template | 4 ++-- frontend/.env.template | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/admin/.env.template b/admin/.env.template index d785705f0..a965b1bb1 100644 --- a/admin/.env.template +++ b/admin/.env.template @@ -1,4 +1,4 @@ -GRAPHQL_URI=${GRAPHQL_URI} -WALLET_AUTH_URL=${WALLET_AUTH_URL} -WALLET_URL=${WALLET_URL} +GRAPHQL_URI=$GRAPHQL_URI +WALLET_AUTH_URL=$WALLET_AUTH_URL +WALLET_URL=$WALLET_URL DEBUG_DISABLE_AUTH=false \ No newline at end of file diff --git a/backend/.env .template b/backend/.env .template index 09e58f5f5..8611e93cf 100644 --- a/backend/.env .template +++ b/backend/.env .template @@ -1,24 +1,24 @@ PORT=4000 -JWT_SECRET=${JWT_SECRET} +JWT_SECRET=$JWT_SECRET JWT_EXPIRES_IN=10m GRAPHIQL=false GDT_API_URL=https://gdt.gradido.net DB_HOST=localhost DB_PORT=3306 -DB_USER=${DB_USER} -DB_PASSWORD=${DB_PASSWORD} +DB_USER=$DB_USER +DB_PASSWORD=$DB_PASSWORD DB_DATABASE=gradido_community -EMAIL=${EMAIL} -EMAIL_USERNAME=${EMAIL_USERNAME} -EMAIL_SENDER=${EMAIL_SENDER} -EMAIL_PASSWORD=${EMAIL_PASSWORD} -EMAIL_SMTP_URL=§{EMAIL_SMTP_URL} +EMAIL=$EMAIL +EMAIL_USERNAME=$EMAIL_USERNAME +EMAIL_SENDER=$EMAIL_SENDER +EMAIL_PASSWORD=$EMAIL_PASSWORD +EMAIL_SMTP_URL=$EMAIL_SMTP_URL EMAIL_SMTP_PORT=587 #RESEND_TIME=1 minute, 60 => 1hour, 1440 (60 minutes * 24 hours) => 24 hours RESEND_TIME=10 -EMAIL_LINK_VERIFICATION=${EMAIL_LINK_VERIFICATION} +EMAIL_LINK_VERIFICATION=$EMAIL_LINK_VERIFICATION #KLICKTIPP_USER= #KLICKTIPP_PASSWORD= @@ -30,4 +30,4 @@ COMMUNITY_URL= COMMUNITY_REGISTER_URL= COMMUNITY_DESCRIPTION= -WEBHOOK_ELOPAGE_SECRET=${WEBHOOK_ELOPAGE_SECRET} \ No newline at end of file +WEBHOOK_ELOPAGE_SECRET=$WEBHOOK_ELOPAGE_SECRET \ No newline at end of file diff --git a/database/.env.template b/database/.env.template index bee25c9ea..5b8554bcf 100644 --- a/database/.env.template +++ b/database/.env.template @@ -1,7 +1,7 @@ DB_HOST=localhost DB_PORT=3306 -DB_USER=${DB_USER} -DB_PASSWORD=${DB_PASSWORD} +DB_USER=$DB_USER +DB_PASSWORD=$DB_PASSWORD DB_DATABASE=gradido_community MIGRATIONS_TABLE=migrations diff --git a/frontend/.env.template b/frontend/.env.template index 5d370fb9d..8c9c053cc 100644 --- a/frontend/.env.template +++ b/frontend/.env.template @@ -1,3 +1,3 @@ -GRAPHQL_URI=${GRAPHQL_URI} +GRAPHQL_URI=$GRAPHQL_URI DEFAULT_PUBLISHER_ID=2896 -ADMIN_AUTH_URL=${ADMIN_AUTH_URL} \ No newline at end of file +ADMIN_AUTH_URL=$ADMIN_AUTH_URL \ No newline at end of file From 0124fc884be5471292109df8204ec0dc12476392 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 22:48:41 +0100 Subject: [PATCH 261/326] removed todo --- deployment/bare_metal/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 3c999b501..2e0124bfb 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -12,7 +12,6 @@ set +o allexport # Load .env or .env.dist if not present set -o allexport -#TODO if [ -f "$SCRIPT_DIR/.env" ]; then source $SCRIPT_DIR/.env else From 4625d4b16423f437586b77cbe5fb902e6c1e419e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 23:00:19 +0100 Subject: [PATCH 262/326] corrected filename --- backend/{.env .template => .env.template} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename backend/{.env .template => .env.template} (100%) diff --git a/backend/.env .template b/backend/.env.template similarity index 100% rename from backend/.env .template rename to backend/.env.template From 71c17c19a2b454537b535b51f7de2977b5a727a2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 13 Jan 2022 23:25:20 +0100 Subject: [PATCH 263/326] some more adjustments to setup andinstall script --- deployment/bare_metal/install.sh | 21 ++++++++++++--------- deployment/bare_metal/setup.md | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 2e0124bfb..76c2274fb 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -36,9 +36,9 @@ sudo mysql_secure_installation # Install nginx sudo apt-get install -y nginx sudo rm /etc/nginx/sites-enabled/default -# sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/sites-available/gradido.conf /etc/nginx/sites-available +sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/sites-available/gradido.conf /etc/nginx/sites-available # sudo ln -s /etc/nginx/sites-available/gradido.conf /etc/nginx/sites-enabled -# sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/sites-available/update-page.conf /etc/nginx/sites-available +sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/sites-available/update-page.conf /etc/nginx/sites-available sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/common /etc/nginx/ # Allow nginx configuration and restart for gradido @@ -64,14 +64,13 @@ sudo apt-get install -y yarn sudo yarn global add pm2 # Install certbot -sudo /etc/init.d/nginx stop sudo apt-get install -y certbot -sudo certbot certonly +sudo apt-get install -y python3-certbot-nginx +sudo certbot > Enter email address (used for urgent renewal and security notices) > support@gradido.net > Please read the Terms of Service at > Y > Would you be willing, once your first certificate is successfully issued, to > N > No names were found in your configuration files. Please enter in your domain > stage1.gradido.net -sudo /etc/init.d/nginx start # Webhooks (optional) (for development) sudo apt install webhook @@ -122,8 +121,8 @@ webhook -hooks ~/hooks.json & webhook -hooks ~/hooks.json -verbose # create db user -DB_USER=gradido -DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); +export DB_USER=gradido +export DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); # create table #create database gradido_community # DEFAULT CHARACTER SET utf8mb4 @@ -139,7 +138,7 @@ EOFMYSQL envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/database/.env.template > $PROJECT_ROOT/database/.env # Configure backend -JWT_SECRET=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); +export JWT_SECRET=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/backend/.env.template > $PROJECT_ROOT/backend/.env # Configure frontend @@ -148,4 +147,8 @@ envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/frontend/.env # Configure admin envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/admin/.env.template > $PROJECT_ROOT/admin/.env -#TODO import old database \ No newline at end of file +#TODO import old database + +# Start gradido +# Note: on first startup some errors will occur - nothing serious +./start.sh \ No newline at end of file diff --git a/deployment/bare_metal/setup.md b/deployment/bare_metal/setup.md index 9c0824e2d..832d34fa4 100644 --- a/deployment/bare_metal/setup.md +++ b/deployment/bare_metal/setup.md @@ -78,6 +78,7 @@ > cd gradido/deployment/bare_metal # Adjust .env +# NOTE ';' can not be part of any value > cd gradido/deployment/bare_metal > cp .env.dist .env > nano .env From 03c7d664c3d2e7ec4e7339a0525b725a8ea050ca Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 14 Jan 2022 08:00:50 +0100 Subject: [PATCH 264/326] Changed href=#! to class cursor-pointer. --- .../src/views/Pages/UserProfile/UserCard_FormUserData.vue | 6 +++++- .../views/Pages/UserProfile/UserCard_FormUserPasswort.vue | 5 +++++ frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index 555e3e78b..84f8b60df 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -133,4 +133,8 @@ export default { }, } - + diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue index 7e993bc75..e67304e02 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue @@ -94,3 +94,8 @@ export default { }, } + diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index c10648efa..dfaf6cf55 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -113,3 +113,8 @@ export default { }, } + From bea99f6904e9cae90fe9c17a9106e54a0b16bc76 Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 14 Jan 2022 08:06:50 +0100 Subject: [PATCH 265/326] New login page is on localhost/login no vue anymore. --- admin/src/plugins/apolloProvider.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/plugins/apolloProvider.test.js b/admin/src/plugins/apolloProvider.test.js index 637efd1be..75e415901 100644 --- a/admin/src/plugins/apolloProvider.test.js +++ b/admin/src/plugins/apolloProvider.test.js @@ -125,7 +125,7 @@ describe('apolloProvider', () => { }) it('redirects to logout', () => { - expect(windowLocationMock).toBeCalledWith('http://localhost/vue/login') + expect(windowLocationMock).toBeCalledWith('http://localhost/login') }) }) From 151f497252b9f6bda4f16a18b4e464a21e38fa7f Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 14 Jan 2022 08:47:07 +0100 Subject: [PATCH 266/326] Changed the logic of no transactions, sets -1 if error was thrown so that we dont have the error if no transactions are present. --- frontend/src/views/Layout/DashboardLayout_gdd.vue | 1 + .../views/Pages/AccountOverview/GddTransactionList.spec.js | 6 ++++++ .../src/views/Pages/AccountOverview/GddTransactionList.vue | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index bd3bd8e4c..40a6011d5 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -100,6 +100,7 @@ export default { }) .catch((error) => { this.pending = true + this.transactionCount = -1 this.$toasted.global.error(error.message) // what to do when loading balance fails? }) diff --git a/frontend/src/views/Pages/AccountOverview/GddTransactionList.spec.js b/frontend/src/views/Pages/AccountOverview/GddTransactionList.spec.js index 2c4b15e17..b116de9e8 100644 --- a/frontend/src/views/Pages/AccountOverview/GddTransactionList.spec.js +++ b/frontend/src/views/Pages/AccountOverview/GddTransactionList.spec.js @@ -61,6 +61,12 @@ describe('GddTransactionList', () => { }) describe('without any properties', () => { + beforeEach(async () => { + await wrapper.setProps({ + transactions: [], + transactionCount: -1, + }) + }) it('renders text saying that there are error.empty-transactionlist ', () => { expect(wrapper.find('div.gdd-transaction-list').text()).toContain( 'transaction.nullTransactions', diff --git a/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue b/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue index 52a66817a..f6c046fe6 100644 --- a/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue +++ b/frontend/src/views/Pages/AccountOverview/GddTransactionList.vue @@ -7,7 +7,7 @@ {{ $t('error.no-transactionlist') }}
-
+
{{ $t('error.empty-transactionlist') }}
@@ -134,7 +134,7 @@ :per-page="pageSize" :total-rows="transactionCount" > -
+
{{ $t('transaction.nullTransactions') }}
From 599d810da3dd74b354ef11f2a6bb525a0215f3bd Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:06:26 +0100 Subject: [PATCH 267/326] add some comments in .env.dist (deploy) --- deployment/bare_metal/.env.dist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index b4f76a98a..feada1d86 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -1,5 +1,7 @@ +# start script DEPLOY_SEED_DATA=false +# nginx NGINX_REWRITE_LEGACY_URLS=true NGINX_SSL=true NGINX_SERVER_NAME=stage1.gradido.net @@ -9,7 +11,6 @@ NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page - # backend EMAIL=true EMAIL_USERNAME=peter@lustig.de From 6514219c050c22e1693e667e20bb16c8cbec2490 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:12:53 +0100 Subject: [PATCH 268/326] added some todos regarding webhooks --- deployment/bare_metal/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 76c2274fb..b5aaaad9b 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -75,6 +75,10 @@ sudo certbot # Webhooks (optional) (for development) sudo apt install webhook # TODO generate +# put hook into ithub +# TODO adjust secret +# TODO adjust branch if needed +# https://stage1.gradido.net/hooks/github nano ~/hooks.json ``` [ From 805362159705b73450aec3f7e8233bf91ec55de8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:19:20 +0100 Subject: [PATCH 269/326] externalize hooks file and generate it --- deployment/bare_metal/install.sh | 43 +------------------ .../bare_metal/webhook/hooks.json.template | 37 ++++++++++++++++ 2 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 deployment/bare_metal/webhook/hooks.json.template diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index b5aaaad9b..43d2b4383 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -79,50 +79,11 @@ sudo apt install webhook # TODO adjust secret # TODO adjust branch if needed # https://stage1.gradido.net/hooks/github -nano ~/hooks.json -``` -[ - { - "id": "github", - "execute-command": "/home/gradido/gradido/deployment/bare_metal/start.sh", - "pass-arguments-to-command": [ - { - "source": "string", - "name": "master" - }, - ], - "command-working-directory": "/home/gradido/gradido/deployment/bare_metal", - "trigger-rule": { - "and": [ - { - "match": { - "type": "payload-hash-sha1", - "secret": "secret", - "parameter": { - "source": "header", - "name": "X-Hub-Signature" - } - } - }, - { - "match": { - "type": "value", - "value": "refs/heads/master", - "parameter": { - "source": "payload", - "name": "ref" - } - } - } - ] - } - } -] -``` +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $SCRIPT_DIR/webhook/hooks.json.template > ~/hooks.json webhook -hooks ~/hooks.json & # or for debugging -webhook -hooks ~/hooks.json -verbose +# webhook -hooks ~/hooks.json -verbose # create db user export DB_USER=gradido diff --git a/deployment/bare_metal/webhook/hooks.json.template b/deployment/bare_metal/webhook/hooks.json.template new file mode 100644 index 000000000..c6915d5b9 --- /dev/null +++ b/deployment/bare_metal/webhook/hooks.json.template @@ -0,0 +1,37 @@ +[ + { + "id": "github", + "execute-command": "/home/gradido/gradido/deployment/bare_metal/start.sh", + "pass-arguments-to-command": [ + { + "source": "string", + "name": "master" + } + ], + "command-working-directory": "/home/gradido/gradido/deployment/bare_metal", + "trigger-rule": { + "and": [ + { + "match": { + "type": "payload-hash-sha1", + "secret": "secret", + "parameter": { + "source": "header", + "name": "X-Hub-Signature" + } + } + }, + { + "match": { + "type": "value", + "value": "refs/heads/master", + "parameter": { + "source": "payload", + "name": "ref" + } + } + } + ] + } + } + ] \ No newline at end of file From 034bc8f739e818d4890a3f4fd0491ae7abf1b505 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:24:12 +0100 Subject: [PATCH 270/326] parameterize hooks template --- deployment/bare_metal/.env.dist | 4 ++++ deployment/bare_metal/webhook/hooks.json.template | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index feada1d86..9eaa2a0ed 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -11,6 +11,10 @@ NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page +# webhook +WEBHOOK_GITHUB_SECRET=secret +WEBHOOK_GITHUB_BRANCH=master + # backend EMAIL=true EMAIL_USERNAME=peter@lustig.de diff --git a/deployment/bare_metal/webhook/hooks.json.template b/deployment/bare_metal/webhook/hooks.json.template index c6915d5b9..7f6a76fd5 100644 --- a/deployment/bare_metal/webhook/hooks.json.template +++ b/deployment/bare_metal/webhook/hooks.json.template @@ -5,7 +5,7 @@ "pass-arguments-to-command": [ { "source": "string", - "name": "master" + "name": "$WEBHOOK_GITHUB_BRANCH" } ], "command-working-directory": "/home/gradido/gradido/deployment/bare_metal", @@ -14,7 +14,7 @@ { "match": { "type": "payload-hash-sha1", - "secret": "secret", + "secret": "$WEBHOOK_GITHUB_SECRET", "parameter": { "source": "header", "name": "X-Hub-Signature" @@ -24,7 +24,7 @@ { "match": { "type": "value", - "value": "refs/heads/master", + "value": "refs/heads/$WEBHOOK_GITHUB_BRANCH", "parameter": { "source": "payload", "name": "ref" From 8bcf4d53c635ed3fa0e421cf2b8aeb9d50c61ddb Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:32:36 +0100 Subject: [PATCH 271/326] backup and log folders --- deployment/bare_metal/backup/.gitkeep | 0 deployment/bare_metal/log/.gitkeep | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 deployment/bare_metal/backup/.gitkeep create mode 100644 deployment/bare_metal/log/.gitkeep diff --git a/deployment/bare_metal/backup/.gitkeep b/deployment/bare_metal/backup/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/deployment/bare_metal/log/.gitkeep b/deployment/bare_metal/log/.gitkeep new file mode 100644 index 000000000..e69de29bb From dafcdb6c8daa0c847a66e8a06a2ce093f35ab9c4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:34:19 +0100 Subject: [PATCH 272/326] ignore backup and log contents --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index de49b2fc1..b02b9d6ec 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,6 @@ package-lock.json /deployment/bare_metal/.env /deployment/bare_metal/nginx/sites-available/gradido.conf /deployment/bare_metal/nginx/sites-available/update-page.conf -/deployment/bare_metal/nginx/update-page/updating.html \ No newline at end of file +/deployment/bare_metal/nginx/update-page/updating.html +/deployment/bare_metal/log +/deployment/bare_metal/backup From 0363f93bd645e469c044b04087ce1791ddb2ea6a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:36:45 +0100 Subject: [PATCH 273/326] cleaned some comments --- deployment/bare_metal/install.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 43d2b4383..a92128a93 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -88,11 +88,6 @@ webhook -hooks ~/hooks.json & # create db user export DB_USER=gradido export DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); -# create table -#create database gradido_community -# DEFAULT CHARACTER SET utf8mb4 -# DEFAULT COLLATE utf8mb4_unicode_ci; -# GRANT ALL PRIVILEGES ON gradido_community.* TO '$DB_USER'@'localhost'; sudo mysql < $PROJECT_ROOT/admin/.env -#TODO import old database - # Start gradido # Note: on first startup some errors will occur - nothing serious ./start.sh \ No newline at end of file From b9bd92a426a0135b9ddba46098c0a0301c3fa33c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 09:57:06 +0100 Subject: [PATCH 274/326] backup script --- deployment/bare_metal/backup.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 deployment/bare_metal/backup.sh diff --git a/deployment/bare_metal/backup.sh b/deployment/bare_metal/backup.sh new file mode 100755 index 000000000..065787288 --- /dev/null +++ b/deployment/bare_metal/backup.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# This script will shut down all services, backup the whole database and restart the services + +# Find current directory & configure paths +set -o allexport +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) +PROJECT_ROOT=$SCRIPT_DIR/../.. +set +o allexport + +# Load backend .env for DB_USERNAME & DB_PASSWORD +set -o allexport +if [ -f "$PROJECT_ROOT/backend/.env" ]; then + source $PROJECT_ROOT/backend/.env +else + source $PROJECT_ROOT/backend/.env.dist +fi +set +o allexport + +# Stop Services +pm2 stop all + +# Backup data +mysqldump --all-databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} + +# Start Services +pm2 start all \ No newline at end of file From 5217b347be855298f217a704d08253183acd085e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 10:24:47 +0100 Subject: [PATCH 275/326] replace all $1 url variables with something meaningfull, since $1 is replaced in scripting --- admin/.env.dist | 2 +- admin/src/components/NavBar.vue | 2 +- admin/src/config/index.js | 2 +- backend/.env.dist | 3 ++- backend/.env.template | 1 + backend/src/config/index.ts | 5 +++-- backend/src/graphql/resolver/UserResolver.test.ts | 2 +- backend/src/graphql/resolver/UserResolver.ts | 6 +++--- deployment/bare_metal/.env.dist | 7 ++++--- frontend/.env.dist | 2 +- frontend/src/config/index.js | 2 +- frontend/src/views/Layout/DashboardLayout_gdd.vue | 2 +- 12 files changed, 20 insertions(+), 16 deletions(-) diff --git a/admin/.env.dist b/admin/.env.dist index 9d9a6fc4c..1419552be 100644 --- a/admin/.env.dist +++ b/admin/.env.dist @@ -1,4 +1,4 @@ GRAPHQL_URI=http://localhost:4000/graphql -WALLET_AUTH_URL=http://localhost/authenticate?token=$1 +WALLET_AUTH_URL=http://localhost/authenticate?token=$token WALLET_URL=http://localhost/login DEBUG_DISABLE_AUTH=false \ No newline at end of file diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index c1c315755..12936f554 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -38,7 +38,7 @@ export default { this.$store.dispatch('logout') }, wallet() { - window.location = CONFIG.WALLET_AUTH_URL.replace('$1', this.$store.state.token) + window.location = CONFIG.WALLET_AUTH_URL.replace('$token', this.$store.state.token) this.$store.dispatch('logout') // logout without redirect }, }, diff --git a/admin/src/config/index.js b/admin/src/config/index.js index 5bcf7938b..6e338fe9c 100644 --- a/admin/src/config/index.js +++ b/admin/src/config/index.js @@ -19,7 +19,7 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', - WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token=$1', + WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token=$token', WALLET_URL: process.env.WALLET_URL || 'http://localhost/login', } diff --git a/backend/.env.dist b/backend/.env.dist index 77fd9f6cc..1238d0f81 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -19,7 +19,8 @@ DB_DATABASE=gradido_community #RESEND_TIME= RESEND_TIME=10 -#EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/$1 +#EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/$code +#EMAIL_LINK_SETPASSWORD=http://localhost/reset/$code #KLICKTIPP_USER= #KLICKTIPP_PASSWORD= diff --git a/backend/.env.template b/backend/.env.template index 8611e93cf..a1cc3eb6b 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -19,6 +19,7 @@ EMAIL_SMTP_PORT=587 RESEND_TIME=10 EMAIL_LINK_VERIFICATION=$EMAIL_LINK_VERIFICATION +EMAIL_LINK_SETPASSWORD=$EMAIL_LINK_SETPASSWORD #KLICKTIPP_USER= #KLICKTIPP_PASSWORD= diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 8e1218f12..9306b2867 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -50,8 +50,9 @@ const email = { EMAIL_PASSWORD: process.env.EMAIL_PASSWORD || 'xxx', EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL || 'gmail.com', EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '587', - EMAIL_LINK_VERIFICATION: process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/$1', - EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/$1', + EMAIL_LINK_VERIFICATION: + process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/$code', + EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/$code', RESEND_TIME: isNaN(resendTime) ? 10 : resendTime, } diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 1f0bce30f..e5b7b9221 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -162,7 +162,7 @@ describe('UserResolver', () => { describe('account activation email', () => { it('sends an account activation email', () => { - const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/\$1/g, emailOptIn) + const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/\$code/g, emailOptIn) expect(sendAccountActivationEmail).toBeCalledWith({ link: activationLink, firstName: 'Peter', diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index b751eb633..e0afe1d19 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -448,7 +448,7 @@ export class UserResolver { const emailOptIn = await createEmailOptIn(loginUserId, queryRunner) const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( - /\$1/g, + /\$code/g, emailOptIn.verificationCode.toString(), ) const emailSent = await sendAccountActivationEmail({ @@ -486,7 +486,7 @@ export class UserResolver { const emailOptIn = await createEmailOptIn(loginUser.id, queryRunner) const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( - /\$1/g, + /\$code/g, emailOptIn.verificationCode.toString(), ) @@ -523,7 +523,7 @@ export class UserResolver { const optInCode = await getOptInCode(loginUser) const link = CONFIG.EMAIL_LINK_SETPASSWORD.replace( - /\$1/g, + /\$code/g, optInCode.verificationCode.toString(), ) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 9eaa2a0ed..322be071d 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -21,14 +21,15 @@ EMAIL_USERNAME=peter@lustig.de EMAIL_SENDER=peter@lustig.de EMAIL_PASSWORD=1234 EMAIL_SMTP_URL=smtp.lustig.de -EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$1 +EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$code +EMAIL_LINK_SETPASSWORD=http://stage1.gradido.net/reset/$code WEBHOOK_ELOPAGE_SECRET=secret # frontend GRAPHQL_URI=https://stage1.gradido.net/graphql -ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token=$1 +ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token=$token # admin -WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token=$1 +WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token=$token WALLET_URL=https://stage1.gradido.net/login \ No newline at end of file diff --git a/frontend/.env.dist b/frontend/.env.dist index 3602c4dd2..212290f2d 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,3 +1,3 @@ GRAPHQL_URI=http://localhost/graphql DEFAULT_PUBLISHER_ID=2896 -ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$1 \ No newline at end of file +ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$token \ No newline at end of file diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 000d5fb37..73ce85fa3 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,7 +20,7 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql', - ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$1', + ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$token', } const options = {} diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index bd3bd8e4c..d26d9325e 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -108,7 +108,7 @@ export default { this.balance -= ammount }, admin() { - window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('$1', this.$store.state.token)) + window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('$token', this.$store.state.token)) this.$store.dispatch('logout') // logout without redirect }, setVisible(bool) { From c6491b6504dd2b304f53e6c0d57ad14c52389d66 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 10:31:13 +0100 Subject: [PATCH 276/326] corrected https --- deployment/bare_metal/.env.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 322be071d..19a13515a 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -22,7 +22,7 @@ EMAIL_SENDER=peter@lustig.de EMAIL_PASSWORD=1234 EMAIL_SMTP_URL=smtp.lustig.de EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$code -EMAIL_LINK_SETPASSWORD=http://stage1.gradido.net/reset/$code +EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset/$code WEBHOOK_ELOPAGE_SECRET=secret From 186c2107e099343fbd6cadcd3379a92e93c6f3da Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 11:08:16 +0100 Subject: [PATCH 277/326] restore script --- deployment/bare_metal/backup.sh | 4 ++-- deployment/bare_metal/restore.sh | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100755 deployment/bare_metal/restore.sh diff --git a/deployment/bare_metal/backup.sh b/deployment/bare_metal/backup.sh index 065787288..e2473a30d 100755 --- a/deployment/bare_metal/backup.sh +++ b/deployment/bare_metal/backup.sh @@ -9,7 +9,7 @@ SCRIPT_DIR=$(dirname $SCRIPT_PATH) PROJECT_ROOT=$SCRIPT_DIR/../.. set +o allexport -# Load backend .env for DB_USERNAME & DB_PASSWORD +# Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE set -o allexport if [ -f "$PROJECT_ROOT/backend/.env" ]; then source $PROJECT_ROOT/backend/.env @@ -22,7 +22,7 @@ set +o allexport pm2 stop all # Backup data -mysqldump --all-databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} +mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE} # Start Services pm2 start all \ No newline at end of file diff --git a/deployment/bare_metal/restore.sh b/deployment/bare_metal/restore.sh new file mode 100755 index 000000000..aa70c0ba5 --- /dev/null +++ b/deployment/bare_metal/restore.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# This script will shut down all services, replace the whole database with the selected backup and restart the services + +# Find current directory & configure paths +set -o allexport +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) +PROJECT_ROOT=$SCRIPT_DIR/../.. +set +o allexport + +# Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE +set -o allexport +if [ -f "$PROJECT_ROOT/backend/.env" ]; then + source $PROJECT_ROOT/backend/.env +else + source $PROJECT_ROOT/backend/.env.dist +fi +set +o allexport + +# Stop Services +pm2 stop all + +# Backup data +mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-restore-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE} + +# Drop Database +mysql -u ${DB_USER} -p${DB_PASSWORD} < Date: Fri, 14 Jan 2022 11:34:09 +0100 Subject: [PATCH 278/326] remove drop database - its now included in the dump itself --- deployment/bare_metal/restore.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/deployment/bare_metal/restore.sh b/deployment/bare_metal/restore.sh index aa70c0ba5..fa11de28a 100755 --- a/deployment/bare_metal/restore.sh +++ b/deployment/bare_metal/restore.sh @@ -24,11 +24,6 @@ pm2 stop all # Backup data mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-restore-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE} -# Drop Database -mysql -u ${DB_USER} -p${DB_PASSWORD} < Date: Fri, 14 Jan 2022 13:12:49 +0100 Subject: [PATCH 279/326] Add pagination buttons to search users --- admin/src/graphql/searchUsers.js | 19 +++++++++++-------- admin/src/locales/de.json | 3 ++- admin/src/locales/en.json | 3 ++- admin/src/pages/Creation.vue | 2 +- admin/src/pages/UserSearch.vue | 29 +++++++++++++++++++++++------ 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/admin/src/graphql/searchUsers.js b/admin/src/graphql/searchUsers.js index cf6225338..643d6f188 100644 --- a/admin/src/graphql/searchUsers.js +++ b/admin/src/graphql/searchUsers.js @@ -1,14 +1,17 @@ import gql from 'graphql-tag' export const searchUsers = gql` - query ($searchText: String!) { - searchUsers(searchText: $searchText) { - userId - firstName - lastName - email - creation - emailChecked + query ($searchText: String!, $currentPage: Int, $notActivated: Boolean) { + searchUsers(searchText: $searchText, currentPage: $currentPage, notActivated: $notActivated) { + userCount + userList { + userId + firstName + lastName + email + creation + emailChecked + } } } ` diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 58f7b6714..72305cf3b 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -1,4 +1,5 @@ { + "all_emails": "Alle E-Mails", "bookmark": "bookmark", "confirmed": "bestätigt", "creation_form": { @@ -53,7 +54,7 @@ "transactionlist": { "title": "Alle geschöpften Transaktionen für den Nutzer" }, - "unregistered_emails": "Unregistrierte E-Mails", + "unregistered_emails": "Nur unregistrierte E-Mails", "unregister_mail": { "button": "Registrierungs-Email bestätigen, jetzt senden", "error": "Fehler beim Senden des Bestätigungs-Links an den Benutzer: {message}", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index a02782267..dad2a0ff5 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -1,4 +1,5 @@ { + "all_emails": "All e-mails", "bookmark": "Remember", "confirmed": "confirmed", "creation_form": { @@ -53,7 +54,7 @@ "transactionlist": { "title": "All creation-transactions for the user" }, - "unregistered_emails": "Unregistered e-mails", + "unregistered_emails": "Only unregistered e-mails", "unregister_mail": { "button": "Confirm registration email, send now", "error": "Error sending the confirmation link to the user: {message}", diff --git a/admin/src/pages/Creation.vue b/admin/src/pages/Creation.vue index 65e0b2f2f..5ab0954eb 100644 --- a/admin/src/pages/Creation.vue +++ b/admin/src/pages/Creation.vue @@ -116,7 +116,7 @@ export default { }, }) .then((result) => { - this.itemsList = result.data.searchUsers.map((user) => { + this.itemsList = result.data.searchUsers.userList.map((user) => { return { ...user, showDetails: false, diff --git a/admin/src/pages/UserSearch.vue b/admin/src/pages/UserSearch.vue index a5d4c05cf..403860238 100644 --- a/admin/src/pages/UserSearch.vue +++ b/admin/src/pages/UserSearch.vue @@ -3,7 +3,7 @@
- {{ $t('unregistered_emails') }} + {{ filterCheckedEmails ? $t('all_emails') : $t('unregistered_emails') }}
@@ -21,6 +21,14 @@ :fieldsTable="fields" :criteria="criteria" /> +
@@ -67,14 +75,15 @@ export default { beforeLastMonth: { short: this.$moment().subtract(2, 'month').format('MMMM'), }, + filterCheckedEmails: false, + rows: 0, + currentPage: 1, } }, - methods: { unconfirmedRegisterMails() { - this.searchResult = this.searchResult.filter((user) => { - return !user.emailChecked - }) + this.filterCheckedEmails = !this.filterCheckedEmails + this.getUsers() }, getUsers() { this.$apollo @@ -82,16 +91,24 @@ export default { query: searchUsers, variables: { searchText: this.criteria, + currentPage: this.currentPage, + notActivated: this.filterCheckedEmails, }, }) .then((result) => { - this.searchResult = result.data.searchUsers + this.rows = result.data.searchUsers.userCount + this.searchResult = result.data.searchUsers.userList }) .catch((error) => { this.$toasted.error(error.message) }) }, }, + watch: { + currentPage() { + this.getUsers() + }, + }, created() { this.getUsers() }, From d441931125fc3cc91fd65832c4a3becb57ee3ea2 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 14 Jan 2022 13:13:48 +0100 Subject: [PATCH 280/326] get pagination working --- backend/src/graphql/model/UserAdmin.ts | 11 ++++++++++- backend/src/graphql/resolver/AdminResolver.ts | 12 ++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/backend/src/graphql/model/UserAdmin.ts b/backend/src/graphql/model/UserAdmin.ts index befc203a5..9e28a33d6 100644 --- a/backend/src/graphql/model/UserAdmin.ts +++ b/backend/src/graphql/model/UserAdmin.ts @@ -1,4 +1,4 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' @ObjectType() export class UserAdmin { @@ -20,3 +20,12 @@ export class UserAdmin { @Field(() => Boolean) emailChecked: boolean } + +@ObjectType() +export class SearchUsersResult { + @Field(() => Int) + userCount: number + + @Field(() => [UserAdmin]) + userList: UserAdmin[] +} diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 1cf50197c..8a7e034a5 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -3,7 +3,7 @@ import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx } from 'type-graphql' import { getCustomRepository, Raw } from 'typeorm' -import { UserAdmin } from '../model/UserAdmin' +import { UserAdmin, SearchUsersResult } from '../model/UserAdmin' import { PendingCreation } from '../model/PendingCreation' import { CreatePendingCreations } from '../model/CreatePendingCreations' import { UpdatePendingCreation } from '../model/UpdatePendingCreation' @@ -27,10 +27,10 @@ import { LoginUserRepository } from '../../typeorm/repository/LoginUser' @Resolver() export class AdminResolver { @Authorized([RIGHTS.SEARCH_USERS]) - @Query(() => [UserAdmin]) + @Query(() => SearchUsersResult) async searchUsers( @Args() { searchText, currentPage = 1, pageSize = 25, notActivated = false }: SearchUsersArgs, - ): Promise { + ): Promise { const userRepository = getCustomRepository(UserRepository) const users = await userRepository.findBySearchCriteria(searchText) let adminUsers = await Promise.all( @@ -46,7 +46,11 @@ export class AdminResolver { }), ) if (notActivated) adminUsers = adminUsers.filter((u) => !u.emailChecked) - return adminUsers.slice(currentPage - 1, currentPage + pageSize - 1) + const first = (currentPage - 1) * pageSize + return { + userCount: adminUsers.length, + userList: adminUsers.slice(first, first + pageSize), + } } @Authorized([RIGHTS.CREATE_PENDING_CREATION]) From 5d9cc6ae24a8d3a583d4c4509c81a071986e461d Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 14 Jan 2022 13:18:34 +0100 Subject: [PATCH 281/326] get the tests working again --- admin/src/pages/Creation.spec.js | 35 ++++++++++++++++-------------- admin/src/pages/UserSearch.spec.js | 21 ++++++++++-------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/admin/src/pages/Creation.spec.js b/admin/src/pages/Creation.spec.js index fc8cdbaf0..9feffda45 100644 --- a/admin/src/pages/Creation.spec.js +++ b/admin/src/pages/Creation.spec.js @@ -6,22 +6,25 @@ const localVue = global.localVue const apolloQueryMock = jest.fn().mockResolvedValue({ data: { - searchUsers: [ - { - userId: 1, - firstName: 'Bibi', - lastName: 'Bloxberg', - email: 'bibi@bloxberg.de', - creation: [200, 400, 600], - }, - { - userId: 2, - firstName: 'Benjamin', - lastName: 'Blümchen', - email: 'benjamin@bluemchen.de', - creation: [800, 600, 400], - }, - ], + searchUsers: { + userCount: 2, + userList: [ + { + userId: 1, + firstName: 'Bibi', + lastName: 'Bloxberg', + email: 'bibi@bloxberg.de', + creation: [200, 400, 600], + }, + { + userId: 2, + firstName: 'Benjamin', + lastName: 'Blümchen', + email: 'benjamin@bluemchen.de', + creation: [800, 600, 400], + }, + ], + }, }, }) diff --git a/admin/src/pages/UserSearch.spec.js b/admin/src/pages/UserSearch.spec.js index b6d01b254..4beda0c49 100644 --- a/admin/src/pages/UserSearch.spec.js +++ b/admin/src/pages/UserSearch.spec.js @@ -5,15 +5,18 @@ const localVue = global.localVue const apolloQueryMock = jest.fn().mockResolvedValue({ data: { - searchUsers: [ - { - firstName: 'Bibi', - lastName: 'Bloxberg', - email: 'bibi@bloxberg.de', - creation: [200, 400, 600], - emailChecked: false, - }, - ], + searchUsers: { + userCount: 1, + userList: [ + { + firstName: 'Bibi', + lastName: 'Bloxberg', + email: 'bibi@bloxberg.de', + creation: [200, 400, 600], + emailChecked: false, + }, + ], + }, }, }) From d88c16a66c81cb59a94cccadc4babf76fcb7502c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 14 Jan 2022 13:32:44 +0100 Subject: [PATCH 282/326] pagination for user list on creation page --- admin/src/pages/Creation.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/admin/src/pages/Creation.vue b/admin/src/pages/Creation.vue index 5ab0954eb..60d9c427e 100644 --- a/admin/src/pages/Creation.vue +++ b/admin/src/pages/Creation.vue @@ -18,6 +18,13 @@ :creation="creation" @update-item="updateItem" /> + { + this.rows = result.data.searchUsers.userCount this.itemsList = result.data.searchUsers.userList.map((user) => { return { ...user, @@ -153,5 +164,13 @@ export default { this.itemsMassCreation = [] }, }, + watch: { + currentPage() { + this.getUsers() + }, + criteria() { + this.getUsers() + }, + }, } From 0c6d63331f465a17c1cd5058e8bf01ca217d3a23 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 14 Jan 2022 13:39:34 +0100 Subject: [PATCH 283/326] test watchers --- admin/src/pages/Creation.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/admin/src/pages/Creation.spec.js b/admin/src/pages/Creation.spec.js index 9feffda45..01a884f54 100644 --- a/admin/src/pages/Creation.spec.js +++ b/admin/src/pages/Creation.spec.js @@ -230,6 +230,22 @@ describe('Creation', () => { }) }) + describe('watchers', () => { + beforeEach(() => { + jest.clearAllMocks() + }) + + it('calls API when criteria changes', async () => { + await wrapper.setData({ criteria: 'XX' }) + expect(apolloQueryMock).toBeCalled() + }) + + it('calls API when currentPage changes', async () => { + await wrapper.setData({ currentPage: 2 }) + expect(apolloQueryMock).toBeCalled() + }) + }) + describe('apollo returns error', () => { beforeEach(() => { apolloQueryMock.mockRejectedValue({ From 90effb41b59c267797da57e366058450f9b468be Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 18:49:35 +0100 Subject: [PATCH 284/326] changed syntax again due to shell replacing $variables --- admin/.env.dist | 2 +- admin/src/components/NavBar.vue | 2 +- admin/src/config/index.js | 2 +- backend/.env.dist | 4 ++-- backend/src/config/index.ts | 4 ++-- backend/src/graphql/resolver/UserResolver.test.ts | 2 +- backend/src/graphql/resolver/UserResolver.ts | 6 +++--- deployment/bare_metal/.env.dist | 8 ++++---- frontend/.env.dist | 2 +- frontend/src/config/index.js | 2 +- frontend/src/views/Layout/DashboardLayout_gdd.vue | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/admin/.env.dist b/admin/.env.dist index 1419552be..66c84dda8 100644 --- a/admin/.env.dist +++ b/admin/.env.dist @@ -1,4 +1,4 @@ GRAPHQL_URI=http://localhost:4000/graphql -WALLET_AUTH_URL=http://localhost/authenticate?token=$token +WALLET_AUTH_URL=http://localhost/authenticate?token={token} WALLET_URL=http://localhost/login DEBUG_DISABLE_AUTH=false \ No newline at end of file diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index 12936f554..0e8ad8acf 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -38,7 +38,7 @@ export default { this.$store.dispatch('logout') }, wallet() { - window.location = CONFIG.WALLET_AUTH_URL.replace('$token', this.$store.state.token) + window.location = CONFIG.WALLET_AUTH_URL.replace('{token}', this.$store.state.token) this.$store.dispatch('logout') // logout without redirect }, }, diff --git a/admin/src/config/index.js b/admin/src/config/index.js index 6e338fe9c..f7d361c12 100644 --- a/admin/src/config/index.js +++ b/admin/src/config/index.js @@ -19,7 +19,7 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', - WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token=$token', + WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token={token}', WALLET_URL: process.env.WALLET_URL || 'http://localhost/login', } diff --git a/backend/.env.dist b/backend/.env.dist index 1238d0f81..2f7f02a78 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -19,8 +19,8 @@ DB_DATABASE=gradido_community #RESEND_TIME= RESEND_TIME=10 -#EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/$code -#EMAIL_LINK_SETPASSWORD=http://localhost/reset/$code +#EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/{code} +#EMAIL_LINK_SETPASSWORD=http://localhost/reset/{code} #KLICKTIPP_USER= #KLICKTIPP_PASSWORD= diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 9306b2867..4269802aa 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -51,8 +51,8 @@ const email = { EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL || 'gmail.com', EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '587', EMAIL_LINK_VERIFICATION: - process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/$code', - EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/$code', + process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/{code}', + EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/{code}', RESEND_TIME: isNaN(resendTime) ? 10 : resendTime, } diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index e5b7b9221..8aaf3b69e 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -162,7 +162,7 @@ describe('UserResolver', () => { describe('account activation email', () => { it('sends an account activation email', () => { - const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/\$code/g, emailOptIn) + const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/{code}/g, emailOptIn) expect(sendAccountActivationEmail).toBeCalledWith({ link: activationLink, firstName: 'Peter', diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index e0afe1d19..83e915bc7 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -448,7 +448,7 @@ export class UserResolver { const emailOptIn = await createEmailOptIn(loginUserId, queryRunner) const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( - /\$code/g, + /{code}/g, emailOptIn.verificationCode.toString(), ) const emailSent = await sendAccountActivationEmail({ @@ -486,7 +486,7 @@ export class UserResolver { const emailOptIn = await createEmailOptIn(loginUser.id, queryRunner) const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( - /\$code/g, + /{code}/g, emailOptIn.verificationCode.toString(), ) @@ -523,7 +523,7 @@ export class UserResolver { const optInCode = await getOptInCode(loginUser) const link = CONFIG.EMAIL_LINK_SETPASSWORD.replace( - /\$code/g, + /{code}/g, optInCode.verificationCode.toString(), ) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 19a13515a..684dc1eab 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -21,15 +21,15 @@ EMAIL_USERNAME=peter@lustig.de EMAIL_SENDER=peter@lustig.de EMAIL_PASSWORD=1234 EMAIL_SMTP_URL=smtp.lustig.de -EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$code -EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset/$code +EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/{code} +EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset/{code} WEBHOOK_ELOPAGE_SECRET=secret # frontend GRAPHQL_URI=https://stage1.gradido.net/graphql -ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token=$token +ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token} # admin -WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token=$token +WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token={token} WALLET_URL=https://stage1.gradido.net/login \ No newline at end of file diff --git a/frontend/.env.dist b/frontend/.env.dist index 212290f2d..f7bda826a 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,3 +1,3 @@ GRAPHQL_URI=http://localhost/graphql DEFAULT_PUBLISHER_ID=2896 -ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$token \ No newline at end of file +ADMIN_AUTH_URL=http://localhost/admin/authenticate?token={token} \ No newline at end of file diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 73ce85fa3..7e213e1d9 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,7 +20,7 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql', - ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$token', + ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token={token}', } const options = {} diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index d26d9325e..abee36082 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -108,7 +108,7 @@ export default { this.balance -= ammount }, admin() { - window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('$token', this.$store.state.token)) + window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('{token}', this.$store.state.token)) this.$store.dispatch('logout') // logout without redirect }, setVisible(bool) { From 0bd9fed2517e2679c2460928a9fec3cfb8152089 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 18:50:11 +0100 Subject: [PATCH 285/326] different .env include in scripts --- deployment/bare_metal/backup.sh | 12 ++++++------ deployment/bare_metal/install.sh | 8 ++++---- deployment/bare_metal/restore.sh | 12 ++++++------ deployment/bare_metal/start.sh | 9 ++++----- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/deployment/bare_metal/backup.sh b/deployment/bare_metal/backup.sh index e2473a30d..f562b033a 100755 --- a/deployment/bare_metal/backup.sh +++ b/deployment/bare_metal/backup.sh @@ -10,19 +10,19 @@ PROJECT_ROOT=$SCRIPT_DIR/../.. set +o allexport # Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE -set -o allexport +# NOTE: all config values will be in process.env when starting +# the services and will therefore take precedence over the .env if [ -f "$PROJECT_ROOT/backend/.env" ]; then - source $PROJECT_ROOT/backend/.env + export $(cat $PROJECT_ROOT/backend/.env | sed 's/#.*//g' | xargs) else - source $PROJECT_ROOT/backend/.env.dist + export $(cat $PROJECT_ROOT/backend/.env.dist | sed 's/#.*//g' | xargs) fi -set +o allexport # Stop Services -pm2 stop all +pm2 stop gradido-backend # Backup data mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE} # Start Services -pm2 start all \ No newline at end of file +pm2 start gradido-backend \ No newline at end of file diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index a92128a93..b8bd11d4e 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -11,13 +11,13 @@ PROJECT_ROOT=$SCRIPT_DIR/../.. set +o allexport # Load .env or .env.dist if not present -set -o allexport +# NOTE: all config values will be in process.env when starting +# the services and will therefore take precedence over the .env if [ -f "$SCRIPT_DIR/.env" ]; then - source $SCRIPT_DIR/.env + export $(cat $SCRIPT_DIR/.env | sed 's/#.*//g' | xargs) else - source $SCRIPT_DIR/.env.dist + export $(cat $SCRIPT_DIR/.env.dist | sed 's/#.*//g' | xargs) fi -set +o allexport # Configure git git config pull.ff only diff --git a/deployment/bare_metal/restore.sh b/deployment/bare_metal/restore.sh index fa11de28a..62041d9d7 100755 --- a/deployment/bare_metal/restore.sh +++ b/deployment/bare_metal/restore.sh @@ -10,16 +10,16 @@ PROJECT_ROOT=$SCRIPT_DIR/../.. set +o allexport # Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE -set -o allexport +# NOTE: all config values will be in process.env when starting +# the services and will therefore take precedence over the .env if [ -f "$PROJECT_ROOT/backend/.env" ]; then - source $PROJECT_ROOT/backend/.env + export $(cat $PROJECT_ROOT/backend/.env | sed 's/#.*//g' | xargs) else - source $PROJECT_ROOT/backend/.env.dist + export $(cat $PROJECT_ROOT/backend/.env.dist | sed 's/#.*//g' | xargs) fi -set +o allexport # Stop Services -pm2 stop all +pm2 stop gradido-backend # Backup data mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-restore-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE} @@ -33,4 +33,4 @@ EOFMYSQL yarn --cwd $PROJECT_ROOT/database up # Start Services -pm2 start all \ No newline at end of file +pm2 start gradido-backend \ No newline at end of file diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 2be5eaee4..5f182f453 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -11,14 +11,13 @@ NGINX_CONFIG_DIR=$SCRIPT_DIR/nginx/sites-available set +o allexport # Load .env or .env.dist if not present -set -o allexport -#TODO +# NOTE: all config values will be in process.env when starting +# the services and will therefore take precedence over the .env if [ -f "$SCRIPT_DIR/.env" ]; then - source $SCRIPT_DIR/.env + export $(cat $SCRIPT_DIR/.env | sed 's/#.*//g' | xargs) else - source $SCRIPT_DIR/.env.dist + export $(cat $SCRIPT_DIR/.env.dist | sed 's/#.*//g' | xargs) fi -set +o allexport # lock start if [ -f $LOCK_FILE ] ; then From 03350a76fbb8a46032c7aeb0b50f089972a3f057 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 19:07:36 +0100 Subject: [PATCH 286/326] removed unused ssl config for nginx --- .../old/setup_server_online_ubuntu18.sh | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/deployment/bare_metal/old/setup_server_online_ubuntu18.sh b/deployment/bare_metal/old/setup_server_online_ubuntu18.sh index e8f766424..8782fa3b4 100644 --- a/deployment/bare_metal/old/setup_server_online_ubuntu18.sh +++ b/deployment/bare_metal/old/setup_server_online_ubuntu18.sh @@ -1,39 +1,4 @@ # nginx security -sudo cat << "EOF" > ssl.conf -## - # SSL Settings - ## - - # disable SSLv3(enabled by default since nginx 0.8.19) since it's less secure then TLS http://en.wikipedia.org/wiki/Secure_Sockets_Layer#SSL_3.0 - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE - - # enables server-side protection from BEAST attacks - # http://blog.ivanristic.com/2013/09/is-beast-still-a-threat.html - ssl_prefer_server_ciphers on; - - # enable session resumption to improve https performance - # http://vincent.bernat.im/en/blog/2011-ssl-session-reuse-rfc5077.html - ssl_session_cache shared:SSL:50m; - ssl_session_timeout 1d; - ssl_session_tickets off; - - # ciphers chosen for forward secrecy and compatibility - # http://blog.ivanristic.com/2013/08/configuring-apache-nginx-and-openssl-for-forward-secrecy.html - ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; - - # enable ocsp stapling (mechanism by which a site can convey certificate revocation information to visitors in a privacy-preserving, scalable manner) - # http://blog.mozilla.org/security/2013/07/29/ocsp-stapling-in-firefox/ - resolver 8.8.8.8 8.8.4.4; - ssl_stapling on; - ssl_stapling_verify on; - # ssl_trusted_certificate /etc/nginx/ssl/star_forgott_com.crt; - - # config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security - # to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping - # also https://hstspreload.org/ - add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; -EOF - cd /etc/nginx/conf.d sudo cat < logging.conf log_format main '$http_x_forwarded_for - $remote_user [$time_local] ' From 430af1ade66519191014e867f9f532e09357a260 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 19:19:32 +0100 Subject: [PATCH 287/326] wildcard match for update page --- .../update-page.conf.ssl.template | 7 +++--- .../sites-available/update-page.conf.template | 24 +++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index 1724ac61e..851d5691d 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -25,10 +25,9 @@ server { root $NGINX_UPDATE_PAGE_ROOT; index updating.html; - #location / { - # alias $NGINX_UPDATE_PAGE_ROOT; - # index updating.html; - #} + location / { + try_files /updating.html =404; + } #access_log /var/log/nginx/access.log main; diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index edc191d54..7b7dd5c21 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -1,21 +1,19 @@ server { - server_name _; - listen 80; - listen [::]:80; + server_name _; + listen 80; + listen [::]:80; - include /etc/nginx/common/protect.conf; - include /etc/nginx/common/protect_add_header.conf; + include /etc/nginx/common/protect.conf; + include /etc/nginx/common/protect_add_header.conf; - root $NGINX_UPDATE_PAGE_ROOT; - index updating.html; + root $NGINX_UPDATE_PAGE_ROOT; + index updating.html; - #location / { - # alias $NGINX_UPDATE_PAGE_ROOT; - # index updating.html; - #} - - access_log /var/log/nginx/access.log main; + location / { + try_files /updating.html =404; + } + #access_log /var/log/nginx/access.log main; } From 0f0609bcb8be35fc2a7a9d6154b4a21cb9712179 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 19:31:12 +0100 Subject: [PATCH 288/326] try enabling gzip --- .../bare_metal/nginx/sites-available/gradido.conf.ssl.template | 1 + .../bare_metal/nginx/sites-available/gradido.conf.template | 1 + .../nginx/sites-available/update-page.conf.ssl.template | 2 ++ .../bare_metal/nginx/sites-available/update-page.conf.template | 2 ++ 4 files changed, 6 insertions(+) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 845cf56ad..ff098a793 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -24,6 +24,7 @@ server { #include /etc/nginx/common/ssl.conf; #gzip_static on; + gzip on; # Legacy URLS set $REWRITE_LEGACY_URLS "$NGINX_REWRITE_LEGACY_URLS"; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index e76140b56..9464f3a8d 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -9,6 +9,7 @@ server { #include /etc/nginx/common/ssl.conf; #gzip_static on; + gzip on; # Legacy URLS set $REWRITE_LEGACY_URLS "$NGINX_REWRITE_LEGACY_URLS"; diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index 851d5691d..d2205c883 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -22,6 +22,8 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; + gzip on; + root $NGINX_UPDATE_PAGE_ROOT; index updating.html; diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index 7b7dd5c21..79fc22de9 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -7,6 +7,8 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; + gzip on; + root $NGINX_UPDATE_PAGE_ROOT; index updating.html; From 4cf3920f8d799fb94d79379b124bb591d6367f70 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 19:35:43 +0100 Subject: [PATCH 289/326] try gzip_proxied any; to gzip proxy results --- .../bare_metal/nginx/sites-available/gradido.conf.ssl.template | 1 + .../bare_metal/nginx/sites-available/gradido.conf.template | 1 + 2 files changed, 2 insertions(+) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index ff098a793..9b099fded 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -25,6 +25,7 @@ server { #gzip_static on; gzip on; + gzip_proxied any; # Legacy URLS set $REWRITE_LEGACY_URLS "$NGINX_REWRITE_LEGACY_URLS"; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 9464f3a8d..0fa0bdf0c 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -10,6 +10,7 @@ server { #gzip_static on; gzip on; + gzip_proxied any; # Legacy URLS set $REWRITE_LEGACY_URLS "$NGINX_REWRITE_LEGACY_URLS"; From e48d7e732eacd130c542af54fa69ca184c3848da Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 19:42:46 +0100 Subject: [PATCH 290/326] define gzip types --- .../nginx/sites-available/gradido.conf.ssl.template | 8 ++++++++ .../nginx/sites-available/gradido.conf.template | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 9b099fded..4137b12a4 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -26,6 +26,14 @@ server { #gzip_static on; gzip on; gzip_proxied any; + gzip_types + text/css + text/javascript + text/xml + text/plain + application/javascript + application/x-javascript + application/json; # Legacy URLS set $REWRITE_LEGACY_URLS "$NGINX_REWRITE_LEGACY_URLS"; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 0fa0bdf0c..4d982f91c 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -11,6 +11,14 @@ server { #gzip_static on; gzip on; gzip_proxied any; + gzip_types + text/css + text/javascript + text/xml + text/plain + application/javascript + application/x-javascript + application/json; # Legacy URLS set $REWRITE_LEGACY_URLS "$NGINX_REWRITE_LEGACY_URLS"; From a5bb22335c1f5c1a41006f9e85180d68c429793d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 19:51:48 +0100 Subject: [PATCH 291/326] fail2ban rule is no longer needed - we server a 404 on vue not over nginx --- .../old/setup_server_online_ubuntu18.sh | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/deployment/bare_metal/old/setup_server_online_ubuntu18.sh b/deployment/bare_metal/old/setup_server_online_ubuntu18.sh index 8782fa3b4..86059a815 100644 --- a/deployment/bare_metal/old/setup_server_online_ubuntu18.sh +++ b/deployment/bare_metal/old/setup_server_online_ubuntu18.sh @@ -6,30 +6,6 @@ log_format main '$http_x_forwarded_for - $remote_user [$time_local] ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $request_time'; EOF - -# fail2ban enable blocking to many http request resulting in forbidden -echo "fail2ban config" -cd /etc/fail2ban/filter.d -sudo cat < nginx-forbidden.conf -[Definition] -failregex = ^.*\[error\] \d+#\d+: .* forbidden .*, client: , .*$ - -ignoreregex = -EOF - -cd /etc/fail2ban/jail.d -sudo cat < nginx-forbidden.conf -[nginx-forbidden] -enabled = true -filter = nginx-forbidden -port = http,https -logpath = /var/log/nginx/*error*.log -findtime = 60 -bantime = 6000 -maxretry = 3 -EOF - -sudo service fail2ban restart # phpmyadmin echo "install and secure phpmyadmin" From 86f1eef03822dab1ad29d53bb0a16fd1f7d27a73 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 14 Jan 2022 20:07:25 +0100 Subject: [PATCH 292/326] make the backup file a parameter --- deployment/bare_metal/restore.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deployment/bare_metal/restore.sh b/deployment/bare_metal/restore.sh index 62041d9d7..b7825d00c 100755 --- a/deployment/bare_metal/restore.sh +++ b/deployment/bare_metal/restore.sh @@ -9,6 +9,12 @@ SCRIPT_DIR=$(dirname $SCRIPT_PATH) PROJECT_ROOT=$SCRIPT_DIR/../.. set +o allexport +# Parameter is a proper file? +export BACKUP_FILE=${SCRIPT_DIR}/backup/$1 +if [ ! -f "$BACKUP_FILE" ]; then + return "File '$BACKUP_FILE' does not exist" 2>/dev/null || exit 1 +fi + # Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE # NOTE: all config values will be in process.env when starting # the services and will therefore take precedence over the .env @@ -26,7 +32,7 @@ mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIP # Restore Data mysql -u ${DB_USER} -p${DB_PASSWORD} < Date: Fri, 14 Jan 2022 20:31:00 +0100 Subject: [PATCH 293/326] typo --- deployment/bare_metal/restore.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/bare_metal/restore.sh b/deployment/bare_metal/restore.sh index b7825d00c..61baeb231 100755 --- a/deployment/bare_metal/restore.sh +++ b/deployment/bare_metal/restore.sh @@ -24,7 +24,7 @@ else export $(cat $PROJECT_ROOT/backend/.env.dist | sed 's/#.*//g' | xargs) fi -# Stop Services +# Stop gradido-backend service pm2 stop gradido-backend # Backup data @@ -38,5 +38,5 @@ EOFMYSQL # Update database if needed (use dev_up for seeding setups) yarn --cwd $PROJECT_ROOT/database up -# Start Services +# Start gradido-backend service pm2 start gradido-backend \ No newline at end of file From b8148eb21e47ab0feee5fa97bfe2faa06b9a15f0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 10:02:51 +0100 Subject: [PATCH 294/326] first test for nginx logging --- deployment/bare_metal/.env.dist | 1 + deployment/bare_metal/nginx/common/logging.conf | 4 ++++ .../sites-available/gradido.conf.ssl.template | 14 +++++++++++--- .../nginx/sites-available/gradido.conf.template | 14 +++++++++++--- .../sites-available/update-page.conf.ssl.template | 4 ++-- .../sites-available/update-page.conf.template | 3 ++- .../bare_metal/old/setup_server_online_ubuntu18.sh | 9 --------- 7 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 deployment/bare_metal/nginx/common/logging.conf diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 684dc1eab..3349e73b3 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -10,6 +10,7 @@ NGINX_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/stage1.gradido.net/privkey.pem NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page +NGINX_LOG_PATH=/home/gradido/gradido/deployment/bare_metal/log # webhook WEBHOOK_GITHUB_SECRET=secret diff --git a/deployment/bare_metal/nginx/common/logging.conf b/deployment/bare_metal/nginx/common/logging.conf new file mode 100644 index 000000000..feebfe814 --- /dev/null +++ b/deployment/bare_metal/nginx/common/logging.conf @@ -0,0 +1,4 @@ +log_format gradido_log '$http_x_forwarded_for - $remote_user [$time_local] ' + '"$request_method $scheme://$host$request_uri $server_protocol" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" $request_time'; \ No newline at end of file diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 4137b12a4..ea01e4a13 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -21,7 +21,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - #include /etc/nginx/common/ssl.conf; + include /etc/nginx/common/logging.conf #gzip_static on; gzip on; @@ -52,6 +52,8 @@ server { proxy_pass http://127.0.0.1:3000; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.frontend.log gradido_log; } # Backend @@ -65,6 +67,8 @@ server { proxy_pass http://127.0.0.1:4000; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.backend.log gradido_log; } # Backend webhooks @@ -78,11 +82,15 @@ server { proxy_pass http://127.0.0.1:4000/hook; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.backend.hook.log gradido_log; } # Webhook reverse proxy location /hooks/ { proxy_pass http://127.0.0.1:9000/hooks/; + + access_log $NGINX_LOG_PATH/nginx-access.hooks.log gradido_log; } # Admin Frontend @@ -96,6 +104,8 @@ server { proxy_pass http://127.0.0.1:8080/; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.admin.log gradido_log; } # TODO this could be a performance optimization @@ -108,6 +118,4 @@ server { # } # try_files $uri $uri/ /index.html = 404; #} - - #access_log /var/log/nginx/access.log main; } \ No newline at end of file diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 4d982f91c..bf315c0a6 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -6,7 +6,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - #include /etc/nginx/common/ssl.conf; + include /etc/nginx/common/logging.conf #gzip_static on; gzip on; @@ -37,6 +37,8 @@ server { proxy_pass http://127.0.0.1:3000; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.frontend.log gradido_log; } # Backend @@ -50,6 +52,8 @@ server { proxy_pass http://127.0.0.1:4000; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.backend.log gradido_log; } # Backend webhooks @@ -64,11 +68,15 @@ server { # no trailing slash to keep the hook/ prefix proxy_pass http://127.0.0.1:4000/hook; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.backend.hook.log gradido_log; } # Webhook reverse proxy location /hooks/ { proxy_pass http://127.0.0.1:9000/hooks/; + + access_log $NGINX_LOG_PATH/nginx-access.hooks.log gradido_log; } # Admin Frontend @@ -82,6 +90,8 @@ server { proxy_pass http://127.0.0.1:8080/; proxy_redirect off; + + access_log $NGINX_LOG_PATH/nginx-access.admin.log gradido_log; } # TODO this could be a performance optimization @@ -94,6 +104,4 @@ server { # } # try_files $uri $uri/ /index.html = 404; #} - - #access_log /var/log/nginx/access.log main; } \ No newline at end of file diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index d2205c883..01fee510a 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -21,6 +21,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; + include /etc/nginx/common/logging.conf gzip on; @@ -31,7 +32,6 @@ server { try_files /updating.html =404; } - #access_log /var/log/nginx/access.log main; - + access_log $NGINX_LOG_PATH/nginx-access.update-page.log gradido_log; } diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index 79fc22de9..a5f4fdfc1 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -6,6 +6,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; + include /etc/nginx/common/logging.conf gzip on; @@ -16,6 +17,6 @@ server { try_files /updating.html =404; } - #access_log /var/log/nginx/access.log main; + access_log $NGINX_LOG_PATH/nginx-access.update-page.log gradido_log; } diff --git a/deployment/bare_metal/old/setup_server_online_ubuntu18.sh b/deployment/bare_metal/old/setup_server_online_ubuntu18.sh index 86059a815..7cc267e33 100644 --- a/deployment/bare_metal/old/setup_server_online_ubuntu18.sh +++ b/deployment/bare_metal/old/setup_server_online_ubuntu18.sh @@ -1,12 +1,3 @@ -# nginx security -cd /etc/nginx/conf.d -sudo cat < logging.conf -log_format main '$http_x_forwarded_for - $remote_user [$time_local] ' - '"$request_method $scheme://$host$request_uri $server_protocol" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" $request_time'; -EOF - # phpmyadmin echo "install and secure phpmyadmin" sudo apt install phpmyadmin From 71d946957e310508d4864f16d9c5496e00583436 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 10:05:54 +0100 Subject: [PATCH 295/326] missing semicolon --- .../bare_metal/nginx/sites-available/gradido.conf.ssl.template | 2 +- .../bare_metal/nginx/sites-available/gradido.conf.template | 2 +- .../bare_metal/nginx/sites-available/update-page.conf.template | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index ea01e4a13..9b5f58f38 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -21,7 +21,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf + include /etc/nginx/common/logging.conf; #gzip_static on; gzip on; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index bf315c0a6..51c32091b 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -6,7 +6,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf + include /etc/nginx/common/logging.conf; #gzip_static on; gzip on; diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index a5f4fdfc1..7c5159639 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -6,7 +6,7 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf + include /etc/nginx/common/logging.conf; gzip on; From 4187383f043e9be4ccaa8ecfa37d3f9d2cb94811 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 10:12:06 +0100 Subject: [PATCH 296/326] use conf.d folder --- deployment/bare_metal/install.sh | 2 ++ deployment/bare_metal/nginx/{common => conf.d}/logging.conf | 0 .../bare_metal/nginx/sites-available/gradido.conf.ssl.template | 1 - .../bare_metal/nginx/sites-available/gradido.conf.template | 1 - .../nginx/sites-available/update-page.conf.ssl.template | 1 - .../bare_metal/nginx/sites-available/update-page.conf.template | 1 - 6 files changed, 2 insertions(+), 4 deletions(-) rename deployment/bare_metal/nginx/{common => conf.d}/logging.conf (100%) diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index b8bd11d4e..b7f06a1ff 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -40,6 +40,8 @@ sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/sites-available/gra # sudo ln -s /etc/nginx/sites-available/gradido.conf /etc/nginx/sites-enabled sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/sites-available/update-page.conf /etc/nginx/sites-available sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/common /etc/nginx/ +sudo rmdir /etc/nginx/conf.d +sudo ln -s /home/gradido/gradido/deployment/bare_metal/nginx/conf.d /etc/nginx/ # Allow nginx configuration and restart for gradido #TODO generate file diff --git a/deployment/bare_metal/nginx/common/logging.conf b/deployment/bare_metal/nginx/conf.d/logging.conf similarity index 100% rename from deployment/bare_metal/nginx/common/logging.conf rename to deployment/bare_metal/nginx/conf.d/logging.conf diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 9b5f58f38..d8f77391b 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -21,7 +21,6 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf; #gzip_static on; gzip on; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 51c32091b..59464c8f3 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -6,7 +6,6 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf; #gzip_static on; gzip on; diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index 01fee510a..5ef0f13aa 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -21,7 +21,6 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf gzip on; diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index 7c5159639..c83c8896a 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -6,7 +6,6 @@ server { include /etc/nginx/common/protect.conf; include /etc/nginx/common/protect_add_header.conf; - include /etc/nginx/common/logging.conf; gzip on; From 20ede53942808b27ebb891b3acc223fc25305e53 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 10:19:58 +0100 Subject: [PATCH 297/326] updated logging format --- deployment/bare_metal/nginx/conf.d/logging.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deployment/bare_metal/nginx/conf.d/logging.conf b/deployment/bare_metal/nginx/conf.d/logging.conf index feebfe814..a76e8fae7 100644 --- a/deployment/bare_metal/nginx/conf.d/logging.conf +++ b/deployment/bare_metal/nginx/conf.d/logging.conf @@ -1,4 +1,4 @@ -log_format gradido_log '$http_x_forwarded_for - $remote_user [$time_local] ' - '"$request_method $scheme://$host$request_uri $server_protocol" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" $request_time'; \ No newline at end of file +log_format gradido_log '$remote_addr - $remote_user [$time_local] ' + '"$request_method $status $request_uri"' + ' "$http_referer" "$http_user_agent"' + ' $server_protocol $body_bytes_sent $request_time'; \ No newline at end of file From da63312f65bd1f095b91a23ea5d5247e824a4be4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 10:42:46 +0100 Subject: [PATCH 298/326] some basic apollo logging --- backend/package.json | 1 + backend/src/server/plugins.ts | 3 ++ backend/yarn.lock | 60 +++++++++++++++++++++++++++++++++-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 65ce3c801..b61938044 100644 --- a/backend/package.json +++ b/backend/package.json @@ -18,6 +18,7 @@ }, "dependencies": { "@types/jest": "^27.0.2", + "apollo-log": "^1.1.0", "apollo-server-express": "^2.25.2", "apollo-server-testing": "^2.25.2", "axios": "^0.21.1", diff --git a/backend/src/server/plugins.ts b/backend/src/server/plugins.ts index 948f9ae1c..0bb5f9f98 100644 --- a/backend/src/server/plugins.ts +++ b/backend/src/server/plugins.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +import { ApolloLogPlugin } from 'apollo-log' + const plugins = [ { requestDidStart() { @@ -19,6 +21,7 @@ const plugins = [ } }, }, + ApolloLogPlugin(), ] export default plugins diff --git a/backend/yarn.lock b/backend/yarn.lock index 2c1603fbd..e01796c0c 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@apollo/protobufjs@1.2.2": +"@apollo/protobufjs@1.2.2", "@apollo/protobufjs@^1.0.3": version "1.2.2" resolved "https://registry.yarnpkg.com/@apollo/protobufjs/-/protobufjs-1.2.2.tgz#4bd92cd7701ccaef6d517cdb75af2755f049f87c" integrity sha512-vF+zxhPiLtkwxONs6YanSt1EpwpGilThpneExUN5K3tCymuxNnVq2yojTvnpRjv2QfsEIt/n7ozPIIzBLwGIDQ== @@ -1273,6 +1273,24 @@ apollo-link@^1.2.14: tslib "^1.9.3" zen-observable-ts "^0.8.21" +apollo-log@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/apollo-log/-/apollo-log-1.1.0.tgz#e21287c917cf735b77adc06f07034f965e9b24de" + integrity sha512-TciLu+85LSqk7t7ZGKrYN5jFiCcRMLujBjrLiOQGHGgVVkvmKlwK0oELSS9kiHQIhTq23p8qVVWb08spLpQ7Jw== + dependencies: + apollo-server-plugin-base "^0.10.4" + chalk "^4.1.0" + fast-safe-stringify "^2.0.7" + loglevelnext "^4.0.1" + nanoid "^3.1.20" + +apollo-reporting-protobuf@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/apollo-reporting-protobuf/-/apollo-reporting-protobuf-0.6.2.tgz#5572866be9b77f133916532b10e15fbaa4158304" + integrity sha512-WJTJxLM+MRHNUxt1RTl4zD0HrLdH44F2mDzMweBj1yHL0kSt8I1WwoiF/wiGVSpnG48LZrBegCaOJeuVbJTbtw== + dependencies: + "@apollo/protobufjs" "^1.0.3" + apollo-reporting-protobuf@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/apollo-reporting-protobuf/-/apollo-reporting-protobuf-0.8.0.tgz#ae9d967934d3d8ed816fc85a0d8068ef45c371b9" @@ -1280,6 +1298,13 @@ apollo-reporting-protobuf@^0.8.0: dependencies: "@apollo/protobufjs" "1.2.2" +apollo-server-caching@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/apollo-server-caching/-/apollo-server-caching-0.5.3.tgz#cf42a77ad09a46290a246810075eaa029b5305e1" + integrity sha512-iMi3087iphDAI0U2iSBE9qtx9kQoMMEWr6w+LwXruBD95ek9DWyj7OeC2U/ngLjRsXM43DoBDXlu7R+uMjahrQ== + dependencies: + lru-cache "^6.0.0" + apollo-server-caching@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/apollo-server-caching/-/apollo-server-caching-0.7.0.tgz#e6d1e68e3bb571cba63a61f60b434fb771c6ff39" @@ -1318,7 +1343,7 @@ apollo-server-core@^2.25.2: subscriptions-transport-ws "^0.9.19" uuid "^8.0.0" -apollo-server-env@^3.1.0: +apollo-server-env@^3.0.0, apollo-server-env@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/apollo-server-env/-/apollo-server-env-3.1.0.tgz#0733c2ef50aea596cc90cf40a53f6ea2ad402cd0" integrity sha512-iGdZgEOAuVop3vb0F2J3+kaBVi4caMoxefHosxmgzAbbSpvWehB8Y1QiSyyMeouYC38XNVk5wnZl+jdGSsWsIQ== @@ -1354,6 +1379,13 @@ apollo-server-express@^2.25.2: subscriptions-transport-ws "^0.9.19" type-is "^1.6.16" +apollo-server-plugin-base@^0.10.4: + version "0.10.4" + resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.10.4.tgz#fbf73f64f95537ca9f9639dd7c535eb5eeb95dcd" + integrity sha512-HRhbyHgHFTLP0ImubQObYhSgpmVH4Rk1BinnceZmwudIVLKrqayIVOELdyext/QnSmmzg5W7vF3NLGBcVGMqDg== + dependencies: + apollo-server-types "^0.6.3" + apollo-server-plugin-base@^0.13.0: version "0.13.0" resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.13.0.tgz#3f85751a420d3c4625355b6cb3fbdd2acbe71f13" @@ -1368,6 +1400,15 @@ apollo-server-testing@^2.25.2: dependencies: apollo-server-core "^2.25.2" +apollo-server-types@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-0.6.3.tgz#f7aa25ff7157863264d01a77d7934aa6e13399e8" + integrity sha512-aVR7SlSGGY41E1f11YYz5bvwA89uGmkVUtzMiklDhZ7IgRJhysT5Dflt5IuwDxp+NdQkIhVCErUXakopocFLAg== + dependencies: + apollo-reporting-protobuf "^0.6.2" + apollo-server-caching "^0.5.3" + apollo-server-env "^3.0.0" + apollo-server-types@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-0.9.0.tgz#ccf550b33b07c48c72f104fbe2876232b404848b" @@ -2559,6 +2600,11 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-safe-stringify@^2.0.7: + version "2.1.1" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" + integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== + fastq@^1.6.0: version "1.13.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" @@ -4008,6 +4054,11 @@ loglevel@^1.6.7: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw== +loglevelnext@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/loglevelnext/-/loglevelnext-4.0.1.tgz#4406c6348c243a35272ac75d7d8e4e60ecbcd011" + integrity sha512-/tlMUn5wqgzg9msy0PiWc+8fpVXEuYPq49c2RGyw2NAh0hSrgq6j/Z3YPnwWsILMoFJ+ZT6ePHnWUonkjDnq2Q== + long@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" @@ -4194,6 +4245,11 @@ named-placeholders@^1.1.2: dependencies: lru-cache "^4.1.3" +nanoid@^3.1.20: + version "3.1.32" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.32.tgz#8f96069e6239cc0a9ae8c0d3b41a3b4933a88c0a" + integrity sha512-F8mf7R3iT9bvThBoW4tGXhXFHCctyCiUUPrWF8WaTqa3h96d9QybkSeba43XVOOE3oiLfkVDe4bT8MeGmkrTxw== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" From 1422563c2aab47b2dc0603899faef1cfea572b61 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 10:57:05 +0100 Subject: [PATCH 299/326] define pm2 log paths --- deployment/bare_metal/.env.dist | 3 ++- .../nginx/sites-available/gradido.conf.ssl.template | 10 +++++----- .../nginx/sites-available/gradido.conf.template | 10 +++++----- .../sites-available/update-page.conf.ssl.template | 2 +- .../nginx/sites-available/update-page.conf.template | 2 +- deployment/bare_metal/start.sh | 6 +++--- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 3349e73b3..fa1b31d38 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -1,3 +1,5 @@ +GRADIDO_LOG_PATH=/home/gradido/gradido/deployment/bare_metal/log + # start script DEPLOY_SEED_DATA=false @@ -10,7 +12,6 @@ NGINX_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/stage1.gradido.net/privkey.pem NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page -NGINX_LOG_PATH=/home/gradido/gradido/deployment/bare_metal/log # webhook WEBHOOK_GITHUB_SECRET=secret diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index d8f77391b..5eadc2478 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -52,7 +52,7 @@ server { proxy_pass http://127.0.0.1:3000; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.frontend.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.frontend.log gradido_log; } # Backend @@ -67,7 +67,7 @@ server { proxy_pass http://127.0.0.1:4000; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.backend.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.backend.log gradido_log; } # Backend webhooks @@ -82,14 +82,14 @@ server { proxy_pass http://127.0.0.1:4000/hook; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.backend.hook.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.backend.hook.log gradido_log; } # Webhook reverse proxy location /hooks/ { proxy_pass http://127.0.0.1:9000/hooks/; - access_log $NGINX_LOG_PATH/nginx-access.hooks.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.hooks.log gradido_log; } # Admin Frontend @@ -104,7 +104,7 @@ server { proxy_pass http://127.0.0.1:8080/; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.admin.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log; } # TODO this could be a performance optimization diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 59464c8f3..f9797d72c 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -37,7 +37,7 @@ server { proxy_pass http://127.0.0.1:3000; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.frontend.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.frontend.log gradido_log; } # Backend @@ -52,7 +52,7 @@ server { proxy_pass http://127.0.0.1:4000; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.backend.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.backend.log gradido_log; } # Backend webhooks @@ -68,14 +68,14 @@ server { proxy_pass http://127.0.0.1:4000/hook; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.backend.hook.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.backend.hook.log gradido_log; } # Webhook reverse proxy location /hooks/ { proxy_pass http://127.0.0.1:9000/hooks/; - access_log $NGINX_LOG_PATH/nginx-access.hooks.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.hooks.log gradido_log; } # Admin Frontend @@ -90,7 +90,7 @@ server { proxy_pass http://127.0.0.1:8080/; proxy_redirect off; - access_log $NGINX_LOG_PATH/nginx-access.admin.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log; } # TODO this could be a performance optimization diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index 5ef0f13aa..832159d23 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -31,6 +31,6 @@ server { try_files /updating.html =404; } - access_log $NGINX_LOG_PATH/nginx-access.update-page.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.update-page.log gradido_log; } diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index c83c8896a..da0e5cf95 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -16,6 +16,6 @@ server { try_files /updating.html =404; } - access_log $NGINX_LOG_PATH/nginx-access.update-page.log gradido_log; + access_log $GRADIDO_LOG_PATH/nginx-access.update-page.log gradido_log; } diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 5f182f453..163ae88ef 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -82,7 +82,7 @@ cd $PROJECT_ROOT/backend yarn install yarn build pm2 delete gradido-backend -pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" +pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -o $GRADIDO_LOG_PATH/pm2.backend.log -e $GRADIDO_LOG_PATH/pm2.backend.error.log pm2 save # Install & build frontend @@ -91,7 +91,7 @@ cd $PROJECT_ROOT/frontend yarn install yarn build pm2 delete gradido-frontend -pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" +pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -o $GRADIDO_LOG_PATH/pm2.frontend.log -e $GRADIDO_LOG_PATH/pm2.frontend.error.log pm2 save # Install & build admin @@ -100,7 +100,7 @@ cd $PROJECT_ROOT/admin yarn install yarn build pm2 delete gradido-admin -pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" +pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -o $GRADIDO_LOG_PATH/pm2.admin.log -e $GRADIDO_LOG_PATH/pm2.admin.error.log pm2 save # let nginx showing gradido From 8a2d64e60954683ca43bad9fd1244e393cd86c63 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:02:20 +0100 Subject: [PATCH 300/326] only use one log file per server --- deployment/bare_metal/start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 163ae88ef..a607c181b 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -82,7 +82,7 @@ cd $PROJECT_ROOT/backend yarn install yarn build pm2 delete gradido-backend -pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -o $GRADIDO_LOG_PATH/pm2.backend.log -e $GRADIDO_LOG_PATH/pm2.backend.error.log +pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.log -e pm2 save # Install & build frontend @@ -91,7 +91,7 @@ cd $PROJECT_ROOT/frontend yarn install yarn build pm2 delete gradido-frontend -pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -o $GRADIDO_LOG_PATH/pm2.frontend.log -e $GRADIDO_LOG_PATH/pm2.frontend.error.log +pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -l $GRADIDO_LOG_PATH/pm2.frontend.log pm2 save # Install & build admin @@ -100,7 +100,7 @@ cd $PROJECT_ROOT/admin yarn install yarn build pm2 delete gradido-admin -pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -o $GRADIDO_LOG_PATH/pm2.admin.log -e $GRADIDO_LOG_PATH/pm2.admin.error.log +pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -l $GRADIDO_LOG_PATH/pm2.admin.log pm2 save # let nginx showing gradido From 8b3f6ea339f3ec005e2264a1a5da15a250945196 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:05:40 +0100 Subject: [PATCH 301/326] disable introspection when GRAPHIQL is disabled --- backend/src/server/createServer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index 201c420f6..c7459b189 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -74,6 +74,7 @@ const createServer = async (context: any = serverContext): Promise => { const apollo = new ApolloServer({ schema: await schema(), playground: CONFIG.GRAPHIQL, + introspection: CONFIG.GRAPHIQL, context, plugins, }) From 452a283306c7c40c9c25aab6822e31dc4f5bae9f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:12:12 +0100 Subject: [PATCH 302/326] typo --- deployment/bare_metal/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index a607c181b..bed188456 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -82,7 +82,7 @@ cd $PROJECT_ROOT/backend yarn install yarn build pm2 delete gradido-backend -pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.log -e +pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.log pm2 save # Install & build frontend From af09a166705c20687602b97155eeccc6b8ce44b5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:13:56 +0100 Subject: [PATCH 303/326] proper exit code --- deployment/bare_metal/start.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index bed188456..310d61f17 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -21,7 +21,8 @@ fi # lock start if [ -f $LOCK_FILE ] ; then - return "Already building!" 2>/dev/null || exit 1 + echo "Already building!" + exit 1 fi touch $LOCK_FILE From 57dd03e5f3872f3caa484ae26bb8aef4bbbfec8c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:20:36 +0100 Subject: [PATCH 304/326] timestamp for pm2 logs --- deployment/bare_metal/start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 310d61f17..6ce22c795 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -83,7 +83,7 @@ cd $PROJECT_ROOT/backend yarn install yarn build pm2 delete gradido-backend -pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.log +pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.log --log-date-format 'DD-MM HH:mm:ss.SSS' pm2 save # Install & build frontend @@ -92,7 +92,7 @@ cd $PROJECT_ROOT/frontend yarn install yarn build pm2 delete gradido-frontend -pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -l $GRADIDO_LOG_PATH/pm2.frontend.log +pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -l $GRADIDO_LOG_PATH/pm2.frontend.log --log-date-format 'DD-MM HH:mm:ss.SSS' pm2 save # Install & build admin @@ -101,7 +101,7 @@ cd $PROJECT_ROOT/admin yarn install yarn build pm2 delete gradido-admin -pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -l $GRADIDO_LOG_PATH/pm2.admin.log +pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -l $GRADIDO_LOG_PATH/pm2.admin.log --log-date-format 'DD-MM HH:mm:ss.SSS' pm2 save # let nginx showing gradido From 70728ec20789fe2dc3bfa8fdcc557a7a44d00b76 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:33:50 +0100 Subject: [PATCH 305/326] force NODE_ENV=production --- deployment/bare_metal/start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 6ce22c795..068aa2603 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -77,6 +77,9 @@ else yarn up fi +# TODO maybe handle this differently? +export NODE_ENV=production + # Install & build backend echo 'Updating backend
' >> $UPDATE_HTML cd $PROJECT_ROOT/backend From 119b97b8791c70d0c055a2b9690c7296a7c12bad Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:40:23 +0100 Subject: [PATCH 306/326] when building the ts sources we need dev mode --- deployment/bare_metal/start.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 068aa2603..4b0b6ea99 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -77,14 +77,13 @@ else yarn up fi -# TODO maybe handle this differently? -export NODE_ENV=production - # Install & build backend echo 'Updating backend
' >> $UPDATE_HTML cd $PROJECT_ROOT/backend yarn install yarn build +# TODO maybe handle this differently? +export NODE_ENV=production pm2 delete gradido-backend pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.log --log-date-format 'DD-MM HH:mm:ss.SSS' pm2 save From 64861404c7a956802c8ac5ab099c98af09d3be1f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 16 Jan 2022 11:44:21 +0100 Subject: [PATCH 307/326] also build frontends with development libraries --- deployment/bare_metal/start.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 4b0b6ea99..3d0589569 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -80,6 +80,8 @@ fi # Install & build backend echo 'Updating backend
' >> $UPDATE_HTML cd $PROJECT_ROOT/backend +# TODO maybe handle this differently? +unset NODE_ENV yarn install yarn build # TODO maybe handle this differently? @@ -91,8 +93,12 @@ pm2 save # Install & build frontend echo 'Updating frontend
' >> $UPDATE_HTML cd $PROJECT_ROOT/frontend +# TODO maybe handle this differently? +unset NODE_ENV yarn install yarn build +# TODO maybe handle this differently? +export NODE_ENV=production pm2 delete gradido-frontend pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -l $GRADIDO_LOG_PATH/pm2.frontend.log --log-date-format 'DD-MM HH:mm:ss.SSS' pm2 save @@ -100,8 +106,12 @@ pm2 save # Install & build admin echo 'Updating admin
' >> $UPDATE_HTML cd $PROJECT_ROOT/admin +# TODO maybe handle this differently? +unset NODE_ENV yarn install yarn build +# TODO maybe handle this differently? +export NODE_ENV=production pm2 delete gradido-admin pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -l $GRADIDO_LOG_PATH/pm2.admin.log --log-date-format 'DD-MM HH:mm:ss.SSS' pm2 save From cce0a7d926ab834c41ded1070a88f1cc4a371655 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 17 Jan 2022 10:13:57 +0100 Subject: [PATCH 308/326] also do nginx error log --- .../nginx/sites-available/gradido.conf.ssl.template | 4 ++++ .../bare_metal/nginx/sites-available/gradido.conf.template | 5 +++++ .../nginx/sites-available/update-page.conf.ssl.template | 1 + .../nginx/sites-available/update-page.conf.template | 1 + 4 files changed, 11 insertions(+) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 5eadc2478..b04c12208 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -53,6 +53,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.frontend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.frontend.log gradido_log; } # Backend @@ -68,6 +69,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.log gradido_log; } # Backend webhooks @@ -83,6 +85,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.hook.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.hook.log gradido_log; } # Webhook reverse proxy @@ -90,6 +93,7 @@ server { proxy_pass http://127.0.0.1:9000/hooks/; access_log $GRADIDO_LOG_PATH/nginx-access.hooks.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.hooks.log gradido_log; } # Admin Frontend diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index f9797d72c..0096c2824 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -38,6 +38,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.frontend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.frontend.log gradido_log; } # Backend @@ -53,6 +54,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.log gradido_log; } # Backend webhooks @@ -69,6 +71,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.hook.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.hook.log gradido_log; } # Webhook reverse proxy @@ -76,6 +79,7 @@ server { proxy_pass http://127.0.0.1:9000/hooks/; access_log $GRADIDO_LOG_PATH/nginx-access.hooks.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.hooks.log gradido_log; } # Admin Frontend @@ -91,6 +95,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.admin.log gradido_log; } # TODO this could be a performance optimization diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index 832159d23..7dbe36a7e 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -32,5 +32,6 @@ server { } access_log $GRADIDO_LOG_PATH/nginx-access.update-page.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.update-page.log gradido_log; } diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index da0e5cf95..b1f00b3d8 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -17,5 +17,6 @@ server { } access_log $GRADIDO_LOG_PATH/nginx-access.update-page.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.update-page.log gradido_log; } From b43740967f8556103f258959535fdb17818d555b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 17 Jan 2022 10:18:14 +0100 Subject: [PATCH 309/326] corrected nginx error_log configuration --- .../nginx/sites-available/gradido.conf.ssl.template | 9 +++++---- .../nginx/sites-available/gradido.conf.template | 10 +++++----- .../sites-available/update-page.conf.ssl.template | 2 +- .../nginx/sites-available/update-page.conf.template | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index b04c12208..aade0429b 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -53,7 +53,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.frontend.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.frontend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.frontend.log warn; } # Backend @@ -69,7 +69,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.backend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.log warn; } # Backend webhooks @@ -85,7 +85,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.hook.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.backend.hook.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.hook.log warn; } # Webhook reverse proxy @@ -93,7 +93,7 @@ server { proxy_pass http://127.0.0.1:9000/hooks/; access_log $GRADIDO_LOG_PATH/nginx-access.hooks.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.hooks.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.hooks.log warn; } # Admin Frontend @@ -109,6 +109,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.admin.log warn; } # TODO this could be a performance optimization diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 0096c2824..b4c7b3463 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -38,7 +38,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.frontend.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.frontend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.frontend.log warn; } # Backend @@ -54,7 +54,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.backend.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.log warn; } # Backend webhooks @@ -71,7 +71,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.backend.hook.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.backend.hook.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.backend.hook.log warn; } # Webhook reverse proxy @@ -79,7 +79,7 @@ server { proxy_pass http://127.0.0.1:9000/hooks/; access_log $GRADIDO_LOG_PATH/nginx-access.hooks.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.hooks.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.hooks.log warn; } # Admin Frontend @@ -95,7 +95,7 @@ server { proxy_redirect off; access_log $GRADIDO_LOG_PATH/nginx-access.admin.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.admin.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.admin.log warn; } # TODO this could be a performance optimization diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template index 7dbe36a7e..ddcb9ffc1 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.ssl.template @@ -32,6 +32,6 @@ server { } access_log $GRADIDO_LOG_PATH/nginx-access.update-page.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.update-page.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.update-page.log warn; } diff --git a/deployment/bare_metal/nginx/sites-available/update-page.conf.template b/deployment/bare_metal/nginx/sites-available/update-page.conf.template index b1f00b3d8..c26a705ce 100644 --- a/deployment/bare_metal/nginx/sites-available/update-page.conf.template +++ b/deployment/bare_metal/nginx/sites-available/update-page.conf.template @@ -17,6 +17,6 @@ server { } access_log $GRADIDO_LOG_PATH/nginx-access.update-page.log gradido_log; - error_log $GRADIDO_LOG_PATH/nginx-error.update-page.log gradido_log; + error_log $GRADIDO_LOG_PATH/nginx-error.update-page.log warn; } From 5b5d56e14f8f158b8d8543c9e4eca63774979b3b Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 17 Jan 2022 10:28:49 +0100 Subject: [PATCH 310/326] Set container-fluid in the parent div over the row that has been changed to row-fluid. --- frontend/src/views/Pages/AccountOverview.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Pages/AccountOverview.vue b/frontend/src/views/Pages/AccountOverview.vue index 5cb04d9f0..44062f4ec 100644 --- a/frontend/src/views/Pages/AccountOverview.vue +++ b/frontend/src/views/Pages/AccountOverview.vue @@ -1,7 +1,7 @@