jambonz / jambonz-infrastructure

packer and cloudformation templates for creating EC2-based jambonz deployments
23 stars 29 forks source link

API not running on port 3000 #6

Closed moaazsidat closed 3 years ago

moaazsidat commented 3 years ago

I'm currently trying to get the local docker setup for jambonz working, and running into a login error on the web app. Upon further inspection, it seems like nothing is running on port 3000, whereas the web app is trying to make a call to 127.0.0.1:3000/v1/login

Attaching a screenshot of the instantiation, any help would be much appreciated!

Screen Shot 2021-01-18 at 2 28 14 PM

P.S. Thanks for putting this together! Undoubtedly one of the most well documented setup I've come along as it relates to calling / communications infrastructure.

davehorton commented 3 years ago

hmm, the jambonz-api-server container is the one that will be listening on port 3000. That is exposed / mapped to the host machine as port 3000. Are you running everything on your laptop? If so, this should work. If you are not running it all on your laptop then I think the problem may be the value you put in for HOST_IP in your .env file. What did you put there?

moaazsidat commented 3 years ago

Correct, running everything on my laptop Have HOST_IP=127.0.0.1 in my .env file

davehorton commented 3 years ago

then it should be working. Can you verify the jambonz-api-server container is running? What is the output of docker ps -a

moaazsidat commented 3 years ago

Hmm, yep, that seems be to be running, just adding a screenshot of the UI: Screen Shot 2021-01-19 at 9 40 05 AM

lsof -i :3000 also returns empty 🤔

davehorton commented 3 years ago

can you show the output of the command below, when you try to log in? Below is what I see when I successfully log in

docker logs -f docker_api-server_1

> jambonz-api-server@1.2.0 start
> node app.js

{"level":30, "time": "2021-01-19T15:48:17.119Z","pid":18,"hostname":"9d11495e24e5","msg":"listening for HTTP traffic on port 3000","v":1}
{"level":30, "time": "2021-01-19T15:48:17.163Z","pid":18,"hostname":"9d11495e24e5","msg":"purged 0 calls from realtimedb","v":1}
{"level":30, "time": "2021-01-19T15:48:59.260Z","pid":18,"hostname":"9d11495e24e5","results":[{"user_sid":"12c80508-edf9-4b22-8d09-55abd02648eb","name":"admin","hashed_password":"xxxxxxxxxx","salt":"yyyyyyy","force_change":0}],"msg":"successfully retrieved account","v":1}
{"level":30, "time": "2021-01-19T15:48:59.291Z","pid":18,"hostname":"9d11495e24e5","msg":"validating with token 746f1333-6a78-45ec-80f1-012f0f400a65","v":1}
{"level":30, "time": "2021-01-19T15:48:59.292Z","pid":18,"hostname":"9d11495e24e5","msg":"validating with token 746f1333-6a78-45ec-80f1-012f0f400a65","v":1}
{"level":30, "time": "2021-01-19T15:48:59.294Z","pid":18,"hostname":"9d11495e24e5","account_sid":null,"service_provider_sid":null,"hasAdminAuth":true,"hasServiceProviderAuth":false,"hasAccountAuth":false,"msg":"successfully validated with scope admin,service_provider,account","v":1}
{"level":30, "time": "2021-01-19T15:48:59.296Z","pid":18,"hostname":"9d11495e24e5","msg":"validating with token 746f1333-6a78-45ec-80f1-012f0f400a65","v":1}
{"level":30, "time": "2021-01-19T15:48:59.299Z","pid":18,"hostname":"9d11495e24e5","msg":"validating with token 746f1333-6a78-45ec-80f1-012f0f400a65","v":1}
{"level":30, "time": "2021-01-19T15:48:59.305Z","pid":18,"hostname":"9d11495e24e5","account_sid":null,"service_provider_sid":null,"hasAdminAuth":true,"hasServiceProviderAuth":false,"hasAccountAuth":false,"msg":"successfully validated with scope admin,service_provider,account","v":1}
{"level":30, "time": "2021-01-19T15:48:59.308Z","pid":18,"hostname":"9d11495e24e5","account_sid":null,"service_provider_sid":null,"hasAdminAuth":true,"hasServiceProviderAuth":false,"hasAccountAuth":false,"msg":"successfully validated with scope admin,service_provider,account","v":1}
{"level":30, "time": "2021-01-19T15:48:59.309Z","pid":18,"hostname":"9d11495e24e5","account_sid":null,"service_provider_sid":null,"hasAdminAuth":true,"hasServiceProviderAuth":false,"hasAccountAuth":false,"msg":"successfully validated with scope admin,service_provider,account","v":1}
{"level":30, "time": "2021-01-19T15:48:59.368Z","pid":18,"hostname":"9d11495e24e5","msg":"validating with token 746f1333-6a78-45ec-80f1-012f0f400a65","v":1}
{"level":30, "time": "2021-01-19T15:48:59.369Z","pid":18,"hostname":"9d11495e24e5","msg":"validating with token 746f1333-6a78-45ec-80f1-012f0f400a65","v":1}
{"level":30, "time": "2021-01-19T15:48:59.369Z","pid":18,"hostname":"9d11495e24e5","account_sid":null,"service_provider_sid":null,"hasAdminAuth":true,"hasServiceProviderAuth":false,"hasAccountAuth":false,"msg":"successfully validated with scope admin,service_provider,account","v":1}
{"level":30, "time": "2021-01-19T15:48:59.371Z","pid":18,"hostname":"9d11495e24e5","account_sid":null,"service_provider_sid":null,"hasAdminAuth":true,"hasServiceProviderAuth":false,"hasAccountAuth":false,"msg":"successfully validated with scope admin,service_provider,account","v":1}
moaazsidat commented 3 years ago

Hmm, definitely see something's off with logging

docker logs -f docker_api-server_1

> jambonz-api-server@1.1.0 start /usr/src/app
> node app.js

WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
WARNING: No configurations found in configuration directory:/usr/src/app/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
/usr/src/app/node_modules/config/lib/config.js:182
    throw new Error('Configuration property "' + property + '" is not defined');
    ^

Error: Configuration property "logging" is not defined
    at Config.get (/usr/src/app/node_modules/config/lib/config.js:182:11)
    at Object.<anonymous> (/usr/src/app/app.js:4:11)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jambonz-api-server@1.1.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jambonz-api-server@1.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-19T15_29_20_710Z-debug.log
davehorton commented 3 years ago

ah, my bad. This is an older version of jambonz-api-server. I had forgotten to set up a build configuration on docker hub so it rebuilds with each checkin.

Can you pull the latest and retest?

docker pull jambonz/jambonz-api-server:latest

Immediately after starting, the logs should show this is version 1.2.0:

 docker logs -f docker_api-server_1

> jambonz-api-server@1.2.0 start
> node app.js

{"level":30, "time": "2021-01-19T17:30:13.396Z","pid":19,"hostname":"baec52a392f5","msg":"listening for HTTP traffic on port 3000","v":1}
moaazsidat commented 3 years ago

Amazing, that did the trick! Thanks! 🙌

davehorton commented 2 years ago

use

docker pull jambonz/api-server:latest

On Feb 15, 2022, at 10:25 AM, Eric Ravelo @.***> wrote:

Hello @davehorton https://github.com/davehorton Any reason why I am getting this now?

docker pull jambonz/jambonz-api-server:latest

Error response from daemon: pull access denied for jambonz/jambonz-api-server, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

— Reply to this email directly, view it on GitHub https://github.com/jambonz/jambonz-infrastructure/issues/6#issuecomment-1040409413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOMGLJBB4LFW6TOL24GKK3U3JWAPANCNFSM4WHXWI2Q. You are receiving this because you were mentioned.

ptd-31 commented 2 years ago

Hello @davehorton . I have installed SBC-Server with doc(Step F): https://www.jambonz.org/docs/open-source/self-host/ Before i installed MySQL and Redis-Server. But to step login. I can't login my defaut account on Web with http://my-address-server:3001/. I reset my password defaut: admin/admin with script(JAMBONES_MYSQL_HOST=localhost JAMBONES_MYSQL_USER=admin JAMBONES_MYSQL_PASSWORD=JambonzR0ck$ JAMBONES_MYSQL_DATABASE=jambones /home/admin/apps/jambonz-api-server/db/reset_admin_password.js), All informations of MySQL and path is right. But still can't login. In this case, How should I handle it?