-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Issue with Database Connection in Laravel Sail #153
Comments
Additional information: If I run the extension with a devcontainer configuration, it works without any issues. |
@whoisnegrello I think that's normal, because the Could you post the |
Yes, this is my devcontainer
But the problem arises when I don't use the devcontainer. |
@whoisnegrello Yeah, that's normal, because when you use a devcontainer, it uses the Docker socket and is able to communicate with the Laravel Sail network bridge. I'm also moving to devcontainers, because it's more flexible and easier to add custom extensions. So I think you're good. :) |
It is indeed an excellent tool, but it’s causing me some performance issues, not to mention that every time the environment starts, it has to reinstall all extensions and remap the files for suggestions. |
What I don’t understand is why I can connect using the host |
Could you please define the performance issues? I'm new to devcontainers, so I'm maybe not much help. I think you could go for an independed devcontainer (e.g. not extending), or limit the resources with I think you cannot access localhost, since macOS runs this in it's own sandbox. Can you ping and run curl without any issues with the vscode terminal? For context, I'm building an own devcontainer instead of extending on Laravel itself, which is indeed quite heavy and you cannot limit the resources: {
"name": "myproject-devcontainer",
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "vscode",
"userUid": "501", // Change this to your user UID (id -u)
"userGid": "501", // Change this to your user GID (id -g)
"upgradePackages": "true"
}
},
"customizations": {
"vscode": {
"settings": {
"Laravel.phpCommand": "/usr/local/bin/php",
"php.validate.executablePath": "/usr/local/bin/php",
"php.executablePath": "/usr/local/bin/php"
},
"extensions": [
"aaron-bond.better-comments",
"bmewburn.vscode-intelephense-client",
"bradlc.vscode-tailwindcss",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"devsense.composer-php-vscode",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"laravel.vscode-laravel",
"stylelint.vscode-stylelint"
]
}
},
"remoteUser": "vscode",
"containerUser": "vscode",
"runArgs": ["--init", "--tty", "--network=myproject_sail"], // here you can append --cpus=1
"mounts": ["type=bind,source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,readonly"]
} |
Is this still happening with v0.1.16? I made some adjustments to the Sail configuration. |
@joetannenbaum Sail configuration? Do you mean in the GitHub repo of Laravel Sail? |
Yes, I just reviewed it; I see the new options, but it doesn't recognize Sail as the environment.
If I change the autodetect option to Sail, I get this new error:
Here is my composer:
Thanks for your help! |
I discovered that if I run the same command in an external terminal outside of VSC, it shows the containers, but not in the integrated terminal. |
I got the extension working properly!
Thank you very much for your help. |
Extension Version
0.1.14
PHP Binary
Sail
Operating System
macOS
What happened?
Hi,
I believe the extension is having trouble connecting to the database when using Laravel Sail.
Here is my
.env
configuration for the database:Despite this setup, the extension cannot connect to the database. The database is running within a Docker container as part of Sail, and Laravel itself can connect without issues when running commands like php artisan migrate.
Could you please confirm if the extension supports Laravel Sail, or provide guidance on how to configure it properly?
Thank you for your help!
Mimimal Code Sample
The text was updated successfully, but these errors were encountered: