npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

digitalocean-ddns

v0.5.2

Published

A minimal dynamic DNS record tool for Digitalocean. Neat to run as a cronjob :)

Downloads

8

Readme

digitalocean-ddns

Dynamic DNS for DigitalOcean!

A dynamic DNS record updater tool for DigitalOcean. Schedule this to run on a machine with dynamic IP to keep your DNS record with your ip address. Caches the API response so no extraneous requests are done.

Install and get started

  1. Run npm install digitalocean-ddns --global, I would advise you to install it globally as it's a tool/utility.

  2. Create a file named .digitalocean.env in your home directory, use the template below but with your own values.

    MacOS: /Users/<username>/.digitalocean.env
    Linux: /home/<username/.digitalocean.env
    Windows: <DRIVE>:/Users/<username>/.digitalocean.env

  3. Run digitalocean-ddns --dns-records to get ids of your domain records, see the example response. Copy the id of the record you want to be dynamic, usually the A record, and paste it into the .digitalocean.env file, example file below.

The configuration is done! Update the DNS record with digitalocean-ddns --setDnsRecord

It's up to you how you want to schedule it. On a Linux-ish OS I would advise you using crontab as it's the de facto standard. The link goes to to a crontab generator for the cron expresson needed.

Templates and examples

.digitalocean.env example
TOKEN=1ed524e51e5d32d51a5a5a325a5616a46a135a1eded6e87de8d76e9d87d98cee
DOMAIN=hello.world
ID=123456
Example response
[ { id: 12345678, type: 'NS', name: '@' },
  { id: 22345678, type: 'NS', name: '@' },
  { id: 32345678, type: 'NS', name: '@' },
  { id: 42345678, type: 'MX', name: '@' },
  { id: 52345678, type: 'MX', name: '@' },
  { id: 62345678, type: 'MX', name: '@' },
  { id: 72345678, type: 'MX', name: '@' },
  { id: 82345678, type: 'MX', name: '@' },
  { id: 92345678, type: 'A', name: '@' } ]
Crontab example (Unix-based systems)
# Run digitalocean-ddns from my home directory 04:00 every night
0 4 * * * cd /home/myuser && digitalocean-ddns --setDnsRecord

Version history

0.5.2 - Deprecated packages, upped versions, code cleanup, etc.


0.5.1 - Edited readme and better argument checking

  • Better examples for env-file and check for correct arguments, not just any argument.

0.5.0 - Refined readme

  • Includes instructions. Version history was incorrect.

0.4.1 - First release that works correct

  • Only requests Digitalocean if your IP has changed (except for first run which caches the result).
  • Environment file for dynamic usage. Helper script to get the domain id you need.

I Would not advise anyone to go below this version.

About

The tool origins from a Node.js script I used to setDnsRecord my records, and didn't differ much from this except that it's driven more dynamically by a environment file now.

MIT licensed, use with care and I'll not take care of any form of misbehavior, data loss etc. It works for me.

Author

Patrik Hoggren
Software Developer
[email protected]