Laravel Email Templates on Production Server - laravel

On my local development server I have changed the default email templates, however, once I have pushed to the production server I notice that those changes don't push because the vendor folder is included in the gitignore file.
What is the best way to get my local changes moved to the production server? I have already published the files on the production server, but how would I access those files to make the changes?
Thank you!

You can safely commit contents of the vendor directory inside resources/views. If no .gitignore is present in the resources/views directory, add one with the content !/vendor. This will unignore the vendor directory within this path.
Side note:
I guess you have vendor/ written in the .gitignore of your projects root directory. This is a special syntax that will use inheritance across your project, meaning the vendor directory is not only ignored in the root directory, but also all sub directories. In theory, if you change the entry to /vendor, the other vendor directory within resources/views should be unignored automatically without an extra .gitignore. But be careful to not unignore other unwanted vendor directories...

Related

Productive files from Laravel 8?

A quick question:
which files or directories from Laravel 8 needs to be transferred to a production system or Muße the entire files and directories?
Well, yes, you have to move all the files including the vendor directory which has all the php dependencies (unless you can run composer install in production, in that case there's no need to upload the vendor directory). If you have local logs and cache in the storage directory, you can omit those.
You will also need to create a new .env file for production.
And, if your are using JavaScript with Laravel Mix, you don't need to upload the node_modules folder, only the compiled js or css files.

Correct method of deploying Laravel 8 Application through cPanel

I designed a Laravel 8 app and successfully deployed it via cPanel. What I did was create a git repo in my cPanel. Connected that repo to my local app folder. Pushed the repo from my laptop and deployed it via git's post-receive hook to the public_html folder.
Now what I request you seniors to tell me, is what is the best practice of deploying the Laravel project.
a) should I deploy directly to my public_html folder via git repo (as I have done) or
b) should I deploy it to another folder and create a symlink pointing to public_html folder.
After deploying, i found that all my folders in storage folder where images are stored, have been deleted/removed. Should I again create those folders and try to create a symlink as I do in local project or there is some other procedure for doing that?
Regards
The public directory in your project needs to be the public facing directory. From what you have described, you need to point public_html to your public directory. So you probably will have to deploy to another directory.
You will need to recreate your storage directories and files, as it sounds like they are being ignored. Check your .gitignore file to make sure the proper files and directories are being tracked.

How to use modules replace functionality in cloud functions

I have a google cloud function that is a subdirectory in a repository. It uses the "Directory with source code" option in the settings menu. I keep getting this error on deploy:
Deployment failure:
Build failed: go: parsing /utils/pubsub/go.mod: open /utils/pubsub/go.mod: no such file or directory
go: error loading module requirements
I'm assuming that GCF does not upload the entire directory to the instance, but instead only the folder? This breaks the replace functionality of Go modules. Is there something I am doing wrong?
Link to the repo: https://github.com/FreekingDean/jeffbotgo/tree/5d735cc/slackevent
I work at Google and on this product.
Only the directory where you run gcloud is uploaded. There is no staging step beyond zipping the current directory and uploading it.
Notably, modules are preferred by the builder over vendor. If there is a go.mod, modules will be used. When you upload your function, it only includes the directory with your function at the root, not any directories one level up. So, when there is a go.mod and you have a replace directive pointing one level up, it will not work.
The solution for now with this layout is to vendor and not upload the go.mod/go.sum files. When using gcloud, you can create a .gcloudignore file to do this for you. See https://cloud.google.com/functions/docs/concepts/go-runtime#specifying_dependencies for more detail. Alternatively, modify your project to include any necessary helper packages in subdirectories.
I had the same issue today.
When reading thru the documentation for the 8th time i came across a warning box bellow the "Vendor directory" headline.
Warning: If your project has both a go.mod file and a vendor directory
at the root of your project, the vendor directory will be ignored
during deployment. You must use a .gcloudignore file to ignore the
go.mod file in order to ensure that your vendor directory is used
during deployment.
So basically once i added a .gcloudignore file with go.mod (will add go.sum as well) everything worked. So i guess if you have a go.mod file the cloud function will try to fetch dependencies instead of using the ones uploaded in the vendor folder.
I'm just guessing here tough.

Gitignore CodeIgniter

Before I put my very first (CodeIgniter) application on Github, I have a question about the CodeIgniter .gitignore file (see below). I do not have a development directory in my config directory. Can I just .gitignore */config/* instead? What is the importance of the development directory in the config directory?
*/config/development
*/logs/log-*.php
*/logs/!index.html
*/cache/*
*/cache/!index.html
Many people set up development and production folders in their config folders. Codeigniter will load the correct file from the correct folder depending on the environment you set in the main index.php
If you're creating a public repository on github copy the files with passwords and keys (your config.php and database.php are the only two that come standard with the framework I believe) to a new folder called development inside config, then remove the passwords and paths and things from the ones in the root folder. Leave the gitignore as is.
This way when you push to git you aren't pushing your personal private information to the project.

TortoiseHg change default .hg folder location

Is it recommend to change the default .hg folder location to a central place? Instead of having the .hg folder stored under working directory. Since I have accidentally shift-deleted the working directory and lost all commit history.
Is there any way to change the default .hg folder location in TortoiseHg?
Or any recommendation on backing up the repo? And how?
AFAIK, changing the location of the .hg folder is not possible. The presence of a .hg folder indicates that a given folder is a HG repository.
Even if it was possible to move the .hg folder itself to another location, there would still have to be some information in your working folder where your actual .hg folder is. So if you would accidentally delete your working folder, you'd also lose the path to the real .hg folder. Same problem :-)
Backing up a repo is easy in distributed version control systems like HG.
Make a clone somewhere (on a server in your network that's backed up regularly, or if you're at home, use a Bitbucket account) and push to it regularly.
I can think of two possible solutions, one I recommend, and one I don't.
The solution I don't recommend relies on your file system having Hard Links. When you create a new project, you could move the .hg directory to somewhere else on the file system, and set up a hard link to it in your working directory. You then essentially have two references on the file system to the same .hg directory, so if you delete one it will still exist.
I have done similar things on my gaming PC to have all savegames stored in subdirectories of a single \savegame directory.
However, a much better solution, and one that I would definitely recommend is as follows:
Have a directory (for example C:\HG) in which all "base" repositories sit. These are not working repositories, and would not have a working directory other than "null". When you create a new project, your first step would be to create a new empty repository in this base area:
hg init C:\HG\myNewProject
You now don't need to touch that repository other than to back it up (I use SkyDrive).
Then in the place you do all your work, you create a clone of that repository:
cd C:\WhereIWork\Projects
hg clone C:\HG\myNewProject myNewProject
Creating the clone automatically creates a link between your working repository and the one in C:\HG : any work you do should be regularly committed and pushed.
And there you have it - a backup that you never need to touch unless you delete your working directory by accident and need to re-clone.

Resources