Jeffail / leaps

A pair programming service using operational transforms
MIT License
754 stars 55 forks source link

404 for every request? #19

Closed andyjeffries closed 8 years ago

andyjeffries commented 8 years ago

Hey mate, I use your Gabs library and just found this other project. Very cool!

However, it doesn't work for me. I've done:

go get github.com/jeffail/leaps

When I run leaps from within a folder I get:

Launching a leaps instance, use CTRL+C to close.

2016-04-15T16:36:21+01:00 | INFO | service:http | Listening for websockets at address: localhost:8080/leaps/socket
2016-04-15T16:36:21+01:00 | INFO | service:http | Serving static file requests at address: localhost:8080/leaps
2016-04-15T16:36:21+01:00 | INFO | service:http_admin | Serving internal admin requests at address: localhost:4040/admin

But any request to localhost:8080 or localhost:4040 or localhost:4040/admin result in "404 page not found". If I shutdown leaps then I get connection refused (so it's definitely hitting the daemon).

Any ideas?

Jeffail commented 8 years ago

Hey @andyjeffries,

After go geting there won't be any pages to serve at the root address (localhost:8080/leaps or localhost:4040/admin) since it doesn't have a web directory to host from. To build the client libs and web interface: make deps make build

and then try: ./bin/leaps -c ./config/leaps_share.yaml

The build steps for the js libs uses uglifyjs which you can install through npm, but you can skip all this instead by downloading from the binary releases, since it comes with all the web clients pre-built, there's a guide here: http://jeffail.github.io/leaps/#quick-tutorial

You can also find some more tutorials here: https://github.com/Jeffail/leaps/wiki/Examples

andyjeffries commented 8 years ago

I tried the binary release as well.. Same outcome :-(

Jeffail commented 8 years ago

Which configuration file are you using?

andyjeffries commented 8 years ago

Let me try detailing all the steps from now.

cd Downloads
wget https://github.com/Jeffail/leaps/releases/download/v0.4.1/leaps-darwin_amd64.tar.gz
tar zxvf leaps-darwin_amd64.tar.gz
sudo mv leaps /opt
cd /opt/leaps
cp ./config/leaps_share.yaml ./config.yaml
./bin/leaps -c ./config.yaml

This all works - yay!

So, that's great. Now I've copyed /opt/config.yaml to /etc/leaps.yaml (so I don't need to keep specifying it).

I tried accessing http://myIP:8001/ over my LAN (replacing myIP obviously) and get 404.

I tried changing http_server / address in the file to be "0.0.0.0:8001" just in case because it seems to be only bind to localhost:

Launching a leaps instance, use CTRL+C to close.

2016-04-15T17:40:14+01:00 | INFO | service:http_admin | Serving internal admin requests at address: localhost:4040/admin
2016-04-15T17:40:14+01:00 | INFO | service:http | Listening for websockets at address: localhost:8080/leaps/socket
2016-04-15T17:40:14+01:00 | INFO | service:http | Serving static file requests at address: localhost:8080/leaps

But still no joy - I get a 404 unless I use localhost:8001 (which stops me collaborating).

Thanks for your help so far :-)

Jeffail commented 8 years ago

Hey @andyjeffries, then you're almost there, in the config is a relative path to the static files directory which will be relative to the binary, just edit that to the absolute path:

www_dir: /opt/leaps/static/share_dir

And you should be ready to go.

Assuming this works I'm still keeping this issue open and marking it, since there's obviously a long way to go on making leaps easier to use.

I've been toying with the idea of merging the static files used in this example straight into the binary since it mostly gets used as a LAN pair programming tool anyway, which would eliminate all these steps.

andyjeffries commented 8 years ago

Bingo! That's sorted it.

That would be a good idea. I've had success with go-binata and go generate with my Go apps. Then it would be a true single binary installation.

I was actually going to make a Homebrew recipe for it once I got it working...

andyjeffries commented 8 years ago

Whoah! Didn't realise how complex Homebrew recipes can be... Was hoping just a tar, install and create a config - but by the looks of it they want a source build followed by bottles for distributions.

If you want to do that, looking at https://github.com/Homebrew/legacy-homebrew/blob/master/Library/Formula/caddy.rb might be a good start, but having seen how hairy it can be (with an app I didn't write), I doubt I'll have time before June (when a major project launches).

Jeffail commented 8 years ago

Hey @andyjeffries, I've finished a huge refactor of the code base. The binary leaps is now exclusively the leaps_share example from before. Among other things it means the configuration mess from before can be completely skipped, and the web files come embedded within the binary.

You can now do all the same as before with: go get github.com/jeffail/leaps/cmd/... cd <dir> && leaps

andyjeffries commented 8 years ago

Just tried it with a mate on our LAN and it works really well!!! Thanks for this. However, chatting is a bit weird...

screen shot 2016-04-25 at 08 04 55

Jeffail commented 8 years ago

Hey @andyjeffries, looks like a bug, I'll fix it tonight.

Jeffail commented 8 years ago

Should be fixed now, I've also added a small indicator on the files list showing you how many people are editing them (refreshed every 5 seconds).

andyjeffries commented 8 years ago

This is a brilliant change. Nice work!