Closed morph1904 closed 3 years ago
Hi There.
It is almost definite that you are getting this issue because of this error:
http://server.lab.domain.net:7071/api/api-token-auth/ [HTTP/1.1 502 Bad Gateway 28ms]"
When you completed the installation form, did you enter server.lab.domain.net or the IP of your docker host?
It should look something like this:
I tried the hosts IP and the internal bridge network IP (172.17. 0.x) both with the same results. My browser came from the hosts network via my desktop machine (192.168.1.y).
Hi.
The IP in the set up needs to be the hosts IP address and not the bridge network. Also please make sure that the port is open on the OS.
I would recommend deleting your mapped data (so Tyger does not know it has been previously installed) and trying again.
Another thing you can try is to access the api before completing the installer. Run your container and visit http://192.168.1.Y:7071/api and see what loads. You can also CURL it if that is better for you.
The basics of what is happening here is that the IP address of your host is set on the installer so that the frontend can forward requests to it. You are unable to log on because that request is not getting through.
No luck! However @ http://192.168.a.b:7070/admin/ I got a "Django administration" page. Google said I should create an superuser, Django said "You have 32 unapplied migration(s)", so I did that and could then create a superuser. I could even log in (without any eye-candy, no .css and .js files could be loaded) and click around. Everything else is "bad gateway" (incl. /api), from my PC, host & inside container with the set IP or other IP, before and after installation.
Does it matter that my docker host has two IP addresses set at host network because it was migrated?
I think we need to take a look at your caddyfile can you post it here please? It will be in your mapped data directory. The 502 bad gateway message is thrown by caddy which proxies the backend by default. It means that caddy cannot connect to uwsgi.
Nothing special I would say. caddyfile.conf:
:9091/api {
proxy / localhost:9090 {
transparent
}
}
:9091 {
root /apps/Tyger2/frontend/dist
log /apps/Tyger2/data/logs/frontend.log
rewrite {
regexp .*
to {path} /
}
}
Yup there is the issue.
If you see above, caddy is expecting requests to the api on port 9091 but you are sending them on port 7071. You can try manually changing the caddyfile, or map port 9091 instead and it will start working.
I'm confused, port 7070 & 7071 are my mapped ports within docker...
Everything below I tested multiple times even with the chromium edge browser and always with hosts IP eg 192.168.123.123 and 192.168.124.124. I did change the caddyfile and my portainer stack to point everything to 7070 & 7071. URL | Response |
---|---|
:7070/install | "connection refused" |
:7071/api | "502 Bad Gateway" |
:7071/login | Login site w/o Icons and login with "502 Bad Gateway" for :7071/api/api-token-auth/ |
No database file ofc
So I freed port 9090 & 9091 (prometheus), deleted data and changed everything back to 9090 & 9091: URL | Response |
---|---|
:9090/install | Setup page |
:9091/api | "502 Bad Gateway" |
:9091/login | Login site w/o Icons and login with "502 Bad Gateway" for :9091/api/api-token-auth/ |
Same as last one goes for docker mapped ports from 6060 & 6061 -> 9090 & 9091.
I'm sorry, I have no clue what is so different with my docker/network environment (except from my two IP's at one eth0) then with others. Most things do work for me and it's ok if it is not solvable. We are all here in our spare time.
Anything more "aggressive" debug logging possible?
Got it! First I tested at caddyfile.conf with a dedicated IP address, because I have two configured:
192.168.a.b:9091/api {
proxy / localhost:9090 {
transparent
}
}
192.168.a.b:9091 {
root /apps/Tyger2/frontend/dist
log /apps/Tyger2/data/logs/frontend.log
rewrite {
regexp .*
to {path} /
}
}
With the success of getting at login the icons of the face and lock instead of the words face and login, but still "bad gateway" for login. Strangely the icons stayed after removing the IP...
After that I just guessed that something with localhost could be strange for your web frontend:
root@host:/# ping localhost
PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.047 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.029 ms
64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.028 ms
So, could IPv6 be the problem? Yes it is! I changed "loalhost" to the local IP "127.0.0.1" and it works! :D
From now on I get from time to time "bad gateway" for "stats" and "api-token-refresh" and now again for "api-token-auth" at login....
The latest release of TygerCaddy does not use this method to map to the backend. so this should not be an issue. I will leave this issue open untill the new version is released.
I have the exact same issue but with the current docker beta image. Any idea what is wrong with my setting? (Except of not internet accessible)
Within my Firefox I get a bunch of "cross-site access not allowed source: https://fonts.gstatic.com..." and so no images at login screen. Trying to log in gets me only the "XHR POST http://server.lab.domain.net:7071/api/api-token-auth/ [HTTP/1.1 502 Bad Gateway 28ms]"
My portainer setting:
Portainer log:
BTW: the logo is very similar to "Syncthing" is that on purpose?
_Originally posted by @BlackF09 in https://github.com/morph1904/Tyger2/issue_comments/705918521_