sdelements / lets-chat

Self-hosted chat app for small teams
http://sdelements.github.io/lets-chat
MIT License
9.76k stars 1.58k forks source link

Docker container crashes #746

Open DracoMilesX opened 7 years ago

DracoMilesX commented 7 years ago

Tried with a fresh install for Docker but it won't start up

lets-chat@0.4.7 start /usr/src/app node app.js

Killed npm ERR! Linux 3.10.77 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v0.12.15 npm ERR! npm v2.15.1 npm ERR! code ELIFECYCLE npm ERR! lets-chat@0.4.7 start: node app.js npm ERR! Exit status 137 npm ERR! Failed at the lets-chat@0.4.7 start script 'node app.js'. npm ERR! This is most likely a problem with the lets-chat package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node app.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs lets-chat npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls lets-chat npm ERR! There is likely additional logging output above. npm ERR! Linux 3.10.77 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v0.12.15 npm ERR! npm v2.15.1 npm ERR! path npm-debug.log.896050243 npm ERR! code EACCES npm ERR! errno -13 npm ERR! Error: EACCES, open 'npm-debug.log.896050243' npm ERR! at Error (native) npm ERR! { [Error: EACCES, open 'npm-debug.log.896050243'] errno: -13, code: 'EACCES', path: 'npm-debug.log.896050243' } npm ERR! Please try running this command again as root/Administrator. npm ERR! Please include the following file with any support request: npm ERR! /usr/src/app/npm-debug.log

The docker run command I use:

docker run -d \ --name letschat \ --memory=128M \ --memory-swap=256M \ --link mongodb:mongo \ -p 8080:8080 \ sdelements/lets-chat

Haven't changed the settings yet so everything would be default.

allan-cf commented 6 years ago

Having this same problem. Here are the full logs:

[32mlets-chat_1 |[0m > lets-chat@0.4.8 start /usr/src/app [32mlets-chat_1 |[0m > node app.js [32mlets-chat_1 |[0m [32mlets-chat_1 |[0m open() is deprecated in mongoose >= 4.11.0, use openUri() instead, or set the useMongoClient option if using connect() or createConnection(). See http://mongoosejs.com/docs/connections.html#use-mongo-client [36mmongo_1 |[0m 2017-11-16T21:40:26.522+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:55048 #1 (1 connection now open) [36mmongo_1 |[0m 2017-11-16T21:40:26.523+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:55050 #2 (2 connections now open) [36mmongo_1 |[0m 2017-11-16T21:40:26.532+0000 I NETWORK [conn1] received client metadata from 172.18.0.4:55048 conn1: { driver: { name: "nodejs", version: "2.2.33" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.8.0-30-generic" }, platform: "Node.js v0.12.18, LE, mongodb-core: 2.1.17" } [36mmongo_1 |[0m 2017-11-16T21:40:26.535+0000 I NETWORK [conn2] received client metadata from 172.18.0.4:55050 conn2: { driver: { name: "nodejs", version: "2.2.33" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.8.0-30-generic" }, platform: "Node.js v0.12.18, LE, mongodb-core: 2.1.17" } [32mlets-chat_1 |[0m TypeError: undefined is not a function [32mlets-chat_1 |[0m at Object. (/usr/src/app/node_modules/node-xmpp-server/node_modules/node-xmpp-core/node_modules/@xmpp/xml/index.js:10:8) [32mlets-chat_1 |[0m at Module._compile (module.js:460:26) [32mlets-chat_1 |[0m at Object.Module._extensions..js (module.js:478:10) [32mlets-chat_1 |[0m at Module.load (module.js:355:32) [32mlets-chat_1 |[0m at Function.Module._load (module.js:310:12) [32mlets-chat_1 |[0m at Module.require (module.js:365:17) [32mlets-chat_1 |[0m at require (module.js:384:17) [32mlets-chat_1 |[0m at Object. (/usr/src/app/node_modules/node-xmpp-server/node_modules/node-xmpp-core/lib/Connection.js:6:15) [32mlets-chat_1 |[0m at Module._compile (module.js:460:26) [32mlets-chat_1 |[0m at Object.Module._extensions..js (module.js:478:10) [32mlets-chat_1 |[0m at Module.load (module.js:355:32) [32mlets-chat_1 |[0m at Function.Module._load (module.js:310:12) [32mlets-chat_1 |[0m at Module.require (module.js:365:17) [32mlets-chat_1 |[0m at require (module.js:384:17) [32mlets-chat_1 |[0m at Object. (/usr/src/app/node_modules/node-xmpp-server/node_modules/node-xmpp-core/index.js:3:18) [32mlets-chat_1 |[0m at Module._compile (module.js:460:26) [32mlets-chat_1 |[0m /usr/src/app/node_modules/mongodb/lib/server.js:327 [32mlets-chat_1 |[0m process.nextTick(function() { throw err; }) [32mlets-chat_1 |[0m ^ [32mlets-chat_1 |[0m TypeError: undefined is not a function [32mlets-chat_1 |[0m at Object. (/usr/src/app/node_modules/node-xmpp-server/node_modules/node-xmpp-core/node_modules/@xmpp/xml/index.js:10:8) [32mlets-chat_1 |[0m at Module._compile (module.js:460:26) [32mlets-chat_1 |[0m at Object.Module._extensions..js (module.js:478:10) [32mlets-chat_1 |[0m at Module.load (module.js:355:32) [32mlets-chat_1 |[0m at Function.Module._load (module.js:310:12) [32mlets-chat_1 |[0m at Module.require (module.js:365:17) [32mlets-chat_1 |[0m at require (module.js:384:17) [32mlets-chat_1 |[0m at Object. (/usr/src/app/node_modules/node-xmpp-server/node_modules/node-xmpp-core/lib/Connection.js:6:15) [32mlets-chat_1 |[0m at Module._compile (module.js:460:26) [32mlets-chat_1 |[0m at Object.Module._extensions..js (module.js:478:10) [32mlets-chat_1 |[0m at Module.load (module.js:355:32) [32mlets-chat_1 |[0m at Function.Module._load (module.js:310:12) [32mlets-chat_1 |[0m at Module.require (module.js:365:17) [32mlets-chat_1 |[0m at require (module.js:384:17) [32mlets-chat_1 |[0m at Object. (/usr/src/app/node_modules/node-xmpp-server/node_modules/node-xmpp-core/index.js:3:18) [32mlets-chat_1 |[0m at Module._compile (module.js:460:26) [36mmongo_1 |[0m 2017-11-16T21:40:26.632+0000 I - [conn2] end connection 172.18.0.4:55050 (2 connections now open) [36mmongo_1 |[0m 2017-11-16T21:40:26.632+0000 I - [conn1] end connection 172.18.0.4:55048 (1 connection now open) [32mlets-chat_1 |[0m [32mlets-chat_1 |[0m npm ERR! Linux 4.8.0-30-generic [32mlets-chat_1 |[0m npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" [32mlets-chat_1 |[0m npm ERR! node v0.12.18 [32mlets-chat_1 |[0m npm ERR! npm v2.15.11 [32mlets-chat_1 |[0m npm ERR! code ELIFECYCLE [32mlets-chat_1 |[0m npm ERR! lets-chat@0.4.8 start: node app.js [32mlets-chat_1 |[0m npm ERR! Exit status 1 [32mlets-chat_1 |[0m npm ERR! [32mlets-chat_1 |[0m npm ERR! Failed at the lets-chat@0.4.8 start script 'node app.js'. [32mlets-chat_1 |[0m npm ERR! This is most likely a problem with the lets-chat package, [32mlets-chat_1 |[0m npm ERR! not with npm itself. [32mlets-chat_1 |[0m npm ERR! Tell the author that this fails on your system: [32mlets-chat_1 |[0m npm ERR! node app.js [32mlets-chat_1 |[0m npm ERR! You can get information on how to open an issue for this project with: [32mlets-chat_1 |[0m npm ERR! npm bugs lets-chat [32mlets-chat_1 |[0m npm ERR! Or if that isn't available, you can get their info via: [32mlets-chat_1 |[0m npm ERR! [32mlets-chat_1 |[0m npm ERR! npm owner ls lets-chat [32mlets-chat_1 |[0m npm ERR! There is likely additional logging output above. [32mlets-chat_1 |[0m npm ERR! Linux 4.8.0-30-generic [32mlets-chat_1 |[0m npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" [32mlets-chat_1 |[0m npm ERR! node v0.12.18 [32mlets-chat_1 |[0m npm ERR! npm v2.15.11 [32mlets-chat_1 |[0m npm ERR! path npm-debug.log.896050243 [32mlets-chat_1 |[0m npm ERR! code EACCES [32mlets-chat_1 |[0m npm ERR! errno -13 [32mlets-chat_1 |[0m [32mlets-chat_1 |[0m npm ERR! Error: EACCES, open 'npm-debug.log.896050243' [32mlets-chat_1 |[0m npm ERR! at Error (native) [32mlets-chat_1 |[0m npm ERR! { [Error: EACCES, open 'npm-debug.log.896050243'] errno: -13, code: 'EACCES', path: 'npm-debug.log.896050243' } [32mlets-chat_1 |[0m npm ERR! [32mlets-chat_1 |[0m npm ERR! Please try running this command again as root/Administrator. [32mlets-chat_1 |[0m [32mlets-chat_1 |[0m npm ERR! Please include the following file with any support request: [32mlets-chat_1 |[0m npm ERR! /usr/src/app/npm-debug.log [32mhj33bko1m_lets-chat_1 exited with code 1

allan-cf commented 6 years ago

Got it working. Changed to latest version of node, also had to remove the cache step, also changed the last line from npm start to node app.js.

allan-cf commented 6 years ago

Here's the working docker file. I'm going to be making changes to mine in my repo.

FROM node:latest MAINTAINER SD Elements

ENV PKG_JSON_URL=https://raw.githubusercontent.com/sdelements/lets-chat/master/package.json \ TAR_GZ_URL=https://github.com/sdelements/lets-chat/archive/master.tar.gz \ BUILD_DEPS='g++ gcc git make python' \ LCB_PLUGINS='lets-chat-ldap lets-chat-s3'

RUN mkdir -p /usr/src/app WORKDIR /usr/src/app

ADD $PKG_JSON_URL ./package.json

RUN set -x \ && apt-get update \ && apt-get install -y $BUILD_DEPS --no-install-recommends \ && rm -rf /var/lib/apt/lists/ \ && npm install --production \ && npm install $LCB_PLUGINS \ && npm dedupe \ && rm -rf /tmp/npm \ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $BUILD_DEPS

ADD $TAR_GZ_URL ./master.tar.gz

RUN tar -xzvf master.tar.gz \ && cp -a lets-chat-master/. . \ && rm -rf lets-chat-master

RUN chown node:node uploads \ && mkdir -p builtAssets \ && chown node:node builtAssets

ENV LCB_DATABASE_URI=mongodb://mongo/letschat \ LCB_HTTP_HOST=0.0.0.0 \ LCB_HTTP_PORT=8080 \ LCB_XMPP_ENABLE=true \ LCB_XMPP_PORT=5222

USER node

EXPOSE 8080 5222

VOLUME ["/usr/src/app/config"] VOLUME ["/usr/src/app/uploads"]

CMD ["node", "app.js"]