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!
Setting Up Dev Part 1
2022-11-06
Laravel has a pretty nice development setup at:
https://laravel.com/docs/9.x/homestead
First thing is first, you will need the following:
Download and install Vagrant
https://www.vagrantup.com/
Download and install GIT
https://git-scm.com/
Download and install Virtualbox 6.1.x
https://www.virtualbox.org/wiki/Download_Old_Builds_6_1
PowerShell Measure Elapsed Time
2022-11-05
On top of knowing when I started a script, I wanted to actually know how long it would take to run the az webapp up. Turns out it's usually somewhere around 23 minutes with variations up to 30 and as low as 4 when it breaks. The commands I settled with are:
$executionTime = Measure-Command { }
$executionTime.Minutes
https://pscustomobject.github.io/powershell/howto/Measure-Script-Time/
Add A Time Stamp To PowerShell Output
2022-11-04
I would forget to check on the time when I would push the app to Azure. Not really a problem if it didn't take 20 minutes. I added Get-Date to my script to run before the push. There are parameters that can be used to pretty it up, otherwise it dump a long date and time. Works for me now.
https://ss64.com/ps/get-date.html
Locate MySQL In App Connection Info
2022-11-03
Hard coding the mySQL connection bit me. Deleting the site means a new port, which can be found at the top of the phpMyAdmin page after the IP, 127.0.0.1:#####. To get all the settings:
Azure Portal > Site > Advanced Tools > Go
In KUDU > Debug Console > open C:\home\data\mysql\MYSQLCONNSTR_localdb.txt
That will provide all the mySQL connection info. Put this into the .env file. Laravel doesn't parse the Azure MYSQLCONNSTR_localdb URL correctly for automatic settings, messes up the database.
Laravel Has Index.php In The Public Folder
2022-11-02
While troubleshooting I did completely delete the site and all resources from Azure, as such I did need to set the root directory of the site.
az resource update --name web --resource-group $Azure_Group --namespace Microsoft.Web --resource-type config --parent sites/$Azure_App_Name --set properties.virtualApplications[0].physicalPath="site\wwwroot\public" --api-version 2015-06-01
.Deployment Breaking Shit
2022-11-01
The last website test deployment kept erroring. I found success in the command the error told me to run:
az webapp log deployment show -n JWGRR -g JWGRR_Group
and the details URL for the "Running deployment command..."
which led to "deploy.sh: No such file or directory"... The .deployment file that was "necessary" to launch the site was breaking it. Deleted the file that was made from my script and we're back in business.
Today be the day the person I am attached to got born. So we shall celebrate!
Set NULL Post Date To Created Date
2022-10-29
Loop through the NULL post dates and set the post date to the created date.
Seemed simple enough, but my lack of understanding around Laravel's object types means I am struggling to set the date in the variable that I thought was holding the blog data in the controller. Also, waiting 20 minutes to find that my syntax is wrong is killing me. Time to focus on setting up a dev environment.
Get Null Posts And Count
2022-10-28
Usually when starting out I have everything in little chunks and then later on combine them to reduce space. This time I'm going backwards. I started with the count, but I also am going to need those posts, so now I'm breaking:
$data['null_count'] = DB::table('Blogs')->whereNull('post_at')->count();
Into this:
$data['null_post_date'] = DB::table('Blogs')->whereNull('post_at');
$data['null_count'] = $data['null_post_date']->count();
Also helps me understand the capabilities of Eloquent.