Skip to content

Commit

Permalink
version: 2.2.1 sync
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidsonGomes committed Jan 22, 2025
1 parent 3a0487a commit 2228d58
Show file tree
Hide file tree
Showing 82 changed files with 14,932 additions and 747 deletions.
12 changes: 7 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ SERVER_URL=http://localhost:8080

SENTRY_DSN=

TZ=America/Sao_Paulo

# Cors - * for all or set separate by commas - ex.: 'yourdomain1.com, yourdomain2.com'
CORS_ORIGIN=*
CORS_METHODS=GET,POST,PUT,DELETE
Expand All @@ -28,10 +26,10 @@ DEL_INSTANCE=false

# Provider: postgresql | mysql
DATABASE_PROVIDER=postgresql
DATABASE_CONNECTION_URI='postgresql://user:pass@localhost:5432/evolution?schema=public'
DATABASE_CONNECTION_URI='postgresql://user:pass@postgres:5432/evolution?schema=public'
# Client name for the database connection
# It is used to separate an API installation from another that uses the same database.
DATABASE_CONNECTION_CLIENT_NAME=evolution
DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange

# Choose the data you want to save in the application's database
DATABASE_SAVE_DATA_INSTANCE=true
Expand Down Expand Up @@ -92,7 +90,7 @@ WEBSOCKET_ENABLED=false
WEBSOCKET_GLOBAL_EVENTS=false

# Pusher - Environment variables
PUSHER_ENABLED=true
PUSHER_ENABLED=false
PUSHER_GLOBAL_ENABLED=false
PUSHER_GLOBAL_APP_ID=
PUSHER_GLOBAL_KEY=
Expand Down Expand Up @@ -226,6 +224,10 @@ S3_USE_SSL=true
# S3_USE_SSL=true
# S3_REGION=eu-south

# Evolution Audio Converter - Environment variables - https://github.com/EvolutionAPI/evolution-audio-converter
# API_AUDIO_CONVERTER=http://localhost:4040/process-audio
# API_AUDIO_CONVERTER_KEY=429683C4C977415CAAFCCE10F7D57E11

# Define a global apikey to access all instances.
# OBS: This key must be inserted in the request header to create an instance.
AUTHENTICATION_API_KEY=429683C4C977415CAAFCCE10F7D57E11
Expand Down
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'CommonJS',
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: false,
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
},
plugins: ['@typescript-eslint', 'simple-import-sort', 'import'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/check_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check Code Quality

on: [pull_request]

jobs:
check-lint-and-build:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 20.x

- name: Install packages
run: npm install

- name: Check linting
run: npm run lint:check

- name: Check build
run: npm run db:generate

- name: Check build
run: npm run build
48 changes: 0 additions & 48 deletions .github/workflows/publish_docker_image.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ lerna-debug.log*
# Package
/yarn.lock
/pnpm-lock.yaml
/package-lock.json

# IDEs
.vscode/*
Expand Down
31 changes: 27 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
# 2.2.0 (develop)
# 2.2.1 (2025-01-22 14:37)

### Features

* Retry system for send webhooks
* Message filtering to support timestamp range queries
* Chats filtering to support timestamp range queries

### Fixed

* Correction of webhook global
* Fixed send audio with whatsapp cloud api
* Refactor on fetch chats
* Refactor on Evolution Channel

# 2.2.0 (2024-10-18 10:00)

### Features

* Fake Call function
* Send List Message
* Send Button Message
* Send List with Baileys
* Send Buttons with Baileys
* Added unreadMessages to chats
* Pusher event integration
* Add support for splitMessages and timePerChar in Integrations
* Audio Converter via API
* Send PTV messages with Baileys

### Fixed

* Fixed prefilledVariables in startTypebot
* Fix duplicate file upload
* Mark as read from me and groups
* fetch chats query
* Fetch chats query
* Ads messages in chatwoot
* Add indexes to improve performance in Evolution
* Add logical or permanent message deletion based on env config
* Add support for fetching multiple instances by key
* Update instance.controller.ts to filter by instanceName
* Receive template button reply message

# 2.1.2 (2024-10-06 10:09)

Expand Down
31 changes: 31 additions & 0 deletions Docker/minio/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.3'

services:
minio:
container_name: minio
image: quay.io/minio/minio
networks:
- evolution-net
command: server /data --console-address ":9001"
restart: always
ports:
- 5432:5432
environment:
- MINIO_ROOT_USER=USER
- MINIO_ROOT_PASSWORD=PASSWORD
- MINIO_BROWSER_REDIRECT_URL=http:/localhost:9001
- MINIO_SERVER_URL=http://localhost:9000
volumes:
- minio_data:/data
expose:
- 9000
- 9001

volumes:
minio_data:


networks:
evolution-net:
name: evolution-net
driver: bridge
32 changes: 19 additions & 13 deletions Docker/swarm/evolution_api_v2.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
version: "3.7"

services:
evolution_v2_lite:
evolution_v2:
image: atendai/evolution-api-lite:latest
entrypoint: ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ]
volumes:
- evolution_instances:/evolution/instances
networks:
Expand All @@ -20,10 +19,10 @@ services:
- DATABASE_SAVE_DATA_CHATS=true
- DATABASE_SAVE_DATA_LABELS=true
- DATABASE_SAVE_DATA_HISTORIC=true
- DATABASE_CONNECTION_CLIENT_NAME=evolution_v2_lite
- DATABASE_CONNECTION_CLIENT_NAME=evolution_v2
- RABBITMQ_ENABLED=false
- RABBITMQ_URI=amqp://admin:admin@rabbitmq:5672/default
- RABBITMQ_EXCHANGE_NAME=evolution_v2_lite
- RABBITMQ_EXCHANGE_NAME=evolution_v2
- RABBITMQ_GLOBAL_ENABLED=false
- RABBITMQ_EVENTS_APPLICATION_STARTUP=false
- RABBITMQ_EVENTS_INSTANCE_CREATE=false
Expand Down Expand Up @@ -97,9 +96,16 @@ services:
- QRCODE_LIMIT=30
- CACHE_REDIS_ENABLED=true
- CACHE_REDIS_URI=redis://evo_redis:6379/1
- CACHE_REDIS_PREFIX_KEY=evolution_v2_lite
- CACHE_REDIS_PREFIX_KEY=evolution_v2
- CACHE_REDIS_SAVE_INSTANCES=false
- CACHE_LOCAL_ENABLED=false
- S3_ENABLED=true
- S3_ACCESS_KEY=
- S3_SECRET_KEY=
- S3_BUCKET=evolution
- S3_PORT=443
- S3_ENDPOINT=files.site.com
- S3_USE_SSL=true
- AUTHENTICATION_API_KEY=429683C4C977415CAAFCCE10F7D57E11
- AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
- LANGUAGE=en
Expand All @@ -111,18 +117,18 @@ services:
- node.hostname == evolution-manager
labels:
- traefik.enable=true
- traefik.http.routers.evolution_v2_lite.rule=Host(`evo2.site.com`)
- traefik.http.routers.evolution_v2_lite.entrypoints=websecure
- traefik.http.routers.evolution_v2_lite.tls.certresolver=letsencryptresolver
- traefik.http.routers.evolution_v2_lite.priority=1
- traefik.http.routers.evolution_v2_lite.service=evolution_v2_lite
- traefik.http.services.evolution_v2_lite.loadbalancer.server.port=8080
- traefik.http.services.evolution_v2_lite.loadbalancer.passHostHeader=true
- traefik.http.routers.evolution_v2.rule=Host(`evo2.site.com`)
- traefik.http.routers.evolution_v2.entrypoints=websecure
- traefik.http.routers.evolution_v2.tls.certresolver=letsencryptresolver
- traefik.http.routers.evolution_v2.priority=1
- traefik.http.routers.evolution_v2.service=evolution_v2
- traefik.http.services.evolution_v2.loadbalancer.server.port=8080
- traefik.http.services.evolution_v2.loadbalancer.passHostHeader=true

volumes:
evolution_instances:
external: true
name: evolution_v2_lite_data
name: evolution_v2_data

networks:
network_public:
Expand Down
38 changes: 29 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,56 @@
FROM node:20-alpine AS builder

RUN apk add git wget curl bash
RUN apk update && \
apk add git wget curl bash openssl

LABEL version="2.2.1" description="Api to control whatsapp features through http requests."
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
LABEL contact="[email protected]"

WORKDIR /evolution

COPY ./package.json ./tsconfig.json ./
RUN npm install --omit=dev

RUN rm -rf /var/cache/apk/*
RUN npm install

COPY ./src ./src
COPY ./public ./public
COPY ./prisma ./prisma
COPY ./.env.example ./.env
COPY ./runWithProvider.js ./
COPY ./tsup.config.ts ./

COPY ./Docker ./Docker

RUN chmod +x ./Docker/scripts/* && dos2unix ./Docker/scripts/* && \
./Docker/scripts/generate_database.sh && \
npm run build
RUN chmod +x ./Docker/scripts/* && dos2unix ./Docker/scripts/*

RUN ./Docker/scripts/generate_database.sh

RUN npm run build

FROM node:20-alpine AS final

RUN apk add git wget curl bash
RUN apk update && \
apk add tzdata bash openssl

ENV TZ=America/Sao_Paulo

WORKDIR /evolution

COPY --from=builder /evolution ./
COPY --from=builder /evolution/package.json ./package.json
COPY --from=builder /evolution/package-lock.json ./package-lock.json

COPY --from=builder /evolution/node_modules ./node_modules
COPY --from=builder /evolution/dist ./dist
COPY --from=builder /evolution/prisma ./prisma
COPY --from=builder /evolution/public ./public
COPY --from=builder /evolution/.env ./.env
COPY --from=builder /evolution/Docker ./Docker
COPY --from=builder /evolution/runWithProvider.js ./runWithProvider.js
COPY --from=builder /evolution/tsup.config.ts ./tsup.config.ts

ENV DOCKER_ENV=true

EXPOSE 8080

ENTRYPOINT ["/bin/bash", "-c", "npm run start:prod" ]
ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ]
Loading

0 comments on commit 2228d58

Please sign in to comment.