timvisee / send

:mailbox_with_mail: Simple, private file sharing. Mirror of https://gitlab.com/timvisee/send
https://send.vis.ee
Mozilla Public License 2.0
4.83k stars 280 forks source link

Issues with files not saving #199

Open back-lacking opened 1 month ago

back-lacking commented 1 month ago

So I'm hosting Send in my homelab but its having issues with it not properly dealing with files. I would have no problem uploading the files. I would upload my files, and then I would get a link for the download. However, clicking on that download, it would result in a page showing that the download has been expired or no longer available. I looked at the logs for the send container and it would give errors about Redis. Currently, in my homelab, I'm running Redis as a completely separate container with its own compose file that i would then link to the networks of containers that need it. Below is the log for Send, along with compose configurations. Send is able to reach the Redis container, as I can ping Redis in Send's shell.

ERROR FirefoxSend.send.storage.Redis:: {"command":"HSET","code":"NR_CLOSED","args":["b67c1b3028eb3154","prefix",1]}
    at handle_offline_command (/app/node_modules/redis/index.js:780:15)
    at RedisClient.internal_send_command (/app/node_modules/redis/index.js:814:9)
    at RedisClient.hset (/app/node_modules/redis/lib/commands.js:46:25)
    at DB.set (/app/server/storage/index.js:54:16)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async WebSocket.<anonymous> (/app/server/routes/ws.js:92:7)
ERROR FirefoxSend.send.storage.Redis:: {"command":"HMSET","code":"NR_CLOSED","args":["b67c1b3028eb3154","owner","f2e028a636ad6a1110bd","metadata","wrDGUyxEH2qdOZ5QsZbNbGggnjwDKxAoS5CrUeuQL4ezRM3CnWV6jwcVwW0DasF1k7qWF7tTnZxPrbjzylEPPcW_IqJwj9nS26rtJRwJBOVFBtn4ENDrgVxdOPhLJIwnDgAql5dNQT0lDS3eexGWV9DeicEkIQ4bwq7ikvE1Ep5qDkiUYbYqBrbRvMRKVwK6EDbI2sjI0kwbxQyHW9mGkBTljU9mNJxc7nCEtdoCJ-Y-gKmNejDI5qlrcuqNKpPRXLdVsW58419WTOT1zK-J3vxWE4Q","dlimit",1,"auth","UF9x_rR-pAuzlX18zYF0Ax4fHaCJy1y-AQtmSTUMdLW7enQHxD3W7k3suJSXAYCunNx1TXMSpE1YDeYH40BIVQ","nonce","waF01g2WO3cACT+Agy8WUA=="]}
    at handle_offline_command (/app/node_modules/redis/index.js:780:15)
    at RedisClient.internal_send_command (/app/node_modules/redis/index.js:814:9)
    at RedisClient.hmset (/app/node_modules/redis/lib/individualCommands.js:364:17)
    at DB.set (/app/server/storage/index.js:56:18)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async WebSocket.<anonymous> (/app/server/routes/ws.js:92:7)
ERROR FirefoxSend.send.storage.Redis:: {"command":"EXPIRE","code":"NR_CLOSED","args":["b67c1b3028eb3154",86400]}
    at handle_offline_command (/app/node_modules/redis/index.js:780:15)
    at RedisClient.internal_send_command (/app/node_modules/redis/index.js:814:9)
    at RedisClient.expire (/app/node_modules/redis/lib/commands.js:46:25)
    at DB.set (/app/server/storage/index.js:58:16)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async WebSocket.<anonymous> (/app/server/routes/ws.js:92:7)

compose files:

version: "3.3"
services:
  send:
    container_name: ff-send
    volumes:
      - $PWD/uploads:/uploads
    environment:
      - DETECT_BASE_URL=true
      - REDIS_HOST=redis
      - FILE_DIR=/uploads
    image: registry.gitlab.com/timvisee/send:latest
    labels:
        - "traefik.enable=true"
        - "traefik.http.routers.send.entrypoints=web"
        - "traefik.http.routers.send.rule=Host(`send.local.domain`)"
        - "traefik.http.middlewares.send-https-redirect.redirectscheme.scheme=websecure"
        - "traefik.http.routers.send.middlewares=send-https-redirect"
        - "traefik.http.routers.send-secure.entrypoints=websecure"
        - "traefik.http.routers.send-secure.rule=Host(`send.local.domain`)"
        - "traefik.http.routers.send-secure.tls=true"
        - "traefik.http.routers.send-secure.service=send"
        - "traefik.http.services.send.loadbalancer.server.port=1443"
    networks:
      - send
      - proxy
networks:
  send:
  proxy:
    external: true
services:
  redis:
    container_name: redis
    hostname: redis
    image: docker.io/library/redis:alpine
    command: redis-server --save 30 1 --loglevel warning
    volumes:
      - redis-volume:/data
    ports:
      - 6379:6379
    cap_drop:
      - ALL
    cap_add:
      - SETGID
      - SETUID
      - DAC_OVERRIDE
    networks:
      - send_send
volumes:
  redis-volume: null
networks:
  send_send:
    external: true
back-lacking commented 1 month ago

Issue would get temporarily fixed if i restart the send container, but would come back after some amount of time (not sure how long).

timvisee commented 1 month ago

Yeah, I'm assuming Redis is the problem here. I've seen similar problems before.

You mention you can ping, but is Redis reachable on it's port? In other words, can you open a Redis connection and run commands from the Send container? Because it looks like Redis commands are not accepted at all.

back-lacking commented 1 month ago

How do i send commands to Redis from the Send container? I tried using curl redis:6379 but curl doesn't exist within the container.

timvisee commented 1 month ago

but curl doesn't exist within the container.

You can probably install it through apk: apk add curl

back-lacking commented 1 month ago

but curl doesn't exist within the container.

You can probably install it through apk: apk add curl

sorry for the late response trying to use apk results in an error as permission is denied. trying to use sudo to escalate the command doesnt work as sudo also doesnt exist in the container.

back-lacking commented 1 month ago
docker exec -it ff-send curl redis:6379
curl: (52) Empty reply from server

got curl and sudo installed by entering the root user of container and running apk through there. this is what i get from redis.