This guide will help you set up and run the Dead Man's Switch application on your own server.
- A server running Linux with Docker installed
- Domain name pointing to your server (for HTTPS and email verification)
- Email account for sending notifications (or use a service like SendGrid)
- Telegram account (to create a bot for notifications)
This is the easiest way to get started with environment variable management:
-
Clone the repository:
git clone https://github.com/korjavin/deadmanswitch.git cd deadmanswitch
-
Copy the example environment file and modify it with your settings:
cp .env.example .env # Edit .env with your preferred text editor nano .env
-
Start the application:
docker-compose up -d
Alternatively, you can deploy the Dead Man's Switch using our pre-built Docker image:
docker run -d \
--name deadmanswitch \
-p 443:443 -p 80:80 \
-v deadmanswitch-data:/app/data \
-e BASE_DOMAIN="your-domain.com" \
-e TG_BOT_TOKEN="your_telegram_bot_token" \
-e SMTP_HOST="smtp.example.com" \
-e SMTP_PORT="587" \
-e SMTP_USERNAME="[email protected]" \
-e SMTP_PASSWORD="your_email_password" \
-e ADMIN_EMAIL="[email protected]" \
-e PING_FREQUENCY="3" \
-e PING_DEADLINE="14" \
ghcr.io/korjavin/deadmanswitch:latest
When using Docker Compose, you can configure these variables in the .env
file. For Docker Run, pass them using the -e
flag.
Variable | Description |
---|---|
BASE_DOMAIN | The domain name where your application is hosted |
TG_BOT_TOKEN | Token for your Telegram bot (get from BotFather) |
ADMIN_EMAIL | Email address for admin notifications |
Variable | Description | Default |
---|---|---|
SMTP_HOST | SMTP server hostname | (required for email) |
SMTP_PORT | SMTP server port | 587 |
SMTP_USERNAME | SMTP username | (required for email) |
SMTP_PASSWORD | SMTP password | (required for email) |
SMTP_FROM | From address for emails | [email protected] |
PING_FREQUENCY | How often to ping users (days) | 1 |
PING_DEADLINE | Time until switch activates (days, must be between 7 and 30) | 7 |
DB_PATH | Database file location | /app/data/db.sqlite |
LOG_LEVEL | Logging verbosity (debug, info, warn, error) | info |
ENABLE_METRICS | Enable Prometheus metrics | false |
DEBUG | Enable debug mode | false |
PORT | Port to expose the application on | 8080 |
DATA_DIR | Directory to store data | ./data |
- Open Telegram and search for "BotFather"
- Start a chat and send
/newbot
command - Follow the instructions to create your bot
- Copy the API token provided
- Use this token as the
TG_BOT_TOKEN
environment variable
The application stores all data in /app/data
. Mount this directory as a volume to ensure data persistence:
docker volume create deadmanswitch-data
If you prefer to build the Docker image yourself:
git clone https://github.com/korjavin/deadmanswitch.git
cd deadmanswitch
docker build -t deadmanswitch .
The application includes Caddy as a reverse proxy, which automatically obtains and renews Let's Encrypt SSL certificates. Ensure that:
- Your domain is correctly pointing to your server's IP address
- Ports 80 and 443 are accessible from the internet
- The BASE_DOMAIN environment variable is set correctly
- Firewall: Configure your server's firewall to only allow necessary ports (80, 443)
- Regular Backups: Backup the data volume regularly
- Updates: Keep the application updated with the latest security patches
- Monitoring: Set up monitoring for the container to ensure it's running
- Authentication: Configure secure authentication methods - see Authentication Guide for details on setting up passkeys and 2FA
docker logs deadmanswitch
Check if ports 80 and 443 are already in use by other services.
Verify your SMTP settings and ensure your email provider allows sending through SMTP.
Make sure your domain is properly configured and pointing to your server.
If you encounter any issues, please open a ticket on our GitHub repository.