Hosting Your Own Relay
Deployment Options
The relay server can be deployed using either Docker containers or directly on the host machine.
Prerequisites
Docker Deployment
Direct Deployment
Setup Instructions
-
Clone the repository and navigate to the project directory:
git clone https://github.com/zestyxyz/relay
cd relay -
Configure environment variables:
cp .env.sample .env
# Edit .env with your configuration -
Start the server using your preferred deployment method:
Docker Deployment:
docker compose up -d
Direct Deployment:
cargo run -r
Network Configuration
Port Configuration
Ensure your server exposes the necessary port for the relay service, which is configured in your .env
file.
Nginx Reverse Proxy Setup
Below is a sample configuration for running the relay behind an Nginx reverse proxy:
# HTTP redirect to HTTPS
server {
listen 80;
server_name <YOUR_HOST_NAME_HERE>;
return 301 https://$host$request_uri;
}
# HTTPS configuration
server {
listen 443 ssl;
server_name <YOUR_HOST_NAME_HERE>;
# SSL configuration
ssl_certificate <PATH_TO_YOUR_SSL_CERT>;
ssl_certificate_key <PATH_TO_YOUR_SSL_CERT_KEY>;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
# Proxy configuration
proxy_intercept_errors on;
location / {
client_max_body_size 20M;
proxy_pass http://localhost:8080; # Adjust port as needed
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}