Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Implementing ability to run bot in a docker container #7

Closed
wants to merge 9 commits into from
Closed

[python] Implementing ability to run bot in a docker container #7

wants to merge 9 commits into from

Conversation

NovusEdge
Copy link
Contributor

@NovusEdge NovusEdge commented Mar 31, 2021

Changed the BTBManagerTelegram.py to make it so that a --docker flag can be passed in, which will allow the script to run in a docker container

The container is: python:3 and uses the Dockerfile to make a temporary image in which the script will be run.

So, to normally run the script:

python3 BTBManagerTelegram.py

And to run inside a docker container:

python3 BTBManagerTelegram.py --docker

@NovusEdge
Copy link
Contributor Author

This PR is in accordance to Issue #3

@NovusEdge
Copy link
Contributor Author

@lorcalhost
Please let me know if this what was required.

If there's some changes to be made, please ping me :)

@lorcalhost
Copy link
Owner

Thanks @NovusEdge , I'll test it right away and let you know ASAP


FROM python:3

WORKDIR ./
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may break if the script is run from a directory other than the project-directory.

A solution to this may be using os and pathlib to change the path to the project-directory.

Copy link
Contributor Author

@NovusEdge NovusEdge Mar 31, 2021

Choose a reason for hiding this comment

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

@lorcalhost
Please let me know if you want me to make the changes according to the before-mentioned comment.

PS: Please make it into a separate issue so that it's easier to review and edit

@lorcalhost
Copy link
Owner

lorcalhost commented Mar 31, 2021

@NovusEdge I am having some trouble running the Docker image (probably due to my lack of knowledge on Docker images).

Would you mind updating the README.md file with some instructions?

Also, in your testing were you able to use all functionalities without any problem?

Edit: never mind, all seems to be working fine on my end, did you encounter any problems?

@NovusEdge
Copy link
Contributor Author

NovusEdge commented Mar 31, 2021

@NovusEdge I am having some trouble running the Docker image (probably due to my lack of knowledge on Docker images).

Would you mind updating the README.md file with some instructions?

Also, in your testing were you able to use all functionalities without any problem?

@lorcalhost
Could you send the error message you're getting (if any). It could be that maybe there's some error in the code I wrote.

I believe the problem may be because of what i mentioned in one of the comments:

This may break if the script is run from a directory other than the project-directory.

A solution to this may be using os and pathlib to change the path to the project-directory.

@NovusEdge
Copy link
Contributor Author

NovusEdge commented Mar 31, 2021

Would you mind updating the README.md file with some instructions?

sure :)

@lorcalhost
Copy link
Owner

lorcalhost commented Mar 31, 2021

This may break if the script is run from a directory other than the project-directory.

When you say project-directory do you mean from inside the /BTB-manager-telegram directory or the /binance-trade-bot directory where the BTBManagerTelegram.py script has been moved?

@NovusEdge
Copy link
Contributor Author

Edit: never mind, all seems to be working fine on my end, did you encounter any problems?

No, I did not, not in any of my tests, although I would admit, I was kinda stuck with this in the beginning:

FileNotFoundError: [Errno 2] No such file or directory: './config/apprise.yml'

@NovusEdge
Copy link
Contributor Author

This may break if the script is run from a directory other than the project-directory.

When you say project-directory do you mean from inside the /BTB-manager-telegram directory or the /binance-trade-bot directory where the BTBManagerTelegram.py script has been moved?

the /BTB-manager-telegram directory

@lorcalhost
Copy link
Owner

lorcalhost commented Mar 31, 2021

@NovusEdge Actually one problem does arise, currently the Start bot feature calls the subprocess function

$(which python3) -m binance_trade_bot &

If with Docker we are working from a different directory than the /binance-trade-bot one, how do we interact with the module?

One way would be calling

BTBManagerTelegram(root_path='../binance-trade-bot')

but in this case we would require both the binance-trade-bot and the BTB-manager-telegram directories to be in the same directory, also I believe we would need to pass some arguments to the Docker image to tell it to run with a different root path.

What else do you propose?

@NovusEdge
Copy link
Contributor Author

NovusEdge commented Mar 31, 2021

@lorcalhost
I believe it'll be far easier to go over this on a voice chat.
Here's my discord tag: Fermi#0472.
Ping me and I'll respond as soon as I can.

@lorcalhost
Copy link
Owner

@NovusEdge sent you a friend request on Discord, unable to send you messages because we don't share a server.

@NovusEdge NovusEdge closed this Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants