The Joyent Community

A place where the Joyent community can gather, help each other out, and stay informed.

You are not logged in.

  • Index
  •  » Subversion
  •  » Using Subversion for web-development - a real life example

#1 2006-05-27 04:30:00

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Using Subversion for web-development - a real life example

Some time ago I posted a cry of help over at the "How Do I...?" forum asking about "Developing a web app and using subversion".

I've finally had some time to take a better look at this SVN business and seem to have found most of the answers I was looking for. Being familiar to the concept but completely new to versioning in practical terms, I've been trying to catch up by doing quiet a lot of reading.

O'Reilly Media's "Version Control with Subversion" is a must and so are TortoiseSVN's help files (most of which are basically shortened versions of this book). There are also various posts spread throughout the forum that are of great help.

Being a one-man team web-developer I'm only using Subversion for versioning, backups and remote storing of project files.

I was quite comfortable with the checkout, make changes, commit changes process but had no idea how I could get the code from the SVN repository to a live version of the site. I've now found a simple svn export will take care of this but it still wasn't making much sense to me. This is because, in my mind, I wanted to code locally, commit changes to SVN repo and then immediately preview and test the application remotely. I was, in fact, wrong.

I've changed my workflow and now everything makes a whole lot more sense. So, now, this is how I do things:


1. Create online SVN repository at TxD
2. Checkout on my dev machine
3. Code locally
4. Test locally
5. if (test==success) ? go to 6 : go to 3
6. Commit to SVN repo
7. SSH to TxD server and svn export to working directory (somewhere in /web/public/...)

There you go. I think I've nailed it. I feel enlightened and wanted to share it with everyone else. I hope it helps.

Offline

 

#2 2006-05-27 04:48:33

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Re: Using Subversion for web-development - a real life example

Please let me have your comments. Let me know what you do differently or what other ways are there to accomplish the same tasks.

Offline

 

#3 2006-05-27 18:19:46

juxta
El Jefe
From: California
Registered: 2005-10-28
Posts: 499
Website  Expertise

Re: Using Subversion for web-development - a real life example

As an alternative to svn export you can always use svn update to put the files in the live version of the site. This has been good for me on large sites as it only copies the updated files to the site. It does however also add the .svn/ directories so you may or may not want to make those web inaccessible.

Offline

 

#4 2006-05-29 17:29:06

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Re: Using Subversion for web-development - a real life example

juxta wrote:

As an alternative to svn export you can always use svn update to put the files in the live version of the site. This has been good for me on large sites as it only copies the updated files to the site. It does however also add the .svn/ directories so you may or may not want to make those web inaccessible.


I've been trying to understand the pros and cons of using the svn update and the svn export commands. Good point on the fact that svn update will profit large sites. Any other pros and cons to these methods?

Offline

 

#5 2006-05-30 01:15:27

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Re: Using Subversion for web-development - a real life example

Found an interesting article about Using SVN for Web Development.

Offline

 

#6 2006-05-30 01:52:37

joshpeek
Member
From: Chicago, IL
Registered: 2005-12-02
Posts: 375
Website  Expertise

Re: Using Subversion for web-development - a real life example

I prefer svn update because I can hook up a bunch of my other projects and third party code through svn externals.

Offline

 

#7 2006-05-31 18:23:11

juxta
El Jefe
From: California
Registered: 2005-10-28
Posts: 499
Website  Expertise

Re: Using Subversion for web-development - a real life example

acastro, I use 'svn update' on my sites on TxD for the reasons I stated on my personal site, but I do use 'svn export' in cases where I want to do something like distribute versioned code. It just makes it cleaner without all of those .svn directories in there and I don't allow anonymous updating from my repositories at the moment.

Offline

 

#8 2006-06-05 21:55:56

joelstein
New member
Registered: 2006-05-30
Posts: 13
Expertise

Re: Using Subversion for web-development - a real life example

I'm trying to get Subversion to work. I successfully created my repository (stlyouth.org) through webmin. And I can checkout the repository just fine. But when I try to do my first commit (to upload my project files), I get this error:

Code:

subversion/libsvn_client/commit.c:873: (apr_err=175002)
svn: Commit failed (details follow):
subversion/libsvn_ra_dav/util.c:296: (apr_err=175002)
svn: MKACTIVITY of '/svn/stlyouth.org/!svn/act/dbd18025-8115-0410-831c-cfbde604ea70': 400 Bad Request (http://stlyouth.textdriven.com)


I'm connecting through the command-line on Mac OS X, using this command:

Code:

svn commit -m 'First try'


Any ideas?

Last edited by joelstein (2006-06-05 21:56:44)

Offline

 

#9 2006-06-06 00:53:45

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Re: Using Subversion for web-development - a real life example

joelstein wrote:

I'm trying to get Subversion to work. I successfully created my repository (stlyouth.org) through webmin. And I can checkout the repository just fine. But when I try to do my first commit (to upload my project files), I get this error:

Code:

subversion/libsvn_client/commit.c:873: (apr_err=175002)
svn: Commit failed (details follow):
subversion/libsvn_ra_dav/util.c:296: (apr_err=175002)
svn: MKACTIVITY of '/svn/stlyouth.org/!svn/act/dbd18025-8115-0410-831c-cfbde604ea70': 400 Bad Request (http://stlyouth.textdriven.com)


I'm connecting through the command-line on Mac OS X, using this command:

Code:

svn commit -m 'First try'


Any ideas?


None here. Might not be a bad idea to submit a ticket.

Offline

 

#10 2007-02-25 13:32:04

JerryWho
New member
Registered: 2007-02-25
Posts: 1
Expertise

Re: Using Subversion for web-development - a real life example

Hi,

I've got one question: How do you solve the problem of ownerships and file-permissions?
Say the user of your development-process is "user". But you need to create a directory or file owned by the
apache user wwwrun.
You check this file/directory in and check it out on the productionserver. But how do you get the right
owner and permissions?

TIA,
Jerry

Offline

 

#11 2007-02-25 14:18:55

mrmachine
Member
From: Sydney, Australia
Registered: 2004-12-09
Posts: 1724
Website  Expertise

Re: Using Subversion for web-development - a real life example

you can also setup a post-commit hook on the server side to update a working copy on the server (in the web root), so that after you checkout to dev, code on dev, test on dev, commit from dev... boom, it's live and ready for you to double-check...

Offline

 

#12 2007-02-26 02:46:42

jordanbrock
Member
From: Perth, Australia
Registered: 2005-01-31
Posts: 344
Website  Expertise

Re: Using Subversion for web-development - a real life example

Once you have your head firmly around subversion, the next step to take is to start using capistrano. This makes deployment a breeze. You just type "cap deploy" and it logs into textdrive, svn exports a whole new instance of the app, updates symlinks and restarts the server. Makes managing apps/websites a pleasure.

Though, you're using TortoiseSVN which means you're on windows ... not sure about capistrano support on windows.

Offline

 

#13 2007-02-26 03:26:30

jonlandrum
Lt. Commander
From: Shi'Kahr
Registered: 2006-01-16
Posts: 3057
Website  Expertise

Re: Using Subversion for web-development - a real life example

Wait, Subversion can be used for that? Why do I even have WinSCP?


\\//_  Live long and prosper.

Offline

 

#14 2007-02-26 06:17:00

enfield
New member
Registered: 2007-01-07
Posts: 14
Expertise

Re: Using Subversion for web-development - a real life example

Though, you're using TortoiseSVN which means you're on windows ... not sure about capistrano support on windows.


Capistrano on Windows deploying to a Unix box works just fine. Last I heard, you couldn't deploy to a Windows server using Capistrano, but the other direction is no problem.

Andrew

Offline

 

#15 2007-02-26 15:19:27

SaintNick
Pilot lost on his own river
From: Minneapolis, MN
Registered: 2005-02-14
Posts: 975
Website  Expertise

Re: Using Subversion for web-development - a real life example

juxta wrote:

As an alternative to svn export you can always use svn update to put the files in the live version of the site. This has been good for me on large sites as it only copies the updated files to the site. It does however also add the .svn/ directories so you may or may not want to make those web inaccessible.


I think by default the .xyz files and folders are automatically inaccessible to the net from Apache. Not sure about lightty, or mongrel...


Pereunt et imputantur - “We act and the acts are accounted to us.”

Offline

 

#16 2007-02-26 15:23:34

jonlandrum
Lt. Commander
From: Shi'Kahr
Registered: 2006-01-16
Posts: 3057
Website  Expertise

Re: Using Subversion for web-development - a real life example

SaintNick wrote:

juxta wrote:

As an alternative to svn export you can always use svn update to put the files in the live version of the site. This has been good for me on large sites as it only copies the updated files to the site. It does however also add the .svn/ directories so you may or may not want to make those web inaccessible.


I think by default the .xyz files and folders are automatically inaccessible to the net from Apache. Not sure about lightty, or mongrel...


Forbidden

You don't have permission to access /.svn on this server.


\\//_  Live long and prosper.

Offline

 
  • Index
  •  » Subversion
  •  » Using Subversion for web-development - a real life example

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson