Closed eddybl closed 1 week ago
If accessing localhost/login
URL gets an 404 error, it is frontend issue.
For local login, default configuration is OK.
The login page is in frontend/src/pages
folder, whereas others pages are in frontend/src/components
folder.
Just now, I built frontend with Node.js 20.12.2 and put stuff in dist
to /var/www/html
directory in a Debian virtual machine, and the login page can be accessed, so Node.js 20.12.2 should be OK.
I am not familiar with Docker, perhaps I need to learn it and try to reproduce the issue.
Well if this is a pure frontend issue, docker should play no role here.
This is the log from the frontend build:
[internal] load build definition from Dockerfile-frontend
transferring 382/0 0.004
[internal] load metadata for docker.io/library/httpd:latest
[internal] load metadata for docker.io/library/node:20.12.2-alpine3.19
[internal] load .dockerignore
[internal] load build context
transferring 10692/0 0.007
[build 1/7] FROM docker.io/library/node:20.12.2-alpine3.19@sha256:7a91aa397f2e2dfbfcdad2e2d72599f374e0b0172be1d86eeb73f1d33f36a4b2
[stage-1 1/2] FROM docker.io/library/httpd:latest@sha256:36c8c79f900108f0f09fd4148ad35ade57cba0dc19d13f3d15be24ce94e6a639
[build 2/7] COPY ./clog /opt/clog/
[build 3/7] WORKDIR /opt/clog/frontend
[build 4/7] COPY configuration/frontend.js config/src/configuration.js
[build 5/7] RUN npm install -g npm@latest
changed 55 packages in 3s
25 packages are looking for funding
run `npm fund` for details
[build 6/7] RUN npm ci
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
added 1822 packages, and audited 1823 packages in 12s
141 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
[build 7/7] RUN npm run build
> clog-frontend@2.1.2 build
> vue-cli-service build
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
- Building legacy bundle for production...
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
WARNING Compiled with 3 warnings2:04:18 PM
[eslint]
/opt/clog/frontend/src/App.vue
283:17 warning Unexpected console statement no-console
292:17 warning Unexpected console statement no-console
302:13 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/LogCreate.vue
122:5 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/LogDetail.vue
209:5 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/LogEdit.vue
122:5 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/Logbook.vue
228:5 warning Unexpected console statement no-console
347:21 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/OAuth.vue
47:17 warning Unexpected console statement no-console
51:17 warning Unexpected console statement no-console
52:17 warning Unexpected console statement no-console
62:17 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/UserManagement.vue
218:4 warning Unexpected console statement no-console
/opt/clog/frontend/src/pages/Login.vue
86:6 warning Unexpected console statement no-console
88:6 warning Unexpected console statement no-console
94:6 warning Unexpected console statement no-console
97:6 warning Unexpected console statement no-console
98:6 warning Unexpected console statement no-console
109:6 warning Unexpected console statement no-console
112:6 warning Unexpected console statement no-console
113:6 warning Unexpected console statement no-console
/opt/clog/frontend/src/pages/emailLink/ResetPassword.vue
33:9 warning Unexpected console statement no-console
/opt/clog/frontend/src/service/AuthenticationService.js
75:17 warning Unexpected console statement no-console
82:17 warning Unexpected console statement no-console
/opt/clog/frontend/src/store/authentication_store.js
24:25 warning Unexpected console statement no-console
33:25 warning Unexpected console statement no-console
47:25 warning Unexpected console statement no-console
56:25 warning Unexpected console statement no-console
70:25 warning Unexpected console statement no-console
79:25 warning Unexpected console statement no-console
â 30 problems (0 errors, 30 warnings)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
img/primeicons.943ab24c.svg (285 KiB)
img/fontawesome-webfont.da909aa0.svg (434 KiB)
css/chunk-vendors.034747d8.css (911 KiB)
js/chunk-vendors-legacy.e430f31e.js (2.67 MiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (3.64 MiB)
css/chunk-vendors.034747d8.css
js/chunk-vendors-legacy.e430f31e.js
css/app.90545477.css
js/app-legacy.69e5483d.js
File Size Gzipped
dist/js/chunk-vendors-legacy.e430f31e. 2735.67 KiB 742.03 KiB
js
dist/js/809-legacy.84fc28bd.js 199.56 KiB 67.14 KiB
dist/js/app-legacy.69e5483d.js 74.20 KiB 24.24 KiB
dist/js/414-legacy.dc968c83.js 34.74 KiB 12.16 KiB
dist/js/225-legacy.5ba65a16.js 21.61 KiB 8.30 KiB
dist/js/747-legacy.503361e0.js 18.13 KiB 5.26 KiB
dist/js/198-legacy.3411514f.js 17.01 KiB 5.10 KiB
dist/js/435-legacy.56c5bc94.js 14.17 KiB 3.18 KiB
dist/js/724-legacy.ec14fbab.js 13.79 KiB 6.62 KiB
dist/js/951-legacy.eff7899d.js 11.65 KiB 3.43 KiB
dist/js/925-legacy.1f202679.js 10.51 KiB 3.29 KiB
dist/js/29-legacy.d739dfd5.js 9.94 KiB 3.42 KiB
dist/js/67-legacy.f386bdfb.js 8.75 KiB 2.35 KiB
dist/js/403-legacy.367654e7.js 8.74 KiB 2.32 KiB
dist/js/826-legacy.25898e78.js 2.22 KiB 1.01 KiB
dist/js/972-legacy.b2155c9b.js 1.25 KiB 0.72 KiB
dist/js/947-legacy.10869797.js 0.73 KiB 0.47 KiB
dist/js/42-legacy.3ba6a1c0.js 0.72 KiB 0.47 KiB
dist/css/chunk-vendors.034747d8.css 910.57 KiB 105.27 KiB
dist/css/app.90545477.css 6.30 KiB 2.05 KiB
dist/css/198.bd92c69b.css 0.32 KiB 0.22 KiB
dist/css/29.9cbbfce6.css 0.25 KiB 0.17 KiB
dist/css/414.b83a07e5.css 0.16 KiB 0.14 KiB
dist/css/225.d971aa34.css 0.11 KiB 0.09 KiB
dist/css/925.e9f32802.css 0.11 KiB 0.09 KiB
dist/css/403.1b1b7273.css 0.08 KiB 0.09 KiB
dist/css/435.2bd98623.css 0.08 KiB 0.09 KiB
dist/css/67.4780787e.css 0.08 KiB 0.09 KiB
dist/css/747.8c405c4f.css 0.08 KiB 0.09 KiB
dist/css/951.2ae8bde1.css 0.08 KiB 0.09 KiB
Images and other types of assets omitted.
Build at: 2024-04-25T14:04:18.800Z - Hash: 67df7eb70c0c71ce - Time: 16944ms
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
- Building module bundle for production...
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
[1m[33m[@vue/compiler-sfc][0m[33m ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.[0m
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
WARNING Compiled with 3 warnings2:04:35 PM
[eslint]
/opt/clog/frontend/src/App.vue
283:17 warning Unexpected console statement no-console
292:17 warning Unexpected console statement no-console
302:13 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/LogCreate.vue
122:5 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/LogDetail.vue
209:5 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/LogEdit.vue
122:5 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/Logbook.vue
228:5 warning Unexpected console statement no-console
347:21 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/OAuth.vue
47:17 warning Unexpected console statement no-console
51:17 warning Unexpected console statement no-console
52:17 warning Unexpected console statement no-console
62:17 warning Unexpected console statement no-console
/opt/clog/frontend/src/components/UserManagement.vue
218:4 warning Unexpected console statement no-console
/opt/clog/frontend/src/pages/Login.vue
86:6 warning Unexpected console statement no-console
88:6 warning Unexpected console statement no-console
94:6 warning Unexpected console statement no-console
97:6 warning Unexpected console statement no-console
98:6 warning Unexpected console statement no-console
109:6 warning Unexpected console statement no-console
112:6 warning Unexpected console statement no-console
113:6 warning Unexpected console statement no-console
/opt/clog/frontend/src/pages/emailLink/ResetPassword.vue
33:9 warning Unexpected console statement no-console
/opt/clog/frontend/src/service/AuthenticationService.js
75:17 warning Unexpected console statement no-console
82:17 warning Unexpected console statement no-console
/opt/clog/frontend/src/store/authentication_store.js
24:25 warning Unexpected console statement no-console
33:25 warning Unexpected console statement no-console
47:25 warning Unexpected console statement no-console
56:25 warning Unexpected console statement no-console
70:25 warning Unexpected console statement no-console
79:25 warning Unexpected console statement no-console
â 30 problems (0 errors, 30 warnings)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
img/primeicons.943ab24c.svg (285 KiB)
img/fontawesome-webfont.da909aa0.svg (434 KiB)
css/chunk-vendors.034747d8.css (911 KiB)
js/chunk-vendors.6f2b6b7f.js (2.63 MiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (3.59 MiB)
css/chunk-vendors.034747d8.css
js/chunk-vendors.6f2b6b7f.js
css/app.90545477.css
js/app.c7b020da.js
File Size Gzipped
dist/js/chunk-vendors.6f2b6b7f.js 2692.74 KiB 727.37 KiB
dist/js/809.84fc28bd.js 199.55 KiB 67.14 KiB
dist/js/app.c7b020da.js 70.36 KiB 23.83 KiB
dist/js/414.f6603d33.js 29.13 KiB 10.77 KiB
dist/js/198.cf00794c.js 26.97 KiB 10.58 KiB
dist/js/925.eb3b93af.js 20.17 KiB 8.46 KiB
dist/js/225.db74af3f.js 18.28 KiB 7.63 KiB
dist/js/747.7cf0c077.js 15.79 KiB 4.53 KiB
dist/js/435.e8584292.js 12.71 KiB 3.05 KiB
dist/js/951.77b7621e.js 9.43 KiB 2.67 KiB
dist/js/29.1eb6c5fa.js 9.27 KiB 3.32 KiB
dist/js/67.7455cf05.js 7.94 KiB 2.25 KiB
dist/js/403.75c19b93.js 7.93 KiB 2.23 KiB
dist/js/826.fbfab158.js 2.15 KiB 1.00 KiB
dist/js/972.12f3e514.js 1.25 KiB 0.71 KiB
dist/js/947.264e8cac.js 0.73 KiB 0.47 KiB
dist/js/42.25604d02.js 0.72 KiB 0.46 KiB
dist/css/chunk-vendors.034747d8.css 910.57 KiB 105.27 KiB
dist/css/app.90545477.css 6.30 KiB 2.05 KiB
dist/css/198.bd92c69b.css 0.32 KiB 0.22 KiB
dist/css/29.9cbbfce6.css 0.25 KiB 0.17 KiB
dist/css/414.b83a07e5.css 0.16 KiB 0.14 KiB
dist/css/225.d971aa34.css 0.11 KiB 0.09 KiB
dist/css/925.e9f32802.css 0.11 KiB 0.09 KiB
dist/css/403.1b1b7273.css 0.08 KiB 0.09 KiB
dist/css/435.2bd98623.css 0.08 KiB 0.09 KiB
dist/css/67.4780787e.css 0.08 KiB 0.09 KiB
dist/css/747.8c405c4f.css 0.08 KiB 0.09 KiB
dist/css/951.2ae8bde1.css 0.08 KiB 0.09 KiB
Images and other types of assets omitted.
Build at: 2024-04-25T14:04:35.355Z - Hash: 459292468ac3bd61 - Time: 15644ms
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
[stage-1 2/2] COPY --from=build /opt/clog/frontend/dist/ /usr/local/apache2/htdocs/
exporting to image
exporting layers 0/0 0.055
writing image sha256:c0126847679d31176bdaebd90622e2f5fa18bc16b0f352c891fec6f8fdce7ef1 0/0 0.001
naming to docker.io/library/clog-frontend:nightly 0/0 0.001
I have installed docker and can reproduced the issue, it occurred because the Apache Rewrite (mod_rewrite) Module was not enabled, sorry for missing this in README.
The tutorials for enabling Apache rewrite are like the following links, https://tecadmin.net/how-to-enable-apache-rewrite-module/ https://www.digitalocean.com/community/tutorials/how-to-rewrite-urls-with-mod_rewrite-for-apache-on-ubuntu-20-04
I have pushed the frontend/deployment/apache/.htaccess file, and used the approach in the following file, https://github.com/jonathanheilmann/docker-httpd-alpine-rewrite/blob/master/Dockerfile
Adding the following lines to httpd image in your frontend Dockerfile worked for me in my Docker version 26.1.0 environment,
RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf && \
sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /usr/local/apache2/conf/httpd.conf
COPY --from=build /opt/clog/frontend/deployment/apache/.htaccess /usr/local/apache2/htdocs/.htaccess
I am not sure if this is the standard solution or not, maybe there are other better solutions.
I have pushed Docker deployment support to the source code and it has been tested on Debian 10 Linux / Docker version 26.1.0 environment.
The Docker deployment section has been appended to README.
Thanks, looks great!
I tried your setup, but I run into a connection error to the database:
Log from backend container:
2024-04-29 09:09:31
2024-04-29 09:09:31 > clog-backend@2.1.2 start
2024-04-29 09:09:31 > node server.js
2024-04-29 09:09:31
2024-04-29 09:09:32 Port connected to: 3000
2024-04-29 09:10:02 Database could not be connected: MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
2024-04-29 09:10:36 MongooseError: Operation `account.findOne()` buffering timed out after 10000ms
2024-04-29 09:10:36 at Timeout.<anonymous> (/app/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:185:23)
2024-04-29 09:10:36 at listOnTimeout (node:internal/timers:573:17)
2024-04-29 09:10:36 at process.processTimers (node:internal/timers:514:7)
2024-04-29 09:10:44 MongooseError: Operation `account.findOne()` buffering timed out after 10000ms
2024-04-29 09:10:44 at Timeout.<anonymous> (/app/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:185:23)
2024-04-29 09:10:44 at listOnTimeout (node:internal/timers:573:17)
2024-04-29 09:10:44 at process.processTimers (node:internal/timers:514:7)
I think the issue is that the mongo DB in the compose setup should be accessible via database:27017
(as described here: https://docs.docker.com/compose/networking/ )
The Docker deployment is described in the last section of README, the IP addresses for both backend API and database need to be consistent with the host IP address.
Sorry I overlooked that part, you are correct!
In my test environment, if I try to click on login, which navigates to
localhost/login
I get a 404, page not found. Other pages, such aslocalhost/logbookmanagement
do work.Also I am not 100% if this is a frontend or backend issue. Backend login is set to "local". For the frontend configuration I pretty much use the "default" configuration currently:
Environment:
Dockerized Setup with 3 Docker container:
For the backend I use
node-20.12.2-alpine3.19
for building and running For the frontend I usenode-20.12.2-alpine3.19
for building but then transfer the build artifacts to a httpd apache docker for runningDockerfile for Frontend:
Dockerfile for Backend: