Skip to content
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

Timezone inconsistency might delete whole release folder being deployed #649

Closed
tchapi opened this issue May 12, 2016 · 5 comments
Closed
Labels

Comments

@tchapi
Copy link

tchapi commented May 12, 2016

Q A
Issue Type Bug
Deployer Version 3.2.1
Local Machine OS Mac OS X El Capitan
Remote Machine OS Ubuntu 16.04 PHP 7

Description

When deploying to a remote server, the name of the release folder is determined with the date() function of the local machine.

If another user deploys to the same server with a machine that is not configured to use the same timezone, or any timezone at all, the folder name timestamps will not be consistent to rsort, which will trigger a wrong cleanup task and potentially delete the current release (being deployed).

The problem apparently lies in https://github.com/deployphp/deployer/blob/master/recipe/common.php#L38

Steps to reproduce

Take two machines. One machine on which php.ini is the standard release file, and another where you added this line in php.ini:

date.timezone = UTC

Deploy from the "standard release" machine, then deploy from the other : the current release folder will be deleted each time you try to release (see log below).

Content of deploy.php

<?php
require 'recipe/symfony.php';
server('[redacted', '[redacted', 22)
    ->user('deploy')
    ->identityFile('[redacted]')
    ->stage('production')
    ->env('deploy_path', '/var/www/[redacted]'); // Define the base path to deploy your project to.
set('repository', '[redacted]');

Output log

✔ Ok [808ms]
➤ Executing task deploy:symlink
↳ on [redacted]
> cd /var/www/[redacted] && ln -sfn /var/www/[redacted]/releases/20160512184857 current
> cd /var/www/[redacted] && rm release
• done on [redacted]
✔ Ok [231ms]
➤ Executing task cleanup
↳ on [redacted]
> rm -rf /var/www/[redacted]/releases/20160512184857
@antonmedv
Copy link
Member

Yes, it's a bug. I'm thinking to using UTC for releases.

@antonmedv antonmedv added the bug label May 13, 2016
oanhnn added a commit to oanhnn/deployer that referenced this issue May 18, 2016
@oanhnn oanhnn mentioned this issue May 18, 2016
oanhnn pushed a commit that referenced this issue May 19, 2016
* Fixed bug #649

* Revert BC break
@oanhnn
Copy link
Contributor

oanhnn commented May 19, 2016

@tchapi I fixed this bug with #656 , please confirm

@tchapi
Copy link
Author

tchapi commented May 19, 2016

Ok thanks to you @coox and @oanhnn ! I will confirm asap

@peschee
Copy link
Contributor

peschee commented Jun 14, 2016

@tchapi Any updates?

@tchapi
Copy link
Author

tchapi commented Jun 14, 2016

Sorry for the late response — to me it looks good !

@tchapi tchapi closed this as completed Jun 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants