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

[nodemon] app crashed - sudo docker-compose up -d #184

Open
enporter opened this issue Sep 5, 2018 · 6 comments
Open

[nodemon] app crashed - sudo docker-compose up -d #184

enporter opened this issue Sep 5, 2018 · 6 comments
Assignees
Labels

Comments

@enporter
Copy link

enporter commented Sep 5, 2018

Here is the output:

icodashboard-space@0.0.1 start /home/ubuico/backend-ico-dashboard
nodemon -w ./src -e ts ./src/bin/www --exec ts-node

[nodemon] 1.18.4
[nodemon] to restart at any time, enter rs
[nodemon] watching: /home/ubuico/backend-ico-dashboard/src/**/*
[nodemon] starting ts-node ./src/bin/www.ts
Error: ENOENT: no such file or directory, open 'undefined/whitelist-sc-abi.json'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object. (/home/ubuico/backend-ico-dashboard/src/config.ts:149:26)
at Module._compile (module.js:652:30)
at Module.m._compile (/home/ubuico/backend-ico-dashboard/node_modules/ts-node/src/index.ts:392:23)
at Module._extensions..js (module.js:663:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/ubuico/backend-ico-dashboard/node_modules/ts-node/src/index.ts:395:12)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
[nodemon] app crashed - waiting for file changes before starting...

@ddevilbb
Copy link
Contributor

ddevilbb commented Sep 5, 2018

@enporter try run sudo cp .env.test .env in backend-ico-dashboard directory and then run sudo docker-compose up -d

@enporter
Copy link
Author

enporter commented Sep 6, 2018

Yes. I went ahead and followed. It progresses further but when I attempt sudo npm start it fails with the same error code. [nodemon] app crashed waiting for changes.
Output:
"~/backend-ico-dashboard$ sudo npm start

icodashboard-space@0.0.1 start /home/ubuico/backend-ico-dashboard
nodemon -w ./src -e ts ./src/bin/www --exec ts-node

[nodemon] 1.18.4
[nodemon] to restart at any time, enter rs
[nodemon] watching: /home/ubuico/backend-ico-dashboard/src/**/*
[nodemon] starting ts-node ./src/bin/www.ts
Error: Redis connection to redis:6379 failed - getaddrinfo ENOTFOUND redis redis:6379
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
[nodemon] app crashed - waiting for file changes before starting..."

I'm pretty sure I am just not setting it up right, maybe I missed something.

@ddevilbb
Copy link
Contributor

ddevilbb commented Sep 7, 2018

@enporter seems you need to run npm start inside ico container or run sudo docker-compose exec ico npm start in backend-ico-dashboard directory

@enporter
Copy link
Author

enporter commented Sep 8, 2018

~/backend-ico-dashboard$ sudo docker-compose exec -u root ico sh
/usr/src/app # npm start

icodashboard-space@0.0.1 start /usr/src/app
nodemon -w ./src -e ts ./src/bin/www --exec ts-node

[nodemon] 1.18.4
[nodemon] to restart at any time, enter rs
[nodemon] watching: /usr/src/app/src/**/*
[nodemon] starting ts-node ./src/bin/www.ts
Error: listen EADDRINUSE :::4000
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at Server.listen (net.js:1476:7)
at Object. (/usr/src/app/src/bin/www.ts:32:17)
at Generator.next ()
at /usr/src/app/src/bin/www.ts:7:71
at new Promise ()
at __awaiter (/usr/src/app/src/bin/www.ts:3:12)
at typeorm_1.createConnection.then (/usr/src/app/src/bin/www.ts:15:54)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
[nodemon] app crashed - waiting for file changes before starting...

Ok I tried:

  • sudo docker-compose exec -u root ico sh
    • npm start
    • npm serve
  • sudo docker-compose exec -u root ico npm start
  • sudo docker-compose exec -u root ico npm serve
  • sudo docker-compose exec -u root ico npm run build
  • sudo docker-compose exec -u root ico npm start
  • sudo docker-compose exec -u root ico npm serve

Different Output:
~/backend-ico-dashboard$ sudo docker-compose exec -u root ico npm run serve

icodashboard-space@0.0.1 serve /usr/src/app
node ./dist/bin/www.js

TypeORM connection error: { Error: ENOENT: no such file or directory, open '/usr/src/app/dist/bin/../certs/ico-key.pem'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object. (/usr/src/app/dist/bin/www.js:32:21)
at Generator.next ()
at /usr/src/app/dist/bin/www.js:7:71
at new Promise ()
at __awaiter (/usr/src/app/dist/bin/www.js:3:12)
at typeorm_1.createConnection.then (/usr/src/app/dist/bin/www.js:23:61)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/usr/src/app/dist/bin/../certs/ico-key.pem' }

Ok I am not sure if I am properly building the application. Steps 2-5, where am I running those commands? Inside ico container? Host Machine?
2. Where am I running curl?

  • I ran inside ico; it returned HTTP/1.1 200 OK
  1. How do I specify the token inside .env AUTH_JWT?
  2. First, where are these certs? Am I copying certs to local machine or ico container?
  3. Which src directory: Local machine or ico container /usr/src?

When I run docker-compose exec for ico it always returns permission denied so I add the -u flag for root. Is this normal because I notice none of your commands specify root?

Sorry I am mentally retarded when it comes to Docker, I've been pouring over this for weeks.

@ddevilbb
Copy link
Contributor

@enporter

  1. You may run commands of building application(step 2-5) inside backend-ico directory on host machine or inside container.
  2. You may run curl inside container
  3. You must execute inside container the commands below:
  • register tenant:
/usr/src/app # curl --include \
   --request POST \
   --header "Content-Type: application/json" \
   --header "Accept: application/json" \
   --data-binary "{
  \"email\": \"test@test.com\",
  \"password\": \"Password1\"
}" \
'http://auth:3000/tenant'
  • login tenant:
/usr/src/app # curl --include \
   --request POST \
   --header "Content-Type: application/json" \
   --header "Accept: application/json" \
   --data-binary "{
  \"email\": \"test@test.com\",
  \"password\": \"Password1\"
}" \
'http://auth:3000/tenant/login'

Login response:

HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Content-Type: application/json; charset=utf-8
Content-Length: 351
ETag: W/"15f-O89V8kaXL+hd3aDJnrpcag"
Date: Mon, 10 Sep 2018 09:41:02 GMT
Connection: keep-alive

{"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjhkNDdjMWFjLTIzMTYtNDgyMC05N2EyLWNmZGIxYjQyZWRlMyIsImxvZ2luIjoidGVuYW50OnRlc3RAdGVzdC5jb20iLCJqdGkiOiI4ZDQ3YzFhYy0yMzE2LTQ4MjAtOTdhMi1jZmRiMWI0MmVkZTMxNTM2NTcyNDYyNDUzIiwiaWF0IjoxNTM2NTcyNDYyNDUzLCJhdWQiOiJqaW5jb3IuY29tIiwiaXNUZW5hbnQiOnRydWV9.BtYZDxooLvyKFZNjxpsYCaD5in5kel0PWghxvHMd_CU"}/

You need specify accessToken of login response inside .env AUTH_JWT
4. Copy the certificates from src/certs to the dist/certs directory
5. Src directory of backend-ico-dashboard on host machine

@gregbkr
Copy link

gregbkr commented Sep 11, 2018

Same issue for me, I had to replace yarn install by npm install here & build again. Now the app ico doesn't crash. Still trying to launch the whole stack with front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants