deployment permissions etc

I haven’t been able to find a definitive guide or discussion about deployment of a yii2 app anywhere, so could anyone either point me to one or can we have the discussion here?

I recently put my working code on git version control, cloned it to a new local copy, and after running composer and changing some permissions it worked. Except the debug bar didn’t show and there were some performance issues. So I fixed that with chmod -R 777 the entire thing… I don’t want to do that when I deploy it!!

So other than runtime/ and assets/ do any other files or folders need the 777 permissions?

I don’t want to git clone the project to the server as a deployment technique, because of problems like setting permissions and leaving the debug mode etc on on the development copy but taking it off on the deployment copy.

I am aware of GitLab and other deployment tools, though, I’ve never used any, or I could just make a local copy in deployment mode and FTP it to the server.

So please could I have some tips? :)

FYI "local" for me is a laptop running ubuntu and xampp. My deployment server is a VPS running ubuntu and a LAMP stack.

What I do, is copy the files to the server, excluding the runtime, web/assets and vendor directories.

I then create the not copied runtime and web/assets directories again on the server.

On the server, I install Composer (and the asset plugin too) globally, run composer install in the newly uploaded site/folder and then set permissions:


                	"runtime": "0777",

                	"web/assets": "0777",

                	"yii": "0755"



That should be it.

In real life, I use Deployer, but the principle is the same.

It is possible, of course, to just copy the ‘vendor’ directory over, but I find that it’s much faster and less error prone to just perform a ‘composer install’.

Thank you Jacmoe, you’ve made it sound easy :)

Good luck!