codemancers / invoker

An awesome utility to manage all your processes in development environment
http://invoker.c9s.dev/
MIT License
459 stars 58 forks source link

Invoker requires port `:9000`, or else will not work. #194

Open gotoAndBliss opened 7 years ago

gotoAndBliss commented 7 years ago

I'm trying to migrate from POW, but lets give Invoker the benefit of the doubt and greenfield a new app rails create newapp && cd newapp. I did..

gem install invoker

My invoker.ini says..

[whisper]
directory = /Users/mycomputer/Sites/newapp
command = bundle exec rails s

I run sudo invoker setup

I run the app with .. invoker start invoker.ini

Looks like it's booting up!

whisper : => Booting Thin
whisper : => Rails 4.0.13 application starting in development on http://0.0.0.0:9000
whisper : => Run `rails server -h` for more startup options
whisper : => Ctrl-C to shutdown server
whisper : Thin web server (v1.6.3 codename Protein Powder)
whisper : Maximum connections set to 1024
whisper : Listening on 0.0.0.0:9000, CTRL+C to stop

But... curl whisper.dev -> Operation Timeout. Strange. https://0.0.0.0:9000 -> This site can’t provide a secure connection 0.0.0.0 sent an invalid response. Weird. http://0.0.0.0:9000/ -> Boots up my homepage without SSL support. So anything CORS fails. Once I try and click on a subdomain. It's a big fail.

gotoAndBliss commented 7 years ago

Today I went a bit further. Curious if anyone can see something blatantly incorrect about my approach here..

Started also forwarding ip6

sudo sysctl -w net.inet6.ip6.forwarding=1
net.inet6.ip6.forwarding: 0 -> 1

Created a new forwarding rule

sudo touch /private/etc/pf.anchors/org.user.forwarding

With

rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 9000
rdr pass on en0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 9000
rdr pass on en1 inet proto tcp from any to any port 80 -> 127.0.0.1 port 9000

Added it to /private/etc/pf.conf

Parse tested it sudo pfctl -vnf /etc/pf.anchors/org.user.forwarding . It was correct.

Rebooted, and ran sudo pfctl -f /etc/pf.conf; sudo pfctl -e .

Still need to include the port 9000 to access domain.

wkrsz commented 7 years ago

Could it be caused by https://github.com/code-mancers/invoker/issues/184?

gotoAndBliss commented 7 years ago

@WojtekKruszewski Thanks so much for the recommendation. I was previously on 2.1.5, and went to 2.3.0, but the problem still persisted.

Arkham commented 7 years ago

I have bumped into the same issue. I can access my app fine by visiting localhost:9000, but if I visit web.dev I'm greeted by the usual

Application not running Invoker did not get any response. Please check if the application is running.

I'm using the latest version (1.5.4) and these are my configuration files:

$ cat /etc/resolver/dev
nameserver 127.0.0.1
port 23400
$ cat ~/.invoker/config
---
:http_port: 23403
:https_port: 23404
:tld: dev
:dns_port: 23400
$ cat /Library/LaunchDaemons/com.codemancers.invoker.firewall.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.codemancers.invoker</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>echo "rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 23403
rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 23404" | pfctl -a 'com.apple/250.InvokerFirewall' -f - -E</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
$ head -1 Procfile
web: sleep 7 && zeus server -p $PORT

and here is the output of invoker list

$ invoker list
  +-----+-----+------+------------------+---------------------------------------------+
  | dir | pid | port | process_name     | shell_command                               |
  +-----+-----+------+------------------+---------------------------------------------+
  |     | 828 | 9000 | web              | sleep 7 && zeus server -p 9000              |
  +-----+-----+------+------------------+---------------------------------------------+
swanandp commented 7 years ago

@Arkham Does this work for you: https://github.com/code-mancers/invoker/issues/194#issuecomment-316599726 ( It did for me, but didn't for @gotoAndBliss )

Arkham commented 7 years ago

Hey @swanandp! I've tried every suggestion in the thread and the current situation is:

Dan2552 commented 6 years ago

@Arkham I had the same and was resolved by running with binding 0.0.0.0 (e.g. rails s -b 0.0.0.0)

Arkham commented 6 years ago

@Dan2552 amazing, works for me too!

gotoAndBliss commented 6 years ago

Would there be something similar for running rails thin?

gnufied commented 6 years ago

thin also has a -a option that you can use to specifying binding address.

gotoAndBliss commented 6 years ago

@gnufied Ah ok, because I tried -a 0.0.0.0, but nothing happened. Should the address always be 0.0.0.0?

gotoAndBliss commented 5 years ago

Purchased a brand new macbook, fresh install. Same issue. 😭

gotoAndBliss commented 5 years ago

I discovered that if I greenfielded a new app, everything works as expected. No port required.

I tried stripping down the problem app to practically nothing ( still in the process of stripping ). And everytime I make the call I get this error

whisper : 4736210368:error:1408F09C:SSL routines:ssl3_get_record:http request:ssl/record/ssl3_record.c:322:

Not sure if that means anything to anyone on this thread.

oleg-vinted commented 11 months ago

Might be related: https://github.com/code-mancers/invoker/issues/248