I know this is technically OT here, but since source control tools are pretty much de rigueur these days, I figured it would be okay to ask a few questions about using SVN with Rails. I''m trying to start using Subversion with my Rails project. I want to be able to work both remotely (on the server) and locally (from my home machine) to develop the project. I''d like to make sure I''m on the right track (er, no pun intended) before I really make the switch. So here''s the setup I have now for working directly on my server: $ cd ~ $ rails myproject $ svnadmin create /var/lib/svn $ svn import /home/me/myproject file:///var/lib/svn/repos/myproject Now, from what I''ve read, I should start by checking out a working copy from the SVN repository, as in: $ mkdir ~/dev $ cd ~/dev $ svn checkout file://var/lib/svn/repos/myproject And then I can (should?) *delete* /home/me/myproject, since all future development will be stored by Subversion in the repository. Is that correct? As for developing from home, if I understand correctly, the next step would be to check out the project remotely, like this: $ svn checkout svn.example.com/repos/myproject So, just to make sure I''m getting this right: when I make a change on a file locally, should I run "svn commit file" on my local machine and then "svn update" on my deployment dir on the server? Is this what people generally do? --Jonas Galvez
Hi Jonas, Jonas Galvez wrote:> So here''s the setup I have now for working directly on my server: > $ cd ~ > $ rails myproject > $ svnadmin create /var/lib/svn > $ svn import /home/me/myproject file:///var/lib/svn/repos/myproject > Now, from what I''ve read, I should start by checking out a working copy > from the SVN repository, as in: > $ mkdir ~/dev > $ cd ~/dev > $ svn checkout file://var/lib/svn/repos/myproject > And then I can (should?) *delete* /home/me/myproject, since all future > development will be stored by Subversion in the repository. > Is that correct?Yes.> As for developing from home, if I understand correctly, the next step > would be to check out the project remotely, like this: > $ svn checkout svn.example.com/repos/myproject > So, just to make sure I''m getting this right: when I make a change on a > file locally, should I run "svn commit file" on my local machine and > then "svn update" on my deployment dir on the server?Yes.> Is this what people generally do?In my previous project I worked with 3 machines: my development machine, the svn server and the production server. For deploying the app on the production server I used a slightly modified version of a deployment script written by Tobias Luetke that would: 1. Log into the production server with SSH 2. Do a clean export of the app tree on a timestamped dir on the production server from the svn server 3. Set all production settings and permissions 4. Run tests 5. Replace the existing running production version by symlinking to the newer version 6. Restart lighttpd It worked like a charm. This is a good way to do it because you don''t need to shutdown your app while updating it and you get the chance to rollback if tests fails. If you need help setting this up, drop me a line, I''ll be glad to help you. rgds Dema -- dema.ruby.com.br - Rails from a .NET perspective
As to the general process of setting up the repository, I cannot make an intelligent comment, because I have never set one up, but I use them all the time, and yes you are correct at least on that part. Once you have put your project under version control, you keep a working copy on your local machine. Typing ''svn status'' will show you all files that have been modified since your last update, whether new files have been created etc. If you add a file to your project after putting it under version control, you will also have to put that file under version control with the ''svn add /dev/appliation.rb'' or something of that type. If you want to delete a file from version control, ''svn delete'' is your friend. You best friend however is ''svn --help'' which will tell you all the things you can do with svn. When you get home, you can checkout a project using the svn protocol like this: svn checkout svn://svn.example.com/repos/myproject. You may be able to use the http:// protocol, but i don''t believe you can. Maybe somebody else can answer this question as well as the others that i have left unaswered. Good luck, Ben Robison Jonas Galvez wrote:> I know this is technically OT here, but since source control tools are > pretty much de rigueur these days, I figured it would be okay to ask a > few questions about using SVN with Rails. > > I''m trying to start using Subversion with my Rails project. I want to > be able to work both remotely (on the server) and locally (from my > home machine) to develop the project. I''d like to make sure I''m on the > right track (er, no pun intended) before I really make the switch. > > So here''s the setup I have now for working directly on my server: > > $ cd ~ > $ rails myproject > $ svnadmin create /var/lib/svn > $ svn import /home/me/myproject file:///var/lib/svn/repos/myproject > > Now, from what I''ve read, I should start by checking out a working > copy from the SVN repository, as in: > > $ mkdir ~/dev > $ cd ~/dev > $ svn checkout file://var/lib/svn/repos/myproject > > And then I can (should?) *delete* /home/me/myproject, since all future > development will be stored by Subversion in the repository. > > Is that correct? > > As for developing from home, if I understand correctly, the next step > would be to check out the project remotely, like this: > > $ svn checkout svn.example.com/repos/myproject > > So, just to make sure I''m getting this right: when I make a change on > a file locally, should I run "svn commit file" on my local machine and > then "svn update" on my deployment dir on the server? > > Is this what people generally do? > > --Jonas Galvez > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.12/46 - Release Date: 7/11/2005
> When you get home, you can checkout a project using the svn protocol > like this: svn checkout svn://svn.example.com/repos/myproject. You > may be able to use the http:// protocol, but i don''t believe you can. > Maybe somebody else can answer this question as well as the others > that i have left unaswered. Good luck,The SVN Book is your friend. Google "svn book" to find it. Topics on repository maintenance are gold and will save you many headaches. MAKE SURE YOU ARE USING FSFS AND NOT BERKELEY FOR THE DB WHEN YOU USE SVNADMIN TO CREATE YOUR REPOSITORY. I hate to use caps but I can''t overstress that enough. Berkeley has problems with corrupting repositories if you cancel during a commit or if you have multiple users accessing the repo at the same time. I''ve lost a couple repositories to this before figuring it out. AFAIK FSFS is now the default, but it helps to be sure. Details in the book. As for http access, for that you need to set up subversion with Apache2 and mod_dav_svn (mod_dav is also required). Not the easiest task in the world, but well worth it if you''re at all concerned about security. Make sure when you install SVN that you point it to your apxs binary (usually something like ./configure --with-apxs=/usr/local/apache/bin/apxs) so that it installs the necessary modules. I''ll be happy to field any questions by email. Also the nice folks at subversion.tigris.org have a good list at users-lmwclWVctOZK/UuDQWWi7iCwEArCW2h5@public.gmane.org that is full of helpful svn geeks. Cheers, Ben
Demetrius, I have had a look at Tobias'' deploy script, and I''m having a minor problem with getting ssh to login. It would be great if you could post your modified script and a sample YAML entry. Is that possible? Oh, and fantastic script Tobias. Can''t wait to get it working! On 7/12/05, Demetrius Nunes <demetrius-fDpYTK8McCzCdMRJFJuMdgh0onu2mTI+@public.gmane.org> wrote:> > Hi Jonas, > > Jonas Galvez wrote: > > So here''s the setup I have now for working directly on my server: > > $ cd ~ > > $ rails myproject > > $ svnadmin create /var/lib/svn > > $ svn import /home/me/myproject file:///var/lib/svn/repos/myproject > > Now, from what I''ve read, I should start by checking out a working copy > > from the SVN repository, as in: > > $ mkdir ~/dev > > $ cd ~/dev > > $ svn checkout file://var/lib/svn/repos/myproject > > And then I can (should?) *delete* /home/me/myproject, since all future > > development will be stored by Subversion in the repository. > > Is that correct? > > Yes. > > > As for developing from home, if I understand correctly, the next step > > would be to check out the project remotely, like this: > > $ svn checkout svn.example.com/repos/myproject > > So, just to make sure I''m getting this right: when I make a change on a > > file locally, should I run "svn commit file" on my local machine and > > then "svn update" on my deployment dir on the server? > > Yes. > > > Is this what people generally do? > In my previous project I worked with 3 machines: my development machine, > the svn server and the production server. > > For deploying the app on the production server I used a slightly > modified version of a deployment script written by Tobias Luetke that > would: > > 1. Log into the production server with SSH > 2. Do a clean export of the app tree on a timestamped dir on the > production server from the svn server > 3. Set all production settings and permissions > 4. Run tests > 5. Replace the existing running production version by symlinking to the > newer version > 6. Restart lighttpd > > It worked like a charm. This is a good way to do it because you don''t > need to shutdown your app while updating it and you get the chance to > rollback if tests fails. > > If you need help setting this up, drop me a line, I''ll be glad to help > you. > > rgds > Dema > -- > dema.ruby.com.br - Rails from a .NET perspective > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >-- Jordan Brock Spin Technologies spintech.com.au <spintech.com.au> _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Could you point me in the direction for Tobias'' script? It sounds very useful. Thanks, Tom On 7/13/05, Jordan Brock <jordanbrock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Demetrius, > > I have had a look at Tobias'' deploy script, and I''m having a minor problem > with getting ssh to login. It would be great if you could post your modified > script and a sample YAML entry. Is that possible? > > Oh, and fantastic script Tobias. Can''t wait to get it working! > > > On 7/12/05, Demetrius Nunes <demetrius-fDpYTK8McCzCdMRJFJuMdgh0onu2mTI+@public.gmane.org > wrote: > > Hi Jonas, > > > > Jonas Galvez wrote: > > > So here''s the setup I have now for working directly on my server: > > > $ cd ~ > > > $ rails myproject > > > $ svnadmin create /var/lib/svn > > > $ svn import /home/me/myproject > file:///var/lib/svn/repos/myproject > > > Now, from what I''ve read, I should start by checking out a working copy > > > from the SVN repository, as in: > > > $ mkdir ~/dev > > > $ cd ~/dev > > > $ svn checkout file://var/lib/svn/repos/myproject > > > And then I can (should?) *delete* /home/me/myproject, since all future > > > development will be stored by Subversion in the repository. > > > Is that correct? > > > > Yes. > > > > > As for developing from home, if I understand correctly, the next step > > > would be to check out the project remotely, like this: > > > $ svn checkout svn.example.com/repos/myproject > > > So, just to make sure I''m getting this right: when I make a change on a > > > file locally, should I run "svn commit file" on my local machine and > > > then "svn update" on my deployment dir on the server? > > > > Yes. > > > > > Is this what people generally do? > > In my previous project I worked with 3 machines: my development machine, > > the svn server and the production server. > > > > For deploying the app on the production server I used a slightly > > modified version of a deployment script written by Tobias Luetke that > would: > > > > 1. Log into the production server with SSH > > 2. Do a clean export of the app tree on a timestamped dir on the > > production server from the svn server > > 3. Set all production settings and permissions > > 4. Run tests > > 5. Replace the existing running production version by symlinking to the > > newer version > > 6. Restart lighttpd > > > > It worked like a charm. This is a good way to do it because you don''t > > need to shutdown your app while updating it and you get the chance to > > rollback if tests fails. > > > > If you need help setting this up, drop me a line, I''ll be glad to help > you. > > > > rgds > > Dema > > -- > > dema.ruby.com.br - Rails from a .NET perspective > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > Jordan Brock > Spin Technologies > spintech.com.au > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails > > >
blog.leetsoft.com/articles/2005/02/14/deployment On 7/13/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Could you point me in the direction for Tobias'' script? It sounds very useful. > > Thanks, > Tom > > On 7/13/05, Jordan Brock <jordanbrock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Demetrius, > > > > I have had a look at Tobias'' deploy script, and I''m having a minor problem > > with getting ssh to login. It would be great if you could post your modified > > script and a sample YAML entry. Is that possible? > > > > Oh, and fantastic script Tobias. Can''t wait to get it working! > > > > > > On 7/12/05, Demetrius Nunes <demetrius-fDpYTK8McCzCdMRJFJuMdgh0onu2mTI+@public.gmane.org > wrote: > > > Hi Jonas, > > > > > > Jonas Galvez wrote: > > > > So here''s the setup I have now for working directly on my server: > > > > $ cd ~ > > > > $ rails myproject > > > > $ svnadmin create /var/lib/svn > > > > $ svn import /home/me/myproject > > file:///var/lib/svn/repos/myproject > > > > Now, from what I''ve read, I should start by checking out a working copy > > > > from the SVN repository, as in: > > > > $ mkdir ~/dev > > > > $ cd ~/dev > > > > $ svn checkout file://var/lib/svn/repos/myproject > > > > And then I can (should?) *delete* /home/me/myproject, since all future > > > > development will be stored by Subversion in the repository. > > > > Is that correct? > > > > > > Yes. > > > > > > > As for developing from home, if I understand correctly, the next step > > > > would be to check out the project remotely, like this: > > > > $ svn checkout svn.example.com/repos/myproject > > > > So, just to make sure I''m getting this right: when I make a change on a > > > > file locally, should I run "svn commit file" on my local machine and > > > > then "svn update" on my deployment dir on the server? > > > > > > Yes. > > > > > > > Is this what people generally do? > > > In my previous project I worked with 3 machines: my development machine, > > > the svn server and the production server. > > > > > > For deploying the app on the production server I used a slightly > > > modified version of a deployment script written by Tobias Luetke that > > would: > > > > > > 1. Log into the production server with SSH > > > 2. Do a clean export of the app tree on a timestamped dir on the > > > production server from the svn server > > > 3. Set all production settings and permissions > > > 4. Run tests > > > 5. Replace the existing running production version by symlinking to the > > > newer version > > > 6. Restart lighttpd > > > > > > It worked like a charm. This is a good way to do it because you don''t > > > need to shutdown your app while updating it and you get the chance to > > > rollback if tests fails. > > > > > > If you need help setting this up, drop me a line, I''ll be glad to help > > you. > > > > > > rgds > > > Dema > > > -- > > > dema.ruby.com.br - Rails from a .NET perspective > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > -- > > Jordan Brock > > Spin Technologies > > spintech.com.au > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi snowdevil.ca - Snowboards that don''t suck typo.leetsoft.com - Open source weblog engine blog.leetsoft.com - Technical weblog
Thanks Tobias :) On 7/13/05, Tobias Luetke <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> blog.leetsoft.com/articles/2005/02/14/deployment > > On 7/13/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Could you point me in the direction for Tobias'' script? It sounds very useful. > > > > Thanks, > > Tom > > > > On 7/13/05, Jordan Brock <jordanbrock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Demetrius, > > > > > > I have had a look at Tobias'' deploy script, and I''m having a minor problem > > > with getting ssh to login. It would be great if you could post your modified > > > script and a sample YAML entry. Is that possible? > > > > > > Oh, and fantastic script Tobias. Can''t wait to get it working! > > > > > > > > > On 7/12/05, Demetrius Nunes <demetrius-fDpYTK8McCzCdMRJFJuMdgh0onu2mTI+@public.gmane.org > wrote: > > > > Hi Jonas, > > > > > > > > Jonas Galvez wrote: > > > > > So here''s the setup I have now for working directly on my server: > > > > > $ cd ~ > > > > > $ rails myproject > > > > > $ svnadmin create /var/lib/svn > > > > > $ svn import /home/me/myproject > > > file:///var/lib/svn/repos/myproject > > > > > Now, from what I''ve read, I should start by checking out a working copy > > > > > from the SVN repository, as in: > > > > > $ mkdir ~/dev > > > > > $ cd ~/dev > > > > > $ svn checkout file://var/lib/svn/repos/myproject > > > > > And then I can (should?) *delete* /home/me/myproject, since all future > > > > > development will be stored by Subversion in the repository. > > > > > Is that correct? > > > > > > > > Yes. > > > > > > > > > As for developing from home, if I understand correctly, the next step > > > > > would be to check out the project remotely, like this: > > > > > $ svn checkout svn.example.com/repos/myproject > > > > > So, just to make sure I''m getting this right: when I make a change on a > > > > > file locally, should I run "svn commit file" on my local machine and > > > > > then "svn update" on my deployment dir on the server? > > > > > > > > Yes. > > > > > > > > > Is this what people generally do? > > > > In my previous project I worked with 3 machines: my development machine, > > > > the svn server and the production server. > > > > > > > > For deploying the app on the production server I used a slightly > > > > modified version of a deployment script written by Tobias Luetke that > > > would: > > > > > > > > 1. Log into the production server with SSH > > > > 2. Do a clean export of the app tree on a timestamped dir on the > > > > production server from the svn server > > > > 3. Set all production settings and permissions > > > > 4. Run tests > > > > 5. Replace the existing running production version by symlinking to the > > > > newer version > > > > 6. Restart lighttpd > > > > > > > > It worked like a charm. This is a good way to do it because you don''t > > > > need to shutdown your app while updating it and you get the chance to > > > > rollback if tests fails. > > > > > > > > If you need help setting this up, drop me a line, I''ll be glad to help > > > you. > > > > > > > > rgds > > > > Dema > > > > -- > > > > dema.ruby.com.br - Rails from a .NET perspective > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > -- > > > Jordan Brock > > > Spin Technologies > > > spintech.com.au > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Tobi > snowdevil.ca - Snowboards that don''t suck > typo.leetsoft.com - Open source weblog engine > blog.leetsoft.com - Technical weblog >
On 12-jul-2005, at 23:02, Ben Jackson wrote:> > MAKE SURE YOU ARE USING FSFS AND NOT BERKELEY FOR THE DB WHEN YOU > USE SVNADMIN TO CREATE YOUR REPOSITORY.I know this is offtopic. Make sure it will break when you move files. Even when you do it right it will. And make sure you will NEVER forget to use svn mv instead of mv and make sure you will NEVER EVER EVER touch your files with your mouse again. Who needs drag&drop in the first place when you have svn?? Sorry, I just HAD had to vent. -- Julian "Julik" Tarkhanov