Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

New Chatwoot + Redis docs and MongoDB Default Method #29

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions docs/01-Get Started/Installation/Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CLI installation is recommended in fast deploy mostly for tests or development,

The fastest way to deploy EvolutionAPI with Docker is using `docker run` in the command line interface.

```bash title="Linux Command Line Interface" live
```bash title="Linux CLI (without MongoDB: recommended for testing)" live
docker run --name evolution-api --detach \
-p 8080:8080 \
-e AUTHENTICATION_API_KEY=YOUR_SUPER_SECURE_AUTHENTICATION_KEY \
Expand All @@ -60,11 +60,17 @@ EvolutionAPI has a in-built Swagger endpoint documentation, you could use to see

## Deploy using docker run with volumes

:::warning MongoDB Requirement

To ensure optimal performance and scalability, MongoDB is now a required component for deploying the Evolution API. Traditional storage solutions (HDD/SDD-based VPS) may result in `no-sessions` errors under high request volumes due to their limited speed. Transitioning to MongoDB effectively addresses these issues, providing a robust and efficient database solution for handling extensive data loads.

:::

You could also deploy using docker volumes to map EvolutionAPI data and instances to keep persist application data and all the instances of WhatsApp in yor local machine avoiding problems with container restart using `docker run` in the command line interface.

Run the following command to deploy the EvolutionAPI with the necessary volumes. This command maps the `evolution_store` and `evolution_instances` volumes to the respective directories within the container.

```bash title="Linux Command Line Interface" live
```bash title="Linux CLI (without MongoDB: recommended for testing)" live
docker run --name evolution-api --detach \
-p 8080:8080 \
-e AUTHENTICATION_API_KEY=YOUR_SUPER_SECURE_AUTHENTICATION_KEY \
Expand Down Expand Up @@ -114,7 +120,19 @@ services:
volumes:
- evolution_store:/evolution/store
- evolution_instances:/evolution/instances

mongodb:
image: mongo:latest
# Is not recommended to expose ports unless necessary, use docker internal dns name of the container for connection
# ports:
# - 27017:27017
environment:
- MONGO_INITDB_ROOT_USERNAME: "root"
- MONGO_INITDB_ROOT_PASSWORD: "YOUR_SUPER_SECURE_PASSWORD"
- PUID: "1000"
- PGID: "1000"
volumes:
- mongodb_data:/data/db
- mongodb_configdb:/data/configdb
volumes:
evolution_store:
evolution_instances:
Expand Down Expand Up @@ -256,7 +274,7 @@ volumes:
# Obligatory volumes for mongodb
mongodb_data:
mongodb_configdb:
# Optional volumes for EvolutionAPI
# Optional volumes for EvolutionAPI for local storage (deprecated)
# evolution_instances:
# evolution_store:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: MongoDB
hide_title: true
hide_table_of_contents: false
sidebar_label: MongoDB
sidebar_position: 1
sidebar_position: 3
pagination_label: MongoDB
# custom_edit_url: https://github.com/facebook/docusaurus/edit/main/docs/api-doc-markdown.md
description: Setup an MongoBD database in your environment with Evolution API.
Expand All @@ -25,7 +25,7 @@ MongoDB, a NoSQL database, is known for high performance and scalability. It's i

Set the MongoDB environment variables in the `.env` for Docker or the `dev-env.yml` for NPM file as follows:

```yaml title=".env or dev-env.yml" showLineNumbers
```yaml title=".env" showLineNumbers
# Set to true to enable MongoDB.
DATABASE_ENABLED=true
# Your MongoDB connection string.
Expand All @@ -34,17 +34,17 @@ DATABASE_CONNECTION_URI=mongodb://user:password@database_URL/?authSource=admin&r
DATABASE_CONNECTION_DB_PREFIX_NAME=evo
```

## Data migration
## Data migration (Beta)

Switching from local storage to MongoDB will not automatically transfer your WhatsApp instances that are currently synchronized with the original local storage.

:::tip Beta: Data Migration

Make sure that you already have an MongoDB instance running with a database created.
Make sure that you already have an MongoDB instance running.

:::

## Migrate your data in NPM or NVM
### Migrate your data in NPM or NVM from deprecated local storage

Stop the PM2 execution:

Expand Down
50 changes: 42 additions & 8 deletions docs/01-Get Started/Optional resources/Redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,55 @@ last_update:

## Setup Redis Cache

:::warning Deprecation of Redis
Redis is an in-memory data structure store, used as a database, cache, and message broker. It supports data structures such as strings, hashes, lists, sets, and more. Incorporating Redis can significantly improve the performance of Evolution API by enabling faster data access and efficient caching. Its integration with the Evolution API enhances system responsiveness through:

Redis will be deprecated in future versions of Evolution API, we do not recommend Redis installation anymore.
1. **Caching Chatwoot Messages**: Significantly improves message retrieval and response times.
2. **Instance Storage**: _(Deprecated)_ Previously used for managing API instances efficiently.

:::
### Configuring Redis for Evolution API

#### Docker Setup (Recommended)

Redis is an in-memory data structure store, used as a database, cache, and message broker. It supports data structures such as strings, hashes, lists, sets, and more. Incorporating Redis can significantly improve the performance of Evolution API by enabling faster data access and efficient caching.
For environments utilizing Docker, configure your Redis settings in the `.env` file:

```javascript title=".env" showLineNumbers
CACHE_REDIS_ENABLED=true
CACHE_REDIS_URI=redis://localhost:6379
CACHE_REDIS_PREFIX_KEY=chatwoot-cache
CACHE_REDIS_TTL=604800
CACHE_LOCAL_ENABLED=true
CACHE_LOCAL_TTL=86400
```
#### PM2 Setup (test and development)

If you use PM2 installation method, the variables has to be set on `env.yml`:

```yaml title="src/env.yml" showLineNumbers
CACHE:
REDIS:
ENABLED: true
URI: "redis://localhost:6379"
PREFIX_KEY: "evolution-cache"
TTL: 604800
LOCAL:
ENABLED: true
TTL: 86400
```

## Deprecation Notice: Redis Instance Storage

:::info Deprecation of Redis for instances

Redis for saving instances will be deprecated in future versions of Evolution API, we do not recommend Redis installation anymore for instance management, there is some problems when using more than one instance.

:::

Set the Redis environment variables in the `.env` for Docker or the `dev-env.yml` for NPM file as follows:

```yaml title=".env or dev-env.yml" showLineNumbers
# Set to true to enable Redis.
**Bug:** with multiple instances Redis ends up mixing information of messages sometimes, this is why deprecation is planned in future versions.

```javascript title=".env" showLineNumbers
REDIS_ENABLED=false
# Your Redis server URI.
REDIS_URI=redis://redis:6379
# Prefix key for Redis data.
REDIS_PREFIX_KEY=evo
```
78 changes: 0 additions & 78 deletions docs/06-Integrations/00-set-chatwoot.md

This file was deleted.

24 changes: 0 additions & 24 deletions docs/06-Integrations/01-find-chatwoot.md

This file was deleted.

Loading