How to Backup Laravel to SnapShooter
Setting up an effective backup strategy is an essential task for any web hosting administrator. Backup will save your data in the event of system or database failure. In this case, you should consider an automated backup solution like SnapShooter to backup your Laravel site and database. SnapShooter provides an easier way to automate Laravel backup from the web-based interface.
SnapShooter has its own storage that allows you to store your Laravel backup without using any third-party cloud storage. SnapShooter is built with a robust storage network that lives on top of Amazon S3. This gives you the power and redundancy of AWS. Also, SnapShooter Storage is available in every AWS region around the world.
This post will show you how to backup Laravel to SnapShooter Storage.
Table Of Contents
Connect Laravel Server to SnapShooter
Before starting, you will need to connect your SnapShooter Account to the server where your Laravel is hosted. First, go to the SnapShooter website and register for their 14-day free trial.
On the SnapShooter dashboard, click on the Servers in the left sidebar. You should see the following screen:
Click on the Connect Server. You should see the following screen:
Now, copy and paste the following code shown on the above screen to your Laravel server.
curl -sSL "https://ingestor.snapshooter.com/api/server/add?token=eyJpdiI6IjU2RHVoRmZkL3dHRmtwbFU3ZXYwL0E9PSIsInZhbHVlIjoiemtoeE5CK05DNDRhcUcvaTFxOVJ4dz09IiwibWFjIjoiZGY5N2ZmM2VhM2Q1ZjUwZTQwMzg5NGFmY2Y4ODU5ZGI2YjZlNjMwODUwMzE2YWVkMTkyYjUyODYxMTNiOGUyNCIsInRhZyI6IiJ9&key=5895" | bash
Once your server is connected to the SnapShooter. You will get the following output:
Welcome to SnapShooter Server SetupEnvironment Detected: OS: linux, OS Type: amd64Installing SSH public keyCreating temp SSH key filegrep: /root/.ssh/authorized_keys: No such file or directorycp: cannot stat '/root/.ssh/authorized_keys': No such file or directoryCreating authorized_keys backup /root/.ssh/authorized_keys.bak-1650962037Key Installed /root/.ssh/authorized_keysRemoving temp SSH key fileScanning SSH configChecking 22matched (22)SSH test confirmed, Server Added to SnapShooter ...
Next, go back to your SnapShooter dashboard, you should see your added server on the following screen:
How to Backup Laravel to SnapShooter Storage
Next, you will need to create a backup job to automate Laravel backup to SnapShooter Storage.
Follow the below steps to Backup Laravel to SnapShooter Storage:
Step 1 - On the SnapShooter dashboard, click on the Backup Jobs in the left sidebar. You should see the following screen:
Step 2 - Click on the Create New Job. You should see the various database option on the following screen:
Step 3 - Click on the Laravel. You should see the following screen:
Step 4 - Define your backup name and click on the Continue button. You should see the Add Your Server screen:
Step 5 - Here, select your Laravel server, which you have added in the previous step. You should see the following screen:
Step 6 - Provide your Laravel root directory path and click on the Test button. You should see the following screen:
Step 7 - Click on the Save and Next button. You should see the Storage Selection screen:
Step 8 - Here, you will need to define your SnapShooter Storage to store your Laravel. Click on the Add New Storage Provider. You should see the following screen:
Step 9 - Click on the Use SnapShooter Storage button. You should see the following screen:
Step 10 - Select your SnapShooter Storage region and click on the Create Bucket button. You should see the following screen:
Step 11 - Select your storage and click on Set Storage. You should see the following screen:
Step 12 - Here, you can select the pre-defined backup schedule and backup retention policy, then click on the Set Schedule and Finish button. You should see the following screen:
Step 13 - Click on the Backup Now button to run your first backup job. Once your backup job is executed successfully, you should see the following screen:Backup
Depending on your compression level and the size of the backup, it may take time to complete. Every minute SnapShooter will go and check the process to see how far it has got. Using the Log button, you can see the latest state the backup is in.
In this guide, you learned how to backup Laravel to SnapShooter Storage. I hope you can now create your backup policy using the SnapShooter.
Thank you for helping us improve!