Welcome to Rants and Raves!
I kept hearing that I needed to write, so here is the blog that I ended up starting.
It is mostly an accounting of my progression through creating a web site, nuances with code, and tips about what I did to make things work.
In there you will find sprinkled about some gems of life, and letting loose fun.
Enjoy!
HeidiSQL And Homestead Finally
2022-11-16
According to the Homestead documentation they use port redirection for connecting to the database from the host machine.
https://laravel.com/docs/9.x/homestead#connecting-to-databases
However, that did not seem to work for me.
HeidiSQL
Network type: MariaDB or MySQL (TCP/IP)
Library: libmysql.dll
Hostname/IP: 192.168.56.56 (Same as the .yaml)
User: homestead
Password: secret
Port: 3306 not 33060 as the document says.
Access Dev And Production Databases Without Switching Code
2022-11-15
Took long enough. Figured out how to get both Homestead and Azure database connections in the code. In the .env file use Homestead's settings. Create a .env.azure file with Azure's settings. In the Azure portal > site > configuration > New application setting > Name: APP_ENV > value: azure > OK > Save > OK. When Laravel loads it will try to use the .env.APP_ENV file before the .env file. Also remove any sensitive defaults in the database.php file.
https://laravel.com/docs/9.x/configuration
Setting Up Dev Part 9
2022-11-14
Database needs data.
After launching Homestead with vagrant up, get into the VM with vagrant ssh and CD into the site directory. If your migrations are up to snuff then just run "php artisan migrate" and start playing. If your data is in a .sql file and placed in the root of your project then import it with "mysql homestead < file.sql" instead.
https://stackoverflow.com/questions/33336659/how-to-import-existing-database-to-homestead
https://radu.link/create-database-laravel-homestead/
Setting Up Dev Part 8
2022-11-13
Homestead database config.
In your .env and/or database.php file make sure that host is 127.0.0.1, port is 3306, database is homestead, username is homestead, and password is secret. This should get your code linked up to the Homestead database. I also needed to correct my table name in the code, Homestead is case sensitive for table calls while Azure is not.
Setting Up Dev Part 7
2022-11-12
After the Homestead Vagrant box is up and running you should be able to run: "vagrant ssh" to console into the VM. This is handy to do some things like database seeding and some other things that I don't recall. Once you are done in the SSH session type "exit" then hit enter. Once you are done with the VM use: "vagrant halt" to stop it. If there is a need to wipe the VM and start over use: "vagrant destroy"
Setting Up Dev Part 6
2022-11-11
From here you should be good to launch your development Laravel Web Server. In CMD or PS (I've read that PS might be preferred due to its ability to handle some of the syntax within homestead) run: vagrant up
The first time it might take a while due to first time setup stuff. Also, I have had issues with there being a timeout issue. I've yet to find the location to change that setting, but I have had success having Virtual box running before issuing the command. Go to homestead.test
Setting Up Dev Part 5
2022-11-10
To make the local site easily accessible in the browser navigate to: C:\Windows\System32\drivers\etc\
hosts file > properties > Security > edit > add > advanced > find now > select yourself > ok > ok > select full control > ok > yes > ok
Edit hosts with something like notepad and add this entry:
192.168.56.56 homestead.test
Adjust this entry according to any tweaks made in the .yaml file.
Setting Up Dev Part 4
2022-11-09
Also in the .yaml file verify:
provider: virtualbox
Because Windows, change the ~ to the full path to your code. Also tweak the code folder in vagrant to something more appropriate if you wish.
folders:
- map: ~/code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/public
And beef up the computing power if you want.
Setting Up Dev Part 3
2022-11-08
In CMD or PS run: ssh-keygen.exe
All the prompts can be left blank, but make note of the install folder.
In the homestead folder edit the .yaml file in something, like notepad.
Replace the ~ with the path from the ssh-keygen in:
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
Setting Up Dev Part 2
2022-11-07
After the prerequisite programs are installed open a command prompt or PowerShell.
CD into the location you want to store the dev files, I put it right next to my web apps.
To get the dev files run:
git clone https://github.com/laravel/homestead.git Homestead
Go into the new folder: CD .\Homestead\
Make sure it's the official version: git checkout release
Initiate some files, run: .\init.bat