Closed omnidan closed 8 years ago
@omnidan port 9000 should be forwarded automatically, this looks like the issue with the server itself. What's your host OS? Have you changed the example code? Or you can send me your initrd
file and I'll take a look.
OS X and I haven't changed it. I can upload my initrd when I get back home
@iefserge Alright, I uploaded it here: http://caffeinery.org/initrd - Thanks for looking into it :smiley:
@omnidan thanks! Hm, I'm on OSX and your initrd worked fine for me.
$ curl --verbose localhost:9000
* Rebuilt URL to: localhost:9000/
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 9000 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 9000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:9000
> Accept: */*
>
< HTTP/1.1 200 OK
< connection: keep-alive
< date: Sun, 20 Sep 2015 12:13:55 GMT
< content-length: 12
* Server runtimejs is not blacklisted
< server: runtimejs
<
* Connection #0 to host localhost left intact
Hello World!%
I tried connecting using netcat as well:
nc localhost 9000
Then typed GET / HTTP/1.1
and pressed enter
GET / HTTP/1.1
HTTP/1.1 200 OK
connection: keep-alive
date: Sun, 20 Sep 2015 12:11:29 GMT
content-length: 12
server: runtimejs
Hello World!^C
Maybe network configuration failed for some reason.
What QEMU version do you use? qemu-system-x86_64 --version
You can also enable the debug mode in runtime by changing node_modules/runtimejs/package.json
file runtimejs.debug
key to true
and post the output here.
Thank you! I'm really curious why it fails for you.
QEMU version:
> qemu-system-x86_64 --version
QEMU emulator version 2.4.0, Copyright (c) 2003-2008 Fabrice Bellard
Debug output:
> npm start
> @1.0.0 start /Users/dan/Development/experiments/example-web-server
> runtimeify index.js -o initrd && runtime-qemu ./initrd
--- starting qemu ---
[INITRD] Load /bundle.js len 346470
v0.1.14 kernel (v8 4.5.107)
v0.1.25 core library
loading...
[random] using entropy source js-random
0:0.0 8086:1237 Bridge Device IRQ: null PIN: dont use
0:1.0 8086:7000 Bridge Device IRQ: null PIN: dont use
0:1.1 8086:7010 Mass Storage Controller IRQ: null PIN: dont use
0:1.3 8086:7113 Bridge Device IRQ: 9 PIN: A
0:2.0 1234:1111 Display Controller IRQ: null PIN: dont use
0:3.0 1af4:1000 Network Controller IRQ: 11 PIN: A
[ ADD ROUTE 127.0.0.0/8 via null loopback ]
{"VIRTIO_NET_F_MAC":true,"VIRTIO_NET_F_GSO":true,"VIRTIO_NET_F_MRG_RXBUF":true,"VIRTIO_NET_F_STATUS":true,"VIRTIO_NET_F_CTRL_VQ":true,"VIRTIO_NET_F_CTRL_RX":true,"VIRTIO_NET_F_CTRL_VLAN":true,"VIRTIO_NET_F_GUEST_ANNOUNCE":true,"VIRTIO_RING_F_NOTIFY_ON_EMPTY":true,"VIRTIO_RING_F_EVENT_IDX":true}
intf add
[UDP] no route to 8.8.8.8
listening to port 9000
recv UDP over IP4 67 68 548
CLIENT OK 192.168.76.2 67 2,1,6,0,0,17,34,51,0,0,0,0,0,0,0,0,192,168,76,9,192,168,76,2,0,0,0,0,26,70,11,202,188,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,130,83,99,53,1,2,54,4,192,168,76,2,1,4,255,255,255,0,3,4,192,168,76,2,6,4,192,168,76,3,51,4,0,1,81,128,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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76,2,1,4,255,255,255,0,3,4,192,168,76,2,6,4,192,168,76,3,51,4,0,1,81,128,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
configure dhcp ok {"ip":{"a":192,"b":168,"c":76,"d":9},"mask":{"a":255,"b":255,"c":255,"d":0},"routers":[{"a":192,"b":168,"c":76,"d":2}],"dns":[{"a":192,"b":168,"c":76,"d":3}]}
[ ADD ROUTE 192.168.76.0/24 via null ]
[ ADD ROUTE 0.0.0.0/0 via 192.168.76.2 ]
recv ARP 2 52:55:c0:a8:4c:02 192.168.76.2 1a:46:0b:ca:bc:7c 192.168.76.9 192.168.76.9
recv UDP over IP4 53 49152 94
DNS recv 8.8.8.8 53 {"hostname":"pool.ntp.org","results":[{"hostname":"pool.ntp.org","record":"A","address":[91,206,8,70],"ttl":11},{"hostname":"pool.ntp.org","record":"A","address":[178,251,65,44],"ttl":11},{"hostname":"pool.ntp.org","record":"A","address":[193,171,23,163],"ttl":11},{"hostname":"pool.ntp.org","record":"A","address":[194,112,182,172],"ttl":11}]}
recv UDP over IP4 123 49153 48
I hope this helps you :)
@omnidan Thanks! I don't see anything wrong with the server and the network, it was able to configure itself and resolve time server hostname pool.ntp.org
. Could this be an issue with your system? maybe firewall? do you have anything else listening to port 9000?
@iefserge ahhh, it seems like php-fpm is running on port 9000 - you might want to change the default port to something else ;)
anyway, I killed php-fpm and it works fine now:
dan@galaxy ~> curl localhost:9000
Hello World!⏎
Thanks a lot! :+1:
I changed the issue title and I'll reopen it in case you want to consider changing the default port.
It's kinda pointless to change default port numbers to avoid a conflict. Besides the system ports (0-1023) where there are some well known conventions, port numbers should just be assigned by the user, or allocated automatically. Especially since there are going to be conflicts with just about every nice round-numbered port, and there's no registry to prevent conflicts. For example, php-fpm is also in conflict with the default port for the Hadoop NameNode server and DBGp.
I'd close this and just make it easier to configure via runtimejs/runtime-tools#4
@slang800 you're right :+1: I'll leave it to @iefserge to decide whether or not to close it though
@omnidan @slang800 yeah, let's keep port 9000 and just add an option to change it
I tried running the example web server:
Then, when trying to connect via curl:
Do I need to manually forward the port in qemu? I thought it was supposed to automatically do it? ;)