-1

Some functionalities require new folders in my application and sometimes I need to grant write permissions to those folders.

At the moment, when I upload the code to production environment, I need to manually grant those permissions in the server. When another person at my development team pulls my code through git, they have to manually grant it locally in their machines.

What is the best practice to grant those permissions automatically in both cases?

I don't know if that interferes in something but the application is written in PHP using Zend Framework2. We use composer for dependency management and Git for versioning.

Edit 1
So I've heard about Git Hooks. I want to create a post-receive hook to be executed everytime my remote repository receives commits and a post-merge hook to be executed at every developer machine after they execute git pull.

I've also heard that hooks are not transfered through commits from developer-to-server and vice-versa.
Is that true? Do I need to create a specific script in my code (which is commited) and then refer it in those hooks?

Edson Horacio Junior
  • 3,033
  • 2
  • 29
  • 50

1 Answers1

0

So after some search and help from a colegue at work, I found out that the best way is to create a script inside my application, so it can be versioned. The good practices says it should stay inside application/bin directory.

That script will check & do everything application-specific that needs to be done through script and not by the application itself, usually it is things that needs to be automated.
In my case, everytime I create a new 'customer' folder, inside it the script will create some folders, copy some config files and give the right permissions.

The only code I wrote in post-receive hook is a variable with the application's fullpath and a git checkout -f to send files from my bare-repository to my non-bare repository.

Edson Horacio Junior
  • 3,033
  • 2
  • 29
  • 50