Open wyllyjon opened 6 years ago
I have the same problem. As a temporary workaround I ended up overriding $this->_symfonyEnvironmentEnvVarName (line 385) in DefaultConfiguration.php, but as @wyllyjon mentioned SF3.4 always seems to be handled like a flex app.
Is there any configuration option we are not aware of?
@DavidFeller, had you overridden it directly in the vendor folder or is there a way to override it properly ?
I've overridden it only for testing purposes, but haven't had time to work on a proper solution, yet
Yes, this is a problem if you use the Symfony 3 directory structure with 3.4 as the bundle assumes Symfony 4 directory structure and env variable name, which can't be changed from outside. See #66, too.
The issue is caused by those lines:
// vendor/easycorp/easy-deploy-bundle/src/Configuration/DefaultConfiguration.php:377
} elseif (3 === $symfonyMajorVersion && 4 < $symfonyMinorVersion) {
$this->_symfonyEnvironmentEnvVarName = 'SYMFONY_ENV';
$this->setDirs('bin', 'app/config', 'var/cache', 'var/logs', 'src', 'app/Resources/views', 'web');
$this->controllersToRemove(['web/app_*.php']);
$this->sharedFiles = ['app/config/parameters.yml'];
$this->sharedDirs = ['var/logs'];
$this->writableDirs = ['var/cache/', 'var/logs/'];
} elseif (4 === $symfonyMajorVersion || (3 === $symfonyMajorVersion && 4 >= $symfonyMinorVersion)) {
$this->_symfonyEnvironmentEnvVarName = 'APP_ENV';
$this->setDirs('bin', 'config', 'var/cache', 'var/log', 'src', 'templates', 'public');
$this->controllersToRemove([]);
$this->sharedDirs = ['var/log'];
$this->writableDirs = ['var/cache/', 'var/log/'];
}
It assumes that Symfony 3.4 is using Symfony's 4 directory structure which is wrong!
This is what fixed it for me:
} elseif (3 === $symfonyMajorVersion) {
$this->_symfonyEnvironmentEnvVarName = 'SYMFONY_ENV';
$this->setDirs('bin', 'app/config', 'var/cache', 'var/logs', 'src', 'app/Resources/views', 'web');
$this->controllersToRemove(['web/app_*.php']);
$this->sharedFiles = ['app/config/parameters.yml'];
$this->sharedDirs = ['var/logs'];
$this->writableDirs = ['var/cache/', 'var/logs/'];
} elseif (4 === $symfonyMajorVersion) {
$this->_symfonyEnvironmentEnvVarName = 'APP_ENV';
$this->setDirs('bin', 'config', 'var/cache', 'var/log', 'src', 'templates', 'public');
$this->controllersToRemove([]);
$this->sharedDirs = ['var/log'];
$this->writableDirs = ['var/cache/', 'var/log/'];
}
@numediaweb Take a look at my PR. It enables you to set the directory layout from the outside without patching the DefaultConfiguration class. Because you could the 4 directory layout already with 3.4 and your change wouldn't work then.
Hello YetiCGN !
How do you set the directory layout from outside ? I have looked at your commit, but I don't understand how it can be made ?
tks !
Hi @wyllyjon,
the code to do this with the forked repo is
return $this->getConfigBuilder()
->setDefaultConfiguration(\EasyCorp\Bundle\EasyDeployBundle\Configuration\DefaultConfiguration::SYMFONY_3)
(or any other of the constants) and then continuing to use the builder in your deploy.php
.
Ok !
Thanks for the info !
@javiereguiluz Can the PR from @YetiCGN be merged please?
Seems this project is unmaintained / abandoned. No commit or merge for almost 6 months. If you add this block to your composer.json
and switch the required version to dev-master
it will pull my forked version:
[...]
"repositories": [
{
"type": "vcs",
"url": "https://github.com/YetiCGN/easy-deploy-bundle"
}
],
"require-dev": {
"easycorp/easy-deploy-bundle": "dev-master",
[...]
Use at your own risk. Should this project be picked up again I can't guarantee to pull all changes to my fork.
@YetiCGN it may look abandoned ... but it's not. I use this bundle every day to deploy multiple personal projects. It's working fine to me :)
Hey, Javier! Thanks for stopping by. I am using it (almost) every day as well to deploy a project, but I have to use my fork since it's a Symfony 3.4 project. By abandoned I meant that development has stopped almost half a year ago with no comments on 9 open pull requests from contributors. It's great to see you're still commenting here, but frankly I've decided to switch to Deployer for new projects although easy-deploy-bundle looked promising.
Still having this issue when using Symfony v3.4.29 @javiereguiluz can you please merge the PR?
@numediaweb Switch to https://github.com/deployphp/deployer/, it's much more flexible and readily maintained. I did and never regretted it.
@numediaweb: I agree with @YetiCGN. I did the same.
Hello,
I am trying to deploy my 3.4 app, and during the
Preparing app
stage, I have this error :It uses APP_ENV, but I think it is a SF4 env variable (SYMFONY_ENV for SF 3.4), maybe that is why it tries to load a dev bundle (DoctrineFixturesBundle).
I tried to add in
beforeStartingDeploy()
a$this->runRemote('export SYMFONY_ENV=prod');
but I do have the error anyway.Any clue ?
Thanks all !