From fea2c176b429d396a7ec26e8b40a904acee83bb9 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 27 Apr 2021 18:58:19 +0200 Subject: [PATCH 01/16] update skeema call to allow also for unsafe db updates --- skeema/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skeema/Dockerfile b/skeema/Dockerfile index 8c921ba23..f2eb27b66 100644 --- a/skeema/Dockerfile +++ b/skeema/Dockerfile @@ -25,4 +25,4 @@ COPY ./mariadb/.skeema.login ./gradido_login/.skeema COPY ./community_server/skeema/ . COPY ./mariadb/.skeema.community ./gradido_community/.skeema -CMD skeema push \ No newline at end of file +CMD skeema push --allow-unsafe \ No newline at end of file From 4eb712e2178de5cd1e70c285d972ed6a43cff788 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 27 Apr 2021 22:47:32 +0200 Subject: [PATCH 02/16] fixed frontend production docker build & refactored frontend file structure - frontend server runs on port 3000 by default - frontend production docker build successfully runs & builds - frontend production docker build is no longer reachable from the outside - moved server.js in subfolder run/ --- docker-compose.override.yml | 2 ++ docker-compose.yml | 6 +++--- frontend/.env.dist | 3 +-- frontend/Dockerfile | 13 ++++++------- frontend/package.json | 2 +- frontend/run/server.js | 14 ++++++++++++++ frontend/server.js | 7 ------- frontend/vue.config.js | 18 ++++++------------ 8 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 frontend/run/server.js delete mode 100644 frontend/server.js diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 5a505478b..944f8d976 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -8,6 +8,8 @@ services: image: gradido/frontend:development build: target: development + networks: + - external-net environment: - NODE_ENV="development" # - DEBUG=true diff --git a/docker-compose.yml b/docker-compose.yml index 8b5bf33de..59e617d71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,13 +15,13 @@ services: context: ./frontend target: production networks: - - external-net + - internal-net ports: - - 8080:8080 + - 3000:3000 environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" - # - PORT="8080" + # - PORT=3000 - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT diff --git a/frontend/.env.dist b/frontend/.env.dist index 39edd4b4e..7815be556 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,3 +1,2 @@ LOGIN_API_URL=http://localhost/login_api/ -COMMUNITY_API_URL=http://localhost/api/ -VUE_PATH=/vue +COMMUNITY_API_URL=http://localhost/api/ \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f133926b2..5ec90fe81 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -15,7 +15,7 @@ ENV BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs -ENV PORT="8080" +ENV PORT="3000" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" @@ -82,15 +82,14 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/dist ./dist -#COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules -#COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js +# We also copy the node_modules express and serve-static for the run script +COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules # Copy static files -# TODO - this should be one Folder containign all stuff needed to be copied -#COPY --from=build ${DOCKER_WORKDIR}/constants ./constants -#COPY --from=build ${DOCKER_WORKDIR}/static ./static -#COPY --from=build ${DOCKER_WORKDIR}/locales ./locales +COPY --from=build ${DOCKER_WORKDIR}/public ./public # Copy package.json for script definitions (lock file should not be needed) COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json +# Copy run scripts run/ +COPY --from=build ${DOCKER_WORKDIR}/run ./run # Run command CMD /bin/sh -c "yarn run start" diff --git a/frontend/package.json b/frontend/package.json index 00e0ca45b..222061847 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.9.4", "private": true, "scripts": { - "start": "node server.js", + "start": "node run/server.js", "serve": "vue-cli-service serve --open", "build": "vue-cli-service build", "lint": "eslint --ext .js,.vue .", diff --git a/frontend/run/server.js b/frontend/run/server.js new file mode 100644 index 000000000..470acdc4e --- /dev/null +++ b/frontend/run/server.js @@ -0,0 +1,14 @@ +// Imports +const express = require('express') +const serveStatic = require('serve-static') + +// Port +const port = process.env.PORT || 3000 + +// Express Server +const app = express() +app.use(serveStatic(__dirname + '/../dist')) +app.listen(port) + +// eslint-disable-next-line no-console +console.log(`http://frontend:${port} server started.`) diff --git a/frontend/server.js b/frontend/server.js deleted file mode 100644 index 5bcebd90a..000000000 --- a/frontend/server.js +++ /dev/null @@ -1,7 +0,0 @@ -var express = require('express') -var serveStatic = require('serve-static') -var app = express() -app.use(serveStatic(__dirname + '/dist')) -var port = process.env.PORT || 5000 -app.listen(port) -// console.log('http://localhost:5000 server started.'); diff --git a/frontend/vue.config.js b/frontend/vue.config.js index ad2c10585..3d196b0c7 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,17 +1,11 @@ const path = require('path') const dotenv = require('dotenv-webpack') -function resolveSrc(_path) { - return path.join(__dirname, _path) -} - -let vue_path = process.env.VUE_PATH -if (vue_path == undefined) { - vue_path = '/vue' -} - // vue.config.js module.exports = { + devServer: { + port: process.env.PORT || 3000, + }, pluginOptions: { i18n: { locale: 'de', @@ -21,12 +15,12 @@ module.exports = { }, }, lintOnSave: true, - publicPath: vue_path + '/', + // publicPath: '/', configureWebpack: { // Set up all the aliases we use in our app. resolve: { alias: { - assets: resolveSrc('src/assets'), + assets: path.join(__dirname, 'src/assets'), }, }, plugins: [new dotenv()], @@ -35,5 +29,5 @@ module.exports = { // Enable CSS source maps. sourceMap: process.env.NODE_ENV !== 'production', }, - outputDir: path.resolve(__dirname, './dist' + vue_path), + outputDir: path.resolve(__dirname, './dist'), } From 47203915999b68822914e73fcd7d5724437ba22a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 28 Apr 2021 03:19:33 +0200 Subject: [PATCH 03/16] nginx fix for vue interface - localhost/vue resolves to frontend - localhost:3000/vue resolves to frontend in development - images are resolved properly - remaining services are reachable as normal - fixed image path to be relative instead of absolute - cleaned nginx config --- community_server/webroot/.htaccess | 1 + frontend/src/routes/router.js | 1 + frontend/src/views/KontoOverview/GddSend.vue | 2 +- frontend/vue.config.js | 2 +- nginx/nginx.conf | 73 +++++++------------- 5 files changed, 30 insertions(+), 49 deletions(-) diff --git a/community_server/webroot/.htaccess b/community_server/webroot/.htaccess index f5f2d631c..7f19fb980 100644 --- a/community_server/webroot/.htaccess +++ b/community_server/webroot/.htaccess @@ -1,5 +1,6 @@ RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !^/vue RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] diff --git a/frontend/src/routes/router.js b/frontend/src/routes/router.js index 6671a8de9..6d2963db5 100644 --- a/frontend/src/routes/router.js +++ b/frontend/src/routes/router.js @@ -6,6 +6,7 @@ Vue.use(VueRouter) // configure router const router = new VueRouter({ + base: '/vue', routes, // short for routes: routes linkActiveClass: 'active', mode: 'history', diff --git a/frontend/src/views/KontoOverview/GddSend.vue b/frontend/src/views/KontoOverview/GddSend.vue index 7230e6326..74acb3f46 100644 --- a/frontend/src/views/KontoOverview/GddSend.vue +++ b/frontend/src/views/KontoOverview/GddSend.vue @@ -10,7 +10,7 @@ - + diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 3d196b0c7..0ff92c052 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -15,7 +15,7 @@ module.exports = { }, }, lintOnSave: true, - // publicPath: '/', + publicPath: '/vue', configureWebpack: { // Set up all the aliases we use in our app. resolve: { diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 4f3aff146..cfe30b2ac 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,5 +1,3 @@ - - server { listen 80 ; @@ -8,12 +6,10 @@ 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/ssl.conf; root /var/www/cakephp/webroot; - index index.php; - + index index.php; location ~ \.php$ { fastcgi_pass community-server:9000; @@ -23,7 +19,6 @@ server { fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; include fastcgi_params; - } location ~ /\.ht { @@ -31,65 +26,49 @@ server { } location /account { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_cache_bypass $http_upgrade; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $host; - rewrite /account/(.*) /$1 break; - - #proxy_next_upstream error timeout invalid_header http_502 non_idempotent; - proxy_pass http://login-server:1200; - proxy_redirect off; - + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + rewrite /account/(.*) /$1 break; + proxy_pass http://login-server:1200; + proxy_redirect off; } location /login_api { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_cache_bypass $http_upgrade; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $host; - rewrite /login_api/(.*) /$1 break; - - proxy_pass http://login-server:1201; - proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + rewrite /login_api/(.*) /$1 break; + + proxy_pass http://login-server:1201; + proxy_redirect off; } location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php?$args; } location /vue { - - location /vue/sockjs-node { - rewrite /vue/(.*) /$1; - } - location ~* \.(png) { - expires 1d; - rewrite /vue/(.*) /$1; - } - - #try_files /vue/$uri /vue/$uri/ /index.html; - proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; - #rewrite /vue/(.*) /$1 break; - - proxy_pass http://frontend:8080; + + proxy_pass http://frontend:3000; proxy_redirect off; } # access_log /var/log/nginx/access.log main; - } \ No newline at end of file From c5967c3f8db9fda303e650f807e43250e3ae090a Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 28 Apr 2021 11:11:48 +0200 Subject: [PATCH 04/16] loading spinner on login --- frontend/package.json | 1 + frontend/src/plugins/dashboard-plugin.js | 5 +++++ frontend/src/views/Layout/AuthLayout_gdd.vue | 16 ++++++++++++++++ frontend/src/views/Pages/Login.vue | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/frontend/package.json b/frontend/package.json index 00e0ca45b..18e561232 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -69,6 +69,7 @@ "vue-good-table": "^2.21.3", "vue-i18n": "^8.22.4", "vue-jest": "^3.0.7", + "vue-loading-overlay": "^3.4.2", "vue-moment": "^4.1.0", "vue-qrcode": "^0.3.5", "vue-qrcode-reader": "^2.3.16", diff --git a/frontend/src/plugins/dashboard-plugin.js b/frontend/src/plugins/dashboard-plugin.js index 9b6e350dc..881fecf7d 100755 --- a/frontend/src/plugins/dashboard-plugin.js +++ b/frontend/src/plugins/dashboard-plugin.js @@ -37,6 +37,10 @@ import 'vue-good-table/dist/vue-good-table.css' import VueMoment from 'vue-moment' +import Loading from 'vue-loading-overlay' +// import the styles +import 'vue-loading-overlay/dist/vue-loading.css' + Object.keys(rules).forEach((rule) => { extend(rule, { ...rules[rule], // copies rule configuration @@ -56,6 +60,7 @@ export default { Vue.use(VueQrcodeReader) Vue.use(VueQrcode) Vue.use(VueFlatPickr) + Vue.use(Loading) configure({ classes: { valid: 'is-valid', diff --git a/frontend/src/views/Layout/AuthLayout_gdd.vue b/frontend/src/views/Layout/AuthLayout_gdd.vue index 5da4d8386..0e963e2ba 100644 --- a/frontend/src/views/Layout/AuthLayout_gdd.vue +++ b/frontend/src/views/Layout/AuthLayout_gdd.vue @@ -1,5 +1,6 @@