7

I am trying to deploy my Yii application using capistrino 3. Sever is EC2 ubuntu instance which by default comes with a user ubuntu. I have added ubuntu user to group www-data and trying to deploy using capistrino 3 but in old releases these runtime files creates some problem.

groups ubuntu
ubuntu : ubuntu adm dialout cdrom floppy sudo audio dip www-data video plugdev netdev

groups www-data
www-data : www-data

Apache server has created some files/folder as

drwxr-sr-x 2 www-data ubuntu 4096 Oct 12 15:23 CSS
drwxr-sr-x 2 www-data ubuntu 4096 Oct 12 15:17 HTML

When i tried to deploy the new version it says,

DEBUG[c9d0212b]     rm: cannot remove '/var/www/html/zl/releases/20141012145437/frontend/runtime/CSS/4.5.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser': Permission denied

What can be a workaround? I have added user ubuntu to group www-data, but new files have owner www-data and group ubuntu. i have no idea how it reversed.

hemc4
  • 1,623
  • 3
  • 18
  • 32

2 Answers2

9

The solution is to add your deploy user in a www-data group by following the bellow command:

sudo usermod -a -G www-data deployer_user_name

To check the user new group, follow the bellow command:

 groups deployer_user_name

After that capistrano clean up will be smooth ;)

Naim Rajiv
  • 3,324
  • 2
  • 17
  • 23
0

@NaimRajiv, your statement is right but my deployer_user_name is ubuntu and that is already added to group www-data

Problem was my directory generated by apache has permission 755 so if you want to remove is when deploying from user ubuntu it needs the group permission which is 775. I updated my PHP code generating dir and it worked.

hemc4
  • 1,623
  • 3
  • 18
  • 32