Laravel Sail command does not run in WSL2 - laravel

I set up an app using Laravel Sail, and hosted it in my C:Users/User/my_app folder, however API endpoints were terribly slow (around 7s to respond).
I decided to move my application to the WSL filesystem. I copied my_app folder to \\wsl$\Ubuntu-20.04\home folder. However, when I type ./vendor/bin/sail up command nothing happens. No error message, no "command not found message", nothing.
I tried changing home/my_app permissions as well as vendor/bin/sail permissions but it has not helped me. I have no idea how to solve this problem as I am not receiving any message from the console.

I think I solved the issue with copying the files from Windows to WSL using cp command run from WSL console (cp /mnt/c/users/..... ).
However I stubmled upon this error Laravel & Docker: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied which I solved using the answers from this github thread https://github.com/aschmelyun/docker-compose-laravel/issues/49.
Now my endpoint response times are usually under 100ms.

Related

Trouble getting started with AWS Lambda locally

I'm trying to get a simple dotnet lambda up and running using the Rider AWS toolkit - starting with the SAM HelloWorld sample project, but in creating, I run into this error
java.util.concurrent.CompletionException: java.lang.RuntimeException: Could not execute `sam init`!: [Cloning from https://github.com/aws/aws-sam-cli-app-templates, Error: Unstable state when updating repo. Check that you have permissions to create/delete files in C:\Users\user_name\AppData\Roaming\AWS SAM directory or file an issue at https://github.com/aws/aws-sam-cli/issues]
I checked the permissions on that directory, and I should have full read/write. I'm not seeing anyone else running into this particular problem online. Is this indicative of any other steps I missed along the way?
The root cause is apparently a long filename issue. There is a workaround here: https://github.com/aws/aws-sam-cli/issues/3781#issuecomment-1081263942
What I did was:
Using regedit set HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled" to 1
With admin permissions, run git config --system core.longpaths true

AWS Beanstalk Laravel post deploy hooks no such file or directory

I'm trying to deploy laravel app to aws beanstalk, OS is Amazon Linux 2 AMI.
I've setup following files:
.ebextensions/01-deploy-script-permission.config
It contains below code:
container_commands:
01-storage-link:
command: 'sudo chmod +x .platform/hooks/postdeploy/post-deploy.sh'
And
.platform\hooks\postdeploy/01-post-deploy.sh
It contains below code:
php artisan optimize:clear
Upon deploying it fails with following entry in eb-engine.log file
[ERROR] An error occurred during execution of command [app-deploy] -
[RunAppDeployPostDeployHooks]. Stop running the command. Error:
Command .platform/hooks/postdeploy/post-deploy.sh failed with error
fork/exec .platform/hooks/postdeploy/post-deploy.sh: no such file or
directory
This answer is for users who are using Windows to deploy their files to elastic beanstalk.
I found this information after spending 6 precious hours. Probably not documented anywhere in official documentations
As per this link "https://forums.aws.amazon.com/thread.jspa?threadID=321653"
psss: most important that the file is saved with LF line separator.
CRLF makes "no file or directory found"
So I used Visual Studio Code to convert CRLF to LF for files in .platform/hooks/postdeploy
At the bottom right of the screen in VS Code there is a little button
that says “LF” or “CRLF”: Click that button and change it to your
preference.
I don't know for sure but I think you are running the command before the files are even created hence getting the following error.
A while ago I faced the same kind of problem where I wrote migration commands in .ebextension and it used to give me an error because my env file wasn't even created yet hence no DB connection is made so I was getting the error. Hope this will give you a direction.
By the way, I resolved the problem by creating env then pushing these commands through the pipeline.

docker: Error response from daemon: Mounts denied:

Even though this question might look like a duplicate one, i seem to be having a peculiar problem here.
Scenario 1:The project folder in the /users directory
I get the below error when i tried to start my docker image:
docker: Error response from daemon: Mounts denied:
The path /users/myUserName/myApp/backend/build/pacts is not shared from OS X and is not known to Docker.
The exact same command passed a few days back and has suddenly stopped working
Scenario 2: The project folder is in the /Documents folder
The docker run command which threw the same error as Scenario 1 now somehow seems to work fine.
The docker preferences has /Users in the list of shared directories and still doesnt work.
(Image attached)
Docker preferences
Macos version : Mojave(10.14.6)
Note: Whenever the docker run command throws the error in Scenario 1, simply shifting the project to a new location (like /Downloads) seems to work fine.Even though this fixes the issue temporarily, i am curious to know why this error occurs even though the default preferences are as expected.
The path is case sensitive. The paths /users/myUserName/myApp/backend/build/pacts and /Users/myUserName/myApp/backend/build/pacts are different inside of docker while MacOS treats them as the same.
To fix, you likely need to cd /Users/myUserName/myApp/ before running your command.

Angular Console: Can't create library

I'm trying to create a new library using v 8.1.0 of the Angular Console on Windows. The error I get is "ENOENT: no such file or directory, mkdir "c:\path\to\my\workspace\libs\new_library_name"
"c:\path\to\my\workspace\libs" exists already
new_library_name folder should be created by Angular Console
The command run by the console is ng generate #nrwl/angular:library new_library_name.
I've tried different names/paths, running as administrator, running inside VSCode and in the standalone console. No luck with anything. This used to work.
Also, if I create the folder c:\path\to\my\workspace\libs\new_library_name and then run the console again, I get an error ENOENT: no such file or directory c:\path\to\my\workspace\libs\new_library_name\ReadMe.md. Of course the ReadMe doesn't exist - it needs to be created by the console.
What am I doing wrong or where to look?
Problem solved. I had turned on Controlled Folder Access in Windows 10 and mistakenly included my project folder as a controlled folder, which prevented applications (Angular Console, Yarn, etc) from writing to the folder. Removed it from Controlled Access and all is working again.

openshift DIY, 503 error after deleting and adding again testrubyserver.ruby file

I am trying openshift DIY cartridge. I use a windows system to manage the server from command line. I managed to run a simple html5 website. I have deleted the testrubyserver.ruby file from the webpage folder for test purposed and then added it again to my webfolder. Now i have 503 error. No restart, no stop, no start helps. I am stuck in 503. Does anyone know what to do? How can I make the testrubyserver.ruby run again?
Solved my problem. I checked the log file in the folder: app-root / logs. There I found out that
nohup: failed to run command `/..//testrubyserver.rb': Permission denied
I change in filezilla the permissions for the file from rw to rwx to execute it. Restarted the server and then it worked.
I do not know if this is the right approach. At least it makes my app running again.

Resources