-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DX] Improving Vagrant support #11395
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
Comments
There are some other problems with a Vagrant setup like performance: http://www.whitewashing.de/2013/08/19/speedup_symfony2_on_vagrant_boxes.html See also: http://www.sitepoint.com/guide-install-orocrm-vagrant-box/ for more frustrations. |
@fabpot the problem mentioned by @javiereguiluz is actually not really dependent to Vagrant. It's a common problem when you are running your system within a VM (and that is really really often the case). |
@fabpot It's really easy with ansible|puppet|chef to automaticly mount a tmpfs partition on the guest and synchronize your source code (on your host) with a rsync watch daemon (like lsyncd). Your VM became quicker than your host. BTW it's not the purpose of this issue. |
Since this is titled 'improving vagrant support', I want to chime in and shared that I've come into issue with sessions in a vagrant setup detailed in my comment here #7885 (comment) which is not an issue with my vagrant setup before, but now it is after I update my virtualbox/vagrant which I thought those who develops with vagrant should be aware of. |
I know that there are a lot of Vagrant fans in the Symfony community. Anyone can please take a look at this issue and see if we can/should do anything to improve Vagrant support? Thanks! |
@javiereguiluz I found this issue while looking for a solution for this kind of problem. This works for me: https://github.com/kimausloos/symfony-standard/commit/1feac8dfa5ffd02adf55c01e4613b51c7ebd5bd0 Any feedback or do I create a pull request? |
👍 for this solution, but most time i use fig / vagrant + port forwarding. so i don't need such a workaround. |
@javiereguiluz What's about providing an |
@jeremy-derusse as an extra file and not a replacement for app_dev.php you mean? Because replacing app_dev.php would mean developers wo are not using environment variables are unable to use the dev environment. Anyway, I will have a look at the feedback @xelaris gave and create a pull request later tonight. |
@kimausloos I don't really know what to say because I personally don't use Vagrant. @jeremy-derusse the Symfony console actually uses that trick to set the environment and the debug options (see https://github.com/symfony/symfony-standard/blob/2.7/app/console#L18-19). I don't know the reasons why the front controllers don't use that trick. |
@jeremy-derusse @javiereguiluz I think the main reason for the separated front controllers is to enable simple switching between the environments in the browser. It also enables to keep the individual front controllers clean and simple while allowing different setups (e.g. AppCache/ApcClassLoader in prod, umask(0000) in dev). Finally all app_* files can be simply removed on prod deploy. |
@javiereguiluz exactly, I use the same environment variable on purpose...
@xelaris the main avantage of an app_env controller, his to get rid of IP checking. |
@jeremy-derusse Choosing the app environment (e.g. via an environment parameter) and limiting access to this environment (e.g. via IP checking) are two separate things IMO. If you configure your server to run your app in dev environment, you might nevertheless like to limit access to this environment. |
👎 for app_env |
@xelaris indeed, I mixed environment and checking.
|
Closing this issue as it's outside of the scope of Symfony core anyway. The snippet discussed is in the SE anyway. |
@fabpot should I close pullrequest symfony/symfony-standard#768 too? |
The one on SE should not be closed as it is something different. |
The problem
When using Vagrant and Symfony, you'll end up with some problems when trying to
access
app_dev.php
controller because of the following check:Your Vagrant host IP will always be different from
127.0.0.1
and therefore,Symfony will prevent you to access
app_dev.php
controller.The solution
The obvious solution is to manually add the host IP (e.g.
192.168.56.1
) to theprevious condition, but this doesn't look like a professional way to fix this problem.
After talking with @frastel he proposed me the following alternative. We could introduce a new server variable (e.g.
SYMFONY__TRUSTED_HOSTS
) and then, modify the dev controller (the resulting code may be a bit ugly):The last step would be to set up this variable with the web server. For instance, if you use nginx:
The text was updated successfully, but these errors were encountered: