├── .env.example ├── .gitignore ├── README.md ├── docker-compose.yaml └── gc.cron /.env.example: -------------------------------------------------------------------------------- 1 | # Docker image to use for Send 2 | # - Latest Send version by @timvisee: registry.gitlab.com/timvisee/send:latest 3 | # - Outdated (archived) Send version by Mozilla: mozilla/send:latest 4 | DOCKER_SEND_IMAGE=registry.gitlab.com/timvisee/send:latest 5 | 6 | # Host to expose Send on 7 | HOST=send.example.org 8 | 9 | # Base URL for Send 10 | SEND_BASE_URL=https://send.example.org 11 | 12 | # Optional: for LetsEncrypt SSL, same as HOST 13 | LETSENCRYPT_HOST= 14 | 15 | # Optional: for LetsEncrypt SSL, your email address 16 | LETSENCRYPT_EMAIL=mail@example.org 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Send in Docker compose 2 | 3 | This repository provides a basic Docker compose configuration to host a public 4 | [Send](https://gitlab.com/timvisee/send) instance on your own domain. 5 | 6 | - Hosts on your own domain 7 | - Provides automatic SSL certificates through LetsEncrypt 8 | 9 | This configuration exposes a reverse proxy on ports 80 and 443, so these must be 10 | available. 11 | 12 | This uses the latest Send version from 13 | [`timvisee/send`](https://gitlab.com/timvisee/send) because 14 | [`mozilla/send`](https://github.com/mozilla/send) has been archived. 15 | This is configurable in your [`.env`](.env.example) file. 16 | 17 | See [docker-compose.yaml](./docker-compose.yaml). 18 | 19 | *Note: for plain Docker usage without Compose, see: https://github.com/timvisee/send/blob/master/docs/docker.md* 20 | 21 | ## Usage 22 | 23 | 1. Install Docker and Docker Compose on your system: https://get.docker.com/ 24 | 2. Clone this repository `git clone https://github.com/timvisee/send-docker-compose && cd send-docker-compose` 25 | 3. Run `cp .env.example .env` and edit `.env` and `docker-compose.yaml` to setup your configuration (see [example](#example-env)) 26 | 4. Run `docker-compose up` to start the containers (add `-d` to start it in the background) 27 | 5. Wait 30sec for it to start, then visit your domain verify the UI is up and running, e.g. `https://send.example.com` 28 | 29 | Screenshot of succesfully running Send UI 30 | 31 | *Note: the server will autostart on boot (to disable, change all the `restart: always` lines to `restart: on-failure`)* 32 | 33 | ## Example .env 34 | 35 | ```bash 36 | # Docker image to use for Send 37 | # - Latest Send version by @timvisee: registry.gitlab.com/timvisee/send:latest 38 | # - Outdated (archived) Send version by Mozilla: mozilla/send:latest 39 | DOCKER_SEND_IMAGE=registry.gitlab.com/timvisee/send:latest 40 | 41 | # Host to expose Send on 42 | HOST=send.example.com 43 | 44 | # Base URL for Send 45 | SEND_BASE_URL=https://send.example.com 46 | 47 | # Optional: for LetsEncrypt SSL, same as HOST 48 | LETSENCRYPT_HOST=send.example.com 49 | 50 | # Optional: for LetsEncrypt SSL, your email address 51 | LETSENCRYPT_EMAIL=ssl@send.example.com 52 | ``` 53 | 54 | ## Configuration 55 | 56 | All the config options and their defaults can be found here: https://github.com/timvisee/send/blob/master/server/config.js 57 | 58 | For more documentation about the config options available and their defaults, see: https://github.com/timvisee/send/blob/master/docs/docker.md 59 | 60 | Config options expecting array values (e.g. `EXPIRE_TIMES_SECONDS`, `DOWNLOAD_COUNTS`) should be set as bare comma separated values, and the first entry is used as the default. 61 | 62 | Other options should be set as unquoted strings, integers, booleans, etc., for example: 63 | ```yaml 64 | ... 65 | services: 66 | ... 67 | send: 68 | ... 69 | environment: 70 | ... 71 | 72 | # strings numbers, bools, etc. should all be set as bare unquoted values 73 | - BASE_URL=https://send.example.com 74 | - DHPARAM_GENERATION=false 75 | - MAX_DOWNLOADS=250000 76 | 77 | # use values set in the .env using ${VARNAME} bash syntax 78 | - VIRTUAL_HOST=${HOST} 79 | 80 | # time values are all in seconds, e.g. 365d * 60*60*24 = 31,536,000 seconds 81 | - MAX_EXPIRE_SECONDS=31536000 82 | - DEFAULT_EXPIRE_SECONDS=86400 83 | 84 | # size values are are in bytes, e.g. 10GB * 1024*1024*1024 = 10,747,904,000 bytes 85 | - MAX_FILE_SIZE=10747904000 86 | 87 | # array configs are set as CSV (first entry is the default for the UI dropdown) 88 | - EXPIRE_TIMES_SECONDS=86400,3600,86400,604800,2592000,31536000,157680000 89 | - DOWNLOAD_COUNTS=10,1,2,5,10,15,25,50,100,1000,10000,100000,250000 90 | ``` 91 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | nginx-proxy: 5 | container_name: nginx-proxy 6 | image: 'jwilder/nginx-proxy:alpine' 7 | restart: always 8 | ports: 9 | - '80:80' 10 | - '443:443' 11 | environment: 12 | - DEFAULT_HOST=${HOST} 13 | - HSTS=off 14 | volumes: 15 | - /var/run/docker.sock:/tmp/docker.sock:ro 16 | - proxy-certs:/etc/nginx/certs:ro 17 | - proxy-vhost:/etc/nginx/vhost.d 18 | - proxy-html:/usr/share/nginx/html 19 | 20 | proxy-letsencrypt: 21 | image: 'jrcs/letsencrypt-nginx-proxy-companion' 22 | restart: always 23 | environment: 24 | - DEFAULT_EMAIL=${LETSENCRYPT_EMAIL} 25 | - NGINX_PROXY_CONTAINER=nginx-proxy 26 | - NGINX_DOCKER_GEN_CONTAINER=nginx-proxy 27 | volumes: 28 | - /var/run/docker.sock:/var/run/docker.sock:ro 29 | - proxy-certs:/etc/nginx/certs 30 | - proxy-vhost:/etc/nginx/vhost.d 31 | - proxy-html:/usr/share/nginx/html 32 | 33 | send: 34 | image: '${DOCKER_SEND_IMAGE}' 35 | restart: always 36 | ports: 37 | - '1234:1234' 38 | volumes: 39 | - ./uploads:/uploads 40 | environment: 41 | - VIRTUAL_HOST=${HOST} 42 | - VIRTUAL_PORT=1234 43 | - DHPARAM_GENERATION=false 44 | - LETSENCRYPT_HOST 45 | - LETSENCRYPT_EMAIL 46 | - NODE_ENV=production 47 | - BASE_URL=${SEND_BASE_URL} 48 | - PORT=1234 49 | - REDIS_HOST=redis 50 | 51 | # For local uploads storage 52 | - FILE_DIR=/uploads 53 | 54 | # For S3 object storage (disable volume and FILE_DIR variable) 55 | # - AWS_ACCESS_KEY_ID=******** 56 | # - AWS_SECRET_ACCESS_KEY=******** 57 | # - S3_BUCKET=send 58 | # - S3_ENDPOINT=s3.us-west-2.amazonaws.com 59 | # - S3_USE_PATH_STYLE_ENDPOINT=true 60 | 61 | # To customize upload limits 62 | # - EXPIRE_TIMES_SECONDS=3600,86400,604800,2592000,31536000 63 | # - DEFAULT_EXPIRE_SECONDS=3600 64 | # - MAX_EXPIRE_SECONDS=31536000 65 | # - DOWNLOAD_COUNTS=1,2,5,10,15,25,50,100,1000 66 | # - MAX_DOWNLOADS=1000 67 | # - MAX_FILE_SIZE=2684354560 68 | 69 | redis: 70 | image: 'redis:alpine' 71 | restart: always 72 | volumes: 73 | - send-redis:/data 74 | 75 | volumes: 76 | send-redis: 77 | proxy-certs: 78 | proxy-vhost: 79 | proxy-html: 80 | -------------------------------------------------------------------------------- /gc.cron: -------------------------------------------------------------------------------- 1 | # Set this up as hourly cronjob to delete old files, that Send forgot to remove 2 | # itself. 3 | # 4 | # Run `crontab -e` and add the line below, and configure the correct path. 5 | 6 | # Delete leaked Send upload files older than 7 days (and a bit) every hour 7 | 0 * * * * find /var/lib/send/uploads/ -mmin +10130 -exec rm {} \; 8 | 9 | # Uploads have their lifetime in days prefixed, so you can be a little bit 10 | # smarter with cleaning up: 11 | # 12 | # 0 * * * * find /var/lib/send/uploads/ -name 7-\* -mmin +10130 -exec rm {} \; 13 | # 0 * * * * find /var/lib/send/uploads/ -name 1-\* -mmin +1500 -exec rm {} \; 14 | --------------------------------------------------------------------------------