How to best update a website from subversion

前端 未结 10 1815
无人及你
无人及你 2021-01-01 02:45

I have a PHP website backed by a MySQL database and a small team of programmers submitting code to subversion. Typically we write code, test it locally, commit to subversio

相关标签:
10条回答
  • 2021-01-01 03:24

    What about checking out the code to place where you want to run it from?

    0 讨论(0)
  • 2021-01-01 03:26

    Thanks for all the answers, helped a lot to proof I wasnt doing too wrong. We're developing and testing on a local checkout of a online subversion repository. When we want to deploy a new version we run a script which basicly deletes the current export on a live testserver, creates a new export and then deploys to all webservers via rsync.

    Problem with this: Rsync always copies all files when deploying to the liveserver because of the completely fresh export. I actually never took the time to find out how to update an export.

    On another machine I just have a checkout and deploy with rsync --without .svn

    0 讨论(0)
  • 2021-01-01 03:30

    Code version management and database version management are two very different problems. The solution that I prefer is done in three stages (Test, Deployment Test, Live) rather than two.

    • Update the code and apply database changes via scripts in the development environment
    • Download the live database to a deployment test environment, restore it and apply the change scripts
    • Test the code against the 'synchronised' live database
    • Update the live environment via svn from the relevant branch on the repository (we do it via ssh tunneling since it's a linux environment) and apply the change scripts to the live db

    Edit: The update for the live environment is best done using export rather than checkout/update. This doesn't leave svn's control file hanging around. This may or may not have security implications, it does force you to specify which branch you're checking out each time though.

    Your 'one click' could probably be scripted for the last step.

    0 讨论(0)
  • 2021-01-01 03:33

    The export can be automatically done after every commit with a post-commit hook:

    http://svnbook.red-bean.com/en/1.5/svn.ref.reposhooks.post-commit.html

    You can setup the hook to automatically export the project inside the hidden area for the online testing.

    0 讨论(0)
提交回复
热议问题