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

Composer symfony scripts in production mode #11704

Closed
flip111 opened this Issue Aug 19, 2014 · 11 comments

Comments

Projects
None yet
9 participants
@flip111
Contributor

flip111 commented Aug 19, 2014

When doing composer install with --no-dev only the production packages are installed (as it should be). However when composer launches the symfony scripts they are launched in development modes and thus start throwing errors when AppKernel.php can not find packages needed for development. These scripts should also be executed in production mode!

@KingCrunch

This comment has been minimized.

Show comment
Hide comment
@KingCrunch

KingCrunch Aug 19, 2014

Contributor
SYMFONY_ENV=prod composer install --no-dev

The point is, that composer doesn't know, which environments you've defined, and anyway it doesn't care.

Contributor

KingCrunch commented Aug 19, 2014

SYMFONY_ENV=prod composer install --no-dev

The point is, that composer doesn't know, which environments you've defined, and anyway it doesn't care.

@flip111

This comment has been minimized.

Show comment
Hide comment
@flip111

flip111 Aug 19, 2014

Contributor

Ok it's reasonable that composer doesn't know which environments are defined in symfony. But composer could pass to the scripts --no-dev enabled true/false and then the symfony scripts can figure out the best suitable environment.

Contributor

flip111 commented Aug 19, 2014

Ok it's reasonable that composer doesn't know which environments are defined in symfony. But composer could pass to the scripts --no-dev enabled true/false and then the symfony scripts can figure out the best suitable environment.

@malarzm

This comment has been minimized.

Show comment
Hide comment
@malarzm

malarzm Aug 20, 2014

Contributor

Personally I have export SYMFONY_ENV="lcl" in my .bashrc file and it works like a charm, all console tasks get "lcl" as environment :) I think you should use this instead of some true/false determiner as for instance pre-production env should use --no-dev option but is not "prod"

Contributor

malarzm commented Aug 20, 2014

Personally I have export SYMFONY_ENV="lcl" in my .bashrc file and it works like a charm, all console tasks get "lcl" as environment :) I think you should use this instead of some true/false determiner as for instance pre-production env should use --no-dev option but is not "prod"

@KingCrunch

This comment has been minimized.

Show comment
Hide comment
@KingCrunch

KingCrunch Aug 20, 2014

Contributor

@flip111 At that point the scripts can't know onto which environment it should map --dev/--no-dev to. Keeping in mind how easy it is to set the environment via environment variables I don't think it is reasonable to enforce a specific mapping from dev/no-dev to one of the arbitrary stagings.

Different point of view: Composers only knows dev and no-dev, but a Symfony2 can have an unlimited number of arbitrary environments. You have to define the concrete environment anyway, because else for example cache warmup would create the DIC with wrong services and parameters, or something like that.

Contributor

KingCrunch commented Aug 20, 2014

@flip111 At that point the scripts can't know onto which environment it should map --dev/--no-dev to. Keeping in mind how easy it is to set the environment via environment variables I don't think it is reasonable to enforce a specific mapping from dev/no-dev to one of the arbitrary stagings.

Different point of view: Composers only knows dev and no-dev, but a Symfony2 can have an unlimited number of arbitrary environments. You have to define the concrete environment anyway, because else for example cache warmup would create the DIC with wrong services and parameters, or something like that.

@jakzal

This comment has been minimized.

Show comment
Hide comment
@jakzal

jakzal Aug 22, 2014

Member

Let me point out that often people re-arrange the default environment setup, so there's no prod or dev. I've seen it several times on client projects. It makes "guessing" the environment and the debug flag a bit harder.

I'd rather document SYMFONY_ENV better. It's easy to define this environment variable in your shell, or deployment scripts.

Member

jakzal commented Aug 22, 2014

Let me point out that often people re-arrange the default environment setup, so there's no prod or dev. I've seen it several times on client projects. It makes "guessing" the environment and the debug flag a bit harder.

I'd rather document SYMFONY_ENV better. It's easy to define this environment variable in your shell, or deployment scripts.

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Aug 22, 2014

Member

I opened an issue in the doc repo asking to document them

Member

stof commented Aug 22, 2014

I opened an issue in the doc repo asking to document them

@flip111

This comment has been minimized.

Show comment
Hide comment
@flip111

flip111 Aug 22, 2014

Contributor

I briefly tested this in a windows environment SET SYMFONY_ENV="prod". At first try this wasn't working, i didn't investigate as to why though.

Contributor

flip111 commented Aug 22, 2014

I briefly tested this in a windows environment SET SYMFONY_ENV="prod". At first try this wasn't working, i didn't investigate as to why though.

@fabpot

This comment has been minimized.

Show comment
Hide comment
@fabpot

fabpot Dec 24, 2014

Member

Closing as the SYMFONY_ENVenv var is now documented.

Member

fabpot commented Dec 24, 2014

Closing as the SYMFONY_ENVenv var is now documented.

@fabpot fabpot closed this Dec 24, 2014

@javiereguiluz

This comment has been minimized.

Show comment
Hide comment
@Seb33300

This comment has been minimized.

Show comment
Hide comment
@Seb33300

Seb33300 Aug 8, 2017

Contributor

Any solution to make this working on a Windows server?
I have the same issue as @flip111, SET SYMFONY_ENV=prod seems to not work.

Contributor

Seb33300 commented Aug 8, 2017

Any solution to make this working on a Windows server?
I have the same issue as @flip111, SET SYMFONY_ENV=prod seems to not work.

@ebuildy

This comment has been minimized.

Show comment
Hide comment
@ebuildy

ebuildy Jan 3, 2018

@Seb33300 depending Symfony version, you may need to use APP_ENV variable.

ebuildy commented Jan 3, 2018

@Seb33300 depending Symfony version, you may need to use APP_ENV variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment