ForceExamples / dart-force-tictactoe-example

a multiplayer dart force example implementation
0 stars 2 forks source link

Heroku configuration #2

Closed giolaq closed 9 years ago

giolaq commented 9 years ago

What is the right configuration to run this example on Heroku? I have manually create a "views" directory because the server part look for it. But from the other errors I think I've to set the right ForceServer fs = new ForceServer(host: ".... configuration. Any Hints?

jorishermans commented 9 years ago

What error do you get when you try to set this up in Heroku, it is been more then a year ago that I played with heroku, because of the custom buildpack and the updates of the dart sdk ...

giolaq commented 9 years ago

2015-03-06T21:55:14.330418+00:00 app[web.1]: Unhandled exception: 2015-03-06T21:55:14.330426+00:00 app[web.1]: Uncaught Error: The null object does not have a method 'serve'. 2015-03-06T21:55:14.330428+00:00 app[web.1]: 2015-03-06T21:55:14.330432+00:00 app[web.1]: Receiver: null 2015-03-06T21:55:14.330430+00:00 app[web.1]: NoSuchMethodError: method not found: 'serve' 2015-03-06T21:55:14.330435+00:00 app[web.1]: Stack Trace: 2015-03-06T21:55:14.330434+00:00 app[web.1]: Arguments: [Instance of '_HttpRequest', "../build/web/", "game.html"] 2015-03-06T21:55:14.330437+00:00 app[web.1]: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) 2015-03-06T21:55:14.330439+00:00 app[web.1]: #1 WebApplication._resolveStatic (package:forcemvc/server/web_application.dart:102:27) 2015-03-06T21:55:14.330462+00:00 app[web.1]: #3 _RootZone.runUnaryGuarded (dart:async/zone.dart:1093) 2015-03-06T21:55:14.330441+00:00 app[web.1]: #2 WebApplication.static.. (package:forcemvc/server/web_application.dart:68:30) 2015-03-06T21:55:14.330464+00:00 app[web.1]: #4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341) 2015-03-06T21:55:14.330469+00:00 app[web.1]: #7 _PendingEvents.schedule. (dart:async/stream_impl.dart:671) 2015-03-06T21:55:14.330466+00:00 app[web.1]: #5 _DelayedData.perform (dart:async/stream_impl.dart:595) 2015-03-06T21:55:14.330467+00:00 app[web.1]: #6 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711) 2015-03-06T21:55:14.330470+00:00 app[web.1]: #8 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) 2015-03-06T21:55:14.330472+00:00 app[web.1]: #9 _asyncRunCallback (dart:async/schedule_microtask.dart:48) 2015-03-06T21:55:14.330478+00:00 app[web.1]: #0 _rootHandleUncaughtError. (dart:async/zone.dart:886) 2015-03-06T21:55:14.330475+00:00 app[web.1]: #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131) 2015-03-06T21:55:14.330473+00:00 app[web.1]: #10 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84) 2015-03-06T21:55:14.330479+00:00 app[web.1]: #1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) 2015-03-06T21:55:14.330476+00:00 app[web.1]: 2015-03-06T21:55:14.330481+00:00 app[web.1]: #2 _asyncRunCallback (dart:async/schedule_microtask.dart:48) 2015-03-06T21:55:14.330482+00:00 app[web.1]: #3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84) 2015-03-06T21:55:14.330484+00:00 app[web.1]: #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131) 2015-03-06T21:55:14.351154+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=bombemotion.herokuapp.com request_id=09fd31ac-e862-49c4-b3ee-568d58998bfc fwd="83.225.43.143" dyno=web.1 connect=1ms service=79ms status=503 bytes=0 2015-03-06T21:55:15.080204+00:00 heroku[web.1]: Process exited with status 255 2015-03-06T21:55:15.094436+00:00 heroku[web.1]: State changed from up to crashed 2015-03-06T21:56:42.342980+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bombemotion.herokuapp.com request_id=01c866c1-62df-48dc-9861-458b5bfd20cb fwd="83.225.43.143" dyno= connect= service= status=503 bytes= 2015-03-06T21:59:05.541885+00:00 heroku[web.1]: State changed from crashed to starting 2015-03-06T21:59:07.465378+00:00 heroku[web.1]: Starting process with command ./dart-sdk/bin/dart bin/server.dart 2015-03-06T21:59:09.663109+00:00 app[web.1]: INFO: 2015-03-06 21:59:09.658: Web server is running on 'http://56ed0e85-8142-41b8-bebf-1851f85ec9af:6332/' 2015-03-06T21:59:09.874787+00:00 heroku[web.1]: State changed from starting to up 2015-03-06T21:59:46.278727+00:00 app[web.1]: Unhandled exception: 2015-03-06T21:59:46.278733+00:00 app[web.1]: Uncaught Error: The null object does not have a method 'serve'. 2015-03-06T21:59:46.278737+00:00 app[web.1]: NoSuchMethodError: method not found: 'serve' 2015-03-06T21:59:46.278741+00:00 app[web.1]: Arguments: [Instance of '_HttpRequest', "../build/web/", "game.html"] 2015-03-06T21:59:46.278739+00:00 app[web.1]: Receiver: null 2015-03-06T21:59:46.278735+00:00 app[web.1]: 2015-03-06T21:59:46.278744+00:00 app[web.1]: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) 2015-03-06T21:59:46.278746+00:00 app[web.1]: #1 WebApplication._resolveStatic (package:forcemvc/server/web_application.dart:102:27) 2015-03-06T21:59:46.278742+00:00 app[web.1]: Stack Trace: 2015-03-06T21:59:46.278748+00:00 app[web.1]: #2 WebApplication.static.. (package:forcemvc/server/web_application.dart:68:30) 2015-03-06T21:59:46.278768+00:00 app[web.1]: #3 _RootZone.runUnaryGuarded (dart:async/zone.dart:1093) 2015-03-06T21:59:46.278770+00:00 app[web.1]: #4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341) 2015-03-06T21:59:46.278774+00:00 app[web.1]: #7 _PendingEvents.schedule. (dart:async/stream_impl.dart:671) 2015-03-06T21:59:46.278777+00:00 app[web.1]: #9 _asyncRunCallback (dart:async/schedule_microtask.dart:48) 2015-03-06T21:59:46.278779+00:00 app[web.1]: #10 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84) 2015-03-06T21:59:46.278780+00:00 app[web.1]: #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131) 2015-03-06T21:59:46.278771+00:00 app[web.1]: #5 _DelayedData.perform (dart:async/stream_impl.dart:595) 2015-03-06T21:59:46.278773+00:00 app[web.1]: #6 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711) 2015-03-06T21:59:46.278776+00:00 app[web.1]: #8 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) 2015-03-06T21:59:46.278782+00:00 app[web.1]: 2015-03-06T21:59:46.278783+00:00 app[web.1]: #0 _rootHandleUncaughtError. (dart:async/zone.dart:886) 2015-03-06T21:59:46.278785+00:00 app[web.1]: #1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) 2015-03-06T21:59:46.278786+00:00 app[web.1]: #2 _asyncRunCallback (dart:async/schedule_microtask.dart:48) 2015-03-06T21:59:46.278787+00:00 app[web.1]: #3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84) 2015-03-06T21:59:46.278789+00:00 app[web.1]: #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131) 2015-03-06T21:59:46.294939+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=bombemotion.herokuapp.com request_id=5be774b6-ca35-4551-8696-89660f976123 fwd="83.225.43.143" dyno=web.1 connect=1ms service=72ms status=503 bytes=0 2015-03-06T21:59:46.987081+00:00 heroku[web.1]: State changed from up to crashed 2015-03-06T21:59:46.969212+00:00 heroku[web.1]: Process exited with status 255 2015-03-06T22:03:13.328376+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bombemotion.herokuapp.com request_id=986ea6bd-13d7-4e62-9716-86f8e1935a21 fwd="83.225.43.143" dyno= connect= service= status=503 bytes= 2015-03-06T22:04:37.781897+00:00 heroku[api]: Release v10 created by glaquidara@gmail.com 2015-03-06T22:04:37.781897+00:00 heroku[api]: Deploy 2050af4 by glaquidara@gmail.com 2015-03-06T22:04:38.452467+00:00 heroku[web.1]: State changed from crashed to starting 2015-03-06T22:04:40.173973+00:00 heroku[web.1]: Starting process with command ./dart-sdk/bin/dart bin/server.dart 2015-03-06T22:04:41.941618+00:00 app[web.1]: INFO: 2015-03-06 22:04:41.937: Web server is running on 'http://db489e66-54c7-408f-b2ff-8d0c0c8837f5:16843/' 2015-03-06T22:04:42.370504+00:00 heroku[web.1]: State changed from starting to up 2015-03-06T22:04:44.644622+00:00 app[web.1]: Unhandled exception: 2015-03-06T22:04:44.644634+00:00 app[web.1]: Receiver: null 2015-03-06T22:04:44.644627+00:00 app[web.1]: Uncaught Error: The null object does not have a method 'serve'. 2015-03-06T22:04:44.644635+00:00 app[web.1]: Arguments: [Instance of '_HttpRequest', "../build/web/", "game.html"] 2015-03-06T22:04:44.666552+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=bombemotion.herokuapp.com request_id=022251e6-6e7d-48c9-89ad-1511d80d2847 fwd="83.225.43.143" dyno=web.1 connect=0ms service=48ms status=503 bytes=0 2015-03-06T22:04:44.644637+00:00 app[web.1]: Stack Trace: 2015-03-06T22:04:44.644642+00:00 app[web.1]: #2 WebApplication.static.. (package:forcemvc/server/web_application.dart:68:30) 2015-03-06T22:04:44.644632+00:00 app[web.1]: NoSuchMethodError: method not found: 'serve' 2015-03-06T22:04:44.644673+00:00 app[web.1]: #3 _RootZone.runUnaryGuarded (dart:async/zone.dart:1093) 2015-03-06T22:04:44.644678+00:00 app[web.1]: #6 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:711) 2015-03-06T22:04:44.644676+00:00 app[web.1]: #5 _DelayedData.perform (dart:async/stream_impl.dart:595) 2015-03-06T22:04:44.644630+00:00 app[web.1]: 2015-03-06T22:04:44.644675+00:00 app[web.1]: #4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341) 2015-03-06T22:04:44.644679+00:00 app[web.1]: #7 _PendingEvents.schedule. (dart:async/stream_impl.dart:671) 2015-03-06T22:04:44.644684+00:00 app[web.1]: #10 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84) 2015-03-06T22:04:44.644691+00:00 app[web.1]: #2 _asyncRunCallback (dart:async/schedule_microtask.dart:48) 2015-03-06T22:04:44.644639+00:00 app[web.1]: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) 2015-03-06T22:04:44.644687+00:00 app[web.1]: 2015-03-06T22:04:44.644689+00:00 app[web.1]: #1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) 2015-03-06T22:04:44.644694+00:00 app[web.1]: #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131) 2015-03-06T22:04:44.644688+00:00 app[web.1]: #0 _rootHandleUncaughtError. (dart:async/zone.dart:886) 2015-03-06T22:04:44.644681+00:00 app[web.1]: #8 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) 2015-03-06T22:04:44.644692+00:00 app[web.1]: #3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84) 2015-03-06T22:04:44.644641+00:00 app[web.1]: #1 WebApplication._resolveStatic (package:forcemvc/server/web_application.dart:102:27) 2015-03-06T22:04:44.644682+00:00 app[web.1]: #9 _asyncRunCallback (dart:async/schedule_microtask.dart:48) 2015-03-06T22:04:44.644685+00:00 app[web.1]: #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131) 2015-03-06T22:04:45.327302+00:00 heroku[web.1]: Process exited with status 255 2015-03-06T22:04:45.341925+00:00 heroku[web.1]: State changed from up to crashed 2015-03-06T22:06:18.028606+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=bombemotion.herokuapp.com request_id=2241933d-3c57-47ce-ac16-4f97d973a160 fwd="83.225.43.143" dyno= connect= service= status=503 bytes= 2015-03-06T22:18:49.038329+00:00 heroku[web.1]: State changed from crashed to starting 2015-03-06T22:18:52.554342+00:00 heroku[web.1]: Starting process with command ./dart-sdk/bin/dart bin/server.dart 2015-03-06T22:18:56.360010+00:00 heroku[web.1]: State changed from starting to up 2015-03-06T22:18:56.294744+00:00 app[web.1]: INFO: 2015-03-06 22:18:56.278: Web server is running on 'http://745d1fb0-92b6-4307-b556-77aca27e2434:31302/'

jorishermans commented 9 years ago

Oké I am going to try running this application in 2 modes! One with DART_SERVE_URL and one time without see if it makes a difference.

jorishermans commented 9 years ago

It is starting and working correct locally in these 2 modes :)

Did you run pub build? so a build folder is been created on heroku ...

It is also strange that he says noMethodFound exception ...

giolaq commented 9 years ago

Locally it works, on heroku running pub build automatically, it shows me this errors. I'll try on Google Cloud soon.

jorishermans commented 9 years ago

Yes indeed, but I remember that I needed to activate websockets on heroku ... don't know if that is still necessary

jorishermans commented 9 years ago

I will do a try too tomorrow. What is the version of the dart sdk on heroku ... I guess that is the same as on our computers ... I need to get some sleep ;) ... keep me posted ;)

It seems like he could not initiate servingAssistent ... strange, typically something environmental ... some small difference between local and heroku ...

giolaq commented 9 years ago

Yes me too, let's have some sleep! :) Dart version is 1.8.5 same in heroku.

jorishermans commented 9 years ago

-----> Installing Dart VM via URL https://storage.googleapis.com/dart-archive/channels/stable/release/42828/sdk/dartsdk-linux-ia32-release.zip SDK: zip detected % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 10.1M 100 10.1M 0 0 20.1M 0 --:--:-- --:--:-- --:--:-- 20.1M -----> Copy Dart binaries to app root -----> Dart cmd found at -rwx------ 1 u8253 8253 11537592 Mar 7 16:33 /app/dart-sdk/bin/dart /tmp/buildpack_9ea87c25d96a3cce834c990cfc25e963/bin/compile: line 86: /app/dart-sdk/bin/dart: No such file or directory

! Push rejected, failed to compile Dart app

I am failing on installing Dart VM what is your DART_URL_SDK? Using this buildpack https://github.com/igrigorik/heroku-buildpack-dart

jorishermans commented 9 years ago

It builds it correctly, now I need some access to the logs, will try to deploy another simple app tomorrow! And compare it, the tooling in heroku are improved, I like it :)

giolaq commented 9 years ago

I cannot make it work with GClud/Docker too, It seems docker build can't find pubspec.yaml ERROR 2015-03-08 13:56:34,611 containers.py:283] pubspec.*: no such file or directory I'm following https://www.dartlang.org/server/google-cloud-platform/app-engine/

jorishermans commented 9 years ago

pubspec.yaml is something essential ... still try to get it working on heroku ;-) ... I know that dart hosting is an issue ... not a lot of options and most of them are all very custom.

giolaq commented 9 years ago

Yes pubspec.yaml is in the directory but it's seem that pubspec.* expression is not working identifying the right file

jorishermans commented 9 years ago

You can maybe ask this in the dart cloud mailing group ...

giolaq commented 9 years ago

Any news? I'm trying in DigitalOcean + Dokku and have some others problems. I want to have a server side platform to run a game starting by this in a conference. Thank you for the help

jorishermans commented 9 years ago

I have it almost working, some tweaks and some more time and then you will have a good solutions ...

jorishermans commented 9 years ago

Great news :) I got it working on Heroku.

ClientServe was put to false so it crashed, because port environment variable was not set ...

http://forcegame.herokuapp.com/

Can you test this too, I am very sorry that it took me so long ;) It give me also some great insides into heroku so that is great too. So lets finish this game now :)

giolaq commented 9 years ago

Thank you! I tested your link, but playing the client don't show the list with other players, and sometimes the server goes off showing "Disconnected - start 'bin/server.dart' to continue"

jorishermans commented 9 years ago

Sometimes the server goes off showing "Disconnected - start 'bin/server.dart' to continue"

After a period of inactivity the heroku server puts himself into sleep mode. So you need to refresh the page. With pooling you want have that ;)

I filled in my name and then in another window I am filling in another name and then I see a list of opponents!

Well it is indeed not good ... but we can make it better.

jorishermans commented 9 years ago

I see what is going on, I fixed it, it is an old demo version of 'Force' so it is not that up to date anymore ...

jorishermans commented 9 years ago

I cleaned up some code in tictactoe. Added broadcast streams in forceclient and added some functionality to keep track of not sended packages when the client don't reaches the server ... test it out and if you find it a good version I can publish it to pub :)

giolaq commented 9 years ago

Thanks, but using http://forcegame.herokuapp.com/ gives me empty opponent list in all the tests I've done. Also deploying to my server. I'm trying with Chrome, Firefox and Safari. When I press Enter after filling a name, in the console there's WebSocket not connected, message Instance of 'aa' not sent WebSocket not connected, message Instance of 'aa' not sent

jorishermans commented 9 years ago

And in dartium? What does it give you as error? Instance of 'aa' doesn't tell me a lot. I really want to solve this ...

I probably forgot something ...

jorishermans commented 9 years ago

Yes I see, you are not connected to the server yet ... so it will not send the websocket message, but when you are it will do that, it saves it now in notSendedPackages. It would be nice if you could help me give me some more insides in your encounters still, it is hard to solve something when you don't have that problem.

jorishermans commented 9 years ago

Was it working better locally before my changes yesterday?

giolaq commented 9 years ago

Locally is working, deploying on a remote server and playing doesn't show the right opponents list. Can you see the right list in http://forcegame.herokuapp.com/ ? I need to push it on my heroku and debug it.

jorishermans commented 9 years ago

Ok I see, well I see a list on http://forcegame.herokuapp.com/ and I can play against another tab. Yesterday I had also the problem of Websocket not connected, so I added offline behaviour in dart force, maybe there is still something not correct in that code.

image

giolaq commented 9 years ago

screen shot 2015-03-13 at 19 51 18 It seems on my laptop ( OSX ) that after "chosing a socket implementation!" the client don't connect to the ws. Running it locally wrote instead "connected!" after the previous step.

jorishermans commented 9 years ago

I see, I am working on a windows 7. I don't have a mac :s

It has maybe something todo with websockets, os x, heroku, ...

giolaq commented 9 years ago

In linux + Chrome is ok, on Android + Chrome is not working,

jorishermans commented 9 years ago

I have an android phone, so I will debug it and see what I can do on that platform.

giolaq commented 9 years ago

:O Now is working, http://forcegame.herokuapp.com/ :smile:

jorishermans commented 9 years ago

The html template had a hidden-xs on the opponent list, I removed it so you should see it now on an android phone.

Heroku also disconnects a websocket after 50 seconds of inactivity.

"The last important piece of logic is a keep-alive for the WebSocket connection. The request timeout window on Heroku still applies to WebSocket connections. An application must send some data across the connection once every 55 seconds or it will be closed by the router. The original chat sample included a robot that would send a message to the room once every 30 seconds. This fulfills the keep-alive requirement." - From an article on Heroku.

So I will implement the 'ping pong' protocol for websockets. We are getting closer ;-)

giolaq commented 9 years ago

Thank you! :+1: All is up and running now

jorishermans commented 9 years ago

Ping pong protocol is working now, you can check it on http://forcegame.herokuapp.com/

I don't know if the outside api, is good with.

fs.activateKeepAlive();

What do you think?

jorishermans commented 9 years ago

When there are still some issues I am glad to hear that ;)