Web开发; 没有服务器源控制支持

Web开发; 没有服务器源控制支持

问题描述:

I'm developing web app using CodeIgniter PHP framework. The server I'm working with does not support any type of source control (i.e. Subversion) unless you go to a higher price tier.

I would still like to put the code under some sort of source control. Does it make sense to do the following:

  1. Install git or SVN on my local machine and develop there
  2. Copy changes from my local machine to development directory on the server (using FileZilla, WinSCP, etc.) and test
  3. Copy changes from development directory to production directory on the server

Does that sound reasonable? Are there better alternatives? Thanks!

我正在使用CodeIgniter PHP框架开发Web应用程序。 我正在使用的服务器不支持任何类型的源代码控制(即Subversion),除非你去更高的价格层。 p>

我仍然希望将代码放在某种类型下 源控制。 执行以下操作是否有意义: p>

  1. 在我的本地计算机上安装git或SVN并在那里开发 li>
  2. 从本地复制更改 服务器上的机器到开发目录(使用FileZilla,WinSCP等)并测试 li>
  3. 将更改从开发目录复制到服务器上的生产目录 li> ol>

    听起来合理吗? 还有更好的选择吗? 谢谢! p> div>

If you are using svn locally it's a bit dangerous because then you will need to protect also your computer - I think the best way is to work with the commercial sites offer fully supported svn/git - like http://www.beanstalkapp.com/ or http://www.github.com

You could use source control on your local machine (SVN, Git, etc.) and use an open source tool like Capistrano to deploy the code from your local source control repo to your server via SSH. Or if you're limited to FTP, this blog post has a potential solution.

An advantage of using a tool like Capistrano instead of directly mirroring the files on your local machine to the server via FileZilla or WinSCP is that Capistrano will version your deployed files so that, if you end up breaking something and need to roll back quickly to the previously-deployed version, it can be as easy as changing a symlink to the previous deployment directory.

Does that sound reasonable?

Partially, in p.1. But even in this case I'll suggest to have your repository also at some Repository-Hosting (BitBucket, GitHub, Assembla)

For pp. 2-3: your deploys must to be automatic and non-interactive, thus - you'll have to select another tools (for using in post-commit hook of SCM-of-choice)

Somehow better alternative to 2-3 may be:

  • Use 2 different branches (DEVEL and PROD) as sources of DEVEL and PROD dir
  • Post-commit hook, which upload only changed in committed revision files to corresponding dir (NCFTP for FTP, SCP with scenario for ssh)
  • Main development happens in DEVEL branch
  • PROD have only mergesets from DEVEL

Workflow is SCM-agnostic and scalable to any reasonable amount of branches and developers