Browse Source

housekeeping and security improvements

develop
ZER0 COOL 5 months ago
parent
commit
2c61012098
7 changed files with 83 additions and 14 deletions
  1. +7
    -3
      Dockerfile
  2. +2
    -8
      docker-compose.yml
  3. +2
    -1
      docker-entrypoint.sh
  4. +35
    -0
      strategies/DCA.js
  5. +35
    -0
      strategies/skystrat.js
  6. +1
    -1
      web/vue/dist/UIconfig.js
  7. +1
    -1
      web/vue/public/UIconfig.js

+ 7
- 3
Dockerfile View File

@ -1,7 +1,9 @@
FROM node:10
RUN useradd -u 8877 gekko
ENV HOST 0.0.0.0
ENV PORT 443
ENV PORT 3000
# Create app directory
RUN mkdir -p /usr/src/app
@ -28,8 +30,10 @@ WORKDIR ../
# Bundle app source
COPY . /usr/src/app
EXPOSE 443
RUN chmod +x /usr/src/app/docker-entrypoint.sh
EXPOSE 3000
RUN chmod +x /usr/src/app/docker-entrypoint.sh && chown -R 8877:8877 /usr/src/app/
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]
CMD ["--config", "config.js", "--ui"]
USER gekko

+ 2
- 8
docker-compose.yml View File

@ -8,12 +8,6 @@ services:
volumes:
- ./volumes/gekko/history:/usr/src/app/history
- ./config.js:/usr/src/app/config.js
- ./strategies:/usr/src/app/strategies
ports:
- "443:443"
# postgresql:
# restart: always
# image: postgres:9.6-alpine
# env_file:
# - ./.env
# volumes:
# - ./_postgresql:/var/lib/postgresql/data:rw
- "3000:3000"

+ 2
- 1
docker-entrypoint.sh View File

@ -2,7 +2,8 @@
sed -i 's/127.0.0.1/0.0.0.0/g' /usr/src/app/web/vue/dist/UIconfig.js
sed -i 's/localhost/'${HOST}'/g' /usr/src/app/web/vue/dist/UIconfig.js
sed -i 's/3000/'${PORT}'/g' /usr/src/app/web/vue/dist/UIconfig.js
sed -i 's/3000/'${API_PORT}'/g' /usr/src/app/web/vue/dist/UIconfig.js
sed -i 's/443/'${UI_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

+ 35
- 0
strategies/DCA.js View File

@ -0,0 +1,35 @@
// Let's create our own strategy
var strat = {};
// Prepare everything our strat needs
strat.init = function() {
// your code!
}
// What happens on every new candle?
strat.update = function(candle) {
// your code!
}
// For debugging purposes.
strat.log = function() {
// your code!
}
// Based on the newly calculated
// information, check if we should
// update or not.
strat.check = function(candle) {
// your code!
}
// Optional for executing code
// after completion of a backtest.
// This block will not execute in
// live use as a live gekko is
// never ending.
strat.end = function() {
// your code!
}
module.exports = strat;

+ 35
- 0
strategies/skystrat.js View File

@ -0,0 +1,35 @@
// Let's create our own strategy
var strat = {};
// Prepare everything our strat needs
strat.init = function() {
// your code!
}
// What happens on every new candle?
strat.update = function(candle) {
// your code!
}
// For debugging purposes.
strat.log = function() {
// your code!
}
// Based on the newly calculated
// information, check if we should
// update or not.
strat.check = function(candle) {
// your code!
}
// Optional for executing code
// after completion of a backtest.
// This block will not execute in
// live use as a live gekko is
// never ending.
strat.end = function() {
// your code!
}
module.exports = strat;

+ 1
- 1
web/vue/dist/UIconfig.js View File

@ -14,7 +14,7 @@ const CONFIG = {
ui: {
ssl: false,
host: 'localhost',
port: 3000,
port: 443,
path: '/'
},
adapter: 'sqlite'

+ 1
- 1
web/vue/public/UIconfig.js View File

@ -14,7 +14,7 @@ const CONFIG = {
ui: {
ssl: false,
host: 'localhost',
port: 3000,
port: 443,
path: '/'
},
adapter: 'sqlite'

Loading…
Cancel
Save