Uberspace / lab

The Uberlab provides various tutorials - written by you! - on how to run software and tools on Uberspace 7.
https://lab.uberspace.de
Other
316 stars 417 forks source link

[umami] check for new nodejs version compatibility #1606

Open noave opened 1 year ago

noave commented 1 year ago

Nodejs 12 / 14 / 16 are EOL and wont be available on Uberspace any longer.

Check if this guide works with Nodejs18 or Nodejs20 and update it accordingly. Otherwise, if you cannot fix it with the new versions mark the guide as broken like it is described here: https://github.com/Uberspace/lab/blob/main/BROKEN_GUIDES.md

(This issue has been created automatically, the guide might already be up to date, in this case you can just comment and close the issue here)

josephbadow commented 11 months ago

I read your Tröt and decided to give umami a try.

Node 18

I didn't encounter any real issues. Running yarn build resulted in an error, but this was already mentioned in your guide.


[...]

 ✓ Compiled successfully
   Skipping validation of types
   Skipping linting
uncaughtException Error: write EPIPE
    at target._send (node:internal/child_process:872:20)
    at target.send (node:internal/child_process:745:19)
    at ChildProcessWorker.initialize (/home/jwb/umami/node_modules/next/dist/compiled/jest-worker/index.js:1:11409)
    at new ChildProcessWorker (/home/jwb/umami/node_modules/next/dist/compiled/jest-worker/index.js:1:10741)
    at WorkerPool.createWorker (/home/jwb/umami/node_modules/next/dist/compiled/jest-worker/index.js:1:6314)
    at new BaseWorkerPool (/home/jwb/umami/node_modules/next/dist/compiled/jest-worker/index.js:1:8173)
    at new WorkerPool (/home/jwb/umami/node_modules/next/dist/compiled/jest-worker/index.js:1:6110)
    at new Worker (/home/jwb/umami/node_modules/next/dist/compiled/jest-worker/index.js:1:23092)
    at createWorker (/home/jwb/umami/node_modules/next/dist/lib/worker.js:30:28)
    at new Worker (/home/jwb/umami/node_modules/next/dist/lib/worker.js:67:9)
    at createStaticWorker (/home/jwb/umami/node_modules/next/dist/build/index.js:732:24)
    at /home/jwb/umami/node_modules/next/dist/build/index.js:797:56
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Span.traceAsyncFn (/home/jwb/umami/node_modules/next/dist/trace/trace.js:105:20)
    at async build (/home/jwb/umami/node_modules/next/dist/build/index.js:185:29)
    at async main (/home/jwb/umami/node_modules/next/dist/bin/next:157:5) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build-app" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Restricting the memory usage as described

NODE_OPTIONS=--max_old_space_size=512 npm run build --debug

yielded a successful build.

 ✓ Compiled successfully
   Skipping validation of types
   Skipping linting
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
Static worker unexpectedly exited with code: null and signal: SIGKILL
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ See more info here https://nextjs.org/docs/messages/static-page-generation-timeout
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ⚠ Restarted collecting page data for undefined because it took more than 60 seconds
 ✓ Collecting page data
Static worker unexpectedly exited with code: null and signal: SIGKILL
   Generating static pages (7/18)  [    ]
 ⚠ Entire page /sso deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /Static worker unexpectedly exited with code: null and signal: SIGKILL
 ✓ Generating static pages (18/18)

I was able to create the service, connect the web backend and login with the default credentials.

uberspace web backend list
/ http:3000 => OK, listening: PID 4674, next-router-worker

supervisorctl status
umami                            RUNNING   pid 4643, uptime 0:04:07
josephbadow commented 11 months ago

Node 20

Node 20 on the other hand threw a bunch of errors. First, I ran the default yarn build and saw that the error messages complain in more detail.

 ✓ Compiled successfully
   Skipping validation of types
   Skipping linting
Static worker unexpectedly exited with code: null and signal: SIGKILL
   Collecting page data  .Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
   Collecting page data  ..Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Static worker unexpectedly exited with code: null and signal: SIGKILL

> Build error occurred
Error: Failed to collect page data for /websites/[id]/event-data
    at /home/jwb/umami/node_modules/next/dist/build/utils.js:1171:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}
$ node scripts/postbuild.js
Done in 137.86s.

I tried to restrict the memory usage again, but this time it didn't work.

 ✓ Compiled successfully
   Skipping validation of types
   Skipping linting
Static worker unexpectedly exited with code: null and signal: SIGKILL
   Collecting page data  .Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}
Error: ENOMEM: not enough memory, read
    at Object.readFileUtf8 (node:internal/fs/sync:25:18)
    at Object.readFileSync (node:fs:441:19)
    at Module._extensions..js (node:internal/modules/cjs/loader:1258:18)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at mod.require (/home/jwb/umami/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:130:18)
    at __webpack_require__.f.require (/home/jwb/umami/.next/server/webpack-runtime.js:1:2013)
    at /home/jwb/umami/.next/server/webpack-runtime.js:1:1176 {
  errno: -12,
  code: 'ENOMEM',
  syscall: 'read'
}

> Build error occurred
Error: Failed to collect page data for /settings/users
    at /home/jwb/umami/node_modules/next/dist/build/utils.js:1171:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}
   Collecting page data  .ERROR: "build-app" exited with 1.

Verifying the web backend and service

uberspace web backend list
/ http:3000 => NOT OK, no service

supervisorctl status
umami                            STARTING

Verifying ~/logs/supervisord.log

2023-11-28 22:33:23,038 DEBG 'umami' stdout output:
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

2023-11-28 22:33:23,071 DEBG fd 7 closed, stopped monitoring <POutputDispatcher at 140070949092456 for <Subprocess at 140070948411280 with name umami in state RUNNING> (stdout)>
2023-11-28 22:33:23,071 DEBG fd 9 closed, stopped monitoring <POutputDispatcher at 140070949139880 for <Subprocess at 140070948411280 with name umami in state RUNNING> (stderr)>
2023-11-28 22:33:23,071 INFO exited: umami (exit status 1; not expected)
2023-11-28 22:33:23,071 DEBG received SIGCLD indicating a child quit
2023-11-28 22:33:24,077 INFO spawned: 'umami' with pid 29655
2023-11-28 22:33:24,623 DEBG 'umami' stdout output:
yarn run v1.22.19

2023-11-28 22:33:24,738 DEBG 'umami' stdout output:
$ next start

2023-11-28 22:33:25,580 DEBG 'umami' stderr output:
 ⚠ Invalid next.config.js options detected:

2023-11-28 22:33:25,581 INFO success: umami entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-11-28 22:33:25,581 DEBG 'umami' stderr output:
 ⚠     Expected string, received boolean at "env.cloudMode"
 ⚠     "env.cloudUrl" is missing, expected string
 ⚠     "env.defaultLocale" is missing, expected string
 ⚠     "env.disableLogin" is missing, expected string
 ⚠     "env.disableUI" is missing, expected string
 ⚠     Expected string, received boolean at "env.isProduction"
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config

2023-11-28 22:33:25,589 DEBG 'umami' stderr output:
[Error: ENOENT: no such file or directory, open '/home/jwb/umami/.next/BUILD_ID'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/jwb/umami/.next/BUILD_ID'
}

2023-11-28 22:33:25,621 DEBG 'umami' stderr output:
error Command failed with exit code 1.

To me it looks like Node 20 requires more memory. But I have no experience with Node, so I'm just guessing here.

josephbadow commented 11 months ago

Do I understand correctly that I can now use this issue to state my intent to update the guide and create a pull request with my changes?

pictosun commented 8 months ago

Would be nice to get an updated instruction to install Umami with Uberspace. For me I tried the standard install and it breaks. After that I tried the other variante with less memory consumption, but it also crashes.

So any update concerning Umami to get it working with Uberspace?

As Uberspace itself is running Umami for their Main-Website it would be nice to get an updated instruction for all of us.

saintflow47 commented 7 months ago

I second this, whatever I tried, I could not get umami to build properly, even though it did not throw any errors with reduced memory. After completion, files like ".next/BUILD_ID" were reported as missing if i tried to yarn start it. This is on the current default node version 18. any updates would be appreciated a lot!