stonith404 / pingvin-share

A self-hosted file sharing platform that combines lightness and beauty, perfect for seamless and efficient file sharing.
https://stonith404.github.io/pingvin-share/
BSD 2-Clause "Simplified" License
3.44k stars 238 forks source link

🐛 Bug Report: Frontend errors out #555

Closed manuelkamp closed 3 months ago

manuelkamp commented 3 months ago

👟 Reproduction steps

get newest files via git compile and start backend switch to frontend directory npm install && npm run build pm2 restart pingvin-share-frontend

👍 Expected behavior

frontend runs

👎 Actual Behavior

 pm2 status
┌────┬───────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name                      │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼───────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ pingvin-share-backend     │ default     │ N/A     │ fork    │ 3823     │ 3m     │ 1    │ online    │ 0%       │ 35.6mb   │ root     │ disabled │
│ 1  │ pingvin-share-frontend    │ default     │ N/A     │ fork    │ 0        │ 0      │ 174  │ errored   │ 0%       │ 0b       │ root     │ disabled │
└────┴───────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
1|pingvin- | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
1|pingvin- |     at setupFsCheck (/opt/pingvin-share/frontend/node_modules/next/dist/server/lib/router-utils/filesystem.js:151:19)
1|pingvin- |     at async initialize (/opt/pingvin-share/frontend/node_modules/next/dist/server/lib/router-server.js:61:23)
1|pingvin- |     at async Server.<anonymous> (/opt/pingvin-share/frontend/node_modules/next/dist/server/lib/start-server.js:249:36)

🌐 Browser

Edge

manuelkamp commented 3 months ago
pm2 start --name="pingvin-share-frontend" .next/standalone/server.js

gives

[PM2][ERROR] Script not found: /opt/pingvin-share/frontend/.next/standalone/server.js
stonith404 commented 3 months ago

Does this issue only occur since the last release? Could you also please share the output of cd frontend && npm run build?

manuelkamp commented 3 months ago

frontend builds and starts fine, no errors. I am on version Version 0.28.0, so yes.

stonith404 commented 3 months ago

frontend builds and starts fine

So does it work now? If not, could you please try pm2 start --name="pingvin-share-frontend" npm -- run startinstead of pm2 start --name="pingvin-share-frontend" .next/standalone/server.js?

manuelkamp commented 3 months ago

sorry, got confused with #546

I tried it again, this time it is another error. It does not build now. So a step ahead of the previous time I tried it.

Already tried to double the RAM to the LXC and has now 2048MB. It uses only max. 63% of available RAM.

I run this command: cd ../frontend && npm install && npx prisma generate && npm run build

up to date, audited 785 packages in 1s

162 packages are looking for funding
  run `npm fund` for details

1 high severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> pingvin-share-frontend@0.29.0 build
> next build

  ▲ Next.js 14.2.3

./src/components/account/showShareInformationsModal.tsx
6:10  Warning: 'FileMetaData' is defined but never used.  no-unused-vars

./src/components/admin/configuration/AdminConfigInput.tsx
17:26  Warning: 'variable' is defined but never used.  no-unused-vars

./src/components/admin/shares/ManageShareTable.tsx
28:17  Warning: 'share' is defined but never used.  no-unused-vars

./src/components/admin/users/ManageUserTable.tsx
6:28  Warning: 'useIntl' is defined but never used.  no-unused-vars
16:16  Warning: 'user' is defined but never used.  no-unused-vars

./src/components/header/ActionAvatar.tsx
6:28  Warning: 'useIntl' is defined but never used.  no-unused-vars

./src/components/share/FileSizeInput.tsx
15:14  Warning: 'number' is defined but never used.  no-unused-vars

./src/components/share/showEnterPasswordModal.tsx
11:20  Warning: 'password' is defined but never used.  no-unused-vars
26:20  Warning: 'password' is defined but never used.  no-unused-vars

./src/components/upload/Dropzone.tsx
44:20  Warning: 'files' is defined but never used.  no-unused-vars

./src/components/upload/FileList.tsx
71:14  Warning: 'files' is defined but never used.  no-unused-vars

./src/components/upload/modals/showCreateUploadModal.tsx
48:20  Warning: 'createShare' is defined but never used.  no-unused-vars
48:46  Warning: 'files' is defined but never used.  no-unused-vars
100:20  Warning: 'createShare' is defined but never used.  no-unused-vars
100:46  Warning: 'files' is defined but never used.  no-unused-vars
461:20  Warning: 'createShare' is defined but never used.  no-unused-vars
461:46  Warning: 'files' is defined but never used.  no-unused-vars

./src/pages/account/shares.tsx
7:3  Warning: 'MediaQuery' is defined but never used.  no-unused-vars

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 ✓ Linting and checking validity of types
   Creating an optimized production build ...
> [PWA] Compile server
> [PWA] Compile server
> [PWA] Compile client (static)
> [PWA] Auto register service worker with: /opt/pingvin-share/frontend/node_modules/next-pwa/register.js
> [PWA] Service worker: /opt/pingvin-share/frontend/public/sw.js
> [PWA]   url: /sw.js
> [PWA]   scope: /
 ✓ Compiled successfully
   Collecting page data  ...Killed
manuelkamp commented 3 months ago

OK forget the previous error, tried doubling the RAm to 4096MB again, and now it builds. And pm2 restart pingvin-share-frontend works... very strange... Previous builds were possible to build with 1024MB, since when it is running, it never uses 4096MB at all: 5.75% (235.42 MiB von 4.00 GiB) I am downgrading RAM again to 1024MB, now I know for updates it needs more RAM.

stonith404 commented 3 months ago

Okay thanks. Alternatively I would recommend you the Docker installation, with that you don't have to build the project.

manuelkamp commented 3 months ago

Thanks, but I avoid docker, since it has too much overhead compared to LXC and is too complex to maintain, so I prefer (and have only) bare metal for everything. It is also easier to include security measurements in bare metal than in docker containers. Docker is just easy to deploy, but for everything other than that, this is a big disadvantage.