开发者

Multiple dev setup with CodeIgniter, GIT and Apache on dev server

I'm trying to use CodeIgniter, GIT and Apache 2 to develop a web app (PHP/MySQL) with a couple of web developers. To set up an environment where each developer has their own lil' virtual sandbox server I imagine a virtual host on Apache (isolated by ports) needs to be created for each dev and each developer has a hook that copies their committed code to their web root (of their virtual host). The only problem is eventually each dev will push their code to the central dev server and each of their code will have a modified config file (CI's index.php file) with different paths for the 'application' and 'system' folders which will cause a major conflict.

For example: dev1 and dev2's web root and index.php file is in 'home/dev1/www/myapp/front-end/开发者_运维知识库' and 'home/dev2/www/myapp/front-end/' respectively and index.php will point to 'home/dev1/www/myapp/back-end/application/' and 'home/dev2/www/myapp/back-end/application/' for the application path respectively but the main dev server's web root and index.php is in '/var/www' and index.php points to '/data/myapp/application' for the application path).

How do I get around this issue? Is there a better solution than the route I'm thinking of?


Use private development branches where you change the config as the first commit in there to suit your specific environment. Now

git checkout shared_branch
git merge -s ours your_branch

Subsequent merges should not use the ours strategy and your config will be what you need for your branch and what it needs to be for the central one.

Hope this helps


Thanks for your replies. I remembered that everything is essentially customizable in Apache, CodeIgniter & GIT and I don't have to use default configs. So to get around the issue I simply moved CI's system folder into the application folder, renamed application folder to 'back-end', created a folder named 'front-end' and moved index.php into there, moved 'back-end' and 'front-end' into '/data/myapp', updated CI's index.php to point to the application and system folders relatively ('../back-end' and '../back-end/system' respectively), updated the post-update hook on the GIT main/central repository to release code to '/data/myapp', updated Apache config on the main dev server to use '/data/myapp/front-end' as document root (instead of the default '/var/www') and created each dev's virtual host in Apache to use 'home/USERNAME/www/myapp/front-end/' as their document root (their working local copy). Developers can test their working code easily and their index.php file won't screw up the main dev server's index.php file since everything is relative and together now.

I know I could of made a hook to ignore index.php (since it's content almost never needs to changed) upon commit or push and that would of been much simpler, but I needed to better organize the directory structure of CI/app and Apache anyway.

Thanks again folks!


Config index.php to use ~/some/path, and make the developers move their repositories to their home folder, this way you have moved the seam to local configuration, rather than configuration in the project.

Or, make index.php run some script which finds out the path by checking some environment variable or database value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜