{"action":"closed","issue":{"url":"https://api.github.com/repos/deployphp/deployer/issues/875","repository_url":"https://api.github.com/repos/deployphp/deployer","labels_url":"https://api.github.com/repos/deployphp/deployer/issues/875/labels{/name}","comments_url":"https://api.github.com/repos/deployphp/deployer/issues/875/comments","events_url":"https://api.github.com/repos/deployphp/deployer/issues/875/events","html_url":"https://github.com/deployphp/deployer/issues/875","id":189889411,"number":875,"title":"First deploy deletes storage folder on laravel recipe.","user":{"login":"henriquebremenkanp","id":3855603,"avatar_url":"https://avatars.githubusercontent.com/u/3855603?v=3","gravatar_id":"","url":"https://api.github.com/users/henriquebremenkanp","html_url":"https://github.com/henriquebremenkanp","followers_url":"https://api.github.com/users/henriquebremenkanp/followers","following_url":"https://api.github.com/users/henriquebremenkanp/following{/other_user}","gists_url":"https://api.github.com/users/henriquebremenkanp/gists{/gist_id}","starred_url":"https://api.github.com/users/henriquebremenkanp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henriquebremenkanp/subscriptions","organizations_url":"https://api.github.com/users/henriquebremenkanp/orgs","repos_url":"https://api.github.com/users/henriquebremenkanp/repos","events_url":"https://api.github.com/users/henriquebremenkanp/events{/privacy}","received_events_url":"https://api.github.com/users/henriquebremenkanp/received_events","type":"User","site_admin":false},"labels":[{"id":47395261,"url":"https://api.github.com/repos/deployphp/deployer/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-16T23:58:22Z","updated_at":"2016-11-19T07:57:48Z","closed_at":"2016-11-19T07:57:48Z","body":"| Q                 | A\r\n| ----------------- | ---\r\n| Issue Type        | Bug\r\n| Deployer Version  | 4.0\r\n| Local Machine OS  | macOS Sierra PHP7\r\n| Remote Machine OS | ubuntu 16.04 PHP7\r\n\r\n### Description \r\n#### Expected behavior\r\nAt first deploy, deployer should copy or move the contents of `storage` from the release to `shared/storage`.\r\n#### Actual behavior\r\nDeployer creates an empty `storage` folder and deletes/overwrites (idk) the `storage` folder we cloned.\r\n\r\n#### Why is this a problem\r\n1. Laravel blade stores cached files on `storage/framework/views`. If it does not exist, it raises an error.\r\n2. Laravel default session driver (file) stores files on `storage/framework/sessions`, which also does not exist and raises an error.\r\n3. Laravel default cache driver (file) stores files on `storage/framework/cache`, which also does not exist and raises an error.\r\n4. We're missing the folder we usually want to symlink (`storage/app/public` to `public/storage`) as part of the default deploy.\r\n\r\nThe last folder we delete but it's not big deal is `storage/logs` because it creates itself when the first log entry appears. \r\n\r\n### Steps to reproduce\r\n#### Create a new laravel project\r\ncomposer create-project --prefer-dist laravel/laravel laravel\r\ncd laravel\r\n\r\n#### Init deployer\r\ncomposer require deployer/deployer\r\nvendor/bin/dep init\r\nChose 1 for Laravel recipe\r\n\r\n#### Init git\r\ngit init\r\ngit add .\r\ngit commit -m \"init\"\r\ngit remote add origin git@github.com:you/repo.git\r\ngit push -u origin master\r\n\r\n\r\n### Content of `deploy.php`\r\nIt is the default generated by `dep init`, just change the `set('repository', '')`, and server info to match valid settings.\r\n```php\r\n<?php\r\nnamespace Deployer;\r\nrequire 'recipe/laravel.php';\r\n\r\n// Configuration\r\n\r\nset('repository', 'git@domain.com:username/repository.git');\r\nadd('shared_files', []);\r\nadd('shared_dirs', []);\r\nadd('writable_dirs', []);\r\n\r\n// Servers\r\n\r\nserver('production', 'domain.com')\r\n    ->user('username')\r\n    ->identityFile()\r\n    ->set('deploy_path', '/var/www/domain.com');\r\n\r\n\r\n// Tasks\r\n\r\ndesc('Restart PHP-FPM service');\r\ntask('php-fpm:restart', function () {\r\n    // The user must have rights for restart service\r\n    // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service\r\n    run('sudo systemctl restart php-fpm.service');\r\n});\r\nafter('deploy:symlink', 'php-fpm:restart');\r\n\r\n```\r\n\r\n### Output log\r\n\r\n✔ Executing task deploy:prepare\r\n✔ Executing task deploy:lock\r\n✔ Executing task deploy:release\r\n✔ Executing task deploy:update_code\r\n✔ Executing task deploy:shared\r\n✔ Executing task deploy:vendors\r\n✔ Executing task deploy:writable\r\n✔ Executing task deploy:symlink\r\n✔ Executing task deploy:unlock\r\n✔ Executing task cleanup\r\n➤ Executing task artisan:cache:clear\r\nCache cleared successfully.\r\n✔ Ok\r\n➤ Executing task artisan:config:cache\r\nConfiguration cache cleared!\r\nConfiguration cached successfully!\r\n✔ Ok\r\n✔ Executing task success\r\nSuccessfully deployed!\r\n\r\n"}}
{"actor":{"display_login":"elfet"}}