Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links expire if docker container restarted #51

Closed
sufd4 opened this issue Aug 11, 2021 · 4 comments
Closed

Links expire if docker container restarted #51

sufd4 opened this issue Aug 11, 2021 · 4 comments

Comments

@sufd4
Copy link

sufd4 commented Aug 11, 2021

So I'm assuming I'm doing something wrong here and would really appreciate help. I've got the container up with a reverse proxy, it works great. I've noticed that inside the container, the uploads never go to the /uploads directory (or what it's mapped to outside docker) but instead go to /tmp/send-XXXXXX.

When I restart the container for any reason, the links are all expired and the items in the tmp folder remain there but are inaccessible. I thought it may have something to do with redis. I do have it running but I'm not sure if it's making use of it for this full self-hosted implementation. Thank you.

@timvisee
Copy link
Owner

Please make sure you run Send in production mode by setting NODE_ENV=production.

For a Docker set-up, set the following property: https://github.com/timvisee/send-docker-compose/blob/6f517849cd6ef0a784bd02265346baade612d7f9/docker-compose.yaml#L46

Redis should be used when running in production mode. If you're still experiencing issues you can run MONITOR within Redis to watch if any operation is coming through.

@sufd4
Copy link
Author

sufd4 commented Aug 13, 2021

MONITOR

Great, thank you for this assistance. I missed putting it in production. I can see it now does communicate with redis and links survive restarts of the docker container. However, while the link is active the file cannot be downloaded. It just goes to the download progress bar and then back to the link page.

I notice that the upload folder is still unused and the tmp folder contains a new /send-XXXXXX folder each time the docker container restarts. Moving files from the previous tmp folder to the current one does enable all the previous links to function again but this is definitely not what you intend. The log just shows [ 'https://[...MYBASEURL...]', 'wss://...MYBASEURL...' ] repeatedly.

Have you encountered anything like this? Thank you.

@base2code
Copy link

First I had the same issue, but I forget to pass REDIS_HOST and FILE_DIR explicity. With this Docker run command the deployment should be working fine (Replace Redis host IP):

(Copied from /docs/docker.md)
# create a network for the send backend and redis containers to talk to each other
$ docker network create timviseesend

# start the redis container
$ docker run --net=timviseesend -v $PWD/redis:/data redis-server --appendonly yes

# start the send backend container
docker run -d \
    --net=timviseesend \
    -v $PWD/uploads:/uploads \
    -p 1443:1443 \
    -e 'BASE_URL=https://send.example.com' \
    -e 'MAX_FILE_SIZE=21474836480' \
    -e 'MAX_EXPIRE_SECONDS=2592000' \
    -e 'NODE_ENV=production' \
    -e 'FILE_DIR=/uploads' \
    -e 'REDIS_HOST=172.18.0.2' \
    -e 'SEND_FOOTER_DMCA_URL=https://example.com' \
    --name send_app \
    registry.gitlab.com/timvisee/send:latest

@sufd4
Copy link
Author

sufd4 commented Aug 23, 2021

Thank you, that solved it

@sufd4 sufd4 closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants