Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FE not able to communicate with BE #136

Closed
ragyabraham opened this issue Dec 1, 2020 · 1 comment
Closed

FE not able to communicate with BE #136

ragyabraham opened this issue Dec 1, 2020 · 1 comment

Comments

@ragyabraham
Copy link

Below is our docker-compose.yml file

x-appvars: &appvars
  LOG_LEVEL: ${LOG_LEVEL:-notice}
  NODE_ENV: ${NODE_ENV:-development}
  PORT: ${APP_PORT:-3000}
  API_PORT: ${API_PORT:-8000}
  URL_APP: ${URL_APP:-http://localhost:3000}
  URL_API: ${URL_API:-http://localhost:8000}
  STRIPEPUBLISHABLEKEY:
  BUCKET_FOR_POSTS:
  BUCKET_FOR_TEAM_AVATARS:
  LAMBDA_API_ENDPOINT:
  GA_TRACKING_ID:
  VERSION:
  ENVIRONMENT: PRODUCTION
  GCP_STORAGE_BUCKET_SCREENSHOTS:

services:
  saas-api:
    build:
      context: api
      args: *apibuildvars
    image: saas-api:${COMPOSE_TAG_NAME:-stage}
    container_name: saas-api
    networks:
      default:
        aliases:
          - localhost
    environment: *apirunvars
    ports:
      - "${API_PORT:-8000}:${API_PORT:-8000}"
    depends_on:
      - saas-mongo
    command: yarn start

  saas-app:
    build:
      context: app
      args: *appvars
    image: saas-app:${COMPOSE_TAG_NAME:-stage}
    container_name: saas-app
    networks:
      default:
        aliases:
          - localhost
    environment: *appvars
    ports:
      - "${APP_PORT:-3000}:${APP_PORT:-3000}"
    depends_on:
      - saas-api
    links:
      - "saas-api:8000"
    command: yarn start

  saas-mongo:
    image: mongo
    restart: always
    container_name: saas-mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME:-root}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD:-supersecret}
      MONGO_INITDB_DATABASE: ${MONGO_INITDB_DATABASE:-raptorweb}
      MONGO_NON_ROOT_USERNAME: ${MONGO_NON_ROOT_USERNAME:-saas}
      MONGO_NON_ROOT_PASSWORD: ${MONGO_NON_ROOT_PASSWORD:-secret}
    ports:
      - 27017:27017
    volumes:
      # 20190601 - fix for https://github.com/docker-library/mongo/issues/329#issuecomment-460858099
      - ./mongo-user.sh:/docker-entrypoint-initdb.d/mongo-user.sh:ro
      - /tmp/saas-db:/data/db

  saas-mongoexp:
    image: mongo-express
    restart: always
    container_name: saas-mongoexp
    environment:
      ME_CONFIG_MONGODB_SERVER: ${ME_CONFIG_MONGODB_SERVER:-saas-mongo}
      ME_CONFIG_MONGODB_ADMINUSERNAME: ${ME_CONFIG_MONGODB_ADMINUSERNAME:-root}
      ME_CONFIG_MONGODB_ADMINPASSWORD: ${ME_CONFIG_MONGODB_ADMINPASSWORD:-supersecret}
    ports:
      - 8081:8081
    depends_on:
      - saas-mongo
    links:
      - "saas-mongo"

networks:
  default:
    driver: bridge

However, we're getting the below error:

saas-app         | > Using external babel configuration
saas-app         | > Location: "/usr/src/app/.babelrc"
saas-app         | > Ready on http://localhost:3000
saas-app         | FetchError: request to http://localhost:8000/api/v1/public/get-user failed, reason: connect ECONNREFUSED 127.0.0.1:8000
saas-app         |     at ClientRequest.<anonymous> (/usr/src/app/node_modules/node-fetch/lib/index.js:1461:11)
saas-app         |     at ClientRequest.emit (events.js:315:20)
saas-app         |     at Socket.socketErrorListener (_http_client.js:469:9)
saas-app         |     at Socket.emit (events.js:315:20)
saas-app         |     at emitErrorNT (internal/streams/destroy.js:106:8)
saas-app         |     at emitErrorCloseNT (internal/streams/destroy.js:74:3)
saas-app         |     at processTicksAndRejections (internal/process/task_queues.js:80:21) {
saas-app         |   type: 'system',
saas-app         |   errno: 'ECONNREFUSED',
saas-app         |   code: 'ECONNREFUSED'
saas-app         | }
saas-app         | FetchError: request to http://localhost:8000/api/v1/public/get-user failed, reason: connect ECONNREFUSED 127.0.0.1:8000
saas-app         |     at ClientRequest.<anonymous> (/usr/src/app/node_modules/node-fetch/lib/index.js:1461:11)
saas-app         |     at ClientRequest.emit (events.js:315:20)
saas-app         |     at Socket.socketErrorListener (_http_client.js:469:9)
saas-app         |     at Socket.emit (events.js:315:20)
saas-app         |     at emitErrorNT (internal/streams/destroy.js:106:8)
saas-app         |     at emitErrorCloseNT (internal/streams/destroy.js:74:3)
saas-app         |     at processTicksAndRejections (internal/process/task_queues.js:80:21) {
saas-app         |   type: 'system',
saas-app         |   errno: 'ECONNREFUSED',
saas-app         |   code: 'ECONNREFUSED'
saas-app         | }
@tima101
Copy link
Member

tima101 commented Dec 7, 2020

@ragyibrahimRNA I acceptet Docker-related commit in the past but I don't have time to maintain it. I will keep this issue open for now but will close when I remove Docker-related configs from this repo. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants