neko
neko copied to clipboard
Dynamic IP
I want to expose my docker to the public internet, but i have a dynamic IP from my ISP. Is it Posible to set a refresh interval or a dyndns to the ENV section, so that the IP updates automaticaly?
Currently, if you do not specify any NEKO_NAT1TO1
when strating the instance, a request is made to http://checkip.amazonaws.com
. But it is not refreshed throughout the session.
Do you plan to have that long running sessions? You could theoretically restart them when IP has changed or peridically, to refresh IP now.
There has been raised a similar concern, but in the context of neko rooms: https://github.com/m1k1o/neko-rooms/issues/62
Yes I want to use long running sessions. https://github.com/m1k1o/neko-rooms/issues/62 is same as i want.
I want to expose my docker to the public internet, but i have a dynamic IP from my ISP. Is it Posible to set a refresh interval or a dyndns to the ENV section, so that the IP updates automaticaly?
I highly recommend a dynamic dns provider with a reverse proxy like Caddy V2 (which also has a lightweight docker image). It will allow you to set a custom url, and it should keep the instance accessible. It also has the added bonus of providing HTTPS support.
I have an dyndns provider but it dont fetch the ip every request or so. It only fetches the IP on Container start
It could be easily implemented by adding new goroutine and ticker every X minutes. Or would you prefer having possibility to set it using CLI and calling it using crontab?
Every X seconds is better maybe to set the interval via ENV.
It could be easily implemented by adding new goroutine and ticker every X minutes. Or would you prefer having possibility to set it using CLI and calling it using crontab?
Both might make sense, however the latter one probably makes the most sense for now. I for example run my own DDNS server, so I can make it push the new IPv4 to the host running the Neko as soon as it changes. However, someone else who uses an external DDNS provider is probably not be able to do that, so just an ENVVAR you can set to seconds in how often it will fetch the new IPv4 from NEKO_IPFETCH is a good idea.
Some news on this toppic?
In my case I am having a VPN on my server and neko pick-up the wrong IP before VPN is established. Having an interval that will fetch the IP regularly would be great.
For now I simply execute container down and up commands automatically after VPN is established.
Any updates in this Case?
Any updates in this Case?
No
I looked at the code and the whole module must be restaretd. So there is no difference in setting up custom CRON script that restarts neko:
docker exec neko supervisorctl restart neko
You could wrap it in such simple bash script:
#!/bin/bash
# Get current ip
current_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
# Get last ip
last_ip=$(cat /opt/last_ip)
# Check if ip changed
if [ "$current_ip" != "$last_ip" ]; then
# Restart network
docker exec neko supervisorctl restart neko
# Save new ip
echo $current_ip > /opt/last_ip
fi
And run e.g. every 5min in CRON.
Maybe you could buildin this script in the container so that you can enable it with an env?
Maybe you could buildin this script in the container so that you can enable it with an env?
I agree, that was the idea at some point in time.