Bonjour,

Je travaille actuellement sur un projet d'application mobile avec 2 parties sur Docker divisées en 2 fichiers pour :
- le front-end (8080 en port local)
- le back-end, écrit en Go

Chaque dossier correspond à un ensemble de conteneurs sur Docker.

J'ai rassemblé les deux dossiers dans un même dossier pour des questions de simplicité.

Le back end est divisé en 5 conteneurs :
- mongo
- redis
- redis_commander (8082)
- mongo_express (8081)
- backend (5000)

Le dernier conteneur (backend, 5000) déclenche l'erreur SASL et tente de redémarrer en boucle :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
/app/db/db.go:53 +0xbf

2021/07/22 10:15:15 Database:mongo:27017

panic: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.
Entre temps, j'ai aussi essayé de :
- supprimer les conteneurs, les volumes et les images
- re-buildé chaque partie à plusieurs reprises
- revu mes fichiers de configuration, notamment avec mes collègues ayant fondé le système

Maintenant, je me demande si je n'ai pas fait d'erreur ou oublié un paramètre essentiel dans mes fichiers de configuration :

docker-compose.yml

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
version: '3.6'
services:
  backend:
    build:
      context: ./src
    restart: on-failure
    ports:
      - "5000:8080" 
    expose:
      - 5000
    networks:
      - backend-network
    depends_on:
      - mongo
      - redis
    env_file:
      - backend_config.env

  mongo:
    image: mongo
    restart: on-failure
    volumes:
      - db-volume:/data/db
      - dbconfig-volume:/data/configdb
    networks:
      - backend-network
    env_file:
      - db_config.env

  mongo-express:
    image: mongo-express
    restart: on-failure
    ports:
      - 8081:8081
    networks:
      - backend-network
    depends_on:
      - mongo
    env_file:
      - db_config.env

  redis:
    image: redis:6.0.3-buster
    restart: on-failure
    networks:
      - backend-network

  redis-commander:
    image: rediscommander/redis-commander:latest
    restart: on-failure
    ports:
    - 8082:8082
    networks:
      - backend-network
    depends_on:
      - redis
    environment:
      - REDIS_HOST=redis
      - PORT=8082

volumes:
  db-volume:
  dbconfig-volume:

networks:
  backend-network:
backend_config.env

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
MONGODB_USERNAME=root
MONGODB_PASSWORD=example

DATABASE=mongo:27017
DATABASE_NAME=admin

ACCESS_SECRET=abc
REFRESH_SECRET=xyz
db_config.env

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=example

ME_CONFIG_MONGODB_ADMINUSERNAME=root
ME_CONFIG_MONGODB_ADMINPASSWORD=example

ME_CONFIG_MONGODB_SERVER=mongo
ME_CONFIG_MONGODB_PORT=27017
J'ai aussi ces messages avec le conteneur mongo-express :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
(node:8) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!

(node:8) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

Could not connect to database using connectionString: mongodb://root:example@mongo:27017/"

(node:8) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [Error: getaddrinfo EAI_AGAIN mongo

at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {

name: 'MongoNetworkError'

}]

at Pool.<anonymous> (/node_modules/mongodb/lib/core/topologies/server.js:441:11)

at Pool.emit (events.js:314:20)

at /node_modules/mongodb/lib/core/connection/pool.js:564:14

at /node_modules/mongodb/lib/core/connection/pool.js:999:11

at /node_modules/mongodb/lib/core/connection/connect.js:32:7

at callback (/node_modules/mongodb/lib/core/connection/connect.js:283:5)

at Socket.<anonymous> (/node_modules/mongodb/lib/core/connection/connect.js:313:7)

at Object.onceWrapper (events.js:421:26)

at Socket.emit (events.js:314:20)

at emitErrorNT (internal/streams/destroy.js:92:8)

at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)

at processTicksAndRejections (internal/process/task_queues.js:84:21)

(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

(node:8) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

Could not connect to database using connectionString: mongodb://root:example@mongo:27017/"

(node:8) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [Error: connect ECONNREFUSED 172.18.0.5:27017

at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {

name: 'MongoNetworkError'

}]

at Pool.<anonymous> (/node_modules/mongodb/lib/core/topologies/server.js:441:11)

at Pool.emit (events.js:314:20)

at /node_modules/mongodb/lib/core/connection/pool.js:564:14

at /node_modules/mongodb/lib/core/connection/pool.js:999:11

at /node_modules/mongodb/lib/core/connection/connect.js:32:7

at callback (/node_modules/mongodb/lib/core/connection/connect.js:283:5)

at Socket.<anonymous> (/node_modules/mongodb/lib/core/connection/connect.js:313:7)

at Object.onceWrapper (events.js:421:26)

at Socket.emit (events.js:314:20)

at emitErrorNT (internal/streams/destroy.js:92:8)

at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)

at processTicksAndRejections (internal/process/task_queues.js:84:21)

(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

(node:8) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Je vous remercie beaucoup par avance.