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

need single binary without nodejs dependecy like go binary #18

Open
thatsk opened this issue May 29, 2018 · 20 comments
Open

need single binary without nodejs dependecy like go binary #18

thatsk opened this issue May 29, 2018 · 20 comments

Comments

@thatsk
Copy link

thatsk commented May 29, 2018

No description provided.

@lchayoun
Copy link
Collaborator

Hi @thatsk, you can use tools such as https://github.com/zeit/pkg in order to create executable from this project

@thatsk
Copy link
Author

thatsk commented May 29, 2018

I have gone through documentation.
during the packaging process, they need some config requirement
image

I am not sure in your source code how much can add in package.json?

@thatsk
Copy link
Author

thatsk commented May 29, 2018

@thatsk
Copy link
Author

thatsk commented May 29, 2018

I have just cloned repository. and then run pkg command to create binary
{code}
pkg app.js

[email protected]
Targets not specified. Assuming:
node6-linux-x64, node6-macos-x64, node6-win-x64
Warning Cannot find module 'express' from '/root/consul_telemetry_exporter'
/root/consul_telemetry_exporter/app.js
Warning Cannot find module 'serve-favicon' from '/root/consul_telemetry_exporter'
/root/consul_telemetry_exporter/app.js
Warning Cannot find module 'morgan' from '/root/consul_telemetry_exporter'
/root/consul_telemetry_exporter/app.js
Warning Cannot find module 'cookie-parser' from '/root/consul_telemetry_exporter'
/root/consul_telemetry_exporter/app.js
Warning Cannot find module 'body-parser' from '/root/consul_telemetry_exporter'
/root/consul_telemetry_exporter/app.js
Warning Cannot find module 'express' from '/root/consul_telemetry_exporter/routes'
/root/consul_telemetry_exporter/routes/index.js
Warning Cannot find module 'express' from '/root/consul_telemetry_exporter/routes'
/root/consul_telemetry_exporter/routes/metrics.js
Warning Cannot find module 'prom-client' from '/root/consul_telemetry_exporter/routes'
/root/consul_telemetry_exporter/routes/metrics.js
Warning Cannot find module 'request-promise' from '/root/consul_telemetry_exporter/routes'
/root/consul_telemetry_exporter/routes/metrics.js
Warning Cannot find module 'underscore' from '/root/consul_telemetry_exporter/routes'
/root/consul_telemetry_exporter/routes/metrics.js
Warning Cannot find module 'express' from '/root/consul_telemetry_exporter/routes'
/root/consul_telemetry_exporter/routes/version.js
Warning Cannot find module 'winston' from '/root/consul_telemetry_exporter/lib'
/root/consul_telemetry_exporter/lib/logger.js
Warning Cannot stat, ENOENT
/root/consul_telemetry_exporter/lib/logs
The file was required from '/root/consul_telemetry_exporter/lib/logger.js'
{code}

@lchayoun
Copy link
Collaborator

@thatsk you should run "pkg bin/www"

@lchayoun
Copy link
Collaborator

@thatsk did you consider using the docker: https://hub.docker.com/r/swce/consul_telemetry_exporter ?

@thatsk
Copy link
Author

thatsk commented May 29, 2018

i am trying that but not sure what prefix and command for port exposing using docker?
i am using as per your doc.
i don't find any doc related to docker run

@thatsk
Copy link
Author

thatsk commented May 29, 2018

@lchayoun how to use docker run command on host to fetch?
like for eg.
docker run -d -p 9101:9101 prom/haproxy-exporter:v0.9.0 --haproxy.scrape-uri=http://localhost/haproxy?stats;csv

@ezraroi
Copy link
Contributor

ezraroi commented May 29, 2018

docker run -d -p 9320:9320 swce/consul_telemetry_exporter

@thatsk
Copy link
Author

thatsk commented May 29, 2018

docker run -p 9320:9320 swce/consul_telemetry_exporter

[email protected] start /usr/src/app
node ./bin/www

2018-05-29T11:30:36.513Z - info: Consul Telemetry Exporter is listening on port 9320
2018-05-29T11:30:37.927Z - debug: Making request to consul @ http://e1da1caa8609:8500/v1/agent/metrics
2018-05-29T11:30:37.949Z - error: Error in metrics collection RequestError: Error: connect ECONNREFUSED 172.17.0.2:8500
172.17.0.1 - - [29/May/2018:11:30:37 +0000] "GET /metrics HTTP/1.1" 500 444 "-" "Consul Health Check"
2018-05-29T11:30:42.408Z - debug: Making request to consul @ http://e1da1caa8609:8500/v1/agent/metrics
2018-05-29T11:30:42.411Z - error: Error in metrics collection RequestError: Error: connect ECONNREFUSED 172.17.0.2:8500
172.17.0.1 - - [29/May/2018:11:30:42 +0000] "GET /metrics HTTP/1.1" 500 444 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"
2018-05-29T11:30:42.959Z - debug: Making request to consul @ http://e1da1caa8609:8500/v1/agent/metrics
2018-05-29T11:30:42.960Z - error: Error in metrics collection RequestError: Error: connect ECONNREFUSED 172.17.0.2:8500
172.17.0.1 - - [29/May/2018:11:30:42 +0000] "GET /metrics HTTP/1.1" 500 444 "-" "Consul Health Check

@thatsk
Copy link
Author

thatsk commented May 29, 2018

its not able to talk to consul ? host consul need to talk to consul

@ezraroi
Copy link
Contributor

ezraroi commented May 29, 2018

looks like you don't have consul server / agent running on the same host

@thatsk
Copy link
Author

thatsk commented May 29, 2018

serviceconsul

@thatsk
Copy link
Author

thatsk commented May 29, 2018

consuldocker
its looks like its looking for consul service running inside container not outside host

@lchayoun
Copy link
Collaborator

You can use the "CONSUL_HOST" env variable to give the outside host:
docker run -d -p 9320:9320 -e CONSUL_HOST= swce/consul_telemetry_exporter

@ezraroi
Copy link
Contributor

ezraroi commented May 29, 2018

You can also use - -net=host if they are on the same host as prometheus suggest

@thatsk
Copy link
Author

thatsk commented May 30, 2018

docker run -d -p 9320:9320 --net=host swce/consul_telemetry_exporter
WARNING: Published ports are discarded when using host network mode
e2a2b22a2866d967d4916ff580a897c86917af1ca08010b6a073c51e62a2088c

@thatsk
Copy link
Author

thatsk commented May 30, 2018

if we are using without port then how we can check outside of container for metrics checking ?

@thatsk
Copy link
Author

thatsk commented May 30, 2018

docker run -d -p 9320:9320 -e CONSUL_HOST=hostname swce/consul_telemetry_exporter
a99677adedfe299d23ee3235ee43e5f98ef1e1102ca23c46cc9d90e545f781f6
docker: Error response from daemon: driver failed programming external connectivity on endpoint agitated_shaw (726135a15a23b7c60935f982eac9a0bf55f973f765a27bafa64e2170f1c529ba): Error starting userland proxy: listen tcp 0.0.0.0:9320: bind: address already in use.

@thatsk
Copy link
Author

thatsk commented May 30, 2018

can you just show me anyone method docker or packaging binary so that i can check correctly?

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

No branches or pull requests

3 participants