question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker Install Errors

See original GitHub issue

New install of the docker-compose file included gives this error at the end of the process.

Is this second line - /app/node_modules in the docker-compose file even allowed? Maybe it is the issue. Shouldn’t it have two paths, one for host and one for docker?

    volumes:
      - .:/app/
      - /app/node_modules

Below is the log:

nodetube_mongo    | 2020-04-16T17:00:10.826+0000 I INDEX    [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
nodetube_mongo    | 2020-04-16T17:00:10.826+0000 I INDEX    [LogicalSessionCacheRefresh] 	 building index using bulk method; build may temporarily use up to 500 megabytes of RAM
nodetube_mongo    | 2020-04-16T17:00:10.827+0000 I INDEX    [LogicalSessionCacheRefresh] build index done.  scanned 0 total records. 0 secs
nodetube_app      | 
nodetube_app      | > NodeTube@1.0.0 start /app
nodetube_app      | > node --max-old-space-size=4096 app.js
nodetube_app      | 
nodetube_app      | internal/modules/cjs/loader.js:638
nodetube_app      |     throw err;
nodetube_app      |     ^
nodetube_app      | 
nodetube_app      | Error: Cannot find module 'express'
nodetube_app      |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
nodetube_app      |     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
nodetube_app      |     at Module.require (internal/modules/cjs/loader.js:692:17)
nodetube_app      |     at require (internal/modules/cjs/helpers.js:25:18)
nodetube_app      |     at Object.<anonymous> (/app/app.js:4:17)
nodetube_app      |     at Module._compile (internal/modules/cjs/loader.js:778:30)
nodetube_app      |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
nodetube_app      |     at Module.load (internal/modules/cjs/loader.js:653:32)
nodetube_app      |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
nodetube_app      |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
nodetube_app      | npm ERR! code ELIFECYCLE
nodetube_app      | npm ERR! errno 1
nodetube_app      | npm ERR! NodeTube@1.0.0 start: `node --max-old-space-size=4096 app.js`
nodetube_app      | npm ERR! Exit status 1
nodetube_app      | npm ERR! 
nodetube_app      | npm ERR! Failed at the NodeTube@1.0.0 start script.
nodetube_app      | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
nodetube_app      | 
nodetube_app      | npm ERR! A complete log of this run can be found in:
nodetube_app      | npm ERR!     /root/.npm/_logs/2020-04-16T17_00_11_464Z-debug.log
nodetube_app exited with code 1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
maltokyocommented, Apr 16, 2020

Hi @chovy I got this working, and upgraded the images used to modern ones (latest node.js version node:alpine and latest mongoDB version mongo:4). Attached are my Dockerfile and docker-compose.yml file.

I added my own network, and adjusted the ports to run behind a reverse proxy on the compose file, but you will see the changes that are probably better to add into your templates. Also you see that your Dockerfile was missing quite a few dependencies that the app requires to install, and that is why it was failing. Anyway, it all now works for me, but the Dockerfile and compose file in this repo DO NOT work “out of the box”, and my attached ones will.

If you would like me to directly make a PR to upgrade this, I will do so, just let me know.

Thanks guys, GREAT app, love it!

I do have a few questions for you (curious, and I could not work it out):

  1. Why do you expose port 8080 in Dockerfile? the app needs port 3000 exposed and is not (as far as I see?) using port 8080 at all.
  2. In compose file, why do you expose mongo 27011:27017 ? 27017 will be accessible on the internal docker network without any config in compose (what is 27011 used for at all?).

My Dockerfile:

FROM node:alpine

RUN apk add ffmpeg
RUN apk add git
RUN apk add tar

COPY package*.json /app/

RUN npm install express compression express-session morgan chalk mkdirp

WORKDIR /app/
#RUN rm -rf ./node_modules
#RUN npm cache clean --force
#RUN npm i --production
RUN npm i
#RUN npm rebuild node-sass

RUN npm audit fix

COPY . .

EXPOSE 8080
EXPOSE 3000

CMD ["npm", "start"]

My docker-compose.yml file:

version: '3.1'

services:
  nodetube_app:
    container_name: nodetube_app
    restart: always
    build:
      context: .
      dockerfile: Dockerfile
#    ports: # required if you do not run behind reverse proxy, uncomment
#      - "49161:3000" # required if you do not run behind reverse proxy, uncomment
    volumes:
      - .:/app/
      - /app/node_modules
      - /var/lib/docker/volumes/nodetube_app/_data_upload:/app/upload
      - /var/lib/docker/volumes/nodetube_app/_data_uploads:/app/uploads
    environment:
      REDIS_HOST: nodetube_redis
      MONGODB_DOCKER_URI: mongodb://nodetube_mongo:27017/nodetube
# start reverse proxy config - comment out if needed and uncomment the ports lines for "49161:3000" above
      VIRTUAL_HOST: "toob.mydomain.com"
      VIRTUAL_PORT: 3000
      LETSENCRYPT_HOST: "toob.mydomain.com"
      LETSENCRYPT_EMAIL: "myemail@mydomain.com"
# end reverse proxy config
    depends_on:
      - nodetube_redis
      - nodetube_mongo
    command: npm start


  nodetube_mongo:
    container_name: nodetube_mongo
    restart: always
    image: mongo:4
    volumes:
      - /var/lib/docker/volumes/nodetube_app/_data_db:/data/db
#    ports: # This is not needed at all
#      - "27011:27017"  # This is not needed at all


  nodetube_redis:
    container_name: nodetube_redis
    restart: always
    image: redis

# start reverse proxy config - add your own network here for all the nodes, or comment it out completely for the default network to be created
networks:
    default:
       external:
         name: webproxy
# end reverse proxy config
0reactions
maltokyocommented, Apr 16, 2020

Ok. Thank you. That’s what a reverse proxy is good for. Then they all can run on port 3000

Are the other changes good for you?

What about the other ports I asked about?

On Thu, 16 Apr 2020, 23:13 Anthony Ettinger, notifications@github.com wrote:

Its good to expose non-standard ports in docker-compose because a lot of times the host OS already has those services running. I run about 30 docker apps locally, they can’t all use port 3000

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mayeaux/nodetube/issues/243#issuecomment-614899163, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKS7W4WYRQSDUZNPUKNCR3RM5YGFANCNFSM4MJ5GPRA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Docker Engine installation
Troubleshoot Docker Engine installation ; Create or edit the Docker daemon configuration file, which defaults to /etc/docker/daemon.json file, which controls the ...
Read more >
Docker Desktop installation failed - Stack Overflow
I was able to install by deleting file "Docker" on C:/ProgramData/ ... I ran into an error there that resulted in the exact...
Read more >
How To Install Docker Desktop And Troubleshoot Issues In ...
Type and search Services in the windows search box or open run then type services.msc and click Ok. Then you will see a...
Read more >
Docker Installation error · Issue #12511 · docker/for-win - GitHub
Getting below error while installing docker desktop for windows 10. Component CommunityInstaller.ExecAction failed: The requested operation ...
Read more >
Troubleshooting Docker - Sitecore Documentation
General troubleshooting steps · Check the logs: The logs are the first place to look. · Restart Docker Desktop: Restarting the Docker Desktop ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found