Skip to content

vasilyprokopov/digitalocean-snap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

do-snap

DigitalOcean currently offers weekly automated backups for Droplets. However, you might want to back up your Droplets more frequently. do-snap is a serverless function that can be deployed on DigitalOcean to take periodic snapshots of a Droplet. It accepts the Droplet ID and a personal access token as input and uses a cron schedule as a trigger. By default, it runs every 6 hours, and you can adjust the frequency.

Operational logic

do-snap connects to the DigitalOcean API and accesses your account using the provided personal access token. It takes a snapshot of the specified Droplet and deletes an old snapshot, ensuring that only a single snapshot copy is retained at all times.

Prerequisites

To use do-snap, you'll need:

  • The latest version of doctl with the serverless software installed.
  • A serverless namespace created and connected to doctl.
  • A personal access token generated for using the DigitalOcean API.
  • The Droplet ID or a list of comma-separated Droplet IDs that you want to back up. You can retrieve the Droplet ID.

How to deploy

  1. Clone this GitHub repository to your local machine.
git clone https://github.com/vprokopov-do/do-snap
  1. Modify project.yml:
  • Replace the environment variable token with your personal access token. See the next section below for the project.yml example.
  • Replace the environment variable droplets with your Droplet ID or list of comma-separated Droplet IDs.
  • Optionally, rename a Function and a Trigger to names that make sense to you.
  1. Important: Rename the "your-function-name" directory to match your Function name (if you renamed a Function in step 2).
do-snap
├── project.yml
└── packages
    └── do-snap
        └── your-droplet-name
            └── snap.py
  1. Optionally, modify project.yaml to adjust the cron schedule (it runs every 6 hours by default).
  2. Use doctl to Deploy the Function on DigitalOcean.
doctl serverless deploy do-snap

Note that you need to run the deploy command on the entire cloned-down folder.

Example project.yml

Token

Contact

If you wish to learn more about DigitalOcean's services, feel free to contact me at vprokopov@digitalocean.com. You are also welcome to reach out to the sales team at sales@digitalocean.com. A global team of talented engineers will be happy to provide assistance.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages