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

react-node-mongodb #59

Merged
merged 1 commit into from
May 11, 2020
Merged

react-node-mongodb #59

merged 1 commit into from
May 11, 2020

Conversation

syed-afzal
Copy link
Contributor

I have created the one more sample of Docker Compose applications with multiple integrated services,
Services which I used is "react-node-mongodb". It will be an honor for me to contribute in docker community.
Let me know if you want some changes ?

Copy link
Collaborator

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First thank you very much for your contribution, the community asked for such sample #50 👍

Don't forget to update the main README.md to add your sample in the applications list 🙏

Few things to rename:

  • the main directory as react-express-mongodb because you use an express server for the backend part
  • the server directory to backend to keep consistency between the samples?

As you will see, we want to keep README.md as close as possible of the other samples, but you're amazing documentation shouldn't be drop, so we'll update of contribution guide and add template with some inspiration of work 🙏

react-node-mongodb/.env Outdated Show resolved Hide resolved
react-node-mongodb/.dockerignore Outdated Show resolved Hide resolved
react-node-mongodb/.gitignore Outdated Show resolved Hide resolved
react-node-mongodb/README.md Outdated Show resolved Hide resolved
react-node-mongodb/README.md Outdated Show resolved Hide resolved
react-node-mongodb/server/Dockerfile Outdated Show resolved Hide resolved
const mongoose = require('mongoose');
const {log} = require('../utils/helpers/logger');

exports.connect = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the MongoDB server isn't up and ready, the server will fail to start
Maybe you can try something like that

exports.connect = (app) => {
    const options = {
        useNewUrlParser: true,
        autoIndex: false, // Don't build indexes
        reconnectTries: 30, // Retry up to 30 times
        reconnectInterval: 500, // Reconnect every 500ms
        poolSize: 10, // Maintain up to 10 socket connections
        // If not connected, return errors immediately rather than waiting for reconnect
        bufferMaxEntries: 0
    }

    const connectWithRetry = () => {
      console.log('MongoDB connection with retry')
      mongoose.connect(process.env.MONGODB_URI, options).then(()=>{
        console.log('MongoDB is connected');
        app.emit('ready');
      }).catch(err=>{
        console.log('MongoDB connection unsuccessful, retry after 2 seconds.')
        setTimeout(connectWithRetry, 2000)
      })
    }
    connectWithRetry();
};

Just don't forget to pass the app to the function call to emit the readiness event 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

react-node-mongodb/server/config/messages.js Outdated Show resolved Hide resolved
react-node-mongodb/server/package.json Outdated Show resolved Hide resolved
react-node-mongodb/server/server.js Outdated Show resolved Hide resolved
@syed-afzal
Copy link
Contributor Author

syed-afzal commented Apr 29, 2020 via email

@syed-afzal
Copy link
Contributor Author

First thank you very much for your contribution, the community asked for such sample #50 👍

Don't forget to update the main README.md to add your sample in the applications list 🙏

Few things to rename:

  • the main directory as react-express-mongodb because you use an express server for the backend part
  • the server directory to backend to keep consistency between the samples?

As you will see, we want to keep README.md as close as possible of the other samples, but you're amazing documentation shouldn't be drop, so we'll update of contribution guide and add template with some inspiration of work 🙏

Hi there,

First thank you so much for the detailed review. Your comments against each item is honored, and I'll surely update them by this weekend.

I'm glad to be working on such a great technology that is backed by a great & active community 😊

I also attended the latest webinar of
'Future of compose webinar'

@glours
Copy link
Collaborator

glours commented May 1, 2020

Don't forget to sign off your commits 😉

@syed-afzal syed-afzal requested a review from glours May 4, 2020 19:58
@syed-afzal
Copy link
Contributor Author

@glours I am done with all the changes. Please have a look in it and let me know if there is anything remaining.

Thanks

@glours
Copy link
Collaborator

glours commented May 4, 2020

I'll try to check tomorrow 👍
Thanks

@syed-afzal
Copy link
Contributor Author

syed-afzal commented May 4, 2020 via email

@syed-afzal
Copy link
Contributor Author

syed-afzal commented May 9, 2020

Hi @glours, hope you are doing well,

Any update?

Copy link
Collaborator

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the delay, just few things to change but I think we're almost done 👌
Thanks for your patience 🙏

react-express-mongodb/frontend/Dockerfile Outdated Show resolved Hide resolved
react-express-mongodb/.env Outdated Show resolved Hide resolved
react-express-mongodb/server/server.js Outdated Show resolved Hide resolved
Signed-off-by: Afzal <sah.afzal@gmail.com>
@syed-afzal
Copy link
Contributor Author

@glours I am done with all the changes. Please have a look

Copy link
Collaborator

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @123afzal

@glours glours merged commit 2f750eb into docker:master May 11, 2020
@glours
Copy link
Collaborator

glours commented May 11, 2020

Fix #50

glours pushed a commit to glours/awesome-compose that referenced this pull request Sep 19, 2020
Signed-off-by: Afzal <sah.afzal@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants