From 94424f17a271f92ebdd827380c93debe4355ba2a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 21 Sep 2021 10:24:43 +0200 Subject: [PATCH 01/21] Fixed database tool to read .env config when built. --- database/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/package.json b/database/package.json index 4656dab43..172253cea 100644 --- a/database/package.json +++ b/database/package.json @@ -10,9 +10,9 @@ "scripts": { "build": "tsc --build", "clean": "tsc --build --clean", - "up": "cd build && node src/index.js up", - "down": "cd build && node src/index.js down", - "reset": "cd build && node src/index.js reset", + "up": "node build/src/index.js up", + "down": "node build/src/index.js down", + "reset": "node build/src/index.js reset", "dev_up": "nodemon -w ./ --ext ts --exec ts-node src/index.ts up", "dev_down": "nodemon -w ./ --ext ts --exec ts-node src/index.ts down", "dev_reset": "nodemon -w ./ --ext ts --exec ts-node src/index.ts reset", From cebf92c451fbc5c525019a9102a7a44beecb6e23 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 21 Sep 2021 10:34:56 +0200 Subject: [PATCH 02/21] fixed migrations directory to default to the production version. This is the downside of this patch - the .env file has to be different in dev and production version --- database/.env.dist | 5 ++++- database/src/config/index.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/database/.env.dist b/database/.env.dist index 8488fb1bf..07db5fd17 100644 --- a/database/.env.dist +++ b/database/.env.dist @@ -4,4 +4,7 @@ DB_USER=root DB_PASSWORD= DB_DATABASE=gradido_community MIGRATIONS_TABLE=migrations -MIGRATIONS_DIRECTORY=./migrations/ \ No newline at end of file +// This value is set to the default for the built version. +// Therefore you need to overwrite this when using the dev version +// MIGRATIONS_DIRECTORY=./migrations/ +MIGRATIONS_DIRECTORY=./build/migrations/ \ No newline at end of file diff --git a/database/src/config/index.ts b/database/src/config/index.ts index 908d40311..a6a7a3385 100644 --- a/database/src/config/index.ts +++ b/database/src/config/index.ts @@ -13,7 +13,7 @@ const database = { const migrations = { MIGRATIONS_TABLE: process.env.MIGRATIONS_TABLE || 'migrations', - MIGRATIONS_DIRECTORY: process.env.MIGRATIONS_DIRECTORY || './migrations/', + MIGRATIONS_DIRECTORY: process.env.MIGRATIONS_DIRECTORY || './build/migrations/', } const CONFIG = { ...database, ...migrations } From f9a40be53926270250777e9b732e5b36078680f0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 21 Sep 2021 19:18:08 +0200 Subject: [PATCH 03/21] use another .env file, else things get too complicated since production and dev .env's are no longer compatible to eachother --- database/.env.dist | 5 +---- database/build/.env.dist | 2 ++ database/package.json | 6 +++--- database/src/config/index.ts | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 database/build/.env.dist diff --git a/database/.env.dist b/database/.env.dist index 07db5fd17..8488fb1bf 100644 --- a/database/.env.dist +++ b/database/.env.dist @@ -4,7 +4,4 @@ DB_USER=root DB_PASSWORD= DB_DATABASE=gradido_community MIGRATIONS_TABLE=migrations -// This value is set to the default for the built version. -// Therefore you need to overwrite this when using the dev version -// MIGRATIONS_DIRECTORY=./migrations/ -MIGRATIONS_DIRECTORY=./build/migrations/ \ No newline at end of file +MIGRATIONS_DIRECTORY=./migrations/ \ No newline at end of file diff --git a/database/build/.env.dist b/database/build/.env.dist new file mode 100644 index 000000000..505546e1b --- /dev/null +++ b/database/build/.env.dist @@ -0,0 +1,2 @@ +// For production you need to put your env file in here. +// Please copy the dist file from the root folder in here and rename it to .env \ No newline at end of file diff --git a/database/package.json b/database/package.json index 172253cea..4656dab43 100644 --- a/database/package.json +++ b/database/package.json @@ -10,9 +10,9 @@ "scripts": { "build": "tsc --build", "clean": "tsc --build --clean", - "up": "node build/src/index.js up", - "down": "node build/src/index.js down", - "reset": "node build/src/index.js reset", + "up": "cd build && node src/index.js up", + "down": "cd build && node src/index.js down", + "reset": "cd build && node src/index.js reset", "dev_up": "nodemon -w ./ --ext ts --exec ts-node src/index.ts up", "dev_down": "nodemon -w ./ --ext ts --exec ts-node src/index.ts down", "dev_reset": "nodemon -w ./ --ext ts --exec ts-node src/index.ts reset", diff --git a/database/src/config/index.ts b/database/src/config/index.ts index a6a7a3385..908d40311 100644 --- a/database/src/config/index.ts +++ b/database/src/config/index.ts @@ -13,7 +13,7 @@ const database = { const migrations = { MIGRATIONS_TABLE: process.env.MIGRATIONS_TABLE || 'migrations', - MIGRATIONS_DIRECTORY: process.env.MIGRATIONS_DIRECTORY || './build/migrations/', + MIGRATIONS_DIRECTORY: process.env.MIGRATIONS_DIRECTORY || './migrations/', } const CONFIG = { ...database, ...migrations } From a404be1cfbc7ec9d70240caf9026b400ae5bb8d9 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 11:02:20 +0200 Subject: [PATCH 04/21] Added Email as parameter for the change language updateUserInfos. --- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index 7bd02cf4c..87a52d1a4 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -93,6 +93,7 @@ export default { .query({ query: updateUserInfos, variables: { + email: this.$store.email, language: this.$store.state.language, }, }) From 8a5b552a11d1f2a80c9b53fffc82fe1cede96173 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 11:32:46 +0200 Subject: [PATCH 05/21] In case of language switch success change language in store. --- .../views/Pages/UserProfile/UserCard_Language.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index 87a52d1a4..e0b5c3a72 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -23,13 +23,13 @@ {{ $t('language') }} - {{ $store.state.language }} + {{ $t(buildLanguage()) }}
- + @@ -93,17 +93,22 @@ export default { .query({ query: updateUserInfos, variables: { - email: this.$store.email, - language: this.$store.state.language, + email: this.$store.state.email, + locale: this.language, }, }) .then(() => { + this.$store.commit('language', this.language) this.cancelEdit() }) .catch((error) => { this.$toasted.error(error.message) }) }, + + buildLanguage() { + return 'languages.' + this.$store.state.language + }, }, } From a0b35dad239cc7b83965401e64b7f1f6339d597d Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 11:36:30 +0200 Subject: [PATCH 06/21] Changed the method name to something a bit more meaningfull. --- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index e0b5c3a72..055441aec 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -23,7 +23,7 @@ {{ $t('language') }} - {{ $t(buildLanguage()) }} + {{ $t(buildTagFromLanguageString()) }}
@@ -106,7 +106,7 @@ export default { }) }, - buildLanguage() { + buildTagFromLanguageString() { return 'languages.' + this.$store.state.language }, }, From 3ca200bb96b9cc3dcc3a8e6c656e5d0b2df9c11f Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 12:12:28 +0200 Subject: [PATCH 07/21] Added a success message in case where language has been switched. --- frontend/src/locales/de.json | 3 ++- frontend/src/locales/en.json | 3 ++- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 851f2a376..5db1c0a82 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -105,7 +105,8 @@ "language": "Sprache", "languages": { "de": "Deutsch", - "en": "English" + "en": "English", + "success": "Deine Sprache wurde erfolgreich geƤndert." }, "login": "Anmeldung", "logout": "Abmelden", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 4edf8e72d..9ca544440 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -105,7 +105,8 @@ "language": "Language", "languages": { "de": "Deutsch", - "en": "English" + "en": "English", + "success": "Your language has been successfully updated." }, "login": "Login", "logout": "Logout", diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index 055441aec..1bf9a8415 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -100,6 +100,7 @@ export default { .then(() => { this.$store.commit('language', this.language) this.cancelEdit() + this.$toasted.success(this.$t('languages.success')) }) .catch((error) => { this.$toasted.error(error.message) From 0acb58c2311d4bff8f77cdc4a68f2a6e4d454ef3 Mon Sep 17 00:00:00 2001 From: Einhornimmond Date: Wed, 22 Sep 2021 12:28:36 +0200 Subject: [PATCH 08/21] use database for migration test db, remove debug code --- .github/workflows/test.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e31fa6b7d..046d63681 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -413,22 +413,31 @@ jobs: needs: [build_test_community_server] services: mariadb: - image: gradido/mariadb:test + image: mariadb/server:10.5 env: MARIADB_ALLOW_EMPTY_PASSWORD: 1 MARIADB_USER: root - # ports: - # - 3306:3306 + MARIADB_DATABASE: gradido_community_test options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=5s --health-retries=3 + database: + image: gradido/database:production_up + build: + context: ./database + target: production_up + depends_on: + - mariadb + networks: + - internal-net + environment: + - NODE_ENV="production" + - DB_HOST=mariadb steps: - name: get mariadb container id run: echo "::set-output name=id::$(docker container ls | grep mariadb | awk '{ print $1 }')" id: mariadb_container - - name: show networks - run: echo "$(docker network ls)" - name: get automatic created network run: echo "::set-output name=id::$(docker network ls | grep github_network | awk '{ print $1 }')" id: network @@ -452,12 +461,6 @@ jobs: path: /tmp - name: Load Docker Image run: docker load < /tmp/community_server.tar - - # for debugging login-server - - name: check login-server - run: docker logs ${{ steps.login_server_container.outputs.id }} - - name: check mariadb - run: docker logs ${{ steps.mariadb_container.outputs.id }} ########################################################################## # UNIT TESTS BACKEND COMMUNITY-SERVER ####################################### ########################################################################## From 09e87526def054991b354132ee1a2314c7b2b5f1 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 12:29:21 +0200 Subject: [PATCH 09/21] Added a success message for language switch in profile. --- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index 1bf9a8415..d7a059715 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -62,6 +62,7 @@