From 5a9983086a75275f2fbeb7f0569e7a3a09277b71 Mon Sep 17 00:00:00 2001 From: daniila Date: Sun, 17 Oct 2021 00:24:00 +0300 Subject: [PATCH 1/4] How to run multiple instances with docker Basic guide on how to run multiple instances using docker. --- docs/advanced-setup.md | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/docs/advanced-setup.md b/docs/advanced-setup.md index f03bc10c0..e7e5b6cec 100644 --- a/docs/advanced-setup.md +++ b/docs/advanced-setup.md @@ -52,6 +52,71 @@ freqtrade trade -c MyConfigUSDT.json -s MyCustomStrategy --db-url sqlite:///user For more information regarding usage of the sqlite databases, for example to manually enter or remove trades, please refer to the [SQL Cheatsheet](sql_cheatsheet.md). +### Multiple instances using docker + +To run multiple instances of freqtrade using docker you will need to edit the docker-compose.yml file and add all the instances you want as separate services. Remember, you can separate your configuration into multiple files, so it's a good idea to think about making them modular, then if you need to edit something common to all bots, you can do that in a single config file. +``` +--- +version: '3' +services: + freqtrade1: + image: freqtradeorg/freqtrade:stable + # image: freqtradeorg/freqtrade:develop + # Use plotting image + # image: freqtradeorg/freqtrade:develop_plot + # Build step - only needed when additional dependencies are needed + # build: + # context: . + # dockerfile: "./docker/Dockerfile.custom" + restart: always + container_name: freqtrade1 + volumes: + - "./user_data:/freqtrade/user_data" + # Expose api on port 8080 (localhost only) + # Please read the https://www.freqtrade.io/en/latest/rest-api/ documentation + # before enabling this. + ports: + - "127.0.0.1:8080:8080" + # Default command used when running `docker compose up` + command: > + trade + --logfile /freqtrade/user_data/logs/freqtrade1.log + --db-url sqlite:////freqtrade/user_data/tradesv3_freqtrade1.sqlite + --config /freqtrade/user_data/config.json + --config /freqtrade/user_data/config.freqtrade1.json + --strategy SampleStrategy + + freqtrade2: + image: freqtradeorg/freqtrade:stable + # image: freqtradeorg/freqtrade:develop + # Use plotting image + # image: freqtradeorg/freqtrade:develop_plot + # Build step - only needed when additional dependencies are needed + # build: + # context: . + # dockerfile: "./docker/Dockerfile.custom" + restart: always + container_name: freqtrade2 + volumes: + - "./user_data:/freqtrade/user_data" + # Expose api on port 8080 (localhost only) + # Please read the https://www.freqtrade.io/en/latest/rest-api/ documentation + # before enabling this. + ports: + - "127.0.0.1:8081:8081" + # Default command used when running `docker compose up` + command: > + trade + --logfile /freqtrade/user_data/logs/freqtrade2.log + --db-url sqlite:////freqtrade/user_data/tradesv3_freqtrade2.sqlite + --config /freqtrade/user_data/config.json + --config /freqtrade/user_data/config.freqtrade2.json + --strategy SampleStrategy + +``` +You can use whatever naming convention you want, freqtrade1 and 2 are arbitrary. + + ## Configure the bot running as a systemd service Copy the `freqtrade.service` file to your systemd user directory (usually `~/.config/systemd/user`) and update `WorkingDirectory` and `ExecStart` to match your setup. From f9b166747847c529c16900904a80e07284f46108 Mon Sep 17 00:00:00 2001 From: daniila Date: Mon, 18 Oct 2021 23:36:47 +0300 Subject: [PATCH 2/4] Update docs/advanced-setup.md Co-authored-by: Matthias --- docs/advanced-setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-setup.md b/docs/advanced-setup.md index e7e5b6cec..79e17fb4e 100644 --- a/docs/advanced-setup.md +++ b/docs/advanced-setup.md @@ -103,7 +103,7 @@ services: # Please read the https://www.freqtrade.io/en/latest/rest-api/ documentation # before enabling this. ports: - - "127.0.0.1:8081:8081" + - "127.0.0.1:8081:8080" # Default command used when running `docker compose up` command: > trade From 5d2e37409962970a45cbffd255ea9080c595fc52 Mon Sep 17 00:00:00 2001 From: daniila Date: Mon, 18 Oct 2021 23:38:45 +0300 Subject: [PATCH 3/4] Update docs/advanced-setup.md Co-authored-by: Matthias --- docs/advanced-setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-setup.md b/docs/advanced-setup.md index 79e17fb4e..6eda8489b 100644 --- a/docs/advanced-setup.md +++ b/docs/advanced-setup.md @@ -55,7 +55,7 @@ For more information regarding usage of the sqlite databases, for example to man ### Multiple instances using docker To run multiple instances of freqtrade using docker you will need to edit the docker-compose.yml file and add all the instances you want as separate services. Remember, you can separate your configuration into multiple files, so it's a good idea to think about making them modular, then if you need to edit something common to all bots, you can do that in a single config file. -``` +``` yml --- version: '3' services: From f863f4fdfca815bd5c8a20f3915b948b90f7d753 Mon Sep 17 00:00:00 2001 From: daniila Date: Mon, 18 Oct 2021 23:49:59 +0300 Subject: [PATCH 4/4] Update advanced-setup.md A note on having to use different database files, ports and telegram configs for each bot. --- docs/advanced-setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-setup.md b/docs/advanced-setup.md index 6eda8489b..02b0307e5 100644 --- a/docs/advanced-setup.md +++ b/docs/advanced-setup.md @@ -114,7 +114,7 @@ services: --strategy SampleStrategy ``` -You can use whatever naming convention you want, freqtrade1 and 2 are arbitrary. +You can use whatever naming convention you want, freqtrade1 and 2 are arbitrary. Note, that you will need to use different database files, port mappings and telegram configurations for each instance, as mentioned above. ## Configure the bot running as a systemd service