Actions on Google: ngrok, running fulfillment locally - actions-on-google

I can deploy to Firebase using "firebase deploy --only functions". However, I'd like to run ngrok in my local computer, as suggested here . How can I do that?
I understand that ngrok will expose a certain URL with a port on the Internet and that it starts locally with a port as parameter. Do I also need to run NodeJS on the same port locally? The sample NodeJS script for using the Inline Editor doesn't declare a NodeJS port. Instead, it has this:
exports.dialogflowFirebaseFulfillment = functions.https.onRequest( ...

Three step process:
Run firebase serve --only functions. The serve command simulates the deployment environment on your own machine. You need to be running node.js (6.11.5 preferred, since that is what runs on Firebase Cloud Functions), but you don't need to make any changes to your code.
It will report something like
functions: webhook: http://localhost:5000/project-name/us-central1/function-name
Note the port number (after the "localhost" part) and use that as a parameter for ngrok with a command like ngrok http 5000. (Don't worry about the "http" part - it will make an https port available.)
The ngrok console will start and will include a line like
Forwarding https://zz99z999.ngrok.io -> localhost:5000
You'll need to combine the URL base from here and the path that firebase has told you for your webhook fulfillment url. In our example, this would be https://zz99z999.ngrok.io/project-name/us-central1/function-name.

Related

git lab ci service connection refused

I have a docker image listed in my gitlab ci services list. When I make an htpp request using curl to my docker service url everything works fine. But when I run my tests which makes an http request using axios to the service docker image url it says connection refused here is the exact message connect EINVAL 0.0.31.129:80 - Local (0.0.0.0:0)
The thing is that I was using a service on my registry running on specific port and the runner was trying to connect to the registry at port 80. Because since I did specify the port the runner don't exactly know what protocol to use. So, the runner pick default port for http which is 80. So, the fix will be to add http protocol to the registry url.

Expose Ngrok Web interface in same LAN

I have some issue to configurate Ngrok.
I have installed the Ngrok on linux CentOS server dedicated (IP 192.168.1.124), it works correctly the tunneling is ok.
My question is: how i can reach the web page on 127.0.0.1:4040 in order to check the traffic on my Ngrok server?
The web interface page is only accessible on the server where ngrok is running, but if this is a linux minimal server (without gui and any type of browser) I can't see it.
is there a way to make it accessible also in LAN?
e.g. I have another client that can reach the IP where ngrok is running but if i put on web browser http:\192.168.1.124:4040 nothing is showing.
I see from netstat that this port is not listening so isn't a firewall problem or other.
Is possible to change config of Ngrok? otherwise are there other possibilities ? do i have to use a reverse proxy or something like?
Any ideas?
thanks for your help,
Luca
Locate your ngrok's config file:
$ ngrok config check
Valid configuration file at /home/youruser/.config/ngrok/ngrok.yml
Add to the config file the following line:
web_addr: 192.168.1.124:4040
In case you want to expose it to all interfaces, you can replace that value with 0.0.0.0:4040

How to expose services between containers with docker-compose

On circleci, when I declare multiple dockers for a job:
dockers:
app: company/image
selenium: selenium/image
app will expose a port 4000 and selenium will expose port 4444.
Then from app container, I can access selenium service via localhost:4444, and on selenium container, I can access app webserver via localhost:4000.
docker-compose, however, behaves differently. I only allow me to access to selenium:4444 from app, and app:4000 from selenium.
I want docker-compose to behave similar to circleci, in which it allows me to use localhost:port to access other services. How can I do that?
The way to achieve the above is via networking_mode:
I need to tell docker-compose to run selenium using networking_mode = "services:app" so that every ports listened by selenium will be available to access from app using just localhost:PORT (and vice versa)
This is explained here: Can docker-compose share an ip between services with discrete ports?
Also the reason for it to work is explained in the docker networking model here: https://codability.in/docker-networking-explained/

How to run a local app on sauce labs?

I'm trying to get my tests running on saucelabs.
The app I'm testing is not publicly available since i want to test my app in my dev environment.
So i'm trying to use sauce connect.
I managed to create a tunnel but when I try to run tests on a vm using sauce connect i get a Bad gateway error.
For some reasons, my local app doesn't run on localhost but on test.example.com:3000
In dev, i use dnsmasq to reroute *.example.com through localhost.
I can't manage to do the same thing using sauce connect. I'll explain.
I've tried to just let dnsmasq do the work but it failed.
So i added the line :
test.example.com localhost
to my /etc/hosts file
but it failed too.
Finally i tried to create a file name /tmp/HOSTALIASES with the same line in it then export HOSTALIASES=/tmp/HOSTALIASES
but it failed too.
I'm out of idea.
UPDATE
If i hit localhost:3000 , it does hit my local rails server but not for test.example.com
So actually you need saucelab running as usual>
You can let dnsmasq running, i suspect it is not even aware of sauce connect running.
You need to add the line :
127.0.0.1 yourdomain.sub.com
you can't have localhost.

apache camel - deploying with cxfs web service

I'm trying to deploy my camel app which on start is creating a cxfrs endpoint. The url is like this: http://localhost:9876 . When I try to hit this one on a rest client or anywhere within my machine it works. But when I try to access it using my phone or other external devices, I'm not able to connect.
Am I missing something?
TIA
Using localhost will mean it is only accessible to your local machine, using 0.0.0.0 instead should make it publicly accessible.
0.0.0.0 should bind all available network interface on your remote machine, but from your description, somehow it only bind to localhost|127.0.0.1 so only accessible from local machine, could you use
http://external.ip.address:9876/foo/FooService
instead to see if it helps?
Also, you can try to access other network service(for example start a tomcat on remote machine and see if you can access it from your local machine) from that remote machine to see if it works, this can determine if your DNS correct or if there's really no firewall between them.