Closed AngryBirdz closed 9 months ago
I realy do like the idea.
Since we need to restart the server anyways on changes of the public ip let me suggest to add a cronjob inside the container (since the crontab is there anyways) that retrieves the current public IP and compare it with the curenlty configured one and restart the server if it has changed and run it minutely or so
Also id rather rely on something like cloudflare or dyndns.org to retrieve the IP
dig +short txt ch whoami.cloudflare @1.0.0.1
If you leave the PUBLIC_IP env var empty, the server will (automatically) get the external IP.
You could also make a script to update the A record in some DDNS service (using their respective API), i'm doing this but with HomeAssistant + Cloudflare, works flawlessly.
Hey @AngryBirdz @masonen
For people like me who are self-hosting their server without a fixed IP, it would be handy for us if the container configuration could automaticaly handle the PUBLIC_IP variable by fetching it on restart.
Afaik what @Rave1996 wrote is true:
If you leave the PUBLIC_IP env var empty, the server will (automatically) get the external IP.
The dedicated-server already does that by itself. If you leave the PUBLIC_IP empty then the config will be written in a way that the server knows, it has to do that. But you dont get back an ip or a log entry in the server-log. Just the be transparent here.
Also IF we would add this function, i would prefer the "dig"-way a lot more then query some random webpage that might be offline. But im not really sure if its really needed. Any feedback on this?
Ping @Plarpoon @thejcpalma @caleb-devops
I also have a dynamic IP and personally think this request is out of scope of this project.
There are plenty of completely free dynamic IP websites online like DynDNS you can use to always contact your homelab. If you want something more professional you can buy yourself a domain (mine is on cloudflare and I pay 8€ a year), then you can redirect the DNS to your machine.
Considering these extremely cheap options I would honestly not focus on this.
I also have a dynamic IP and personally think this request is out of scope of this project.
There are plenty of completely free dynamic IP websites online like DynDNS you can use to always contact your homelab. If you want something more professional you can buy yourself a domain (mine is on cloudflare and I pay 8€ a year), then you can redirect the DNS to your machine.
Considering these extremely cheap options I would honestly not focus on this.
I mean the server already determines the IP of "PUBLIC_IP" if its empty, so i dont have to do something, because the server does it itself. If thats not enough for a "dynamic" approach, im not sure what getting the IP from "dig" or "curl something" would do different. But i might miss something here.
Also https://www.noip.com/ does that for free, 3 sub-domains per account, im using that for over 10 years.
In my case, when I tried this Docker image for the first time I had some problems. Everything is fine now, but one of them was that the container could not access the Internet if I left the PUBLIC_IP variable empty. Manually entering my public IP address fixed the issue.
Now I just did another test by deploying a second container leaving the PUBLIC_IP variable empty. The container was deployed without incident and had access to the internet. I really don't know what happened. 🤔
Also https://www.noip.com/ does that for free, 3 sub-domains per account, im using that for over 10 years.
Also have DuckDNS, it's really cool but you also have many other.
Take a look here.
Does anyone know if the dedicated server restarts automatically once the local ip has changed ? Could not find reliable information about this.
Does anyone know if the dedicated server restarts automatically once the local ip has changed ? Could not find reliable information about this.
If you for example change the Host machine IP?
You'll need to update the entry on the router for the port forward but the server doesnt restart if the Host changes IP address.
Does anyone know if the dedicated server restarts automatically once the local ip has changed ? Could not find reliable information about this.
No need, the server automatically allows any connection by doing that even if the external IP changes.
Does anyone know if the dedicated server restarts automatically once the local ip has changed ? Could not find reliable information about this.
No need, the server automatically allows any connection by doing that even if the external IP changes.
I don't know if he's talking about externalpublic IP or the host machine. If it's the host he needs to adjust the forwarding on the router to accomodate the new change
Does anyone know if the dedicated server restarts automatically once the local ip has changed ? Could not find reliable information about this.
No need, the server automatically allows any connection by doing that even if the external IP changes.
I don't know if he's talking about externalpublic IP or the host machine. If it's the host he needs to adjust the forwarding on the router to accomodate the new change
He's talking about the IP required to connect from outside his network (even after his ISP changes it)..., the port forwarding is another completly different setting that's not related to the repository and the local IP wont change unless he moves the server to another device or changes his network card.
Exactly. Public IPs are dynamic (most of the time), that's why using a DuckDNS (which you can host/install easily, or even run a docker container) or another of course. Local IP changes (the IP of the host machine running docker) don't affect anything on the container. Usually local IP doesn't change (like @Rave1996 is saying) but it can (for example, the DHCP leases on the router aren't permanent unless you set a rule on the router for a fixed IP to a specific mac address or if you set a fixed IP on the machine - which might bug if it asks for that IP, and it is already assigned to another machine).
So, summing up:
Does anyone know if the dedicated server restarts automatically once the local ip has changed ? Could not find reliable information about this.
Hey @masonen - This question is a little bit to vague, do you mind getting it more detailed please? Before people get crazy about solutions here? 🤣 If however the question was already answered, please write something 🙏
yeah my question was related to if the server requires a restart IF the external public ip changes - but it doesnt question answered. sorry for the late response - release days are hard.. :D
I think we can close this issue 😉 @masonen
yeah my question was related to if the server requires a restart IF the external public ip changes - but it doesnt question answered. sorry for the late response - release days are hard
@masonen afaik the server needs to restart to re-detect the ip. So no-noninteractive thing.
Im closing this issue as resolved, feel free to reach out again if you need help.
If you like this project, please consider giving this repo and the docker-hub-repo a Star.
Have you read the Important information text above
Describe the feature
For people like me who are self-hosting their server without a fixed IP, it would be handy for us if the container configuration could automaticaly handle the PUBLIC_IP variable by fetching it on restart. This should be easy enough to implement. I've already tested my example code from your container and it worked. It could be something like:
Additional information
Final checks