Gekko: postgresql adapter not working

Created on 21 Nov 2017  路  9Comments  路  Source: askmike/gekko

Note: for support questions, please join our Discord server

  • I'm submitting a ...
    [X] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository

  • Action taken (what you did)
    adjusted the line in UIconfig.js

    adapter: 'postgresql'
    adjusted sample-config.js :+1:
    // Postgres adapter example config (please note: requires postgres >= 9.5):
    config.postgresql = {
    path: 'plugins/postgresql',
    version: 0.1,
    connectionString: 'postgres://myuser:mypasword@localhost:5432', // if default port
    database: gekko_db, // if set, we'll put all tables into a single database.
    schema: 'public',
    dependencies: [{
    module: 'pg',
    version: '6.1.0'
    }]
    }

I can login to this database with this user

  • Expected result (what you hoped would happen)

I would hope I could load local data in the postgresql database

  • Actual result (unexpected outcome)

looks like it tries to login with a "user" setting somewhere in an other config?
I have seen the other issues about the difficulties finding the right configs to use, i agree...
I noted issue/956

I also tried renaming sample-config.js to config.js but no luck.

seems gekko does not read the sample-config.js?

gekko stopped working:

hugo@pcloud:~/git/gekko$ node gekko --ui

______   ________  __    __  __    __   ______

/ / |/ | / |/ | / | /
/$$$$$$ |$$$$$$$$/ $$ | /$$/ $$ | /$$/ /$$$$$$ |
$$ | _$$/ $$ |__ $$ |/$$/ $$ |/$$/ $$ | $$ |
$$ |/ |$$ | $$ $$< $$ $$< $$ | $$ |
$$ |$$$$ |$$$$$/ $$$$$ $$$$$ $$ | $$ |
$$ __$$ |$$ |_____ $$ |$$ $$ |$$ $$ __$$ |
$$ $$/ $$ |$$ | $$ |$$ | $$ |$$ $$/
$$$$$$/ $$$$$$$$/ $$/ $$/ $$/ $$/ $$$$$$/

Gekko v0.5.10
I'm gonna make you rich, Bud Fox.

TAlib is disabled
TULIP indicators is enabled
Serving Gekko UI on http://192.168.178.23:3000/

<-- GET /api/imports
--> GET /api/imports 200 2ms 2b
<-- GET /api/gekkos
--> GET /api/gekkos 200 0ms 2b
<-- GET /api/gekkos
--> GET /api/gekkos 200 0ms 2b
<-- GET /api/apiKeys
--> GET /api/apiKeys 200 0ms 2b
<-- GET /api/exchanges
--> GET /api/exchanges 200 999ms 60.95kb
<-- POST /api/scansets

Gekko encountered an error and can't continue

Error:

{ error: role "user" does not exist
at Connection.parseE (/home/hugo/git/gekko/node_modules/pg/lib/connection.js:546:11)
at Connection.parseMessage (/home/hugo/git/gekko/node_modules/pg/lib/connection.js:371:19)
at Socket. (/home/hugo/git/gekko/node_modules/pg/lib/connection.js:114:22)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)
name: 'error',
length: 96,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'miscinit.c',
line: '502',
routine: 'InitializeSessionUserId' } 'nn'

Meta debug info:

Gekko version: v0.5.10
Nodejs version: v8.9.1

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)

Most helpful comment

I don't think gekko needs better documentation, it needs to solve how config files are used.
The issue is that nobody expects to set database login params in file web/routes/baseConfig.js which is located in web/routes... I thought this folder should be used for frontend and for vue routes, definitely not for backend configs....
And what about web/vue/UIcoinfig.js, you have to set DB adapter there adapter: 'sqlite'. It is just wrong.
Why can't all configs be loaded from single config.js?

All 9 comments

I found the answer on https://discordapp.com/channels/342488930983215115/342488930983215115?jump=374609859674374155

for anyone else wondering i found the answer to my question... to use pgsql with the UI or API web/routes/baseConfig.js and put credentials then in UIconfig.js change sqlite to postgresql
edit web/routes/baseConfig.js

wow, this is an issue and it should not be closed. Gekko has a huge issue with its config files. It has to be fixed. Please reopen this

@AidasK

install pg:
npm install [email protected]

@Kirbylix pg was already installed hence its not related

@AidasK the specific error in this issue:

{ error: role "user" does not exist

Is a postgresql error, Gekko can't do much about postgresql auth.

I do agree we need better documentation on how to run postgresql and other databases with Gekko..

I don't think gekko needs better documentation, it needs to solve how config files are used.
The issue is that nobody expects to set database login params in file web/routes/baseConfig.js which is located in web/routes... I thought this folder should be used for frontend and for vue routes, definitely not for backend configs....
And what about web/vue/UIcoinfig.js, you have to set DB adapter there adapter: 'sqlite'. It is just wrong.
Why can't all configs be loaded from single config.js?

@AidasK The main problem came from the fact that before the UI the only thing you could do was start one gekko with one config file.

Everything was housed in this config file, including things like strategy params and market settings. Under the hood Gekko still works like this: all settings about what a gekko is supposed to do are pulled out of a config, even if a physical one on disk doesn't exist. The idea of the UI is that you don't have to configure this in config files anymore, whenever you click on something in the UI a config file is dynamically generated and passed under the hood to the underlying gekko instance.

With the UI a single config file does not make sense since you'll use the create different gekkos that do different things (else what is the point?).

Best would be to move everything which doesn't make sense in the UIConfig to the config screen in the UI imo.

Read more background story here: #956.


You are more than welcome to propose a better config system, the last time someone did (see #956 it was a just bashing against how bad things are in Gekko with the promise to make it better via a PR, this was almost 6 months ago). Though there are some requirements.

Maybe sqlite is too slow or computer problem
i think update version need to change postalsql or moongodb

Was this page helpful?
0 / 5 - 0 ratings

Related issues

godfrey68 picture godfrey68  路  3Comments

prathanbomb picture prathanbomb  路  3Comments

Oowii picture Oowii  路  4Comments

patjk picture patjk  路  3Comments

Chroll91 picture Chroll91  路  5Comments