Nom du projet : my_project
URL : my.project.dv
Dans le répertoire qui accueille nos fichiers de site :
- Laravel installer (optionnel) :
composer global require laravel/installer cd D:\wwwlaravel new my_project- (ou sans l'installer Laravel :
composer create-project --prefer-dist laravel/laravel my_project)
- (ou sans l'installer Laravel :
cd my_projectnpm install
- Install Virtualbox
- Install Vagrant
- Install Homestead box :
vagrant box add laravel/homestead composer require laravel/homestead --devvendor\\bin\\homestead make
Configurer le fichier Homestead.yaml :
ip: 192.168.10.10
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
-
map: 'D:\www\my_project'
to: /home/vagrant/my_project
sites:
-
map: my.project.dv
to: /home/vagrant/my_project/public
databases:
- my_project
features:
-
mariadb: false
-
ohmyzsh: false
-
webdriver: false
name: my-project
hostname: my-project
backup: trueAjouter l'IP dans le fichier C:\Windows\System32\drivers\etc\hosts : 192.168.10.10 my.project.dv
- Lancer la VM :
vagrant up - L'URL
http://my.project.dvest accessible - Status des VM :
vagrant global-status - Connexion SSH :
vagrant ssh - Eteindre la VM :
vagrant halt - Détruire la VM :
vagrant destroy
- Host :
127.0.0.1 - Port :
33060 - User :
homestead - Pass :
secret
En cas de destruction de la machine, un backup de la base de donnée est disponible dans le répertoire mysql_backup.
Pour le restaurer :
- Connexion SSH :
vagrant ssh - Connexion Mysql :
mysql - Utilisation de la database :
use my_project - Import du fichier (attention au nom du fichier) :
source /home/vagrant/my_project/mysql_backup/my_project-201910301141.sql - Sortie de Mysql :
exit - Sortie du SSH :
exit