-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Dockerize server (#249, #236) #251
Conversation
Bumps [set-value](https://github.com/jonschlinkert/set-value) from 0.4.3 to 2.0.1. - [Release notes](https://github.com/jonschlinkert/set-value/releases) - [Commits](jonschlinkert/set-value@0.4.3...2.0.1) Signed-off-by: dependabot[bot] <[email protected]>
Bumps [lodash.merge](https://github.com/lodash/lodash) from 4.6.1 to 4.6.2. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/commits) Signed-off-by: dependabot[bot] <[email protected]>
Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2. - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases) - [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2) Signed-off-by: dependabot[bot] <[email protected]>
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.11...4.17.15) Signed-off-by: dependabot[bot] <[email protected]>
…yarn/mixin-deep-1.3.2 Bump mixin-deep from 1.3.1 to 1.3.2
…yarn/lodash-4.17.15 Bump lodash from 4.17.11 to 4.17.15
…yarn/lodash.merge-4.6.2 Bump lodash.merge from 4.6.1 to 4.6.2
…yarn/set-value-2.0.1 Bump set-value from 0.4.3 to 2.0.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 10 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @irsol)
Dockerfile, line 8 at r1 (raw file):
RUN npm install ENV SECRET='abadjadjadja1223232412424' ENV developmentDB = 'mongodb://mongodb:27017/ntwitter'
Use capital letter for environment variables, for example, DEVELOPMEN_DB
Dockerfile, line 12 at r1 (raw file):
COPY . . #Expose port and start application EXPOSE 3000
Don't change ports if there is not real reason for this
Dockerfile, line 14 at r1 (raw file):
EXPOSE 3000 CMD [ "node", "server.js" ]
node server.js
just runs you server. npm start
execute start from the scri[ts package.json. In package.json it is defined nodemon server.js
. Bear in mind, that nodemon is not needed for Docker it is still needed when running the service without Docker
readme.md, line 54 at r1 (raw file):
};Usage via Docker
Add here how to run your server in Docker and mongo without (check your config.js)
server.js, line 2 at r1 (raw file):
const express = require('express'); var cookieParser = require('cookie-parser');
See comment about sessions below
server.js, line 15 at r1 (raw file):
const promiseRetry = require('promise-retry'); app.use(cookieParser("super55"));
I think you should not include cookies and sessions into this PR
config/config.js, line 6 at r1 (raw file):
const clientID = process.env.GITHUB_CLIENT_ID; const clientSecret = process.env.GITHUB_CLIENT_SECRET; const developmentDB = process.env.developmentDB || 'mongodb://localhost:27017/ntwitter';
See comment about environment variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @irsol)
config/config.js, line 20 at r1 (raw file):
}, github: { clientID: "e3930cf94c772ba10ef1",
All these secrets should go to .env
file ( checkout this blog post Node.js Everywhere with Environment Variables! ). But for this, you need to create another issue and another pull request (just a recommendation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @irsol)
Dockerfile, line 7 at r1 (raw file):
COPY package*.json ./ RUN npm install ENV SECRET='abadjadjadja1223232412424'
When I run the server without Docker it is missing SECRET
variable (see file expess.js
where it is used) and I get an error Error: secret option required for sessions. You probably need to define this variable in .env file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @irsol)
server.js, line 16 at r1 (raw file):
app.use(cookieParser("super55")); app.use(cookieSession({
See comment about SECRET
how to solve problem that will appear once you remove those lines
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @irsol and @sash-ko)
server.js, line 36 at r1 (raw file):
maxTimeout: 5000 };
Add comments with an explanation why you do this (promiseRetry)
|
Renamed env variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 8 of 11 files reviewed, 12 unresolved discussions (waiting on @irsol and @sash-ko)
Dockerfile, line 12 at r1 (raw file):
Previously, sash-ko (Oleksandr Lysenko) wrote…
Don't change ports if there is not real reason for this
Same. Don't change that port.3000
has always been the port so keep it as it is.
docker-compose.yml, line 6 at r2 (raw file):
build: . ports: - "8080:3000"
Keep it as 3000. Don't change it.
This pull request introduces 5 alerts when merging 34b494e into 2e4f8f6 - view on LGTM.com new alerts:
|
This pull request introduces 5 alerts when merging 34b494e into c41d553 - view on LGTM.com new alerts:
|
Description
App and MongoDB can run as Docker containers.
Issue Addressed
Issue number [BUG] Server Discovery and Monitoring engine is deprecated #249
Issue number [FEATURE] Setup with docker #236
Additionally
Upgraded Node version to 12.0.0.
This change is