Gekko: Deployment to Heroku error

Created on 21 Nov 2016  路  7Comments  路  Source: askmike/gekko

Hello

first of all thanks for this amazing project

I don't know if I am wrong but I was trying to deploy gekko to Heroku and had some problems, it runs locally everything are fine. I created a Procfile with "web: node gekko.js"

$ heroku local

Everything runs normal, but when I deploy to Heroku:

$ git push heroku stable:master
$ heroku logs --app name_app -t

to see what is happening on remote server output is:

2016-11-21T14:22:09.576796+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  Gekko v0.3.4 started
2016-11-21T14:22:09.582297+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  I'm gonna make you rich, Bud Fox. 
2016-11-21T14:22:09.582299+00:00 app[web.1]: 
2016-11-21T14:22:09.582300+00:00 app[web.1]: 
2016-11-21T14:22:09.586884+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  Setting up Gekko in realtime mode
2016-11-21T14:22:09.586970+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  
2016-11-21T14:22:09.589600+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  Setting up:
2016-11-21T14:22:09.589763+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):     Candle writer
2016-11-21T14:22:09.589853+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):     Store candles in a database
2016-11-21T14:22:09.684859+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  
2016-11-21T14:22:09.684862+00:00 app[web.1]: 
2016-11-21T14:22:09.725249+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  Setting up:
2016-11-21T14:22:09.725317+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):     Trading Advisor
2016-11-21T14:22:09.725387+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):     Calculate trading advice
2016-11-21T14:22:09.728704+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):     Using the trading method: RSI
2016-11-21T14:22:09.737581+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):    The trading method requests 1500 minutes of historic data. Checking availablity..
2016-11-21T14:22:09.739717+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):  
2016-11-21T14:22:09.739719+00:00 app[web.1]: 
2016-11-21T14:22:09.740426+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):    No usable local data available, trying to get as much as possible from the exchange..
2016-11-21T14:22:09.741520+00:00 app[web.1]: 2016-11-21 14:22:09 (INFO):    Preventing Gekko from requesting 1500 minutes of history.
2016-11-21T14:22:09.741726+00:00 app[web.1]: 2016-11-21 14:22:09 (DEBUG):   Fetching exchange data since 240 minutes ago
2016-11-21T14:22:10.136712+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG):   Available exchange data:
2016-11-21T14:22:10.137018+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG):     from: 239 minutes ago
2016-11-21T14:22:10.137175+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG):     to: 0 minutes ago
2016-11-21T14:22:10.137249+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG):   Unable to stitch datasets.
2016-11-21T14:22:10.137311+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):    Not seeding locally available data to the trading method.
2016-11-21T14:22:10.137396+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):    The exchange does not return enough data. NaN minutes are still missing.
2016-11-21T14:22:10.139657+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  Setting up:
2016-11-21T14:22:10.139731+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     Trader
2016-11-21T14:22:10.139812+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     Follows the advice and create real orders.
2016-11-21T14:22:10.144510+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG): getting balance & fee from Poloniex
2016-11-21T14:22:10.147404+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  
2016-11-21T14:22:10.147406+00:00 app[web.1]: 
2016-11-21T14:22:10.466779+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  trading at Poloniex ACTIVE
2016-11-21T14:22:10.466890+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  Poloniex trading fee will be: 0.25%
2016-11-21T14:22:10.467059+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  Poloniex portfolio:
2016-11-21T14:22:10.467403+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     BTC: 0.000000000000
2016-11-21T14:22:10.467506+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     USDT: 11.219357580000
2016-11-21T14:22:10.469013+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  Setting up:
2016-11-21T14:22:10.469245+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     Advice logger
2016-11-21T14:22:10.469320+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     
2016-11-21T14:22:10.473519+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  Setting up:
2016-11-21T14:22:10.473656+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     Profit Simulator
2016-11-21T14:22:10.473770+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):     Paper trader that logs fake profits.
2016-11-21T14:22:10.477619+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  
2016-11-21T14:22:10.477624+00:00 app[web.1]: 
2016-11-21T14:22:10.504678+00:00 app[web.1]: 2016-11-21 14:22:10 (INFO):  Starting to watch the market: Poloniex /
2016-11-21T14:22:10.510031+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG): scheduling ticks
2016-11-21T14:22:10.513544+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG): Requested / trade data from Poloniex ...
2016-11-21T14:22:10.636960+00:00 app[web.1]: 2016-11-21 14:22:10 (DEBUG): Processing 200 new trades. From 2016-11-21 13:26:49 UTC to 2016-11-21 14:21:47 UTC. (an hour)
2016-11-21T14:22:30.530634+00:00 app[web.1]: 2016-11-21 14:22:30 (DEBUG): Requested / trade data from Poloniex ...
2016-11-21T14:22:30.647955+00:00 app[web.1]: 2016-11-21 14:22:30 (DEBUG): No new trades.
2016-11-21T14:22:50.540718+00:00 app[web.1]: 2016-11-21 14:22:50 (DEBUG): Requested / trade data from Poloniex ...
2016-11-21T14:22:50.670565+00:00 app[web.1]: 2016-11-21 14:22:50 (DEBUG): No new trades.
2016-11-21T14:23:07.208303+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-11-21T14:23:07.208303+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-11-21T14:23:07.301153+00:00 heroku[web.1]: Process exited with status 137
2016-11-21T14:23:07.314111+00:00 heroku[web.1]: State changed from starting to crashed

I was looking this error R10 on heroku and said: "This error is often caused by a process being unable to reach an external resource, such as a database, or the application doing too much work, such as parsing and evaluating numerous, large code dependencies, during startup"

Any ideas to fix this?

Most helpful comment

You have to change from web to worker, adding a file named Procfile in your root folder and adding this line of code:

worker: node gekko

Then, you have to got to Resources of your heroku project and activate it and deactivate web.

screen shot 2017-03-04 at 12 08 05

All 7 comments

I haven't used Heroku in years, but looking at the docs:

Define a Procfile

This declares a single process type, web, and the command needed to run it. The name web is important here. It declares that this process type will be attached to the HTTP routing stack of Heroku, and receive web traffic when deployed.

And the error:

R10: A web process took longer than 60 seconds to bind to its assigned $PORT.

Heroku is a platform to host "node.js apps", but what they actually mean is node.js web APIs. So you push your code, you tell it what script to run and then Heroku will run your code and expects that have a web server up within 60 seconds of launch.


The problem is that gekko (stable branch) does not actually run a web server. So after 60 seconds heroku is killing it because it things it was unable to start. The logs show that Gekko started just fine, however after a minute heroku killed it.

As for solutions:

  • You can use a VPS provider that will give you your own (virtual) linux server, and run Gekko there (see here).
  • I am working on a new version of Gekko that will have a webserver (so in theory you should be able to run it on Heruko). It works way easier than the current one, since you don't have to do a lot of things on the commandline anymore. Read more in #489 (note, backtesting "should" work and I am working right now on running live gekko's).

I am closing this for now! Consider Heroku unsupported until the UI is stable.

You have to change from web to worker, adding a file named Procfile in your root folder and adding this line of code:

worker: node gekko

Then, you have to got to Resources of your heroku project and activate it and deactivate web.

screen shot 2017-03-04 at 12 08 05

yup my Procfile is

worker: node gekko.js -c config.js

with my package.json containing

"start": "node gekko.js --config config.js"

@EasyAsABC123

Awesome! So this is a way to run gekko CLI in heroku? And have you tested running the UI as well?

@askmike this does the CLI, i messed with the UI 1 time...i am sure i can get it working but it seems to want to use localhost:3000 even after i changed the .env file, i didn't search too hard since i use gekko for live trading.

@albertolive thank you very match, it worked, this is additional info for other users:
heroku ps:scale web=0 in order to switch off web dynos
heroku ps:scale worker=1 in order to add worker dynos

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clownfish44 picture clownfish44  路  3Comments

rcoenen picture rcoenen  路  5Comments

belemaire picture belemaire  路  5Comments

yacindou picture yacindou  路  3Comments

thegamecat picture thegamecat  路  4Comments