Skip to content

Connection to mongodb fails #183

@nicokant

Description

@nicokant

Hi, I'm trying to setup the project using Docker, but I keep getting the same error:

com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]

The docker image is built on the master branch, the docker compose is the following:

version: "3.9"

volumes:
  mongo-data:

services:
  mongo:
    image: mongo:3.6.2-jessie
    ports:
      - 27017:27017
    volumes:
      - mongo-data:/data/db

  gamification-engine:
    image: ghcr.io/nicokant/smartcampus-gamification:latest    # remote image built on github
    ports:
      - "8010:8010"
      - "7777:7777"
    depends_on:
      - mongo
    links:
      - mongo:mongodb
    env_file: 
      - ./gamification.env
    volumes:
      - ./logs:/app/game-engine.web/logs
      - ./engine-config:/app/config

the gamification.env instead is the following:


# SERVER CONFS
#
SERVER_PORT=8010
SERVER_CONTEXTPATH=/gamification
GAMIFICATION_REVERSEPROXY=
SPRING_PROFILE=sec
# LOG PATH
LOG_PATH=/app/game-engine.web/logs
STATS_LOGGER_LEVEL=INFO
USERS_FILE=/app/config/users.yml
#
# Actuators stuff.
#
MANAGEMENT_CONTEXT=/manage
MANAGEMENT_PORT=9000
MANAGEMENT_SECURITY_ENABLED=false

#
# DB SETTINGS
#
MONGO_HOST=mongo
MONGO_PORT=27017
MONGO_DBNAME=gamification
#MONGO_USERNAME=
#MONGO_PWD=
#MONGO_AUTHDB=

#
# Platform security
#
#Parent Space
AAC_ROLES_CONTEXT=COMPONENTS/GAMIFICATION
AAC_ROLES_ROLE=ROLE_PROVIDER
AAC_URL=http://localhost:8080/aac
AAC_CLIENTID=8f5d78cf-56b6-4217-b3f0-bdc126a99258
AAC_CLIENTSECRET=2bb738cc-718b-44d4-aace-5d62680971f2

#
# PERSISTENCE TASK CONFIGURATIONS
#
# Use to activate task persistence (default value false)
TASK_PERSISTENCE_ACTIVATE=false

#
# RABBITMQ CONFIGURATIONS
#
# RABBITMQ_ENABLED=false
# RABBITMQ_HOST=localhost
# RABBITMQ_VIRTUALHOST=playgo
# RABBITMQ_PORT=5672
# RABBITMQ_USER=user
# RABBITMQ_PASSWORD=password
# RABBITMQ_PNGEXCHANGENAME=ge-notifications
# RABBITMQ_PNGROUTINGKEYPREFIX=game
# # comma separated list
# RABBITMQ_GAMEIDS=

It's strange that it keeps trying to connect to localhost:27017 while gamification.env set the HOST to mongo

How can I solve this?
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions