Skip to content

Docker installation

Matt Robinson edited this page Jul 14, 2018 · 2 revisions

article by bald123

  • Clone gekko repo
  • Clone Gekko-BacktestTool repo
  • (optionally) Clone Gekko-Strategies repo
  • (optionally) Clone gab0/gekko-extra-indicators
  • Install all repositories into the gekko repo according to their respective install instructions.

Change the Dockerfile of the gekko repo to (to install cpanminus and the perl dependencies):

FROM node:8

ENV HOST localhost
ENV PORT 3000

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install GYP dependencies globally, will be used to code build other dependencies
RUN npm install -g --production node-gyp && \
    npm cache clean --force

# Install app dependencies
COPY package.json /usr/src/app
RUN npm install --production && \
    npm install --production [email protected] [email protected] [email protected] pg && \
    npm cache clean --force

# Install cpanminus.
RUN curl -L http://cpanmin.us | perl - App::cpanminus

# Install perl dependencies for Gekko-BacktestTool.
RUN cpanm -n install Parallel::ForkManager Time::Elapsed Getopt::Long List::MoreUtils File::chdir Statistics::Basic DBI DBD::SQLite JSON::XS TOML File::Basename File::Find::Wanted Template LWP::UserAgent LWP::Protocol::https Set::CrossProduct DBD::CSV Text::Table File::Copy

# Bundle app source
COPY . /usr/src/app

EXPOSE 3000
RUN chmod +x /usr/src/app/docker-entrypoint.sh
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

CMD [ "npm", "start" ]

And build your Docker container. To execute the backtesttool from within the container, use the following command on the Docker host:

docker exec -it [image ID] perl backtest.pl

When you fire up 2 containers of the same image, you automatically solve the issue of "SQLITE_BUSY: database is locked". Use one container for your trading, one container for your backtesting.

Clone this wiki locally