nikhiljohn10 / ddns-on-cloudflare Goto Github PK
View Code? Open in Web Editor NEWDDNS on Cloudflare
License: MIT License
DDNS on Cloudflare
License: MIT License
Hi,
I wish to use your script to automate updating my ddns on Cloudflare but I keep getting the log messages below because I think I dont have the Cloudflare user service key.
Is this key still provided by cloudflare as I can only see my Global API and Origin CA keys under my dashboard? Is there a workaround if this key is no longer provided by cloudflare?
./setup.sh: line 19: pip: command not found
./setup.sh: line 20: pip: command not found
./setup.sh: line 21: pip: command not found
./setup.sh: line 36: pyinstaller: command not found
cp: cannot stat './dist/main': No such file or directory
Setting up systemd service
cp: cannot stat 'ddns': No such file or directory
Created symlink from /etc/systemd/system/multi-user.target.wants/ddns.service to /lib/systemd/system/ddns.service.
./setup.sh: line 69: pip: command not found
Setup completed successfully
โ ddns.service - DDNS on Cloudflare
Loaded: loaded (/lib/systemd/system/ddns.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-02-20 21:08:25 GMT; 14ms ago
Process: 19877 ExecStart=/usr/sbin/ddns /opt/ddns-on-cloudflare (code=exited, status=203/EXEC)
Main PID: 19877 (code=exited, status=203/EXEC)
Feb 20 21:08:25 nathan systemd[1]: ddns.service: Unit entered failed state.
Feb 20 21:08:25 nathan systemd[1]: ddns.service: Failed with result 'exit-code'.
Alle the times I try to run the setup script end up with this error:
Building wheels for collected packages: pyinstaller
Building wheel for pyinstaller (PEP 517) ... error
Complete output from command /usr/bin/python2.7 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmppUVywX:
running bdist_wheel
running build
running build_bootloader
No precompiled bootloader found. Trying to compile it for you ...
Setting top to : /tmp/pip-install-HSQsFw/pyinstaller/bootloader
Setting out to : /tmp/pip-install-HSQsFw/pyinstaller/bootloader/build
Python Version : 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
Checking for 'gcc' (C compiler) : not found
Checking for 'clang' (C compiler) : not found
Checking for 'icc' (C compiler) : not found
could not configure a C compiler!
(complete log in /tmp/pip-install-HSQsFw/pyinstaller/bootloader/build/config.log)
ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py
----------------------------------------
Failed building wheel for pyinstaller
Running setup.py clean for pyinstaller
Failed to build pyinstaller
Could not build wheels for pyinstaller which use PEP 517 and cannot be installed directly
root@DietPi:/opt#
Edit: grammar
Great script, but I think there's one huge flaw in it that makes it unusable in any real scenario. Or in a lot of them at least. I've tweaked it for myself, but here it is:
Right now it seems to not change IP when it's first launches. I believe this is wrong.
Imagine this scenario:
I've set everything up at home (say, video surveilance system on raspberry pi), and then unplugged everything and moved it to another location. I plug it back in and naturally I will get assigned a new IP. But ddns script will not change it until the NEXT change. So it can stay on that IP for as long as.... well maybe until it reboots even, depending on how long lease time for IP is.
Fix is simple. Don't run self.get_ip()
on __init__
.
class DDNS(object):
def __init__(self,secret_path):
super(DDNS, self).__init__()
zone_name, email, token, certtoken = secrets.get(secret_path)
self.zone_name = zone_name
self.ip='0.0.0.0'
self.dns = CloudFlare.CloudFlare(email = email, token = token, certtoken = certtoken)
#self.get_ip() # Comment this line out
self.get_zone_id()
self.get_record_id()
self.update_dns()
self.worker()
Another option would be to write IP to disk, not just keeping it in RAM. This way even after reboot it will be able to check if IP changed or not.
Is there any significant performance improvement or what other improvements does it get from being compiled with pyinstaller? Why not just let it run with python?
Or is it just to not pollute environment with libraries?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.