Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Instructions for setting SYMFONY_ENV on Heroku#4591

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 3 commits intosymfony:2.3fromdzuelke:heroku_symfony_env
Dec 6, 2014

Conversation

dzuelke
Copy link
Contributor

Much smoother sailing with that step included :)

On a related note, I was going to add general advice on usingSYMFONY_ENV, as it is currently very under-documented (just one aside mention athttp://symfony.com/doc/current/cookbook/deployment/tools.html#c-update-your-vendors), but I wasn't sure where to do this. Maybe incookbook/configuration/environments.rst and a few other places?

@dzuelke
Copy link
ContributorAuthor

@stof /@fabpot, any thoughts?

@stof
Copy link
Member

stof commentedDec 5, 2014

looks good to me

@dzuelke
Copy link
ContributorAuthor

Wanna merge it? And where do you think general docs on that env var should go?

On 05.12.2014, at 11:34, Christophe Coevoetnotifications@github.com wrote:

looks good to me


Reply to this email directly or view it on GitHub.

@stof
Copy link
Member

stof commentedDec 5, 2014

Wanna merge it?

I'm not a member of the doc core team. I don't have merge rights on this repo

@javiereguiluz
Copy link
Member

@dzuelke thanks for this nice improvement and for documenting theSYMFONY_ENV usage.

You are right about the necessity of documenting more these variables (there is an opened issue related to this:#4162). However, as this is a quick fix for Heroku, my proposal for doc managers (@weaverryan,@wouterj and@xabbuh) would be to merge this PR right away and keep#4162 open to discuss more about where and how to document these variables.

@dzuelke
Copy link
ContributorAuthor

👍@javiereguiluz

correct settings. After you've done that, you can simply ``git push`` and
you're done!
correct document root. After that, you will ensure that your Symfony application
runs the ``prod`` environment, and then you'll be ready to ``git push`` to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Our standard is to not use Oxford commas.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

But this is a subordinate clause, not a list of items, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm actually not completely sure. Maybe our native speaker@weaverryan can make it clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@dzuelke what do you mean by:

you will ensure that your Symfony application runs theprod environment

I mean, does the user need to do something here? Or do we just mean, double-check that things are ok when you go toapp.php locally, just to be sure first? I'm just not sure myself, so I want it to be clear for others :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Bah, nevermind - now I see the next section... - let me read the rest

@xabbuh
Copy link
Member

I only see some minor issues. Besides that 👍.

@dzuelke
Copy link
ContributorAuthor

Is this ready for a merge,@weaverryan ?

@weaverryanweaverryan merged commit576bbfb intosymfony:2.3Dec 6, 2014
weaverryan added a commit that referenced this pull requestDec 6, 2014
This PR was merged into the 2.3 branch.Discussion----------Instructions for setting SYMFONY_ENV on HerokuMuch smoother sailing with that step included :)On a related note, I was going to add general advice on using `SYMFONY_ENV`, as it is currently very under-documented (just one aside mention athttp://symfony.com/doc/current/cookbook/deployment/tools.html#c-update-your-vendors), but I wasn't sure where to do this. Maybe in `cookbook/configuration/environments.rst` and a few other places?Commits-------576bbfb remove first person as per feedback579fdd6 capitalize section title as per feedback5f987ff instructions for setting SYMFONY_ENV on Heroku for smooth deploys
@weaverryan
Copy link
Member

Hey David!

Merged! Thanks for this - I really want the Heroku instructions to be rock solid :). I created a follow-up PR with some minor formatting things - see#4601.

We still have#4217 open, which has some Heroku-deploy issues and discussion. In particular, I'm personally still unclear how parameters.yml should be handled. As you see on that issue, you can use theenv-map of theIncenteev/ParameterHandler, should that be the best way? And if so, wouldn't that mean I'm committing sensitive parameters to my composer.json? So then, should we be usingconfig vars. If so, this still needs to be the article, with details on how that will play with Incenteev - I remember my friend Jon having issues with that.

Thanks!

@stof
Copy link
Member

@weaverryan the env-map feature of Incenteev/ParameterHandler has been implemented precisely to be able to provide the parameters through heroku config vars to build the parameters.yml (which is still ignored in the git repo) (disclaimer: I'm deploying my Symfony app on Heroku since 2 years at work).

@dzuelke
Copy link
ContributorAuthor

@weaverryan Inenv-map, you do e.g.

"database.url": "DATABASE_URL"

to read env varDATABASE_URL into the container parameterdatabase.url.

@dzuelke
Copy link
ContributorAuthor

Mind you that there is a caveat though with both this approach and aparameters.php that you import where you do$container->setParameter('database.url', getenv('DATABASE_URL'));: at build time, those containers get dumped/cached, and the cache contains the literal value of the environment variable.

However, it is possible for env vars to change, either because the user changes them (throughheroku config:set), or because the system does it automatically (e.g. when moving databases to a different for durability reasons).

In that case, an empty Git push would have to be made to restore the app to working order. I started looking into generating agetenv('DATABASE_URL') into the dumped container for special syntax like%env:DATABASE_URL%, but it's not trivial - in particular, bundles are not aware of this. Meh meh.

@stof
Copy link
Member

@dzuelke I'm planning to try writing a bundle hooking into the container to change some service arguments to be retrieved dynamically from the environment at runtime (with a fallback to the configured parameter), precisely to support the case of Heroku Postgres HA plans. I will give you some feedback in a few days after my experiments.

@dzuelke
Copy link
ContributorAuthor

@stof My super crude approach to hack it in was this (theXmlDumper change is just so it won't crash, and it gets thevar_export()ed value, which is wrong, but you get the idea):https://gist.github.com/dzuelke/8fbe0179a90bdca0007e

@stof
Copy link
Member

your approach will be broken, because lots of strings can be callables.
Note that I started working on my approach to this issue (but for Symfony 2.6.2+ only, which means2.6@dev for now because I needsymfony/symfony#13013 to fix the extension point added in 2.6)

@dzuelke
Copy link
ContributorAuthor

Yeah, could also check for__invoke() or similar, but the question remains what to do for XML and YAML dumpers?

@dzuelke
Copy link
ContributorAuthor

Did you push your work somewhere publicly? :) I'm curious!

@stof
Copy link
Member

@dzuelke not yet. It is still in progress. I will open-source it this evening hopefully, or in the coming days (depending of how much time it takes me to have the initial version working). Watch new repos appearing onhttps://github.com/Incenteev/

@stof
Copy link
Member

@dzuelke here it is:https://github.com/Incenteev/DynamicParametersBundle
It requires to use 2.6.x-dev or 2.7.x-dev though (the fix I did in Symfony is not yet released, it will be in 2.6.2)

weaverryan added a commit that referenced this pull requestMar 15, 2015
This PR was merged into the 2.3 branch.Discussion----------[Heroku] A few more tweaks to outline the steps| Q             | A| ------------- | ---| Doc fix?      | yes| New docs?     | no| Applies to    | 2.3+| Fixed tickets | n/aHey guys!This is just a tweak to#4591 - it's just a minor organizational thing so that (hopefully) it's even more clear what 3 steps you need to take.Thanks!Commits-------8c7e3b2 Changing to #. format4ee7cef A few more tweaks to outline the steps
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@dzuelke@stof@javiereguiluz@xabbuh@weaverryan

[8]ページ先頭

©2009-2025 Movatter.jp