Create database backup folder mapping in Homestead.yaml file
folders:
# change to your path
- map: ~/tmp/backup
to: /home/vagrant/backup
Once you edit your Homestead.yaml file. Restart your vagrant host by using following commands
vagrant halt
vagrant up
Once your vagrant has finished loading, type vagrant ssh to connect to your host.
After you connected to your host. Run following command to install the scripts
git clone https://pildog@github.com/pildog/homestead-scripts.git ~/bin
chmod 755 ~/bin/db/*
chmod 755 ~/bin/mailcatcher/*
Run following command to copy from a sample.
cp ~/bin/config.sample ~/bin/config
Change path if nesseccary.
~/bin/config
#!/usr/bin/env bash
# path to the credential file for mysql
CREDENTIAL_PATH="/home/vagrant/.my.cnf"
# Where your DB backup will be saved
BACKUP_PATH="/home/vagrant/backup"
# mailcatcher smtp port
SMTP_PORT="9999"
# mailcatcher web port
WEB_PORT="1080"
# Defines the folder where the mailcatcher startup script will be saved
SCRIPT_PATH="/home/vagrant/mailcatcher"
# mailcatcher bin folder location
BIN_PATH="/usr/local/bin"
# default ethernet intergace
INTERFACE="eth1"
Laravel Homestead default database username and password is 'homestead' and 'secret'. Use the following command to create a mysql credential file.
~/bin/db/create_cred homestead secret
~/bin/db/backup_all Backup all databases
~/bin/db/restore_all Restore from backup archive
~/bin/db/import Run SQL script to target database
Running the script will create a folder and back up all databases inside.
~/bin/db/backup_all
Passing a folder name as a parameter will restore all databases inside of the folder.
~/bin/db/restore_all [YYYY-MM-DD-HH-MM-SS]
This script will run the given SQL script to the target database. If the database doesn't exist, it will create one. However, if the target database already exists, script will do no further action.
~/bin/db/import [SQL script filename] [database name]
~/bin/mailcatcher/setup Mailcatcher setup scripts
~/bin/mailcatcher/start Start mailcatcher manually (for MacOS)
~/bin/mailcatcher/stop Stop mailcatcher manually
Mailcatcher is a fake SMTP program that catch all outgoing e-mails instead of actually delivering to recipients. After thed script finishes installation, it will give you URL to access via Web UI.
$ bin/mailcatcher/setup
mailcatcher setup completed. See your emails at http://192.168.10.10:1080
You can type http://192.168.10.10:1080 on your web browser to access Web GUI.
If you want to point a different network interface. put the name of the interface after as an argument.
bin/mailcatcher/setup eth2