Skip to content

Commit 485c8c3

Browse files
committed
fixed docker files and quoted message option
1 parent f2d0a8e commit 485c8c3

File tree

7 files changed

+51
-43
lines changed

7 files changed

+51
-43
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM node:16.18-alpine
22

3+
USER root
4+
35
RUN apk update && apk upgrade && \
46
apk add --no-cache git
57

docker-compose.yaml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ networks:
77
services:
88
api:
99
container_name: evolution_api
10-
build:
11-
context: .
12-
dockerfile: Dockerfile
10+
image: evolution/api:local
1311
ports:
14-
- 8083:8080
15-
# volumes:
16-
# - /data/instances:/evolution/instances
12+
- 8080:8080
13+
volumes:
14+
- ./docker-data/instances:/evolution/instances
15+
depends_on:
16+
- mongodb
17+
- redis
1718
environment:
1819
# Determine how long the instance should be deleted from memory in case of no connection.
1920
# Default time: 5 minutes
@@ -25,7 +26,7 @@ services:
2526
- STORE_CONTACTS=true
2627
- STORE_CHATS=true
2728
# Permanent data storage
28-
- DATABASE_ENABLED=false
29+
- DATABASE_ENABLED=true
2930
- DATABASE_CONNECTION_URI=mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true
3031
- DATABASE_CONNECTION_DB_PREFIX_NAME=evolution
3132
# Choose the data you want to save in the application's database or store
@@ -35,7 +36,7 @@ services:
3536
- DATABASE_SAVE_MESSAGE_UPDATE=false
3637
- DATABASE_SAVE_DATA_CONTACTS=true
3738
- DATABASE_SAVE_DATA_CHATS=true
38-
- REDIS_ENABLED=false
39+
- REDIS_ENABLED=true
3940
- REDIS_URI=redis://redis:6379
4041
- REDIS_PREFIX_KEY=evolution
4142
# Webhook Settings
@@ -76,7 +77,7 @@ services:
7677
# OBS: This key must be inserted in the request header to create an instance.
7778
- AUTHENTICATION_API_KEY=B6D711FCDE4D4FD5936544120E713976
7879
# Expose the api key on return from fetch instances
79-
- AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
80+
- AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=false
8081
# Set the secret key to encrypt and decrypt your token and its expiration time.
8182
- AUTHENTICATION_JWT_EXPIRIN_IN=0 # seconds - 3600s === 1h | zero (0) - never expires
8283
# Set the instance name and webhook url to create an instance in init the application
@@ -90,33 +91,31 @@ services:
9091
networks:
9192
- evolution-net
9293
expose:
93-
- 8083
94+
- 8080
9495

95-
# mongodb:
96-
# container_name: mongodb
97-
# image: mongo
98-
# restart: always
99-
# volumes:
100-
# - /data/mongodb:/data/db
101-
# ports:
102-
# - 27017:27017
103-
# environment:
104-
# MONGO_INITDB_ROOT_USERNAME: root
105-
# MONGO_INITDB_ROOT_PASSWORD: root
106-
# networks:
107-
# - evolution-net
108-
# expose:
109-
# - 27017
96+
mongodb:
97+
container_name: mongodb
98+
image: mongo
99+
restart: always
100+
volumes:
101+
- ./docker-data/mongodb/data:/data/db
102+
- ./docker-data/mongodb/configdb:/data/configdb
103+
ports:
104+
- 27017:27017
105+
environment:
106+
MONGO_INITDB_ROOT_USERNAME: root
107+
MONGO_INITDB_ROOT_PASSWORD: root
108+
networks:
109+
- evolution-net
110+
expose:
111+
- 27017
110112

111-
# redis:
112-
# container_name: redis
113-
# image: redis:latest
114-
# restart: always
115-
# volumes:
116-
# - /data/redis:/data
117-
# ports:
118-
# - 6379:6379
119-
# networks:
120-
# - evolution-net
121-
# expose:
122-
# - 6379
113+
redis:
114+
image: redis:latest
115+
volumes:
116+
- ./docker-data/redis:/data
117+
container_name: redis
118+
ports:
119+
- 6379:6379
120+
networks:
121+
- evolution-net

docker.sh

100644100755
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ then
88
docker network create -d bridge ${NET}
99
fi
1010

11-
sudo mkdir -p /data/instances
11+
sudo mkdir -p ./docker-data/instances
12+
sudo mkdir -p ./docker-data/mongodb
13+
sudo mkdir -p ./docker-data/mongodb/data
14+
sudo mkdir -p ./docker-data/mongodb/configdb
1215

1316
docker build -t ${IMAGE} .
1417

15-
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}
18+
docker compose up -d

src/dev-env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Choose the server type for the application
88
SERVER:
99
TYPE: http # https
10-
PORT: 8083 # 443
10+
PORT: 8080 # 443
1111

1212
CORS:
1313
ORIGIN:

src/validate/validate.schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ const quotedOptionsSchema: JSONSchema7 = {
8181
required: ['id', 'remoteJid', 'fromMe'],
8282
...isNotEmpty('id', 'remoteJid'),
8383
},
84-
message: { type: 'object' },
8584
},
8685
};
8786

src/whatsapp/services/monitor.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class WAMonitoringService {
7171
let apikey: string;
7272
if (this.configService.get<Auth>('AUTHENTICATION').EXPOSE_IN_FETCH_INSTANCES) {
7373
const tokenStore = await this.repository.auth.find(key);
74-
apikey = tokenStore.apikey || '';
74+
apikey = tokenStore.apikey || 'Apikey not found';
7575

7676
instances.push({
7777
instance: {

src/whatsapp/services/whatsapp.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,12 @@ export class WAStartupService {
983983

984984
const messageSent = await (async () => {
985985
const option = {
986-
quoted,
986+
quoted: {
987+
key: quoted.key,
988+
message: {
989+
conversation: 'message',
990+
},
991+
},
987992
};
988993

989994
if (!message['audio'] && !message['poll'] && !message['linkPreview']) {

0 commit comments

Comments
 (0)