Skip to content

A script to trigger a DB backup in Forge. Use this is deploy scripts to back up every time you deploy.

License

Notifications You must be signed in to change notification settings

rileysiemens/forge-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Forge Backup

Description

A script to trigger a DB backup in Forge. Use this in deploy scripts to back up every time you deploy.

Requirements

  1. A Laravel Forge account, with a valid API key
  2. A server with jq and curl installed (if you created the server through Forge recently, it probably has both installed already.)

How to use

Copy the contents of backup.sh to the deploy script section of Forge (also works in Envoyer, or theoretically any server...). The three required variables are the server ID, the backup ID, and your API key.

You may optionally increase or decrease the time before this script will timeout (default is 10 minutes). You can also uncomment the last two lines of the script if you want the deployment to fail on timeout.

Server ID

You can find the server ID in the upper right corner the server home page. image

Backup ID

After creating a DB backup in Forge, you can find its ID in parenthesis in the backup name. image

How it works

The script initially gets the UUID of the most recent backup file before triggering a new backup job. Then it begins polling via API calls every 10 seconds to check the UUID of the latest backup file. Once the manually triggered job is finished, the latest file UUID will be different than the initial UUID and the loop exits. If there is no change in 10 minutes (or whatever you set the timeout value), the script prints an error and continues.

About

A script to trigger a DB backup in Forge. Use this is deploy scripts to back up every time you deploy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages