This guide provides complete step-by-step instructions for deploying Evolution API on Dokku.
- Prerequisites
- Step 1: Create the Application
- Step 2: Configure PostgreSQL
- Step 3: Configure Persistent Storage
- Step 4: Configure Domain and Ports
- Step 5: Deploy the Application
- Step 6: Enable SSL (Optional)
- Completion
Before proceeding, ensure you have:
- A server with Dokku installed
- SSH access to your Dokku server
- The PostgreSQL plugin installed on Dokku
- (Optional) The Let's Encrypt plugin for SSL certificates
- A domain pointing to your server (optional, but recommended)
Connect to your Dokku server via SSH and create the evo application:
dokku apps:create evoThis creates a new application named evo on your Dokku server.
-
Install the PostgreSQL plugin (skip if already installed):
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
-
Create the PostgreSQL service:
dokku postgres:create evo
-
Link PostgreSQL to the application:
dokku postgres:link evo evo
Evolution API requires both DATABASE_CONNECTION_URI and SERVER_URL:
# Set DATABASE_CONNECTION_URI
dokku config:set evo DATABASE_CONNECTION_URI="$(dokku config:get evo DATABASE_URL)"
# Set SERVER_URL (REQUIRED - replace with your actual domain)
dokku config:set evo SERVER_URL="https://evo.example.com"Important: Replace
evo.example.comwith your actual domain.
Evolution API requires a global API Key for all requests. Generate one securely:
On Linux/macOS:
# Generate a random secure 32-character API Key
API_KEY=$(openssl rand -hex 16)
dokku config:set evo AUTHENTICATION_API_KEY="$API_KEY"
# Save the API Key for later use
echo "Your API Key: $API_KEY"
# Verify it was configured correctly
dokku config:get evo AUTHENTICATION_API_KEYOn Windows (PowerShell):
# Generate a random secure 32-character API Key
$API_KEY = -join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object {[char]$_})
ssh your-server "config:set evo AUTHENTICATION_API_KEY=$API_KEY"
# Save the API Key for later use
Write-Host "Your API Key: $API_KEY"
# Verify it was configured correctly
ssh your-server "config:get evo AUTHENTICATION_API_KEY"Important: Save this API Key in a secure location. You'll need it for all API requests.
If you need an additional user and database for the application, run the following commands one by one:
-
Create the
evo_app_useruser:dokku postgres:connect evo << 'EOF' DO $$ BEGIN IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'evo_app_user') THEN CREATE USER evo_app_user WITH PASSWORD 'jA54%B@rF7$pQs2*Lx8#mZvN9!wY3&tD'; END IF; END $$; EOF
-
Create the
service_dbdatabase:dokku postgres:connect evo << 'EOF' CREATE DATABASE service_db; EOF
-
Grant privileges:
dokku postgres:connect evo << 'EOF' GRANT ALL PRIVILEGES ON DATABASE service_db TO evo_app_user; EOF
Note: These commands are optional. The application works correctly with the main database automatically created by the PostgreSQL plugin.
To persist WhatsApp instances between restarts, create and mount a directory:
# Ensure the storage directory exists
dokku storage:ensure-directory evo
# Mount the storage directory to the application
dokku storage:mount evo /var/lib/dokku/data/storage/evo:/evolution/instancesThis ensures that all WhatsApp sessions, media, and data are preserved across application restarts and deployments.
Configure the domain for your application:
dokku domains:set evo evo.example.comReplace
evo.example.comwith your actual domain.
Map the internal port 8080 (Evolution API default) to external port 80:
dokku ports:set evo http:80:8080You can deploy the application using one of the following methods:
If you have SSH access to the Dokku server, you can deploy directly from the official repository:
dokku git:sync --build evo https://github.com/carrilloapps/evolution-api-on-dokku.gitThis will download the code, build, and deploy automatically.
Note: This command must be run from the Dokku server via SSH.
If you prefer to work locally (works on Windows, macOS, and Linux):
-
Clone the repository:
git clone https://github.com/carrilloapps/evolution-api-on-dokku.git cd evolution-api-on-dokku -
Add your Dokku server as a remote:
Linux/macOS/Windows (Git Bash):
git remote add dokku dokku@your-server.com:evo
Windows (PowerShell/CMD):
git remote add dokku dokku@your-server.com:evo
-
Push to Dokku:
git push dokku master
Choose the method that best suits your workflow.
Secure your application with an SSL certificate from Let's Encrypt:
-
Add the HTTPS port:
dokku ports:add evo https:443:8080
-
Install the Let's Encrypt plugin (skip if already installed):
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
-
Configure the contact email:
dokku letsencrypt:set evo email you@example.com
-
Enable Let's Encrypt:
dokku letsencrypt:enable evo
-
Configure automatic renewal:
dokku letsencrypt:cron-job --add
Congratulations! Your Evolution API instance is up and running. You can access it at:
- HTTP:
http://evo.example.com - HTTPS:
https://evo.example.com(if you configured SSL)
Retrieve the API Key you generated during installation:
dokku config:get evo AUTHENTICATION_API_KEYExample output:
oXZkh4B2FETGL31VeOzl6gqsdav9wmC0
If you want to change the API Key to a custom one:
dokku config:set evo AUTHENTICATION_API_KEY="your-new-super-secure-api-key"Test that the API is working correctly:
# Replace YOUR_API_KEY with the one you obtained
curl -X GET https://evo.example.com \
-H "apikey: YOUR_API_KEY"Example:
curl -X GET https://evo.example.com \
-H "apikey: oXZkh4B2FETGL31VeOzl6gqsdav9wmC0"You should receive a successful response from Evolution API.
- Review System Requirements to optimize resources
- Check Configuration for advanced settings
- Read Performance & Optimization for scaling tips
- See Useful Commands for management tasks
Check the logs:
dokku logs evo -tVerify the database URL:
dokku config:get evo DATABASE_CONNECTION_URICheck current port mappings:
dokku ports:report evoFor more help, visit the Evolution API documentation.