Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Fixed docker build #349

Merged
merged 3 commits into from
Jul 28, 2017
Merged

Fixed docker build #349

merged 3 commits into from
Jul 28, 2017

Conversation

Froelund
Copy link
Contributor

@Froelund Froelund commented Jul 4, 2017

Removed the mapping of the entire map directory: This should not be mapped in runtime, as necessary files actually are copied to the container on build-time.
Mapped conf.js: This file is the only file needed, that is not all-ready in the build container.

Dockerfile restructure: More effecient for development, as dependencies are only fetched if you actually change them.

See: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/

Dockerfile Outdated

COPY . /app

CMD [ "./zenbot.sh", "trade" ]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this one is necessary, as we also rely on it to run sims

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this command is specified inside docker-compose file so you need to decide which one you want to use to run the command

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the default command for the bot to run is running ./zenbot trade. However it can be overwritten in docker-compose.yml or when running as a docker run command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it may confuse people, especially those who are new to Docker. Either way you should pass --paper by default so people don't accidentally trigger live trading

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. That makes sense 👍 I'll fix it.

Copy link
Owner

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this is a good change.

Copy link
Contributor

@egorbenko egorbenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to make these changes I would go different route and create another docker file, one for development and one for production/live trading. Otherwise someone else will create another PR to revert these changes making it more suitable for development.

RUN npm install

COPY . /app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this override node_modules if you install them locally before running docker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .dockerignore file includes node_modules, so it won't be copied

Before the docker CLI sends the context to the docker daemon, it looks for a file named .dockerignore in the root directory of the context. If this file exists, the CLI modifies the context to exclude files and directories that match patterns in it. This helps to avoid unnecessarily sending large or sensitive files and directories to the daemon and potentially adding them to images using ADD or COPY.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks for clarifying I didn't notice someone added .dockerignore

Dockerfile Outdated

COPY . /app

CMD [ "./zenbot.sh", "trade" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this command is specified inside docker-compose file so you need to decide which one you want to use to run the command

@@ -1,8 +1,7 @@
server:
build: .
volumes:
- .:/app
- /app/node_modules
- ./conf.js:/app/conf.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work for development purposes

Copy link
Contributor Author

@Froelund Froelund Jul 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I agree. For development purposes I would probably mount in more directories. I would even consider running the environment without docker container.
I could also make a docker-compose.development.yml which would override the main docker-compose.yml with extra volume mappings.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i still think it should be the other way around, have docker-compose.yml as your default dev environment and docker-compose.live.yml as your live trading one. @DeviaVir what do you think?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egorbenko I like this lightweight version as the default a bit better, developers will know to use docker-compose.development.yml while your "average" user won't intuitively understand how to use docker-compose.live.yml. Fully understand where you're coming from though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that i think of it maybe docker-compose.development.yml makes more sense, as long as there is a flag for --paper trading by default in both Dockerfile and docker-compose

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@Froelund
Copy link
Contributor Author

Froelund commented Jul 6, 2017

@egorbenko I've made the changes you requested.
I have the code ready for a docker-compose.development.yml file, but as it also include upgrading to docker-compose version 2 syntax, I will put it in a separate pull-request.

@egorbenko
Copy link
Contributor

egorbenko commented Jul 6, 2017

Looks good to me, maybe add some documentation in your follow up PR with docker-compose.development.yml because this merge will break some people's dev environment if they are using docker-compose for development

@Froelund
Copy link
Contributor Author

Froelund commented Jul 7, 2017

Yes - I will @egorbenko .

@DeviaVir DeviaVir merged commit 3ebc07a into DeviaVir:master Jul 28, 2017
This was referenced Jul 28, 2017
christian452 pushed a commit to christian452/zenbot that referenced this pull request Aug 4, 2017
…os8f-master

* 'master' of https://github.com/carlos8f/zenbot:
  Improve command help for train command (DeviaVir#436)
  Support for missing win/loss and error rate from output (DeviaVir#426)
  Fix docker builds for forex.analytics (DeviaVir#424)
  Minor fixes for Quadriga trading API (DeviaVir#421)
  xmpp for trading alarms (DeviaVir#333)
  Strategies: TA (ema+macd) and Trust/Distrust (DeviaVir#285)
  Fixed docker build (DeviaVir#349)
  updated c.default_selector to c.selector in README.md (DeviaVir#418)
  added check for message before doing anything with it (DeviaVir#412)
  FIX: Properly check for unknown indicators in forex_analytics (DeviaVir#408)
  Added support for the BTCe exchange (DeviaVir#388)
  Add strategy: forex.analytics, an genetic optimization algorithm for TA-lib stats (DeviaVir#389)

# Conflicts:
#	.gitignore
#	commands/sim.js
#	extensions/exchanges/bittrex/exchange.js
#	extensions/exchanges/quadriga/exchange.js
#	lib/engine.js
#	scripts/auto_backtester/backtester.js
supersabbath pushed a commit to supersabbath/zenbot that referenced this pull request Oct 2, 2017
* Fixed docker build

* Added --paper according to github comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants