Skip to content

Norse-IoT/snipeit-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snipeit-backup

For context, Tyler installed Snipe-IT on a Raspberry Pi to act as our asset manager.

Setup

You should run git clone https://github.com/Norse-IoT/snipeit-data in this directory.

This program will automatically push content to this repo, as long as the permissions are set up properly.

Backups

We can run:

/usr/bin/php /var/www/html/snipeit/artisan snipeit:backup

to create a backup on the pi.

To download the backup onto another machine, we can use the backups API.

To access this API, you must create a user in SnipeIt that has the superuser entitlement.

You should then create a Personal Access Token for yourself, and store it as SNIPEIT_TOKEN in your .env file.

This token should last ~15 years. It will be the automated way to backup file content.

Be careful not to leak it.

Crontab

We need a crontab on the server to make regular backups:

$ crontab -e

You can checkout https://crontab-generator.org/ for more info.

Here's the crontab I used to backup every two days at 4am:

We anticipate that nobody is going to be logging new stuff at exactly 4am.

0 4 1-31/2 * * /usr/bin/php /var/www/html/snipeit/artisan snipeit:backup >> /var/log/snipeit-backup.log

These backups will then be downloaded by our download script.

venv

It is expected to use this project with a Python virtual environment.

$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt

On the machine I want to download the backups to, I've added this crontab:

* */12 * * * /home/iplus/snipeit-backup/venv/bin/python3 /home/iplus/snipeit-backup/backup.py >> /var/log/snipeit-backup.log

Releases

No releases published

Packages

No packages published

Languages