Prerequisites: Before proceeding with the installation of Evolution API v2 using Docker, make sure you have already configured the necessary services, such as PostgreSQL and Redis. Follow the links below for more details:
These installation instructions assume that you have already installed Docker on your machine. You can find information on how to install Docker in the
Official Docker Documentation.
Docker Compose
Deploying Evolution API v2 using Docker Compose simplifies the setup and management of your Docker containers. It allows you to define your Docker environment in adocker-compose.yaml file and then use a single command to start everything.
Docker Compose File
The following example illustrates how to configure Docker Compose for standalone environments, i.e., a single running server. For syncing two servers in parallel or for greater scalability, use Docker Swarm, recommended for more advanced users.Standalone Configuration
Docker standalone is suitable when Evolution API will run on just one machine, without the need for immediate scalability. This is the most convenient method for most users. To get started, create adocker-compose.yml file with the following content:
.env file in the same directory with the following minimal content:
For more configurations, you can get the example file from the
official repository. Also, check the environment variables guide here.
Starting the API
Navigate to the directory containing thedocker-compose.yml file and run the following command to start the services defined in the file:
Checking the Logs
After running thedocker compose up command, you can check the logs to confirm that the services are running correctly:
Stopping the Service
To stop the service, use the command:Accessing the API
Open your browser and go to http://localhost:8080 to check if the Evolution API is operational.Docker Swarm
To set up and manage a Docker Swarm cluster for Evolution API v2, follow the instructions below. Docker Swarm is ideal for environments that require scalability and high availability.Docker Swarm Installation
Configuring the Manager Server
If you are using a Hetzner server, run:- Change the machine’s hostname to identify it in the cluster:
- Edit the
/etc/hostsfile to add the new name:
- Reboot the system to apply the changes:
- Check the hostname:
Configuring the Worker Server
If you are using a Hetzner server, run:- Change the machine’s hostname to identify it in the cluster:
- Edit the
/etc/hostsfile to add the new name:
- Reboot the system to apply the changes:
Prerequisites for Evolution API via Swarm
Installing Traefik
To install Traefik on Docker Swarm, follow the instructions below:- On the manager server, create a
traefik.yamlfile:
- Add the following content to the file:
- Run the following command to deploy the Traefik stack: