Long ago I tried to sort out my system between local, web server and subversion. I got some good explanation on this question.
Unfortunately I hit a road block on the whole pushing from SVN to a web server part and never revisited. All of my projects are solo, so I'm the only one developing them and often I'm the only user. So I've been able to get away with writing directly to the live server most of the time.
For 2009 I want to break that bad habit and actually do things the right way. I have SSH access to my web server (I can login and browse the files) but don't really know what to do in order to get the newest files out of SVN, into the server.
I've googled my fingers to the bone but everything I find requires some set of knowledge that I don't yet have.
I'd really, really appreciate step by step directions of how to automatically push the newest version of my code from an SVN repo to a live web server. FYI I'm currently using Beanstalk for Subversion hosting, but am totally willing to change that if someone has a better suggestion.
Thanks
If you have SSH access you could do:
Export will mean you don't get the .svn baggage that comes with a working copy.
Release Management
you can create an job/batch which exports the svn to a local folder. after the export you can upload it with rsync.
the job can automatically execute by the svn hooks.
you can also use mtod ways but keep in mind: using a checkout on the server is a security risk, if someone can access the .svn folders! they can access the php code and see passwords or bugs.
simply - login to your server machine and checkout the repository contents. This should be done just once.
Everytime you need to update your working copy with the newest one, perform
update
:Unless your hosting company has given you access to either
cron(1)
or a shell, it will be difficult as svn, a centralised VCS, does not have a way to push things to a working directory, you are supposed tosvn update
.Several ways to do what you want, depending on the above mentioned resources available:
crontab(5)
entry that doescd $WEBSITE && svn update
ssh
can be automated by acrontab
entry on your side.cron
on your side) that does the same command.Best way to me will still be moving to a decentralized VCS (like Mercurial or git) but that is a much bigger project.
I had a somewhat similar question some time ago, however I didn't have SSH access into my server so I was quite limited in my options.
Depending on the size of your project you might consider not doing an export. In my case the project was over a gig of data! Not practical because with an export you need to export all the files over and over again. If you only have a hand full of files it might be different. Also, doing an export on your local machine means that the export needs to download the file first and then upload it to your hosting which is like a waste of bandwidth.
Also keep in mind that doing an SVN export doesn't do any database updates. E.g., while you're developing your site your database will probably change may times. With just an SVN export you still need to manually re-import the database on the server.
What I suggest is that you write a script that you place on the server. You can make this script as elaborate as you want of course but the bare bone script would do an 'update' on a checked out version of your site, does an export of your database in a temp folder (your database is of course also placed under version control) and re-imports the database (or merges it, whatever it needs to do). With one single command you can then deploy your site. Over and over and over again.
There are tools that can help you with this sort of automation, like CruiseControl and Capistrano.
have you tried using our FTP deploy on Beanstalk? We also have web-hooks available, which means you can ping a URL on each commit to code your own stuff.
http://help.beanstalkapp.com/articles/17-deployment-and-releases