Skip to content

Commit

Permalink
Improve docker usage; use docker-compose for starting the PokemonGo-B…
Browse files Browse the repository at this point in the history
…ot ecosystem (#1669)

* update Dockerfile; install missed python-protobuf package; add CMD as a way of defining default arguments for the ENTRYPOINT

* remove CMD command, default config parameter is also set in pokecli.py

* improve docker usage; add single container run for the webUI; add docker-compose.yml for starting the bot ecosystem with one command

* fix "How to run with Docker" link

* fix timezone setting: send timezone arg to the docker image build process, e.g. "docker build --build-arg timezone=Europe/Berlin -t pokemongo-bot ."
  • Loading branch information
joergpatz authored and douglascamata committed Jul 29, 2016
1 parent b9aff7a commit 872dfa5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.git*
configs/config.json
**/*config.json
**/*userdata.js
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
FROM python:2.7-onbuild

ARG timezone=Etc/UTC
RUN echo $timezone > /etc/timezone \
&& ln -sfn /usr/share/zoneinfo/$timezone /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata

RUN apt-get update \
&& apt-get install -y python-protobuf

VOLUME ["/usr/src/app/web"]

ENTRYPOINT ["python", "pokecli.py"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This bot takes a strong stance against automating gym battles. Botting gyms will
All information on [Getting Started](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Getting-Started) is available in the [Wiki](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/)!
- __Installation__
- [Requirements] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#requirements-click-each-one-for-install-guide)
- [How to run with Docker](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#how-to-run-with-docker)
- [How to run with Docker](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/How-to-run-with-Docker)
- [Linux] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#installation-linux)
- [Mac] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#installation-mac)
- [Windows] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#installation-windows)
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '2'
services:
bot1-pokego:
build: .
volumes:
- ./configs/config.json:/usr/src/app/configs/config.json
stdin_open: true
tty: true
bot1-pokegoweb:
image: python:2.7
ports:
- "8000:8000"
volumes_from:
- bot1-pokego
volumes:
- ./configs/userdata.js:/usr/src/app/web/userdata.js
working_dir: /usr/src/app/web
command: bash -c "echo 'Serving HTTP on 0.0.0.0 port 8000' && python -m SimpleHTTPServer > /dev/null 2>&1"
depends_on:
- bot1-pokego

5 comments on commit 872dfa5

@bruvv
Copy link
Contributor

@bruvv bruvv commented on 872dfa5 Jul 29, 2016

Choose a reason for hiding this comment

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

still getting errors

2016-07-29 23:32:12 (18.8 MB/s) - './config.properties' saved [4873/4873]                 

RTNETLINK answers: No such file or directory                                              


:PokeGOAPI-Java:extractIncludeProto UP-TO-DATE                                            
:PokeGOAPI-Java:extractProto UP-TO-DATE                                                   
:PokeGOAPI-Java:generateProto UP-TO-DATE                                                  
:PokeGOAPI-Java:compileJavawarning: [options] bootstrap class path not set in conjunction 

url used for image:
https://hub.docker.com/r/babfrag/docker-pokemongobot/

@Wonderfall
Copy link

@Wonderfall Wonderfall commented on 872dfa5 Jul 29, 2016

Choose a reason for hiding this comment

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

Why not Alpine Linux? It is recommended for smaller images.
I've made this one with someone else and it works well : https://hub.docker.com/r/arckosfr/pokemongobot/

@joergpatz
Copy link
Contributor Author

@joergpatz joergpatz commented on 872dfa5 Jul 30, 2016

Choose a reason for hiding this comment

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

you can also have a look here: https://hub.docker.com/r/joergpatz/pokegobot/

@bruvv
Copy link
Contributor

@bruvv bruvv commented on 872dfa5 Jul 30, 2016

Choose a reason for hiding this comment

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

@Wonderfall still a noob regarding docker, the webserver isn't really working. Have an config file but looks like the server isn't being spawned. also the bot keeps crashing

[2016-07-30 06:50:25] [x] Captured Pidgey! [CP 95] [IV 0.42]
stdout
06:50:26
Traceback (most recent call last):
stdout
06:50:26
  File "pokecli.py", line 220, in <module>
stdout
06:50:26
    main()
stdout
06:50:26
  File "pokecli.py", line 211, in main
stdout
06:50:26
    bot.take_step()
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/__init__.py", line 36, in take_step
stdout
06:50:26
    self.stepper.take_step()
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/stepper.py", line 62, in take_step
stdout
06:50:26
    self._work_at_position(position[0], position[1], position[2], True)
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/stepper.py", line 139, in _work_at_position
stdout
06:50:26
    self.bot.work_on_cell(cell, position, pokemon_only)
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/__init__.py", line 93, in work_on_cell
stdout
06:50:26
    worker.work()
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_fort_worker.py", line 30, in work
stdout
06:50:26
    self.stepper._walk_to(self.config.walk, *position)
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/stepper.py", line 88, in _walk_to
stdout
06:50:26
    alt, False)
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/stepper.py", line 139, in _work_at_position
stdout
06:50:26
    self.bot.work_on_cell(cell, position, pokemon_only)
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/__init__.py", line 63, in work_on_cell
stdout
06:50:26
    if self.catch_pokemon(pokemon) == PokemonCatchWorker.NO_POKEBALLS:
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/__init__.py", line 190, in catch_pokemon
stdout
06:50:26
    return_value = worker.work()
stdout
06:50:26
  File "/PokemonGo-Bot/pokemongo_bot/cell_workers/pokemon_catch_worker.py", line 164, in work
stdout
06:50:26
    'Trying to transfer 0 pokemons!')
stdout
06:50:26
RuntimeError: Trying to transfer 0 pokemons!
stdout
06:50:26
2016-07-30 06:50:26,159 INFO exited: bot (exit status 1; not expected)

and thanks @joergpatz that works!

@Wonderfall
Copy link

@Wonderfall Wonderfall commented on 872dfa5 Jul 30, 2016

Choose a reason for hiding this comment

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

@nivong I have no problem. Perhaps because you're using the dev branch, we prefer to stay with stable features so we keep using the master branch.

If I remember correctly the old Dockerfile was using Alpine Linux. Docker official images will switch to Alpine due to its small size, and the officiel python image has already an alpine tag.

Please sign in to comment.