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

ExpressJS and MongoDB as stack or service #1086

Closed
macmladen opened this issue Jun 20, 2019 · 1 comment
Closed

ExpressJS and MongoDB as stack or service #1086

macmladen opened this issue Jun 20, 2019 · 1 comment

Comments

@macmladen
Copy link

I am working on a project that uses ExpressJs for backend, MongoDB for database with Angular frontend.

As I see that Angular stack is supported, it would be nice if we could add Express container for backend and have the option to use MongoDB as database?

Such a stack would need:

  1. Frontend (Angular, React, Vue...)
  2. Backend (Express)
  3. Database (Mongo)

Also, it would be nice to have React project template although it is not hard to make a one from Node.

@achekulaev
Copy link
Member

This ticket is very loaded.

ExpressJS is a node library. Not sure why you would want a separate container for that. It uses port 3000, so I would declare DOCKSAL_STACK=node to get cli to auto-expose that port and then declare express as a dependency in package.json.

Same approach for Angular, React, Vue or others. There is little sense in baking a separate image for each of them. One should rather define them as dependencies and install during npm install which is an essential part of any node based app.

Full fledged Mongo support is harder. Huge effort. Unikely in in short or medium perspective, unless someone specifically pays for the development.

But basic Mongo support can be achieved by using https://hub.docker.com/_/mongo
They even have an example YAML

services:

  mongo:
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example

but I would rather change the mongo-express to be more Docksal friendly

  mongo-express:
    image: mongo-express
    restart: always
    labels:
      - io.docksal.virtual-host=mongo.${VIRTUAL_HOST}
      - io.docksal.virtual-port=8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example

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

No branches or pull requests

2 participants