-
Notifications
You must be signed in to change notification settings - Fork 475
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
adds devcontainer to install command #203
Conversation
@videlalvaro, I don't use VS Code and I don't need extra files in my project. Make it an option. I can do PR if you have problems with it. |
Converted to option. Thanks! |
Awesome @taylorotwell thanks! Do you think there's room for documentation perhaps on the Sail site? I could help write those. |
@videlalvaro sure! |
* adds devcontainer to install command * formatting Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
* adds devcontainer to install command (#203) * adds devcontainer to install command * formatting Co-authored-by: Taylor Otwell <taylorotwell@gmail.com> * add env options Co-authored-by: Alvaro Videla <videlalvaro@gmail.com> Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
I'm trying to see what is the best place to update the docs. What would be the best way to have this https://laravel.com/docs/8.x/installation#choosing-your-sail-services support the I tried something like the following URL Any suggestions? Should this be documented in the Sail side of things? |
@videlalvaro probably on the Sail docs specifically.
I think this indeed is because the sail server code still needs to be updated. I have it on my list to look into this at some point and get a fully working VS Code setup. But it might be a while before I get to that. I'm btw in the GitHub Stars channel on the GitHub partners slack if you want to hmu on this :) |
In the meantime, it is possible to misuse the
Also, if someone can point me to the laravel.build source code, I could add the option for the devcontainer. |
@xanderificnl it's closed source |
Is there a reason for it being closed source? i.e. does it do more than just spit out a bash script? |
We just don't want that one publicly for now, sorry. |
@driesvints hey, we would like to perhaps create a laravel/devcontainer tutorial. Do you think the server code could be updated so something like this would work officially? #203 (comment) |
We really like this setup and would love to promote Laravel with VS Code. If we could get this added to the server code, we could get rolling on our side with some content on Laravel and VS Code. |
I'm sorry @videlalvaro @burkeholland, I totally lost track of @videlalvaro's question. We've recently open sourced the app that runs the Sail install process. Take a look at https://github.com/laravel/sail-server, feel free to make a PR and we'll have a look 👍 |
It works: https://laravel.build/test?devcontainer -- enjoy! |
EDIT: nevermind, I see it's here in the code already https://github.com/videlalvaro/sail-server/blob/master/routes/web.php#L25 @driesvints is the solution proposed by @xanderificnl above officially supported? This: If yes, I could send a PR documenting that, and also we could start building some video demos with this. |
Yes we deployed that 👍 You can also use the parameter with a default value if that's more clearer to users: |
Yeah I just saw that in the code https://github.com/videlalvaro/sail-server/blob/master/routes/web.php#L25 Awesome! |
I'm working with the VS Code & GitHub teams and we like to propose the following idea.
When working in projects that have a complex infrastructure - say a MySQL backend, with Redis for caching - it's hard to get the project started due to infrastructure setup. Thanks to Sail, Laravel addresses most of those problems, making it easy to start new projects. We want to improve that experience even further by enabling the current project setup to “just work” in VS Code.
Imagine opening a folder with a Laravel project and the editor takes care of setting up the environment automatically for the user. Not only on the infrastructure level, but also installing the required editor extensions so the developer can start hacking right away.
By adding a
.devcontainer/devcontainer.json
file to a project VS Code will detect that the project can be opened inside a container and do all the heavy lifting for the user.A more detailed description of this feature can be found here: laravel/ideas#2660
Here's the
.devcontainer.json
documentation https://code.visualstudio.com/docs/remote/devcontainerjson-referenceSince Sail already does most of the heavy lifting for a user when it comes to containers, adding a
.devcontainer.json
to a project is the natural next step. This would allow VS Code to fire up the containers after prompting the user for confirmation. Once the user has told VS Code to start the containers, VS Code will use thedocker-compose
generated by Sail to start those containers, and connect remotely to them, so the user has a development environment that's ready to work in the containers.Besides the container side of the PR, it also suggests a list of Laravel extensions for VS Code, in order to provide a sort of standardized dev environment for Laravel developers. Of course the list suggested here can be improved.
Caveat
For this to work auto-magically with VS Code the
.env
file requires the following variables to be set:Also based on the installed services we could specify a list of ports to be forwarded to the user computer.
If the team thinks it's OK to add that to the
.env
file then I could update the PR accordingly.