askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.08k stars 3.93k forks source link

Getting gekko to run in the cloud after SSH close #1056

Closed jon85j closed 7 years ago

jon85j commented 7 years ago

hey,

so i've managed to get gekko running in a headless environment absolutely fine. However of course after reading some other tickets, after i close SSH i get a disconnect of course.

I have tried PM2, and to set the server up in a cloud config and neither seem to work for me.

I'm running it straight off an IP, not a domain, and i don't believe any ports are blocked.

When i try to run in port 443 for cloud settings, it simply won't find via the browser.

Any thoughts on where i should start with my investigation, having read around im a bi stumped.

I have tried the nginx setup, not totally sure whether its 100% setup like it should. But thinking the issue may be starting there?

jon85j commented 7 years ago

just found and tested issue : https://github.com/askmike/gekko/issues/1026

installed and successfully ran the cmd : pm2 start gekko.js --name gekko -- --ui with cloud config tested and then headless config

when SSH exit, get disconnect message still

Vyteniss commented 7 years ago

You could always use screen to keep the software running even after ssh disconnect.

jon85j commented 7 years ago

well i can give that a test thanks, eager to know why my cloud config tests just dont work though

askmike commented 7 years ago

So to be sure:

after i close SSH i get a disconnect of course.

Is this your main problem? Everything else is working? Exactly what PM2 command did you try but didn't work?

jon85j commented 7 years ago

Yes that is my main problem so far

Pm2 did not help this

askmike commented 7 years ago

So after you started gekko with pm2 and disconnected it crashed? Please post logs (type "pm2 info gekko")

On 31 Aug 2017 00:56, "jon85j" notifications@github.com wrote:

Yes that is my main problem so far

Pm2 did not help this

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/1056#issuecomment-326150965, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MDyHsC6K1OQGkOmplKF-ybvmCr3HIks5sdfasgaJpZM4PHQDC .

jon85j commented 7 years ago

It had the same result as without, will try get that log

jon85j commented 7 years ago

Do you have any other suggestions in the meantime?

gamaraan commented 7 years ago

Run gekko using this command: nohup node gekko --ui & Take note of the number shown after the command is issued, that's the pid of the process. You will need it to kill the running gekko (if you ever need to) without restarting the entire server, using kill -9 pid where pid is a number. If you need to see the console output of gekko, run this command from the gekko folder: tail -f nohup.out You can exit from it with Ctrl-C

jon85j commented 7 years ago

okay trying to start gekko with pm2 has not worked in a headless environment config

[CODE]

[root@li1355-173 gekko]# pm2 restart gekko.js --name gekko -- --ui -f Use --update-env to update environment variables [PM2] Applying action restartProcessId on app [gekko.js](ids: 0) [PM2] gekko ✓ ┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤ │ gekko │ 0 │ fork │ 22144 │ online │ 16 │ 0s │ 39% │ 15.8 MB │ root │ disabled │ └──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘ Use pm2 show <id|name> to get more details about an app [root@li1355-173 gekko]# pm2 info gekko Describing process with id 0 - name gekko ┌───────────────────┬───────────────────────────────────┐ │ status │ errored │ │ name │ gekko │ │ restarts │ 31 │ │ uptime │ 0 │ │ script path │ /root/gekko/gekko.js │ │ script args │ --ui -f │ │ error log path │ /root/.pm2/logs/gekko-error-0.log │ │ out log path │ /root/.pm2/logs/gekko-out-0.log │ │ pid path │ /root/.pm2/pids/gekko-0.pid │ │ interpreter │ node │ │ interpreter args │ N/A │ │ script id │ 0 │ │ exec cwd │ /root/gekko │ │ exec mode │ forkmode │ │ node.js version │ 6.11.1 │ │ watch & reload │ ✘ │ │ unstable restarts │ 0 │ │ created at │ N/A │ └───────────────────┴───────────────────────────────────┘ Revision control metadata ┌──────────────────┬──────────────────────────────────────────┐ │ revision control │ git │ │ remote url │ git://github.com/askmike/gekko.git │ │ repository root │ /root/gekko │ │ last update │ 2017-08-31T16:19:17.709Z │ │ revision │ b940767faebb3d3684a3e97edb6e2d74c9cc2652 │ │ comment │ Merge branch 'develop' into stable │ │ branch │ stable │ └──────────────────┴──────────────────────────────────────────┘ Add your own code metrics: http://bit.ly/code-metrics Use pm2 logs gekko [--lines 1000] to display logs Use pm2 monit to monitor CPU and Memory usage gekko [root@li1355-173 gekko]# pm2 logs gekko [TAILING] Tailing last 15 lines for [gekko] process (change the value with --lines option) /root/.pm2/logs/gekko-out-0.log last 15 lines: 0|gekko | $$ _$$ |$$ | $$ |$$ \ $$ |$$ \ $$ \$$ | 0|gekko | $$ $$/ $$ |$$ | $$ |$$ | $$ |$$ $$/ 0|gekko | $$$$$$/ $$$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/ 0|gekko | 0|gekko | 0|gekko | __ ____ __ 0|gekko | / \ / |/ | / |/ | / | / \ 0|gekko | /$$$$$$ |$$$$$$$$/ $$ | /$$/ $$ | /$$/ /$$$$$$ | 0|gekko | $$ | $$/ $$ | $$ |/$$/ $$ |/$$/ $$ | $$ | 0|gekko | $$ |/ |$$ | $$ $$< $$ $$< $$ | $$ | 0|gekko | $$ |$$$$ |$$$$$/ $$$$$ \ $$$$$ \ $$ | $$ | 0|gekko | $$ _$$ |$$ |____ $$ |$$ \ $$ |$$ \ $$ __$$ | 0|gekko | $$ $$/ $$ |$$ | $$ |$$ | $$ |$$ $$/ 0|gekko | $$$$$$/ $$$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/ 0|gekko |

/root/.pm2/logs/gekko-error-0.log last 15 lines: 0|gekko | 0|gekko | error: unknown option -f' 0|gekko | 0|gekko | 0|gekko | error: unknown option-f' 0|gekko | 0|gekko | 0|gekko | error: unknown option -f' 0|gekko | 0|gekko | 0|gekko | error: unknown option-f' 0|gekko | 0|gekko | 0|gekko | error: unknown option `-f' 0|gekko |

[END CODE]

jon85j commented 7 years ago

@gamaraan i tried and upon SSH exit, i get the disconnect

[root@li1355-173 ~]# nohup node gekko --ui & [1] 22819 [root@li1355-173 ~]# nohup: ignoring input and appending output to ‘nohup.out’

i had used this technique with redis before, i forgot, should work not sure why


just for record also, here is the config im trying to get sorted.

const CONFIG = { headless: true, api: { host: '139.162.192.000', port: 3000, }, ui: { ssl: false, host: '139.162.192.000', port: 3000, path: '/' }, adapter: 'sqlite' }

if(typeof window === 'undefined') module.exports = CONFIG; else window.CONFIG = CONFIG;


very frustrating to not be able to continually run this on a server :(, surely must be something i've missed? Im sure there are tons of people who have had this issue starting gekko via SSH?

zeroX-tj commented 7 years ago

pm2 restart gekko.js --name gekko -- --ui -f

I don't know why there is an -f appended to the gekko params but that is throwing an error in the pm2 logs. This should work: pm2 start gekko.js --name gekko -- --ui

To restart, use the named process pm2 restart gekko

If your gekko crashes you will get a disconnect message (you can see it restarting in the logs) And iirc after 15 unstable restarts it stops restarting the process and puts it in an errored state. Maybe that is happening?

jon85j commented 7 years ago

okay amazing, @zeroX-tj thanks so much man, that seems for the moment to have done the trick!

Seems to be working ok in headless environment, now to try get it running more securely!

askmike commented 7 years ago

great stuff :) Feel free to keep discussing.