diff --git a/Dockerfile b/Dockerfile index f215b72e..13e02edf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM node:16.18-alpine +USER root + RUN apk update && apk upgrade && \ apk add --no-cache git diff --git a/docker-compose.yaml b/docker-compose.yaml index 5858f5f1..b85ddae1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,13 +7,14 @@ networks: services: api: container_name: evolution_api - build: - context: . - dockerfile: Dockerfile + image: evolution/api:local ports: - - 8083:8080 - # volumes: - # - /data/instances:/evolution/instances + - 8080:8080 + volumes: + - ./docker-data/instances:/evolution/instances + depends_on: + - mongodb + - redis environment: # Determine how long the instance should be deleted from memory in case of no connection. # Default time: 5 minutes @@ -25,7 +26,7 @@ services: - STORE_CONTACTS=true - STORE_CHATS=true # Permanent data storage - - DATABASE_ENABLED=false + - DATABASE_ENABLED=true - DATABASE_CONNECTION_URI=mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true - DATABASE_CONNECTION_DB_PREFIX_NAME=evolution # Choose the data you want to save in the application's database or store @@ -35,7 +36,7 @@ services: - DATABASE_SAVE_MESSAGE_UPDATE=false - DATABASE_SAVE_DATA_CONTACTS=true - DATABASE_SAVE_DATA_CHATS=true - - REDIS_ENABLED=false + - REDIS_ENABLED=true - REDIS_URI=redis://redis:6379 - REDIS_PREFIX_KEY=evolution # Webhook Settings @@ -76,7 +77,7 @@ services: # OBS: This key must be inserted in the request header to create an instance. - AUTHENTICATION_API_KEY=B6D711FCDE4D4FD5936544120E713976 # Expose the api key on return from fetch instances - - AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true + - AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=false # Set the secret key to encrypt and decrypt your token and its expiration time. - AUTHENTICATION_JWT_EXPIRIN_IN=0 # seconds - 3600s === 1h | zero (0) - never expires # Set the instance name and webhook url to create an instance in init the application @@ -90,33 +91,31 @@ services: networks: - evolution-net expose: - - 8083 + - 8080 - # mongodb: - # container_name: mongodb - # image: mongo - # restart: always - # volumes: - # - /data/mongodb:/data/db - # ports: - # - 27017:27017 - # environment: - # MONGO_INITDB_ROOT_USERNAME: root - # MONGO_INITDB_ROOT_PASSWORD: root - # networks: - # - evolution-net - # expose: - # - 27017 + mongodb: + container_name: mongodb + image: mongo + restart: always + volumes: + - ./docker-data/mongodb/data:/data/db + - ./docker-data/mongodb/configdb:/data/configdb + ports: + - 27017:27017 + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: root + networks: + - evolution-net + expose: + - 27017 - # redis: - # container_name: redis - # image: redis:latest - # restart: always - # volumes: - # - /data/redis:/data - # ports: - # - 6379:6379 - # networks: - # - evolution-net - # expose: - # - 6379 \ No newline at end of file + redis: + image: redis:latest + volumes: + - ./docker-data/redis:/data + container_name: redis + ports: + - 6379:6379 + networks: + - evolution-net \ No newline at end of file diff --git a/docker.sh b/docker.sh old mode 100644 new mode 100755 index 43f1952d..defa76d8 --- a/docker.sh +++ b/docker.sh @@ -8,8 +8,11 @@ then docker network create -d bridge ${NET} fi -sudo mkdir -p /data/instances +sudo mkdir -p ./docker-data/instances +sudo mkdir -p ./docker-data/mongodb +sudo mkdir -p ./docker-data/mongodb/data +sudo mkdir -p ./docker-data/mongodb/configdb docker build -t ${IMAGE} . -docker run -d --restart 'always' --name 'evolution_api' --mount 'type=bind,source=/data/instances,target=/evolution/instances' --publish '8083:8083' --hostname 'evolution' --network ${NET} ${IMAGE} \ No newline at end of file +docker compose up -d \ No newline at end of file diff --git a/src/dev-env.yml b/src/dev-env.yml index b62b0532..b3e6f304 100644 --- a/src/dev-env.yml +++ b/src/dev-env.yml @@ -7,7 +7,7 @@ # Choose the server type for the application SERVER: TYPE: http # https - PORT: 8083 # 443 + PORT: 8080 # 443 CORS: ORIGIN: diff --git a/src/validate/validate.schema.ts b/src/validate/validate.schema.ts index 408fa32e..b4680c3d 100644 --- a/src/validate/validate.schema.ts +++ b/src/validate/validate.schema.ts @@ -81,7 +81,6 @@ const quotedOptionsSchema: JSONSchema7 = { required: ['id', 'remoteJid', 'fromMe'], ...isNotEmpty('id', 'remoteJid'), }, - message: { type: 'object' }, }, }; diff --git a/src/whatsapp/services/monitor.service.ts b/src/whatsapp/services/monitor.service.ts index 03bb97e3..c91473f4 100644 --- a/src/whatsapp/services/monitor.service.ts +++ b/src/whatsapp/services/monitor.service.ts @@ -71,7 +71,7 @@ export class WAMonitoringService { let apikey: string; if (this.configService.get('AUTHENTICATION').EXPOSE_IN_FETCH_INSTANCES) { const tokenStore = await this.repository.auth.find(key); - apikey = tokenStore.apikey || ''; + apikey = tokenStore.apikey || 'Apikey not found'; instances.push({ instance: { diff --git a/src/whatsapp/services/whatsapp.service.ts b/src/whatsapp/services/whatsapp.service.ts index 4c900a43..16644523 100644 --- a/src/whatsapp/services/whatsapp.service.ts +++ b/src/whatsapp/services/whatsapp.service.ts @@ -983,7 +983,12 @@ export class WAStartupService { const messageSent = await (async () => { const option = { - quoted, + quoted: { + key: quoted.key, + message: { + conversation: 'message', + }, + }, }; if (!message['audio'] && !message['poll'] && !message['linkPreview']) {