|
| 1 | +# Ansible Role: Freqtrade-Docker |
| 2 | + |
| 3 | +Pulls and/or builds [Freqtrade](https://www.freqtrade.io) Docker images on Debian/Ubuntu based systems. |
| 4 | + |
| 5 | +## Information |
| 6 | + |
| 7 | +This Ansible Role is designed to pull or build Docker images for Freqtrade - a crypto-currency algorithmic trading software developed in Python. It also allows to build a custom image based on the official Freqtrade sources, to enhance or customize it with own Python packages and/or commands. |
| 8 | + |
| 9 | +Ansible is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. If you are new to Ansible and/or Freqtrade, it is highly recommended to get familiar with the concept of configuration management and infrastructure as code (IaaC). Please see the latest [Ansible documentation](https://docs.ansible.com/ansible/latest/index.html) for further information. |
| 10 | + |
| 11 | +## Requirements |
| 12 | + |
| 13 | +Currently only compatible with Debian/Ubuntu based systems. Tested on Ubuntu 20.04. **At the moment it is not possible to deploy it on Rasberry Pi's (armv7l) architecture!** |
| 14 | + |
| 15 | +*If you want to see other OS flavors supported, you can very much submit a pull request with the desired additions.* |
| 16 | + |
| 17 | +Note that this role requires root access, so either run it in a playbook with a global `become: yes`, or invoke the role in your playbook like: |
| 18 | + |
| 19 | + - hosts: tradingbots |
| 20 | + roles: |
| 21 | + - role: nightshift2k.freqtrade-docker |
| 22 | + become: yes |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +### Via Github |
| 27 | + |
| 28 | + ansible-galaxy install git+https://github.com/nightshift2k/ansible-role-freqtrade-docker.git |
| 29 | + |
| 30 | +### From Ansible Galaxy |
| 31 | + |
| 32 | + ansible-galaxy install nightshift2k.freqtrade-docker |
| 33 | + |
| 34 | +## Role Variables |
| 35 | + |
| 36 | +Available variables are listed below, along with default values (see `defaults/main.yml`): |
| 37 | + |
| 38 | + |
| 39 | + freqtrade_branch: "stable" |
| 40 | + |
| 41 | +The branch in GitHub for the checkout of source files, and also the tag used when pulling the Docker image from registry. |
| 42 | + |
| 43 | + docker_build_directory: "/tmp/build/docker" |
| 44 | + |
| 45 | +Temporary directory for the Docker images. GitHub checkout will happen into subfolder, also if custom image will be build, a Dockerfile will be created there. |
| 46 | + |
| 47 | + build_freqtrade: false |
| 48 | + |
| 49 | +When set to true, will build the image from GitHub sources, instead of pulling it from Docker Registry. |
| 50 | + |
| 51 | + build_freqtrade_custom: false |
| 52 | + |
| 53 | +Will build an additional image with custom Dockerfile and Prefix (see below). |
| 54 | + |
| 55 | + freqtrade_custom_prefix : "custom" |
| 56 | + |
| 57 | +Needs to be defined, when `build_freqtrade_custom` equals `true` which will define the docker image name prefix (repository), so the custom image will be created as `custom/freqtrade:stable`on the target. |
| 58 | + |
| 59 | + freqtrade_custom_commands: |
| 60 | + - "RUN pip install --upgrade pip" |
| 61 | + |
| 62 | +Commands that will be placed into the Dockerfile, anything that is supported in Dockerfiles can be placed here as a list. |
| 63 | + |
| 64 | + freqtrade_custom_pips: |
| 65 | + - finta |
| 66 | + - ta |
| 67 | + - technical |
| 68 | + |
| 69 | +Will be placed after `freqtrade_custom_commands` to install custom Python packages via pip, see `templates/Dockerfile.j2` inside of the role for details. |
| 70 | + |
| 71 | + |
| 72 | +## Dependencies |
| 73 | + |
| 74 | +This role is dependent on `geeringguy.docker` and also the collection `community.docker` please use `ansible-galaxy` to install the role and collection beforehand. |
| 75 | + |
| 76 | + ansible-galaxy collection install community.docker |
| 77 | + ansible-galaxy install geerlingguy.docker |
| 78 | + |
| 79 | +## Example Playbook |
| 80 | + |
| 81 | + - hosts: tradingbots |
| 82 | + vars_files: |
| 83 | + - vars/freqtrade-docker.yml |
| 84 | + roles: |
| 85 | + - role: nightshift2k.freqtrade-docker |
| 86 | + become: yes |
| 87 | + |
| 88 | +*Inside `vars/freqtrade-docker.yml`*: |
| 89 | + |
| 90 | + freqtrade_branch: "develop" |
| 91 | + docker_build_directory: "/tmp/build/docker" |
| 92 | + build_freqtrade: true |
| 93 | + build_freqtrade_custom: true |
| 94 | + freqtrade_custom_prefix : "nightshift2k" |
| 95 | + freqtrade_custom_commands: |
| 96 | + - "RUN pip install --upgrade pip" |
| 97 | + freqtrade_custom_pips: |
| 98 | + - finta |
| 99 | + - ta |
| 100 | + - technical |
| 101 | + - mergedeep |
| 102 | + ... |
| 103 | + |
| 104 | +## License |
| 105 | + |
| 106 | +MIT / BSD |
0 commit comments