Created
October 1, 2019 14:29
-
-
Save NightyKnight/de5e832050f4b996e63ffaa305037bf9 to your computer and use it in GitHub Desktop.
Restore Snipe-IT From Backup on Linux Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Migrate Production Data | |
a) Login to production SnipeIT and go to Admin -> Backups -> Generate Backups | |
b) Either download the backup locally or connect from the new machine via SFTP | |
i) SFTP Method - Assuming a starting directory of root's home /root or ~/ when logged in as root | |
sftp root@snipeit.dev | |
cd /var/www/snipeit/storage/app/backups | |
get lastest_backup.zip | |
exit | |
c) Unpack archive into new folder | |
mkdir ~/snipeit-prod/ | |
cd ~/snipeit-prod/ | |
unzip ../lastest_backup.zip | |
d) Stop Application before importing database | |
systemctl stop httpd #For Ubuntu this would be systemctl stop apache2 | |
e) Drop Test Database created during install script | |
mysql -u root -p | |
drop database snipeit; | |
create database snipeit; | |
exit; | |
f) Import Database Backup | |
mysql -u root -p snipeit < ~/snipeit-prod/snipeit.sql | |
g) Import Snipe-IT Application Data | |
cd /var/www/snipeit | |
cp .env .env.fresh | |
cp ~/snipeit-prod/.env .env.import | |
i) diff the current .env file with the one from the old systemctl | |
diff -yw .env .env.import | |
ii) Copy the APP_KEY Value from the diff output from the .env.import file and replace in the new .env | |
Also update the APP_URL field to https://snipeit.dev | |
vi .env | |
iii) Copy the OAuth keys | |
i) Backup Fresh keys | |
mv storage/oauth-private.key storage/oauth-private.key.bak | |
mv storage/oauth-public.key storage/oauth-public.key.bak | |
ii) Import Prod keys | |
cp ~/snipeit-prod/var/www/snipe-it/storage/*.key /var/www/snipeit/storage/ | |
iv) Copy Public Uploads and Private Uploads (Skip if empty) | |
cp ~/snipeit-prod/var/www/snipe-it/storage/private_uploads /var/www/snipeit/storage/ | |
cp ~/snipeit-prod/var/www/snipe-it/public/uploads /var/www/snipeit/public/ | |
v) Run the migration scripts | |
cd /var/www/snipeit | |
sudo -u snipeitapp php artisan migrate | |
sudo -u snipeitapp php artisan config:clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment