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

crash when running make docker-run-prod (at route.js => containers.pop()) #7

Closed
kerphi opened this issue May 4, 2016 · 2 comments
Closed

Comments

@kerphi
Copy link
Contributor

kerphi commented May 4, 2016

It crashes when i run ezmaster as bellow and I open my browser on http://127.0.0.1:3000/

This line NODE_ENV=production docker-compose -f ./docker-compose.yml up --force-recreate is the same as make docker-run-prod

[master] kerphi@p-gully:~/ezmaster
$ NODE_ENV=production docker-compose -f ./docker-compose.yml up --force-recreate
WARNING: The https_proxy variable is not set. Defaulting to a blank string.                                                                          
WARNING: The http_proxy variable is not set. Defaulting to a blank string.                                                                           
Recreating ezmaster_ezmaster_db_1                                                                                                                                       
Recreating ezmaster_ezmaster_1                                                                                                                                          
Attaching to ezmaster_ezmaster_db_1, ezmaster_ezmaster_1                                                                                                                
ezmaster_db_1  | 2016-05-04T17:25:37.375+0000 I JOURNAL  [initandlisten] journal dir=/data/db/journal                                                                   
ezmaster_db_1  | 2016-05-04T17:25:37.375+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed                                         
ezmaster_db_1  | 2016-05-04T17:25:37.392+0000 I JOURNAL  [durability] Durability thread started                                                                         
ezmaster_db_1  | 2016-05-04T17:25:37.393+0000 I JOURNAL  [journal writer] Journal writer thread started                                                                 
ezmaster_db_1  | 2016-05-04T17:25:37.408+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=7db1f13d6e5d                                           
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten]                                                                                                                        
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.                                                    
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] 
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] db version v3.0.7
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] git version: 6ce7cbe8c6b899552dadd907604559806aa2e9bd
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] build info: Linux ip-10-183-78-195 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 BOOST_LIB_VERSION=1_49
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] allocator: tcmalloc
ezmaster_db_1  | 2016-05-04T17:25:37.409+0000 I CONTROL  [initandlisten] options: { storage: { mmapv1: { smallFiles: true } } }
ezmaster_db_1  | 2016-05-04T17:25:37.413+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
ezmaster_1     | npm info it worked if it ends with ok
ezmaster_1     | npm info using [email protected]
ezmaster_1     | npm info using [email protected]
ezmaster_1     | npm info prestart [email protected]
ezmaster_1     | npm info start [email protected]
ezmaster_1     | 
ezmaster_1     | > [email protected] start /app
ezmaster_1     | > ./ezmaster
ezmaster_1     | 
ezmaster_1     | Load local configuration file. /app/config.local.js
ezmaster_1     | Set extension directory.  /app
ezmaster_1     | Watching hot directory.  /app/data
ezmaster_1     | Warning: connect.session() MemoryStore is not
ezmaster_1     | designed for a production environment, as it will leak
ezmaster_1     | memory, and will not scale past a single process.
ezmaster_1     | Wed, 04 May 2016 17:25:39 GMT body-parser deprecated bodyParser: use individual json/urlencoded middlewares at routes/route.js:76:52
ezmaster_1     | Wed, 04 May 2016 17:25:39 GMT body-parser deprecated undefined extended: provide extended option at node_modules/body-parser/index.js:105:29
ezmaster_db_1  | 2016-05-04T17:25:39.968+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49445 #1 (1 connection now open)
ezmaster_db_1  | 2016-05-04T17:25:39.969+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49446 #2 (2 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.973+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49447 #3 (3 connections now open)
ezmaster_1     | App detected. ezmaster 1.0.4
ezmaster_1     | Server is listening. http://127.0.0.1:3000/
ezmaster_db_1  | 2016-05-04T17:25:39.985+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49448 #4 (4 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.991+0000 I NETWORK  [conn1] end connection 172.17.0.3:49445 (3 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.993+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49449 #5 (4 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.995+0000 I NETWORK  [conn2] end connection 172.17.0.3:49446 (3 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.997+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49450 #6 (4 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.998+0000 I NETWORK  [conn3] end connection 172.17.0.3:49447 (3 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:39.999+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49451 #7 (4 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:40.000+0000 I NETWORK  [conn4] end connection 172.17.0.3:49448 (3 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:40.002+0000 I NETWORK  [initandlisten] connection accepted from 172.17.0.3:49452 #8 (4 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:40.012+0000 I NETWORK  [conn5] end connection 172.17.0.3:49449 (3 connections now open)
ezmaster_1     | Files and Database are synchronised.
ezmaster_1     | /app/routes/route.js:30
ezmaster_1     |         const elements = containers.pop();
ezmaster_1     |                                    ^
ezmaster_1     | 
ezmaster_1     | TypeError: Cannot read property 'pop' of null
ezmaster_1     |     at check (/app/routes/route.js:30:36)
ezmaster_1     |     at Object.callback (/app/routes/route.js:72:10)
ezmaster_1     |     at /app/node_modules/dockerode/lib/docker.js:261:10
ezmaster_1     |     at Modem.buildPayload (/app/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:225:19)
ezmaster_1     |     at ClientRequest.<anonymous> (/app/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:210:10)
ezmaster_1     |     at emitOne (events.js:77:13)
ezmaster_1     |     at ClientRequest.emit (events.js:169:7)
ezmaster_1     |     at Socket.socketErrorListener (_http_client.js:256:9)
ezmaster_1     |     at emitOne (events.js:77:13)
ezmaster_1     |     at Socket.emit (events.js:169:7)
ezmaster_1     |     at emitErrorNT (net.js:1250:8)
ezmaster_1     |     at nextTickCallbackWith2Args (node.js:442:9)
ezmaster_1     |     at process._tickCallback (node.js:356:17)
ezmaster_db_1  | 2016-05-04T17:25:45.472+0000 I NETWORK  [conn8] end connection 172.17.0.3:49452 (2 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:45.472+0000 I NETWORK  [conn6] end connection 172.17.0.3:49450 (2 connections now open)
ezmaster_db_1  | 2016-05-04T17:25:45.472+0000 I NETWORK  [conn7] end connection 172.17.0.3:49451 (1 connection now open)
ezmaster_1     | 
ezmaster_1     | npm info [email protected] Failed to exec start script
ezmaster_1     | npm ERR! Linux 3.16.0-4-amd64
ezmaster_1     | npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
ezmaster_1     | npm ERR! node v4.4.0
ezmaster_1     | npm ERR! npm  v2.14.20
ezmaster_1     | npm ERR! code ELIFECYCLE
ezmaster_1     | npm ERR! [email protected] start: `./ezmaster`
ezmaster_1     | npm ERR! Exit status 1
ezmaster_1     | npm ERR! 
ezmaster_1     | npm ERR! Failed at the [email protected] start script './ezmaster'.
ezmaster_1     | npm ERR! This is most likely a problem with the ezmaster package,
ezmaster_1     | npm ERR! not with npm itself.
ezmaster_1     | npm ERR! Tell the author that this fails on your system:
ezmaster_1     | npm ERR!     ./ezmaster
ezmaster_1     | npm ERR! You can get information on how to open an issue for this project with:
ezmaster_1     | npm ERR!     npm bugs ezmaster
ezmaster_1     | npm ERR! Or if that isn't available, you can get their info via:
ezmaster_1     | npm ERR! 
ezmaster_1     | npm ERR!     npm owner ls ezmaster
ezmaster_1     | npm ERR! There is likely additional logging output above.
ezmaster_1     | 
ezmaster_1     | npm ERR! Please include the following file with any support request:
ezmaster_1     | npm ERR!     /app/npm-debug.log
ezmaster_ezmaster_1 exited with code 1
@kerphi
Copy link
Contributor Author

kerphi commented May 6, 2016

I think the main problem is that whithout doing anything, there is not a host docker socket access from the ezmaster docker container.
Basicaly, the nodejs app must have an access to the host docker socket, it can be done mounting a volume like that:
-v /var/run/docker.sock:/var/run/docker.sock

But it's certainly not as easy as that. Have a look top this article to undersand this issue a bit deeper:
https://integratedcode.us/2016/04/08/user-namespaces-sharing-the-docker-unix-socket/

@kerphi
Copy link
Contributor Author

kerphi commented May 9, 2016

I just added -v /var/run/docker.sock:/var/run/docker.sock everywhere in the docker-compose*.yml ezmaster files
I also added the docker client installation in the Dockerfile.

I think it's a good start and the nodejs process seams to be able to communicate with the docker socket.
Please test it and give me feedbacks.

Next serious problem seams to be this one #8

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