开发者

can you make my life easier working this way? (large code base and patching issue)

开发者 https://www.devze.com 2023-02-14 08:56 出处:网络
So I am working on a really large code base, more than 3000 files, more than 1 million lines of code and more than 500+ tables.

So I am working on a really large code base, more than 3000 files, more than 1 million lines of code and more than 500+ tables.

Though that is not really the issue. The issue here is, when a new feature is required, I work on it locally on my machine and when the time comes to update/patch our live production:

  1. I ssh to our prod server
  2. I navigate to the directory, and open the file to p开发者_StackOverflow中文版atch
  3. I copy and paste??? OMG

Anyway, here is my take, please suggest if you guys have alternatives or more comfortable of doing this

  1. First, we migrate to GIT. (we're in SVN)

  2. Everytime we make release, we branch out in our git repo, and then clone a new copy in our prod server (right now we do a branch in svn, and do svn export, then copy it to target dir

  3. when patching the server with new feature, I can simply go to the target repo/release, and do a git pull?? or should i go with a git patch?

This is how i envision a more simpler life.

Would you guys come up anything much easier than this?


I think you are on the right track. I did something similar.

I have two branches.

Master -> holds latest in dev
Production -> holds latest in production

When I need to make a change to prod, I branch production branch, make my changes and the merge back in to production branch. This gives me the option to work on multiple features at the same time.

Then I log on to the box and do git pull.

Of course the bigger problem here is that with PHP there is no such thing as package like there is java (WAR packages). :( So I am sure this is a pain.

I wish I could help you more but I can't think of anything else to make your life easier.


install svn on your prod server, checkout a specific branch, lets say production, ( cd /var/www && svn co svn://domain/path/to/branch )

then once you are ready to push your code just login to prod and run a script that will svn up that specific folder and maybe do some owner updates on the files

( cd /var/www && svn up ) ( cd /var/www && chown -R www-data:www-data ) ( cd /var/www && svn info )

if you want to do it remotely w/o login to the server you can do remote commands from ssh (if the script above is on your home and called updateRepo.sh) ssh user@server updateRepo.sh if you have your ssh key pair setup you wont even need to do your password Note: above will output to bash so you might want to redirect all of this 2>&1

is this helpful?


It may be time to consider using a continuous integration tool like Hudson Jenkins.

If not, at the very least consider having different branches or repositories for development and production code as per @Amir Raminfar's suggestion.

0

精彩评论

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