Git Product home page Git Product logo

Comments (7)

diavrank avatar diavrank commented on September 2, 2024

I think you shouldn't remove mongo service, since Meteor app needs to connect to a database, that's why you are getting that error.

from meteor-base.

inoyatov avatar inoyatov commented on September 2, 2024

@diavrank i already removed. There is only one service app with external MONGO_URL=mongodb://root:[email protected]:27017/meteor. But error shows me that I am trying to connect 127.0.01:27017. So, what can be the case?

from meteor-base.

diavrank avatar diavrank commented on September 2, 2024

I don't know why you remove the mongo service. I imagine that you have a meteor app which doesn't need a database (maybe because is only a website or front-end app), so, in that case you can use MONGO_URL=none according to this link

from meteor-base.

inoyatov avatar inoyatov commented on September 2, 2024

@diavrank my MongoDB is managed instance I do not need to deploy it as a docker container. So, I removed it. And I am passing MONGO_URL=mongodb://root:[email protected]:27017/meteor

from meteor-base.

inoyatov avatar inoyatov commented on September 2, 2024

Here is my docker-compose.

version: '3'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - '80:3000'
    depends_on:
      - mongo
    environment:
      ROOT_URL: ${APP_ROOT_URL:-http://localhost}
      MONGO_URL: mongodb://root:[email protected]:27017/meteor
      PORT: 3000

from meteor-base.

diavrank avatar diavrank commented on September 2, 2024

ok, now I understand, so, in that case you need to specify a public IP address or domain in order to establish a successful connection, since if you use a local IP address like 192.168.0.100, docker will try to find it inside the docker network (a network created by default which is used by the containers defined in the docker-compose file). Your compose file should be like this:

version: '3'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - '80:3000'
    environment:
      ROOT_URL: ${APP_ROOT_URL:-http://localhost}
      MONGO_URL: mongodb://root:[email protected]:27017/meteor?authSource=admin
      PORT: 3000

Also, you can use a cloud service like Mongo Atlas, and your compose file should be like this:

version: '3'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - '80:3000'
    environment:
      ROOT_URL: ${APP_ROOT_URL:-http://localhost}
      MONGO_URL: mongodb+srv://user:[email protected]/databaseName?retryWrites=true&w=majority
      PORT: 3000

In my opinion, I don't recommend you to use Mongo Atlas in free tier because you can experience speed issues with your app.

On the other hand, I recommend you if you are using docker in you personal computer, you'll need to migrate the database server to a docker container in order to achieve the connection with your app service. I don't know if exists a way to connect a docker container with a service in the host machine.

from meteor-base.

GeoffreyBooth avatar GeoffreyBooth commented on September 2, 2024

Closing as this isn’t an issue with this project.

from meteor-base.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.