Last active
November 15, 2021 06:34
-
-
Save ansemjo/c24267ea4684a09dd841db910d908b9b to your computer and use it in GitHub Desktop.
simple docker compose to self-host the firefox send experiment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to a crontab to tidy up expired uploads: | |
# 0 * * * * find /var/lib/send/ -type f -mmin +1450 -exec rm {} \; | |
version: "3" | |
services: | |
web: | |
# repository: https://gitlab.com/timvisee/send | |
image: registry.gitlab.com/timvisee/send:latest | |
restart: unless-stopped | |
links: | |
- redis | |
volumes: | |
# check permissions on this directory, node runs with UID 10001 | |
- /var/lib/send:/uploads | |
ports: | |
# port needs to be reverse-proxied | |
- "127.0.0.1:1443:1443" | |
environment: | |
# urls | |
- BASE_URL=https://send.example.com | |
- REDIS_HOST=redis | |
- NODE_ENV=production | |
# local file storage | |
- FILE_DIR=/uploads | |
# -- upload limits: | |
# file size | |
- MAX_FILE_SIZE=10737418240 # 10 GB | |
# downloads | |
- MAX_DOWNLOADS=10 | |
- DOWNLOAD_COUNTS=1,2,3,5,10 | |
# expiry | |
- MAX_EXPIRE_SECONDS=604800 # 7 days | |
- EXPIRE_TIMES_SECONDS=300,900,3600,86400,259200,604800 # 5m,15m,1h,1d,3d,7d | |
redis: | |
image: redis:alpine | |
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example of a vhost configuration for nginx, which restricts access to uploading websocket. | |
# everything in CAPS needs to be replaced, of course. | |
upstream send { | |
server 127.0.0.1:1443; | |
} | |
server { | |
listen [::]:80; | |
listen [::]:443 ssl http2; | |
server_name SERVERNAME; | |
ssl_certificate /PATH/TO/CERTIFICATE; | |
ssl_certificate_key /PATH/TO/KEY; | |
if ($scheme != https) { | |
return 301 https://$host$request_uri; | |
} | |
location ~ ^/(api/ws)?$ { | |
auth_basic "Uploads"; | |
auth_basic_user_file /PATH/TO/AUTH/FILE; # create hashes with 'openssl passwd -6' | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_ignore_headers X-Accel-Expires Expires Cache-Control; | |
proxy_pass http://send; | |
} | |
location / { | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_ignore_headers X-Accel-Expires Expires Cache-Control; | |
proxy_pass http://send; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check the permissions on your
/var/lib/send
directory. Thenode
processes inside the container runs with UID 10001, so you'll likely have to run the following on your host:Alternatively, if you don't care about security that much, run the
web:
container asroot
by addinguser: root
:services: web: image: registry.gitlab.com/timvisee/send:latest + user: root links: - redis volumes: