Browse Source

unf***ed gekko, to be sane and more portable.

develop
ZER0 COOL 7 months ago
parent
commit
722c682d13
10 changed files with 44 additions and 47 deletions
  1. +0
    -3
      .env
  2. +20
    -0
      .env.example
  3. +3
    -0
      .gitignore
  4. +7
    -6
      Dockerfile
  5. +7
    -34
      docker-compose.yml
  6. +4
    -0
      docker-entrypoint.sh
  7. +0
    -0
      exchange/wrappers/hitbtc2.js.old
  8. +1
    -2
      package.json
  9. +0
    -0
      plugins/postgresql/reader.js
  10. +2
    -2
      web/routes/baseConfig.js

+ 0
- 3
.env View File

@ -1,3 +0,0 @@
HOST=localhost
PORT=3000
USE_SSL=0

+ 20
- 0
.env.example View File

@ -0,0 +1,20 @@
#hostname localhost is generally used in a test env.
HOST=localhost
#listening por
PORT=3000
#enable this if youre using a ssl certificate. acceptable values are 1 or 0: denoting on or off.
USE_SSL=0
#Acceptable values are sqlite, postgresql, and mongodb
DATABASE_ADAPTER=sqlite
# only applicable if postgresql adapter is used.
POSTGRES_HOST='greengekko_postgresql_1'
POSTGRES_DB=gekko
POSTGRES_USER=gekko
POSTGRES_PASSWORD='thisisadbpassword'
# Connection string constructor, built from POSTGRES docker vars.
CONSTRING="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432"

+ 3
- 0
.gitignore View File

@ -56,3 +56,6 @@ db_backup/*.gz
strategies/testbear.js
telegram-config-eth.js.json
deploy.sh
# Secret files
.env

+ 7
- 6
Dockerfile View File

@ -1,7 +1,7 @@
FROM node:8
FROM node:10
ENV HOST localhost
ENV PORT 3000
ENV HOST 0.0.0.0
ENV PORT 443
# Create app directory
RUN mkdir -p /usr/src/app
@ -14,20 +14,21 @@ RUN npm install -g --production node-gyp && \
# Install Gekko dependencies
COPY package.json .
RUN npm install --production && \
npm install --production redis@0.10.0 talib@1.0.2 tulind@0.8.7 pg && \
npm install --production redis@0.10.0 tulind@0.8.18 pg && \
npm install talib && \
npm cache clean --force
# Install Gekko Broker dependencies
WORKDIR exchange
COPY exchange/package.json .
RUN npm install --production && \
RUN npm install && \
npm cache clean --force
WORKDIR ../
# Bundle app source
COPY . /usr/src/app
EXPOSE 3000
EXPOSE 443
RUN chmod +x /usr/src/app/docker-entrypoint.sh
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

+ 7
- 34
docker-compose.yml View File

@ -2,45 +2,18 @@ version: '3'
services:
gekko:
build: ./
restart: always
env_file:
- ./.env
volumes:
- ./volumes/gekko/history:/usr/src/app/history
- ./config.js:/usr/src/app/config.js
links:
- redis
# - postgresql
environment:
- HOST
- PORT
- USE_SSL
ports: # you can comment this out when using the nginx frontend
- "${PORT}:${PORT}"
## optionally set nginx vars if you wish to frontend it with nginx
# environment:
# - VIRTUAL_HOST=gekko
# - PORT=3000
# - DOMAIN=gekko
redis:
image: redis:latest
volumes:
- ./volumes/redis:/data
## optionally uncomment if you wish to use nginx as a frontend
# nginx:
# restart: always
# image: jwilder/nginx-proxy
# ports:
# - "80:80"
# volumes:
# - /var/run/docker.sock:/tmp/docker.sock:ro
## optionally uncomment if you wish to use postgresql as a db
ports:
- "443:443"
# postgresql:
# restart: always
# image: postgres:9.6-alpine
# ports:
# - 5432:5432
# env_file:
# - ./.env
# volumes:
# - ./_postgresql:/var/lib/postgresql/data:rw
# environment:
# POSTGRES_DB: gekko
# POSTGRES_USER: username
# POSTGRES_PASSWORD: password

+ 4
- 0
docker-entrypoint.sh View File

@ -6,4 +6,8 @@ sed -i 's/3000/'${PORT}'/g' /usr/src/app/web/vue/dist/UIconfig.js
if [[ "${USE_SSL:-0}" == "1" ]] ; then
sed -i 's/ssl: false/ssl: true/g' /usr/src/app/web/vue/dist/UIconfig.js
fi
# This will insert the correct database adapter in both disUI and vueUI
sed -i 's/sqlite/'${DATABASE_ADAPTER}'/g' /usr/src/app/web/vue/dist/UIconfig.js
sed -i 's/sqlite/'${DATABASE_ADAPTER}'/g' /usr/src/app/web/vue/public/UIconfig.js
exec node gekko "$@"

exchange/wrappers/hitbtc2.js → exchange/wrappers/hitbtc2.js.old View File


+ 1
- 2
package.json View File

@ -49,10 +49,9 @@
"semver": "5.4.1",
"sqlite3": "^4.0.6",
"stats-lite": "^2.0.4",
"talib": "^1.0.6",
"tiny-promisify": "^0.1.1",
"toml": "^2.3.0",
"tulind": "^0.8.15",
"tulind": "^0.8.18",
"ws": "^6.0.0"
},
"devDependencies": {

+ 0
- 0
plugins/postgresql/reader.js View File


+ 2
- 2
web/routes/baseConfig.js View File

@ -57,8 +57,8 @@ config.sqlite = {
config.postgresql = {
path: 'plugins/postgresql',
version: 0.1,
connectionString: 'postgres://gekkodbuser:1234@localhost:5432', // if default port
database: null, // if set, we'll put all tables into a single database.
connectionString: process.env.CONSTRING,
database: 'gekko', // if set, we'll put all tables into a single database.
schema: 'public',
dependencies: [{
module: 'pg',

Loading…
Cancel
Save