freqtrade / frequi

Freqtrade UI - Frontend for Freqtrade
https://github.com/freqtrade/freqtrade
GNU General Public License v3.0
573 stars 259 forks source link

Connecting bots to FreqUI thru cloudflare tunnels #1345

Open fdoooch opened 1 year ago

fdoooch commented 1 year ago

I am trying to connect my freqtrade bots to one freqUI. For security reasons, I use authorization services (cloudflare tunnel) to access my bots over the internet. So when I try to connect the bot to the freqtrade UI, I get an API URL error. I assume this is because FreqtradeUI cannot access the URL without authorization.

All of these bots are on the same docker network. So if I connect them through the docker network, that solves the problem. Something like "container_name:port" instead of the API Url.

If there are other ways to connect multiple bots to Freqtrade UI without open free access to those bots, I would be happy to know about it. I'm new to Freqtrade, so please don't get mad at me if this is a dumb request.

fdoooch commented 1 year ago

image For example, I have two containers with Freqtrade. How could I connect them to the one FreqtradeUI?

xmatthias commented 1 year ago

Please get used to filling out the issue template. Those who frequently omit the template may have their issues closed without comment. We're asking some very basic questions - by deleting the issue template, you're explicitly choosing not to answer our questions.

Filling out the template helps reduce our workload, and we greatly appreciate that.


I don't see how cloudflare tunnel would make a difference here.

In my understanding of that (i read the docs a few weeks ago, but never actively played with it) - it'll just transparently proxy requests for a specific (to be configured) IP / Port combination to a specific host (which needs to have the cloudflare agent installed). Obviously a similar agent also has to be installed on the host you connect it to.

As such, it'll not "really" differ from a regular multi-bot setup - and what you're almost certainly missing is the CORS setup.

If from your LOCAL host (not the one running the containers), you can ping the url (basically curl <freqtradeCloudflareTunnelIp>:port/api/v1/ping) - then it should work. if that doesn't work - then your setup is not correct just yet.

fdoooch commented 1 year ago

Thank you for the answer! I'm sorry for deleting issue template, so I'm trying again: Is your feature request related to a problem? Please describe. I am trying to attach my bots to one Freqtrade UI dashboard. I am running two bots in docker containers with a common freqtrade_network. image I have access to the UI of these bots over the internet via Cloudflare Tunnel, for example, you could see them on https://freqtrade0.milega.cc/ and https://uniusdt.milega.cc/. I could connect uniusdt-bot to freqtrade0-bot UI, when I use "https://freqtrade0.milega.cc" in the CORS_origin settings field of uniusdt-bot: image image Then I enable authentication to access the uniusdt.milega.cc subdomain via cloudflare tunnel. And after that I can no longer connect uniusdt-bot to freqtrade UI freqtrade0-bot: image image Both bot's containers are hosted on the same VPS.

Describe the solution you'd like I would like to have an option to connect my bots to FreqtradeUI thru the docker network. Both of my bots are in the same docker network. And I could ping them from each other's containers.

Describe alternatives you've considered Cloudflar Tunnels has an service-tokens authorization system - https://developers.cloudflare.com/cloudflare-one/identity/service-tokens/. So, we could use the tokens to use Freqtrade API thru the auth connection

Additional context Add any other context or screenshots about the feature request here.

xmatthias commented 1 year ago

I'm not entirely sure what you'd expect here - but to be quite honest, i think that's quite a niche setup.

Just for this feature alone, there's probably 20 different providers offering similar functionality - which all work slightly differently, and would therefore require different functionality. Unless it's something very simple - i don't really see us adding explicit support for this - but i'm also not entirely sure what you'd expect here anyway.


If i did underderstand this correctly, then your main connection (freqtrade0.xxx.cc) works correctly (with auth enabled) - because it's not CORS - correct?