Deployment Notes
TURN server for Internet Transfer
Beware that you have to host your own TURN server to enable transfers between different networks. Follow this guide to either install coturn directly on your system (Step 1) or deploy it via Docker (Step 5). You can use thedocker-compose-coturn.yml in this repository. See Coturn and ErikrafT Drop via Docker Compose.
Alternatively, use a free, pre-configured TURN server like OpenRelay
ErikrafT Drop via HTTPS
On some browsers ErikrafT Drop must be served over TLS in order for some features to work properly. These may include:- Copying an incoming message via the ‘copy’ button
- Installing ErikrafT Drop as PWA
- Persistent pairing of devices
- Changing of the display name
- Notifications
Deployment with Docker
The easiest way to get ErikrafT Drop up and running is by using Docker.Docker Image from Docker Hub
⚠️ This is a third-party community image hosted by linuxserver.io. This is based on PairDrop (a similar but unofficial project), not the official ErikrafT Drop. For more information visit https://hub.docker.com/r/linuxserver/pairdrop For official ErikrafT Drop images, build from source using the Dockerfile below.
Docker Image from GitHub Container Registry (ghcr.io)
⚠️ This is the non-official PairDrop image from the original PairDrop project. This is based on PairDrop (a similar but unofficial project), not the official ErikrafT Drop.
Docker Image self-built
Build the image
A GitHub action is set up to do this step automatically at the release of new versions.
--pull ensures always the latest node image is used.
Run the image
You must use a server proxy to set theX-Forwarded-Forheader to prevent all clients from discovering each other (See #HTTP-Server). To prevent bypassing the proxy by reaching the docker container directly,127.0.0.1is specified in the run command.
Flags
Set options by using the following flags in thedocker run command:
Port
Specify the port used by the docker image
- 3000 ->
-p 127.0.0.1:3000:3000- 8080 ->
-p 127.0.0.1:8080:3000
Set Environment Variables via Docker
Environment Variables are set directly in thedocker run command: e.g.
docker run -p 127.0.0.1:3000:3000 -it pairdrop -e DEBUG_MODE="true"
Overview of available Environment Variables are found here.
Example:
Deployment with Docker Compose
Here’s an example docker compose file:docker compose up -d.
You must use a server proxy to set theX-Forwarded-Forheader to prevent all clients from discovering each other (See #HTTP-Server). To prevent bypassing the proxy by reaching the Docker container directly,127.0.0.1is specified in theportsargument.
Deployment with Node.js
Clone this repository and enter the folderBy default, the node server listens on port 3000.
Options / Flags
These are some flags only reasonable when deploying via Node.jsPort
Default:3000Environment variable to specify the port used by the Node.js server
e.g.PORT=3010 npm start
Local Run
Only allow connections from localhost.
You must use a server proxy to set the X-Forwarded-For header to prevent all clients from discovering each other (See #HTTP-Server).
Use this when deploying ErikrafT Drop with node to prevent bypassing the reverse proxy by reaching the Node.js server directly.
Automatic restart on error
Restarts server automatically on error
Production (autostart and rate-limit)
shortcut for RATE_LIMIT=5 npm start -- --auto-restart
Production (autostart, rate-limit, localhost-only)
To prevent connections to the node server from bypassing
the proxy server you should always use “—localhost-only” on production.
Set Environment Variables via Node.js
To specify environment variables set them in the run command in front ofnpm start. The syntax is different on Unix and Windows.
On Unix based systems
Environment Variables
Debug Mode
Default:falseLogs the used environment variables for debugging. Prints debugging information about the connecting peers IP addresses. This is quite useful to check whether the #HTTP-Server is configured correctly, so the auto-discovery feature works correctly. Otherwise, all clients discover each other mutually, independently of their network status. If this flag is set to"true"each peer that connects to the ErikrafT Drop server will produce a log to STDOUT like this:If the IP address “ErikrafT Drop uses” matches the public IP address of the client device, everything is set up correctly.
To find out the public IP address of the client device visit https://whatsmyip.com/. To preserve your clients’ privacy:
Never use this environment variable in production!
Rate limiting requests
Default:falseLimits clients to 1000 requests per 5 min “If you are behind a proxy/load balancer (usually the case with most hosting services, e.g. Heroku, Bluemix, AWS ELB, Render, Nginx, Cloudflare, Akamai, Fastly, Firebase Hosting, Rackspace LB, Riverbed Stingray, etc.), the IP address of the request might be the IP of the load balancer/reverse proxy (making the rate limiter effectively a global one and blocking all requests once the limit is reached) or undefined.” (See: https://express-rate-limit.mintlify.app/guides/troubleshooting-proxy-issues) To find the correct number to use for this setting:e.g. on Render you must use RATE_LIMIT=5
- Start ErikrafT Drop with
DEBUG_MODE=TrueandRATE_LIMIT=1- Make a
getrequest to/ipof the ErikrafT Drop instance (e.g.https://pairdrop-example.net/ip)- Check if the IP address returned in the response matches your public IP address (find out by visiting e.g. https://whatsmyip.com/)
- You have found the correct number if the IP addresses match. If not, then increase
RATE_LIMITby one and redo 1. - 4.
IPv6 Localization
Default:falseTo enable Peer Auto-Discovery among IPv6 peers, you can specify a reduced number of segments
of the client IPv6 address to be evaluated as the peer’s IP.
This can be especially useful when using Cloudflare as a proxy. The flag must be set to an integer between1and7.
The number represents the number of IPv6 hextets
to match the client IP against. The most common value would be4,
which will group peers within the same/64subnet.
Websocket Fallback (for VPN)
Default:falseProvides ErikrafT Drop to clients with an included websocket fallback
if the peer to peer WebRTC connection is not available to the client. This is not used on the official https://pairdrop.net website, but you can activate it on your self-hosted instance.
This is especially useful if you connect to your instance via a VPN (as most VPN services block WebRTC completely in order to hide your real IP address). (Read more here). Warning:
All traffic sent between devices using this fallback is routed through the server and therefor not peer to peer! Beware that the traffic routed via this fallback is readable by the server.
Only ever use this on instances you can trust. Additionally, beware that all traffic using this fallback debits the servers data plan.
Specify STUN/TURN Servers
Default:falseSpecify the STUN/TURN servers ErikrafT Drop clients use by setting
RTC_CONFIGto a JSON file including the configuration.
You can usertc_config_example.jsonas a starting point. To host your own TURN server you can follow this guide: https://gabrieltanner.org/blog/turn-server/ Alternatively, use a free, pre-configured TURN server like OpenRelay Default configuration:
You can host an instance that uses another signaling server This can be useful if you don’t want to trust the client files that are hosted on another instance but still want to connect to devices that use https://pairdrop.net.
Specify Signaling Server
Default:falseBy default, clients connecting to your instance use the signaling server of your instance to connect to other devices. By usingSIGNALING_SERVER, you can host an instance that uses another signaling server. This can be useful if you want to ensure the integrity of the client files and don’t want to trust the client files that are hosted on another ErikrafT Drop instance but still want to connect to devices that use the other instance. E.g. host your own client files under pairdrop.your-domain.com but use the official signaling server under pairdrop.net This way devices connecting to pairdrop.your-domain.com and pairdrop.net can discover each other. Beware that the version of your ErikrafT Drop server must be compatible with the version of the signaling server.SIGNALING_SERVERmust be a valid url without the protocol prefix. Examples of valid values:pairdrop.net,pairdrop.your-domain.com:3000,your-domain.com/pairdrop
Customizable buttons for the About ErikrafT Drop page
Default: unset By default, clients will show the default button configuration: GitHub, BuyMeACoffee, Twitter, and FAQ on GitHub. The GitHub and FAQ on GitHub buttons are essential, so they are always shown. The other buttons can be customized:
*_BUTTON_ACTIVE: set this totrueto show a natively hidden button or tofalseto hide a normally shown button*_BUTTON_LINK: set this to any URL to overwrite the href attribute of the button*_BUTTON_TITLE: set this to overwrite the hover title of the button. This will prevent the title from being translated.
Healthcheck
The Docker Image hosted on ghcr.io and the self-built Docker Image include a healthcheck.
Read more about Docker Swarm Usage.
HTTP-Server
When running ErikrafT Drop, theX-Forwarded-For header has to be set by a proxy. Otherwise, all clients will be mutually visible. To check if your setup is configured correctly
use the environment variable DEBUG_MODE="true".
Using nginx
Allow http and https requests
Automatic http to https redirect:
Using Apache
install modulesproxy, proxy_http, mod_proxy_wstunnel
Create a new configuration file under
/etc/apache2/sites-available (on Debian)
pairdrop.conf
Allow HTTP and HTTPS requests
Automatic HTTP to HTTPS redirect:
Coturn and ErikrafT Drop via Docker Compose
Setup container
To run coturn and ErikrafT Drop at once by using thedocker-compose-coturn.yml with TURN over TLS enabled you need to follow these steps:
- Generate or retrieve certificates for your
<DOMAIN>(e.g. letsencrypt / certbot) - Create
./sslfolder:mkdir ssl - Copy your ssl-certificates and the privkey to
./ssl - Restrict access to
./ssl:chown -R nobody:nogroup ./ssl - Create a dh-params file:
openssl dhparam -out ./ssl/dhparams.pem 4096 - Copy
rtc_config_example.jsontortc_config.json - Copy
turnserver_example.conftoturnserver.conf - Change
<DOMAIN>in both files to the domain where your ErikrafT Drop instance is running - Change
usernameandpasswordinturnserver.confandrtc-config.json - To start the container including coturn run:
docker compose -f docker-compose-coturn.yml up -d
Setup container
To restart the container including coturn run:docker compose -f docker-compose-coturn.yml restart
Setup container
To stop the container including coturn run:docker compose -f docker-compose-coturn.yml stop
Firewall
To run ErikrafT Drop including its own coturn-server you need to punch holes in the firewall. These ports must be opened additionally:- 3478 tcp/udp
- 5349 tcp/udp
- 10000:20000 tcp/udp
Local Development
Install
All files needed for developing are available in the folder./dev.
For convenience, there is also a docker compose file for developing:
Developing with docker compose
First, Install docker with docker compose. Then, clone the repository and run docker compose:http://localhost:8080.
- To debug the Node.js server, run
docker logs pairdrop. - After changes to the code you have to rerun the
docker composecommand
Testing PWA related features
PWAs requires the app to be served under a correctly set up and trusted TLS endpoint. The NGINX container creates a CA certificate and a website certificate for you. To correctly set the common name of the certificate, you need to change the FQDN environment variable indocker-compose-dev.yml to the fully qualified domain name of your workstation. (Default: localhost)
If you want to test PWA features, you need to trust the CA of the certificate for your local deployment. For your convenience, you can download the crt file from
http://<Your FQDN>:8080/ca.crt. Install that certificate to the trust store of your operating system. \
Windows
- Make sure to install it to the
Trusted Root Certification Authoritiesstore.
macOS
- Double-click the installed CA certificate in
Keychain Access, - expand
Trust, and selectAlways Trustfor SSL.
Firefox
Firefox uses its own trust store. To install the CA:- point Firefox at
http://<Your FQDN>:8080/ca.crt(Default:http://localhost:8080/ca.crt) - When prompted, select
Trust this CA to identify websitesand click OK.
- Download
ca.crtfromhttp://<Your FQDN>:8080/ca.crt(Default:http://localhost:8080/ca.crt) - Go to
about:preferences#privacyscroll down toSecurityandCertificatesand clickView Certificates - Import the downloaded certificate file (step 1)
Chrome
- When using Chrome, you need to restart Chrome so it reloads the trust store (
chrome://restart). - Additionally, after installing a new cert, you need to clear the Storage (DevTools → Application → Clear storage → Clear site data).
Google Chrome
- To skip the installation of the certificate, you can also open
chrome://flags/#unsafely-treat-insecure-origin-as-secure - The feature
Insecure origins treated as securemust be enabled and the list must include your ErikrafT Drop test instance. E.g.:http://127.0.0.1:3000,https://127.0.0.1:8443
https://<Your FQDN>:8443 (Default: https://localhost:8443).
