Git Product home page Git Product logo

easy-deploy-bundle's People

Contributors

cve avatar dafish avatar damienharper avatar fon60 avatar heahdude avatar javiereguiluz avatar patrick-mota avatar xabbuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easy-deploy-bundle's Issues

Parameters for each env

I don't understand how we can have a parameter setup for each environment.
The parameters.yml file on the server is anyway overwritten buy the parameters.dist.
Thanks in advance for your advice.

Console-Binary-Path not honored

If I set ->consoleBinaryPath('bin/adminconsole') for deployment of a Sulu CMS application, it is not honored and the {{ console_bin }} template variable is still evaluated as bin/console. Now, this works for Sulu because of a fallback, but results in annoying messages:
"[WARNING] This command will be executed in the "admin" context. For the "website" context, run ./bin/websiteconsole"

Configure deployDir per server

I was trying to deploy my application to multiple production servers, which each have different deployDirs.
Is that possible?

This is what I found in the documentation:
return $this->getConfigBuilder() ->server('[email protected]') ->server('[email protected]') ->deployDir('/var/www/symfony-demo');
But that would set the deployDir for both servers, right?

github.com:map2u: nodename nor servname provided, or not known

The command "(export SYMFONY_ENV=prod; cd /NetBeansProjects/COBAS_react &&
git ls-remote ssh://[email protected]:map2u/cobas_react.git master)" failed.

Exit Code: 128(Invalid exit argument)

Working directory: /NetBeansProjects/COBAS_react

Output:

Error Output:

ssh: Could not resolve hostname github.com:map2u: nodename nor servname pro
vided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

getConfigBuilder() ->server('jzhao@*****.***.ca:8822') // ->useSshAgentForwarding(false) ->deployDir('/opt/cobas.juturna.ca/cobas_react') ->repositoryUrl('ssh://[email protected]:map2u/cobas_react.git') ->repositoryBranch('master') ; } public function beforeStartingDeploy() { // Deployment hasn't started yet, so here you can execute commands // to prepare the application or the remote servers } public function beforeFinishingDeploy() { // Deployment has finished but the deployer hasn't finished its // execution yet. Here you can run some checks in the deployed app // or send notifications. } public function beforeCancelingDeploy() { // An error happened during the deployment and remote servers are // going to be reverted to their original state. Here you can perform // clean ups or send notifications about the error. } public function beforeStartingRollback() { // Rollback hasn't started yet, so here you can execute commands // to prepare the application or the remote servers. } public function beforeCancelingRollback() { // An error happened during the rollback and remote servers are // going to be reverted to their original state. Here you can perform // clean ups or send notifications about the error. } public function beforeFinishingRollback() { // Rollback has finished but the deployer hasn't finished its // execution yet. Here you can run some checks in the reverted app // or send notifications. } };

Reset opcache via CLI

https://github.com/gordalina/cachetool/ actually lets you reset opcaches from CLI at least if you use FCGI/FPM. It does this by creating a temp file and then instructing the FCGI socket to execute that file, so it all happens without public URL. It would be good to somehow integrate it as an option, maybe if the binary is available globally it could be used, or require it as a dependency?

ssh connection with password

Hello!

My remote server to connect with SSH require a password. But such bundle's configuration does not work:
->server("my_login:my_password@ip:port")

Always i have such error:
...
[my_login@ip] Executing command: "echo 210016579"
| err :: Permission denied, please try again.
| err :: Permission denied, please try again.
| err :: my_login@ip: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

What should i do?

Thanks for help!

Windows compatibility ?

I was trying to use this in PHPStorm on a Windows 10 machine. First I got this:

debug1: read_passphrase: can't open /dev/tty: No such device or address

I managed to get over this by using ssh public key access.
But then I got this:

The command "ssh xxx@xxxx "where /usr/local/bin/composer"" failed.
and
bash: where: command not found

Is it correct to assume that this tool is not meant to run on windows machines ?

Improve your code

Take a look at the deployer.org code and get some ideas.
First, display some sensible message regarding the location of the configuration file.
Second, let me use my own path to php.
Third, run composer using php.

This bundle is in the first place suggested solutions for Symfony, but it should be on the second, maybe the third. A lot to improve.

disable installWebAssets

How do you change any of the config? There are get methods, but no set methods. E.g. I want to disable installWebAssets

Improve detection of config directory

Right now we just check the Symfony version. If it's 2.x or 3.x, use app/config/deploy_prod.php, if it's 4.x, use etc/prod/deploy.php.

However, if you use Symfony Flex, the config dir is probably the same as 4.x, even if you are using 3.3 or 3.4.

The detection should be: use the new config dir if Symfony 4.x or (etc/ exists and app/config/ doesn't exist).

Cannot deploy Sf 3.3 with bundle v1.0.3

Hello, today I've updated to v1.0.3 and my deploy script is not working.

Im running symfony 3.3, here is my config:

public function configure()
    {
        return $this->getConfigBuilder()
            ->server("servername")
            ->deployDir($this->getDeployDir())
            ->repositoryUrl($this->repoUrl)
            ->remoteComposerBinaryPath('composer')
            ->composerInstallFlags('--prefer-dist --no-interaction --quiet')
            ->sharedFilesAndDirs(array('app/config/parameters.yml', 'var/logs', 'var/sessions'))
            ->writableDirs(array('var/cache/', 'var/logs/', 'var/sessions'))
            ;
    }

This is the error when I run "deploy stag":

[InvalidArgumentException]                                                 
                                                                              
   The target directory "/home/user/client_repo/releases/20180404184402/public" does not exist. 

I think it's something related to symfony 4 and the "public" directory.

Thanks!

if git server and web server on the same machine, is that ok?

The command "(export SYMFONY_ENV=prod; cd /NetBeansProjects/COBAS_react &&
git ls-remote ssh://[email protected]:map2u/cobas_react.git master)" failed.

Exit Code: 128(Invalid exit argument)

Working directory: /NetBeansProjects/COBAS_react

Output:

Error Output:

ssh: Could not resolve hostname github.com:map2u: nodename nor servname pro
vided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

getConfigBuilder() ->server('jzhao@*****.***.ca:8822') // ->useSshAgentForwarding(false) ->deployDir('/opt/cobas.juturna.ca/cobas_react') ->repositoryUrl('ssh://[email protected]:map2u/cobas_react.git') ->repositoryBranch('master') ; } public function beforeStartingDeploy() { // Deployment hasn't started yet, so here you can execute commands // to prepare the application or the remote servers } public function beforeFinishingDeploy() { // Deployment has finished but the deployer hasn't finished its // execution yet. Here you can run some checks in the deployed app // or send notifications. } public function beforeCancelingDeploy() { // An error happened during the deployment and remote servers are // going to be reverted to their original state. Here you can perform // clean ups or send notifications about the error. } public function beforeStartingRollback() { // Rollback hasn't started yet, so here you can execute commands // to prepare the application or the remote servers. } public function beforeCancelingRollback() { // An error happened during the rollback and remote servers are // going to be reverted to their original state. Here you can perform // clean ups or send notifications about the error. } public function beforeFinishingRollback() { // Rollback has finished but the deployer hasn't finished its // execution yet. Here you can run some checks in the reverted app // or send notifications. } };

Provide a way to setDefaultConfiguration programmatically

I've noticed in src/Configuration/DefaultConfiguration.php that the code assumes a lot of configuration defaults depending on the Symfony version used. So for 3.4 and up it already assumes the Symfony 4 directory structure. But it's entirely possible to run a project on Symfony 3.4 LTS and even 4.1 and still use the "old" layout.

Please provide an easy way to select either of the three configuration presets to save a couple of lines to set everything back to what's actually used.

The magic here made it a bit difficult to determine why our deployment was failing for a Symfony 3.4 project. You could also check your assumptions against the "extra" section in the composer.json, where some of the directories are configured.

Current code:

            ->configDir('app/config')
            ->logDir('var/logs')
            ->templatesDir('app/Resources/views')
            ->webDir('web')
            ->sharedFilesAndDirs(['app/config/parameters.yml', 'var/logs'])
            ->writableDirs(['var/cache/', 'var/logs/'])
            ->controllersToRemove(['web/app_*.php'])

Should be more like:

            ->directoryStructure(DefaultDeployer::SYMFONY_3)

Miscopy of parameters on deploy

Hi there,

we're facing an strange behavior with the parameters.yml.dist and parameters.yml files when deployed.

Here's the content of the two files after the deploy:
parameters.yml.dist

parameters:
    database_host: 127.0.0.1
    database_port: ~
    database_name: symfony
    database_user: root
    database_password: ~
    mailer_transport: gmail
    mailer_host: null
    mailer_user: [email protected]
    mailer_password: thepassword

    fos_mailer_user: [email protected]

    # A secret key that's used to generate certain security-related tokens
    secret: ThisTokenIsNotSoSecretChangeIt

    # JWTAuthentication
    jwt_private_key_path: '%kernel.root_dir%/../var/jwt/private.pem' # ssh private key path
    jwt_public_key_path:  '%kernel.root_dir%/../var/jwt/public.pem'  # ssh public key path
    jwt_key_pass_phrase:  '31A2xYz77i'                               # ssh key pass phrase
    jwt_token_ttl:        3600

    # Delivery addreses for dev
    dev_delivery_address: ['[email protected]']

resultant parameters.yml

parameters:
    database_host: 127.0.0.1
    database_port: null
    database_name: symfony
    database_user: root
    database_password: null
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    fos_mailer_user: [email protected]
    secret: ThisTokenIsNotSoSecretChangeIt
    jwt_private_key_path: '%kernel.root_dir%/../var/jwt/private.pem'
    jwt_public_key_path: '%kernel.root_dir%/../var/jwt/public.pem'
    jwt_key_pass_phrase: 31A2xYz77i
    jwt_token_ttl: 3600
    dev_delivery_address:
        - [email protected]

As you can see, the parameters related to mailer_ are written with the default values. The parameter fos_mailer_user has been created 'cause it was breaking the deploy, as the fos_user.from_email.address configuration value cannot be null.

HELP NEEDED from Docker experts

The problem

We need to create integration tests for this bundle. Somehow we must test that deploys/rollbacks are working as expected. I'm already testing all this using physical servers, but we need another solution based on fake servers created with Docker.

The solution

I know that the purpose of Docker containers is to run just one command/service, but I want to "abuse" Docker to create a small server with these features: Linux distribution (Alpine?), SSH server, Apache, Composer and PHP 7.1.

The idea is to create two of these fake servers so we can deploy applications on them via SSH and local IP addresses. And all this should run on Travis CI so we can automate everything.

Is there any Docker expert willing to do this for us? Thanks!

->fixPermissionsWith*() requires sudo

I decided to give a try to this bundle, and appreciate the initiative.
But I had some problem using it in my environments.
So I decided to open issues for it, if accepted, I could propose a PR.

Regarding the DefaultDeployer::doSetPermissions the only strategy that do not use sudo for fixing permissions is chmod.

Problem here is that in my case, sudo is not required at all (worst : if used, I have an error).
Could sudo be optional ?

We could be adding a parameter $sudo = true to the fixPermissionsWith*() methods.

Allow to fill parameters.yml on first deploy?

Hello,

When first deploying a Symfony application, the composer install command fails when clearing the cache within the post-deployment scripts as the parameters.yml file is not filled with production parameters:

Output:                                                                                                                                                                
  ================                                                                                                                                                       
  Error Output:                                                                                                                                                          
  ================                                                                                                                                                       
  Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception                             
                                                                                                                                                                         
    [RuntimeException]                                                                                                                                                   
    An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                                            
                                                                                                                                                                         
      [Doctrine\DBAL\Exception\ConnectionException]                                                                                                                      
      An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for us                                                                                        
      er 'root'@'localhost' (using password: NO)                                                                                                                         
                                                                                                                                                                         
                                                                                                                                                                         
      [Doctrine\DBAL\Driver\PDOException]                                                                                                                                
      SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas                                                                                        
      sword: NO)                                                                                                                                                         
                                                                                                                                                                         
                                                                                                                                                                         
      [PDOException]                                                                                                                                                     
      SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas                                                                                        
      sword: NO)

What would be the best solution for this? One option would be removing the cache clear script from the composer.json file as the deployer takes care of that, but that would not fix the problem entirely, as the parameters.yml file would still remain with non-production values, and some other custom post-deployment scripts could fail, like executing doctrine migrations. And, even so, the cache clearing command from the deployer would fail โ€”I have already tried.

I guess the best solution would be that the deployer prompts for parameters' values, the same way composer does when installing or updating the project. Would that be possible? If not, would there be any other workaround other than connecting to the server and filling the parameters manually?

By the way, the deployer works like a charm, at least in a little project where I tested it.

Regards!

Use of a persistant SSH connection

Hey ;)

Would it be possible to use a persistent SSH connection?
On a single deployment the bundel is using 22 ssh sessions.

Greetings,
Florian

[Documentation] Conditionally enable the bundle

Currently, the docs suggest to enable the bundle in the AppKernel as follows:

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new EasyCorp\Bundle\EasyDeployBundle\EasyDeployBundle(),
        );

        // ...
    }

    // ...
}

However, doing so will break your application after deploying as the bundle will not be installed on your production environment (it's been installed as a dev dependency when following the installation instructions).

Error: Invalid argument or option - '/usr/local/bin/composer' on command ./bin/console deploy

Hello there,
I was trying to deploy my Symfony 3.3 app on locally on Windows 10 x64 using EasyCrop and I've got this error:

[Symfony\Component\Process\Exception\ProcessFailedException]
The command "where /usr/local/bin/composer" failed.

Exit Code: 2(Misuse of shell builtins)

Working directory: C:\xampp\htdocs\bigEventsApp

Output:

================

Error Output:

================
ERROR: Invalid argument or option - '/usr/local/bin/composer'.
Type "WHERE /?" for usage help.

After a long time of searching for a solution I've realised that the problem starts with the DefaultConfiguration.php line 35
Where the app is trying to find the composer using the default path which is defined in the variable $remoteComposerBinaryPath.
I've tried to give the path of the composer.phar which I've located in the root directory of my project, but it didn't work still getting the same error with the new path.
I am not sure if being on the right way to solve this problem or not?
Any idea to solve this problem?

Regards,
Mehyar Sawas

.env problem

Hi,

I have
$this->runRemote('export SYMFONY_ENV=prod');

but uppon deploy error

PHP Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "/var/www/vhosts/iwebi.pl/app-s4.iwebi.pl/releases/20190129153613/.env" environment file. in /var/www/vhosts/iwebi.pl/app-s4.iwebi.pl/releases/20190129153613/vendor/symfony/dotenv/Dotenv.php:466

butr

Is deploy to prod by default is good idea ?

I think you must explicitly specify when you want deploy to prod server. You should test in some similar env before press "red button"
You can simply forget to add deploy server parameter in command line and do some ugly things on prod.
Yes, you can name "prod" like "really-prod" but it is causing unnecessary entities.

Make all methods protected, not private

Hi there,

I've been using your deployer for a while now and its fantastic - but it would be great to make all of the methods in the DefaultDeployer protected instead of private - that way we can easily override them if we need to.

For example, I was having trouble with the doResetOpCache function.

Inserting a 1 second sleep between writing the file and wgetting the file has solved this problem, but I cannot override the class method!

Thanks!

Tries to load dev bundle

Hello,

I am trying to deploy my 3.4 app, and during the Preparing app stage, I have this error :

The command "ssh -A petitecolo '(export APP_ENV=prod; cd /home/www/beta/releases/20180628172057 && /home/www/bin/composer install --no-dev --prefer-dist --no-interaction --quiet)'" failed.                     
                                                                                                                                                                                                                   
  Exit Code: 1(General error)                                                                                                                                                                                      
                                                                                                                                                                                                                   
  Working directory: /media/jon/Projets/Projets/LeCoinEcolo.fr/symfony                                                                                                                                             
                                                                                                                                                                                                                   
  Output:                                                                                                                                                                                                          
  ================                                                                                                                                                                                                 
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
  Error Output:                                                                                                                                                                                                    
  ================                                                                                                                                                                                                 
  Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception                                                                       
                                                                                                                                                                                                                   
                                                                                                                                                                                       
    [RuntimeException]                                                                                                                                                                                             
                                                                                                                                                                                                                   
    An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                                                                                      
                                                                                                                                                           
    Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineFixturesBundle" from namespace "Doctrine\Bundle\FixturesBundle".                              
                                                                                                                                                                                                                   
    Did you forget a "use" statement for another namespace? in /home/www/beta/releases/20180628172057/app/AppKernel.php:45                                                                                         
                                                                                                                                                                                                                   
    Stack trace:                                                                                                                                                                                                   
                                                                                                                                                                                                                   
    #0 /home/www/beta/releases/20180628172057/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(492): AppKernel->registerBundles()                                                                
                                                                                                                                                                                                                   
    #1 /home/www/beta/releases/20180628172057/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(132): Symfony\Component\HttpKernel\Kernel->initializeBundles()                                    
                                                                                                                                                                                                                   
    #2 /home/www/beta/releases/20180628172057/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(64): Symfony\Component\HttpKernel\Kernel->boot()                                   
                                                                                                                                                                                                                   
    #3 /home/www/beta/releases/20180628172057/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(148): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Conso  
  le\Input\ArgvInput), Object(Symfo in /home/www/beta/releases/20180628172057/app/AppKernel.php on line 45                                                                                                         
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
                                                                                                                                                                                                                   
  install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoload  
  er] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...                  

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 !

Permission denied

Hi,

when I try to execute php bin/console deploy,

I have this error :

' The command "(export SYMFONY_ENV=prod; cd /home/gbdd/SandBox/deploy-test && git ls-remote [email protected]:GBDD/AAA.git master)" failed.

Exit Code: 128(Invalid exit argument)

Working directory: /home/gbdd/SandBox/deploy-test

Permission denied (publickey).

fatal: Could not read from remote repository.'

But I think I have Permission because when I execute git ls-remote [email protected]:GBDD/AAA.git master on my console it's work.

Thank s for your help

Composer install error when deploying (symfony export environment missing)

Configuration

  • Symfony v3.4.18
  • EasyDeployBundle v1.0.5

Problem

When running the deploy command, while in the "Preparing app" phase, I get the following error:

The command "ssh -A staging '(export APP_ENV=prod; cd /var/www/html/releases/20181129155451 && /usr/local/bin/composer install --no-dev --prefer-dist --no-interaction --quiet)'" failed.  
                                                                                                                                                                                             
  Exit Code: 1(General error)

Which if I run the command on my remote server without the --quiet option gives this error:

An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                                                                                
  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\GeneratorBundle".                     
  Did you forget a "use" statement for another namespace? in /var/www/html/app/AppKernel.php:43

Solution

This error does not happen if you specify the symfony environment before doing the composer install.

export SYMFONY_ENV=prod

I will try to do a pull-request as soon as I can.

Bug while setting symbolic links

ln -nfs /home/radmin/tests/shared/var/log /home/radmin/tests/releases/20180413100346/var/log make link normally, but it return empty string result and EDB think that it is false result. It is on Debian server.
Console text:

Creating symlinks for shared files
[ERROR] Cancelling the deployment and reverting the changes
A log file with all the error details has been generated in /var/www/html/var/log/deploy_prod.log

But link created ok.

bin/console assets:install fails

php /var/www/webroot/swz/deployer/releases/20180723171355/bin/console assets:
  install /var/www/webroot/swz/deployer/releases/20180723171355/web --symlink
   --no-debug --env=prod

This fails with no meaningful error. And I cannot see how to run it on the server via SSH myself and the release dir is removed. And I cannot find a way to flag it not to be removed so I can execute the command myself on the remove server to view the rea error.

I just see "Exit Code: 255(Unknown error)"

More docs on how this actually deploys

It's not too clear to me what this does, nor how it achieves zero-downtime deploys, etc. I want to believe you, but without technical details, and for having seen so many people mess this up, I have to remain skeptical :)

Error during release folder creation

Hello!

Always on deploying i have such error...

[user@host] Executing command: "(export APP_ENV=prod; export _release_path="/home/u28053/data/www/u28053.s1.radisol.org/releases/$(date +%Y%m%d%H%M%S)" && mkdir -p $_release_path && echo $_release_path)"
| err :: date: extra operand 'Y'

But, when i copy this command in my console, there is no any errors. And all work correctly. And nothing i can do with it...

Could someone explain me, what happens, and what i should do?

I work in win7, may be it's importent.

Config dir detection in flex

Due to issue #16 the config directory detection was changed to:

The detection should be: use the new config dir if Symfony 4.x or (etc/ exists and app/config/ doesn't exist).

However the config directory has been named /config again, instead of /etc (see this issue) so this bundle looks in the wrong directory and throws the following error:

None of the usual Symfony config dirs exist in the application. Create one of these dirs before continuing: "%s/etc" or "%s/app/config".

Shared directories are failing

Deployment keeps failing with shared directories. Config below.

Initializing configuration
Processing the configuration options of the deployer class
binDir                     : app
cacheDir                   : app/cache
composerInstallFlags       : --no-dev --prefer-dist --no-interaction --quiet
composerOptimizeFlags      : --optimize
configDir                  : app/config
consoleBinaryPath          :
controllersToRemove        : []
deployDir                  : /home/deploydemo/application
dumpAsseticAssets          : true
installWebAssets           : true
keepReleases               : 2
localProjectDir            : /usr/local/var/www/htdocs/deploydemo
logDir                     : app/logs
permissionGroup            :
permissionMethod           : chmod
permissionMode             : 0777
permissionUser             :
remoteComposerBinaryPath   : /usr/local/bin/composer
remotePhpBinaryPath        : php
repositoryBranch           : master
repositoryUrl              : xxxxxxxx
resetOpCacheFor            :
servers                    : [email protected]
sharedDirs                 : ["app/logs/"]
sharedFiles                : ["app/config/parameters.yml"]
srcDir                     : src
symfonyEnvironment         : staging
templatesDir               : app/Resources/views
updateRemoteComposerBinary : false
useSshAgentForwarding      : false
warmupCache                : true
webDir                     : web
writableDirs               : ["app/cache/","app/logs/"]
Preparing app
Creating cache directory
[[email protected]] Executing command: (export SYMFONY_ENV=staging; cd /home/deploydemo/application/releases/20170615103114 && if [ -d /home/deploydemo/application/releases/20170615103114/app/cache ]; then rm -rf /home/deploydemo/application/releases/20170615103114/app/cache; fi; mkdir -p /home/deploydemo/application/releases/20170615103114/app/cache)
Creating log directory
[[email protected]] Executing command: (export SYMFONY_ENV=staging; cd /home/deploydemo/application/releases/20170615103114 && if [ -d /home/deploydemo/application/releases/20170615103114/app/logs ] ; then rm -rf /home/deploydemo/application/releases/20170615103114/app/logs; fi; mkdir -p /home/deploydemo/application/releases/20170615103114/app/logs)
Creating symlinks for shared directories
[[email protected]] Executing command: (export SYMFONY_ENV=staging; cd /home/deploydemo/application/releases/20170615103114 && mkdir -p /home/deploydemo/application/shared/app/logs/)
[[email protected]] Executing command: (export SYMFONY_ENV=staging; cd /home/deploydemo/application/releases/20170615103114 && if [ -d /home/deploydemo/application/releases/20170615103114/app/logs/ ] ; then rm -rf /home/deploydemo/application/releases/20170615103114/app/logs/; fi)
[[email protected]] Executing command: (export SYMFONY_ENV=staging; cd /home/deploydemo/application/releases/20170615103114 && ln -nfs /home/deploydemo/application/shared/app/logs/ /home/deploydemo/application/releases/20170615103114/app/logs/)
| err :: ln: target `/home/deploydemo/application/releases/20170615103114/app/logs/' is not a directory: No such file or directory
[ERROR] Cancelling the deployment and reverting the changes
A log file with all the error details has been generated in /usr/local/var/www/htdocs/deploydemo/app/logs/deploy_prod.log
Executing beforeCancelingDeploy hook

Default Deployer not working

The autoloader expected class "App\Controller\deploy_prod" to be defined in
file "/var/www/html/sisIgreja/vendor/composer/../../src/Controller/deploy_
prod.php". The file was found but the class was not in it, the class name o
r namespace probably has a typo.

Custom composer command failing when executing 'which' on remote

Hello, I am trying to configure the deploy process, but I can't continue as composer command is failing.

I have a cPanel server, with several php versions. The composer command uses php5.6 as it is the default version, so if I want to execute composer with php7.2 I have to execute composer with the following command:

$ php -ea_php 72 /opt/cpanel/composer/bin/composer

Using this, composer will not show any error regarding php version being lower than 7 as it is being executed with the php7.2 version.

The problem is that if I configure this command with remoteComposerBinaryPath the deploy process fails, as it tries to execut the which command:

return $this->getConfigBuilder()
            ->remoteComposerBinaryPath('php -ea_php 72 /opt/cpanel/composer/bin/composer');
In Process.php line 223:
                                                                                                                     
  The command "ssh ****@*****  'which php -ea_php 72 /opt/cpanel/composer/bin/composer'" failed.  
                                                                                                                     
  Exit Code: 1(General error)                                                                                        
                                                                                                                     
  Working directory: /app                                                                                            
                                                                                                                     
  Output:                                                                                                            
  ================                                                                                                   
  /usr/local/bin/php                                                                                                 
  /usr/bin/php                                                                                                       
  /opt/cpanel/composer/bin/composer                                                                                  
                                                                                                                     
                                                                                                                     
  Error Output:                                                                                                      
  ================                                                                                                   
  which: invalid option -- 'e'                                                                                       
  which: invalid option -- '_'                                                                                       
  which: invalid option -- 'p'                                                                                       
  which: invalid option -- 'h'                                                                                       
  which: invalid option -- 'p'                                                                                       
  which: no 72 in (/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/usr/bin:/opt/cpanel/composer/bin)

Attempted to load class "EasyDeployBundle"

Hi
Since I updated from 1.0.3 to 1.0.5 I have the following error:

PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: 
Attempted to load class "EasyDeployBundle" from namespace "EasyCorp\Bundle\EasyDeployBundle".

I don't understand as my environment is set to 'uat' and that I have the following AppKernel:

<?php

use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

            new cwt\psmdbBundle\psmdbBundle(),
            new cwt\gpscRestBundle\gpscRestBundle(),
            new APY\DataGridBundle\APYDataGridBundle(),
            new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
            new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle()

        ];

        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

            if ('dev' === $this->getEnvironment()) {
                $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
                $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
                $bundles[] = new EasyCorp\Bundle\EasyDeployBundle\EasyDeployBundle();
            }
        }

        return $bundles;
    }

    public function getRootDir()
    {
        return __DIR__;
    }

    public function getCacheDir()
    {

        if (in_array($this->getEnvironment(), ['test','dev'])) {
            return '/var/tmp/sfcache/'.$this->getEnvironment();
        }

        return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
    }

    public function getLogDir()
    {
        return dirname(__DIR__).'/var/logs';
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(function (ContainerBuilder $container) {
            $container->setParameter('container.autowiring.strict_mode', true);
            $container->setParameter('container.dumper.inline_class_loader', true);

            $container->addObjectResource($this);
        });
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Could not open input file: bin/console

I'm running into this error and I can't find a proper solution :

[[email protected]] Executing command: (export SYMFONY_ENV=prod; cd /home/goldsr/public_html/project/releases/20171229190937 && composer install --ignore-platform-reqs --no-dev --prefer-dist --no-interaction --quiet)
| err :: 
| err ::                                                                              
| err ::   [RuntimeException]                                                         
| err ::   An error occurred when executing the "'cache:clear --no-warmup'" command:  
| err ::   Could not open input file: bin/console                                     
| err ::                                                                              
| err :: install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
| err :: 
[ERROR] Cancelling the deployment and reverting the changes
A log file with all the error details has been generated in /var/www/html/project/var/logs/deploy_prod.log
Executing beforeCancelingDeploy hook
Nothing to execute
Deleting the last release directory
[[email protected]] Executing command: (export SYMFONY_ENV=prod; cd /home/goldsr/public_html/project/releases/20171229190937 && export _last_release_dirname=$(ls -r1 /home/goldsr/public_html/project/releases | head -n 1) && rm -fr /home/goldsr/public_html/project/releases/$_last_release_dirname)

                                                                                                                                                      
  [Symfony\Component\Process\Exception\ProcessFailedException]                                                                                                         
  The command "ssh -A [email protected] -p 60504 '(export SYMFONY_ENV=prod; cd /home/goldsr/public_html/project/releases/20171229190937 && composer install --ignor  
  e-platform-reqs --no-dev --prefer-dist --no-interaction --quiet)'" failed.                                                                                           
                                                                                                                                                                       
  Exit Code: 1(General error)                                                                                                                                          
                                                                                                                                                                       
  Working directory: /var/www/html/project                                                                                                                             
                                                                                                                                                                       
  Output:                                                                                                                                                              
  ================                                                                                                                                                      
                                                                                                                                                                       
  Error Output:                                                                                                                                                        
  ================                        
                                                                                                                                                                       
                                                                                                                                                                       
    [RuntimeException]                                                                                                                                                 
    An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                                          
    Could not open input file: bin/console      
                                                                                                                                                                       
                                                                                                                                                                       
  install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--ver  
  bose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...                                                         
                                                                                                                                                                                                    

Can I set, somewhere, the console path ?

Exit Code: 2 (Misuse of shell builtins)

Using PHP 7.1.7

This is my config file

use EasyCorp\Bundle\EasyDeployBundle\Deployer\DefaultDeployer;

return new class extends DefaultDeployer
{
    public function configure()
    {
        return $this->getConfigBuilder()
            ->server('user@host')
            ->deployDir('/var/www/vhosts/domain_deploy/')
            ->repositoryUrl('[email protected]:anacona16/repo.git')
            ->repositoryBranch('master')
            ->useSshAgentForwarding(false)
            ->sharedFilesAndDirs(['var/logs/', 'var/cache/', 'public/uploads/'])
            ->remoteComposerBinaryPath('/usr/bin/composer')
            ->configDir('config/')
            ->templatesDir('templates/')
            ->webDir('public/')
            ->resetOpCacheFor('http://www.domain.com')
        ;
    }
};

I got this error:

Initializing configuration
Starting the deployment
Updating app code
Preparing app
[ERROR] Cancelling the deployment and reverting the changes
A log file with all the error details has been generated in /var/www/vhosts/domain/var/logs/deploy_prod.log

14:53:30 ERROR     [console] Error thrown while running command "deploy -c 'config/deploy_prod.php'".

[Symfony\Component\Process\Exception\ProcessFailedException]                                                                                    
  The command "ssh user@host '(export SYMFONY_ENV=prod; cd /var/www/vhosts/domain_deploy/releases/20170811145246 && /usr/bin/composer  
   install --no-dev --prefer-dist --no-interaction --quiet)'" failed.                                                                             
  Exit Code: 2(Misuse of shell builtins)                                                                                                          
  Working directory: /var/www/vhosts/domain                                                                                                     
  Output:                                                                                                                                         
  ================                                                                                                                                
  Error Output:                                                                                                                                   
  ================   

CustomDeployer. The "symfonyEnvironment" option is not defined.

I'm using v1.0.5 with Symfony 3.4.11 and CustomDeployer
When I run bin/console deploy I've got error:

The "symfonyEnvironment" option is not defined.

It is raised by ConfigurationAdapter

And I can't set it while configure deployer (like in DefaultDeployer), because there is no method in CustomConfiguration

public function configure()
    {
        return $this->getConfigBuilder()
            ->server('self')
	    ->symfonyEnvironment('prod_ru')
        ;
    }

Call to undefined method EasyCorp\Bundle\EasyDeployBundle\Configuration\CustomConfiguration::symfonyEnvironment()

Here is my code:

use EasyCorp\Bundle\EasyDeployBundle\Deployer\CustomDeployer;

return new class extends CustomDeployer
{
    public function configure()
    {
        return $this->getConfigBuilder()
            ->server('self')
        ;
    }
    
    public function deploy()
    {
         // ...
    }

    public function cancelDeploy()
    {
    }

    public function rollback()
    {

    }
};

Is it a bug or I just don't understand how to set symfonyEnvironment in right way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.