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 ?
This may work using Bash for Windows, which is available for 64-bit Win 10 systems. All I can say is that I've used it to ssh into a remote system at DreamHost. I'm currently experimenting with deployment mechanisms so I haven't yet tried easy-deploy-bundle yet.
I can confirm the problem. It is due to different names for the function "where" (Windows) or "which" (Linux). Which name is used depends on the PHP constant DIRECTORY_SEPARATOR. Accordingly, the script "thinks" that the remote server is also a Windows system.
See CommandExists.php at the bottom.
I realize I'm coming to this a bit late but I thought it made sense to comment here instead of opening a new issue.
I develop on a Windows system and the system I'm deploying on is running Linux. Whenever I run the deploy command, it's assumed that the remote host is also running Windows and deployment fails because it's using the wrong command.
Has anyone found a decent workaround for this particular problem?
If your Windows Mashine know which (git bash, cmder,..) maybe a quickfix workaround is: $shellCommand = sprintf('%s %s', $this->isWindows() ? 'which' : 'which', $this->commandName);
tested short which / where error is gone. Must install now composer first on Server to see if works now fully... new error output
Error Output:
================
which: no composer in (/usr/local/bin)
Update So now i invested some more time to finish up my tests. Basicly i failed...
- Windows Prob which (use git bash and hardcode which / which works
- ComposerOnRemote (after installed Composer on Remote i has also change the Composer path in this Bundle (for what it uses which...)
- There is a Problem with the date Command which creates the releases Folders.
The command "ssh -A user@host "(export APP_ENV=prod; export _release_path= /path/$(date + Y m d
H M S) && mkdir -p $_release_path && echo $_release_path)"" failed.
Error Output:
================
date: extra operand 'Y'
Try 'date --help' for more information.
I think for Windows its currently to much to fix. If i tested the Command directly on Remote via shell it works. Think there is some escaping Issue wasnt able to fast write any dirty quickfix for that.. in knowing about maybe other errors occur next i gave up for now.
I'm using windows. How to write commands $ ./bin/console deploy ? I'm trying c:\source\sympro\symfony-demo>php bin/console deploy but it returned: Command "deploy" is not defined.
PS: I haven't configuration file deploy_prod.php in app/config/. The deploy_prod.php file must be created manually?
Unfortunately, I ended up giving up on this bundle for the time being. I installed Linux through the Windows Subsystem and a completely new set of problems emerged that are beyond the scope of this discussion. Doing that did fix the issues with where/which since both the local and remote OS are Linux. If you use Windows 10, the Windows Subsystem for Linux might be a good workaround to this particular issue if other methods don't work. It's much faster and less of a headache than setting up a dual boot environment or using a VM since Linux natively runs inside Windows.
@c1ewd It sounds like the bundle hasn't been included in your composer.json file. The deploy command should get added automatically after you install the bundle. Make sure to run this command as stated in the installation documentation:
composer require --dev easycorp/easy-deploy-bundle
That should be all you have to do if you're using Symfony Flex. Also double check to make sure the bundle has been enabled in config/bundles.php. If a deploy_prod.php file isn't created automatically, then you'll probably need to manually create one. I don't remember if I had to do that or not.
You can find more on that in the configuration documentation. That's where you'll define all of your configuration. If you're using Symfony 4.x, that file will go in config/. If you're using an older version of Symfony, it'll go in app/config/.
I'm using Windows Subsystem for Linux to fix the issue and things seem to be working (for now). I've looked into the code. EasyDeploy looks to make use of PHP's DIRECTORY_SEPARATOR constant for both the where/which differences (in ~/src/Requirement/CommandExists.php where it performs the check in isWindows()). It looks to also make extensive use of it in ~/src/Configuration/DefaultConfiguration.
The easiest fix would be to allow the user to set an operating system parameter for each server. However, (unless I'm misinterpreting the code) this will be complicated because it looks like EasyDeploy's Tasks/Commands aren't defined by server. They look to be global (i.e., indifferent to which server is being used).
A really good upgrade would be to define Tasks by server, allow the user to set the operating system per server, make isWindows() check by server, and develop a substitute for PHP's DIRECTORY_SEPARATOR tool. Maybe use something like this
This would really save a lot of us on Windows computers a lot of time...
Notes on trying to deploy using WSL onto a virtual machine on my system:
- needed to install php
- needed to provide a password multiple times
- needed to change
repositoryUrl(...)- incorrect format for git - deploy failed - could not create a directory in
/var/www/ - changed
deploy.phpto target my home directory - deploy failed - Could not read from remote repository: Permission denied
Conclusion: Cannot deploy from Windows to Linux system using this bundle.
Why not just let us define/override the which/where command? I mean it's a matter of few lines of code, how come noone did it since 2017?
Similar problem: easy deploy is using "export" to set variables, but in Windows the command is called "set". Trying to deploy from Windows 10 to Windows Server 2012, couldn't find a way to get it to work. I support the idea of setting of the operating system per server to remove OS-specifig problems.
Same issue for me... I thought that after almost 3 years it would be solved. I am trying to deploy from Windows machine to Debian server, I will just give up on this bundle, since no one has been able to make it work at least for my use case, any update no matter the date, it will be welcome