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.42k stars 237 forks source link

🐛 Bug Report: Cannot run container as non root #682

Open alvitali opened 1 day ago

alvitali commented 1 day ago

👟 Reproduction steps

Not sure if I should file this as a bug report or feature request:

Setting user: UID:GID' in the docker compose file or- PUID=${UID}` as environment variables in docker compose leads to the container failing to start. I'd like to run pingvin-share as a non-root user for security purposes, is that possible?

👍 Expected behavior

Being able to run the container rootless

👎 Actual Behavior

The container fails to start

📜 Logs

{"level":"info","ts":1732238761.2249975,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""} {"level":"warn","ts":1732238761.228795,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2} {"level":"info","ts":1732238761.2303803,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]} {"level":"info","ts":1732238761.2312374,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000367380"} {"level":"warn","ts":1732238761.2324665,"logger":"tls","msg":"unable to get instance ID; storage clean stamps will be incomplete","error":"open /home/node/.local/share/caddy/instance.uuid: no such file or directory"} {"level":"info","ts":1732238761.2324882,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]} {"level":"info","ts":1732238761.233389,"msg":"autosaved config (load with --resume flag)","file":"/home/node/.config/caddy/autosave.json"} {"level":"info","ts":1732238761.2334046,"msg":"serving initial configuration"} Successfully started Caddy (pid=39) - Caddy is running in the background {"level":"info","ts":1732238761.2343607,"logger":"tls","msg":"cleaning storage unit","storage":"FileStorage:/home/node/.local/share/caddy"} {"level":"info","ts":1732238761.2345603,"logger":"tls","msg":"finished cleaning storage units"} ▲ Next.js 14.2.12

Local: http://localhost:3333/ Network: http://0.0.0.0:3333/ ✓ Starting...

pingvin-share-backend@1.4.0 prod prisma migrate deploy && prisma db seed && node dist/src/main ✓ Ready in 874ms Environment variables loaded from prisma/.env Prisma schema loaded from prisma/schema.prisma Datasource "db": SQLite database "pingvin-share.db" at "file:../data/pingvin-share.db"

22 migrations found in prisma/migrations

No pending migrations to apply. Environment variables loaded from prisma/.env Running seed command ts-node prisma/seed/config.seed.ts ... PrismaClientUnknownRequestError: Invalid prisma.config.update() invocation in /opt/app/backend/prisma/seed/config.seed.ts:387:27

384 const variableOrder = Object.keys( 385 configVariables[existingConfigVariable.category] 386 ).indexOf(existingConfigVariable.name); → 387 await prisma.config.update( Error occurred during query execution: ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteError { extended_code: 1544, message: Some("attempt to write a readonly database") }), transient: false }) at Ln.handleRequestError (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:121:7943) at Ln.handleAndLogRequestError (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:121:7061) at Ln.request (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:121:6745) at async l (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:130:9633) at async migrateConfigVariables (/opt/app/backend/prisma/seed/config.seed.ts:387:7) { clientVersion: '5.19.1' }

An error occurred while running the seed command: Error: Command failed with exit code 1: ts-node prisma/seed/config.seed.ts npm notice npm notice New minor version of npm available! 10.8.2 -> 10.9.1 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.1 npm notice To update run: npm install -g npm@10.9.1 npm notice {"level":"error","ts":1732238771.2307196,"logger":"http.log.error","msg":"dial tcp [::1]:8080: connect: connection refused","request":{"remote_ip":"::1","remote_port":"52280","client_ip":"::1","proto":"HTTP/1.1","method":"GET","host":"localhost:3000","uri":"/api/health","headers":{"User-Agent":["curl/8.11.0"],"Accept":["/"]}},"duration":0.001431034,"status":502,"err_id":"uphagjnm9","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}

stonith404 commented 9 hours ago

This isn't supported yet. But I'm actually working on a non root image at the moment. Would you mind to try the image stonith404/pingvin-share:rootless-experiment and let me know if you encounter any issues?

gdmn commented 8 hours ago

1.4.0 version works with rootless podman, no issues :) I'm using quadlet file for pingvin-share.