Skip to content

Commit

Permalink
Allow docker to run all commands at once (#99)
Browse files Browse the repository at this point in the history
* Update start.sh

* Update README.md

* Update README.md
  • Loading branch information
m0ngr31 authored Apr 19, 2021
1 parent 270a80e commit 67b4d49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ All configuration is done through env variables
The image is published on docker hub under [ayratbadykov/el_monitorro](https://hub.docker.com/r/ayratbadykov/el_monitorro). It accepts additional env variables:

- `RUN_MIGRATION` - if this variable is not empty, `diesel database setup` is run. It creates DB and runs migrations.
- `BOT_BINARY` - depending on this variable, docker container will run one of four binaries. Possible values are `commands`, `sync`, `deliver`, `cleaner`.
- `BOT_BINARY` - depending on this variable, docker container will run one of four binaries. Possible values are `commands`, `sync`, `deliver`, `cleaner`, `all`.

You'll have to set these variables in the `.env` file. For example:

Expand All @@ -152,7 +152,7 @@ docker run --env-file ./.env --network host -t ayratbadykov/el_monitorro:latest
Notes:

- `--network host` is used so the docker container can access a host network if you're running Postgres on the same machine
- To run all binaries (commands, sync, deliver and cleaner), you'll have to start 4 containers replacing `BOT_BINARY` variable.
- To run all binaries (commands, sync, deliver and cleaner), you'll have to start 4 containers replacing `BOT_BINARY` variable, or run with `BOT_BINARY` set to `all`. If you choose to use the `all` option, it would be wise to set a cron job to restart the container periodically in case one of the executables crashes.

#### Creating a docker image from the latest master branch

Expand Down
3 changes: 3 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ case "$BOT_BINARY" in
cleaner*)
./cleaner
;;
all*)
./el_monitorro & ./sync & ./deliver & ./cleaner
;;
*)
echo "Unknown binary"
exit 1
Expand Down

0 comments on commit 67b4d49

Please sign in to comment.