This document discusses how to manage the various different types of data and databases associated with the WhatsApp Business API client.
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. The WhatsApp Business API client requires one Docker volume for media. This volume will be created automatically when running the
docker-compose commands during installation.
Docker volumes support storing volumes on remote hosts or cloud providers. You can set up the media volume on any existing datacenter fileshare solution. Make sure all the Webapp and Coreapp containers have read/write access to it. To view or edit the path to the volume, edit the
The WhatsApp Business API client can use MySQL to store data.
You can configure the database settings by setting the following environment variables in the
db.env file when installing the WhatsApp Business API client. These environment variables will be used by the Coreapp and Webapp when connecting to the MySQL database.
|Database Setting||Environment Variable|
WA_DB_NAME_PREFIX— Can be used to prefix all databases created when the WhatsApp Business API client is installed. It can be used to run multiple sets of WhatsApp Business API databases on the same database host.
WA_DB_CONNECTION_IDLE_TIMEOUT— By setting this environment variable (in milliseconds) while starting the Coreapp, you can set the idle timeout for your MySQL database. The MySQL server will then close any database connections that are idle for the time set.
These are recommendations for managing the database associated with your WhatsApp Business API client.
Upgrading with a large database
Large databases are considered those with more than 2 million rows in the
Use the automatic garbage collection parameter to ensure your database operates with stability by cleaning up the database periodically. See the Application Settings documentation for more information on the
Automatic garbage collection configuration
API call-based garbage collection
See the Services documentation for more information.
A log rotation script is packaged within the Coreapp and Webapp containers.
The log rotation script in the Webapp container:
The log rotation script in the Coreapp container:
In the Coreapp, a new log file is only created when the size exceeds 15MB per log file. The old log files are not removed automatically.
It is recommended you periodically (i.e., daily) execute the cleanup script below to perform log rotation on all Webapp, Coreapp and Master (in the case of a Multiconnect setup) containers. It's best to configure a cronjob on your host to perform on all running WhatsApp Business API containers and be executed during off-peak hours. Invoking the cleanup script periodically will keep the disk space consumed by log files under control.
docker exec your-container-name /opt/whatsapp/bin/cleanup.sh