Nov 22
Digg
Stumbleupon
Technorati
Delicious

The power of rsync

I’ve never really faced the problem of differences between development and production versions before. The reason is development version always was stored on my local PC and production one was stored on the server. Or I always tried to kept it in my mind (the differences between versions) and sometimes I felt really crazy about that. I had to go and copy files over and remember which ones I copied an which not. I never had a time to try rsync and now I know for sure it was a mistake. I figured out about the ability of symfony to synchronize versions and it helped me to breath out 🙂

So it can be used in the different ways, e.g. you may synchronize development version and production. But there can be another implementation – you may have the same codebase which you are improving from time to time and you want these changes to be quickly deployed on another hosts where is installed the same codebase. So in other words you may want to have an ability to quickly upgrade your software. And lets focus exactly on this case.

So first of all you’ll have to go to config/properties.ini and modify it by adding a list of hosts where your codebase (which must be upgraded) is installed, e.g.

[name1]
host=hostname1.com
port=22
user=username1
dir=/home/username1

[name2]
host=hostname2.com
port=22
user=username2
dir=/home/username2

That’s it. Now you have to run the following commands from the place where is installed your main codebase (e.g. improved one):

symfony sync name1 go
symfony sync name2 go

and it will ask you about host access password and it will copy your current codebase to name1 and name2 locations.
You have to read symfony manual to figure out the details but I hope this small writing helps you to start using sync.


Author: symfonian

8 Comments

NoNo
November 23, 2007

Rsync is so powerful for deployment tasks !

But what i’m missing is some kind of Rsync but on the structure of a database 🙂 If you’re updating the structure of your database, you must do the same on the n deployment servers… by hand 🙂

admin
November 23, 2007

Yes, that is good point. What I do is create a shell or php update script with db or cron changes or wherever else I have to modify and it’s coping to the other hosts along with codebase and than I go to each account and run this script by hands. If you have permanent updating process you may do it more sophisticated – e.g. setup a cron on each hosts which will be running up update.sh script daily or hourly so you wont need to do that manually.

NoNo
November 23, 2007

I have found this

http://www.softcities.com/telecharger-sync-database/24682.htm

But it would be nice if we could have such a feature in Symfony, or a plugin

admin
November 23, 2007

Yes, it looks like a good option but on the other hand I’ll always preffer manual update of DB structure vs automatic. Because of it contains live data and for each site it’s the most problably different while codebase mostly are identical and does not contain live data. But of course auto-update for DB structure must be available as an option.
I’m not sure however if this has to be symfony plugin. It may work as a pake task like it’s for rsync but you’ll have to keep DB access passwords in analogue of properies.yml file and also you’ll have to open external access for your remoted DBs (for each host). Generally, it does not sound like something fantastic. The other option is to mark changes somehow in schema.yml file so it’s clearer what was changed and why.
Interesting to browse web and find which automated solutions are done for this problem in another frameworks.
Frankly to say I’ve never heard of something like this.

Alexey Kupershtokh
November 23, 2007

Guys, haven’t you ever heard about database migrations? 🙂
http://trac.symfony-project.com/wiki/Migrations

[…] The power of rsync – SymfonyLab […]

[…] The power of rsync […]

Comments RSS TrackBack Identifier URI

Leave a comment