BGUL 2008/11/16: Subversion na serwerze KWI

Zgodnie z obietnic?, krtka notatka jak za?o?y? Subversion na serwerze KWI z dost?pem przez SSH.

# zalogowanie sie na serwer
$ ssh username@kwi.pb.bialystok.pl

$ mkdir repos
$ cd repos

# stworzenie repozytorium
$ svnadmin create repo1

$ logout
Connection to kwi.pb.bialystok.pl closed.

I teraz mo?emy stworzy? podstawow? struktur? katalogw repozytorium:

$ svn mkdir svn+ssh://username@kwi.pb.bialystok.pl/home/username/repos/project1/trunk -m "Tworze trunk"
$ svn mkdir svn+ssh://username@kwi.pb.bialystok.pl/home/username/repos/project1/tags -m "Tworze tags"
$ svn mkdir svn+ssh://username@kwi.pb.bialystok.pl/home/username/repos/project1/branches -m "Tworze branches"

Stworzmy jakis przykladowy projekt w C:

$ mkdir projekt
$ cd projekt
$ vim main.c 
# i wpisz jakas tresc
$ touch README.txt 
# pusty plik readme

Import projektu do repozytorium:

# b?d?c w katalogu projektu:
$ svn import . svn+ssh://username@kwi.pb.bialystok.pl/home/username/repos/project1/trunk -m "Poczatkowy import projektu"
Dodawanie       main.c
Dodawanie       README.txt
Zatwierdzona wersja 4.

$ cd ..
# usuwamy niepotrzebna poczatkowy katalog z projektem:
$ rm -rf projekt

# i pobieramy projekt z repozytorium
$ svn checkout svn+ssh://username@kwi.pb.bialystok.pl/home/username/repos/project1/trunk projekt
A    projekt/main.c
A    projekt/README.txt
Pobrano wersj? 4.

Voila! Mamy dzia?aj?ce repozytorium. Kilka komend do obs?ugi:

$ svn commit  .  -m "Wysylanie do repozytorium"
# pobieranie z repozytorium: 
$ svn up . 
# log:
$ svn log
# Dodawanie plikw/katalog? do repozytorium
$ svn add nowykatalog
# podobnie jak add mamy "rm"  do usuwania, "mv" do przenoszenia itd.

Posted by Hubert Łępicki Wed, 26 Nov 2008 20:20:00 GMT


Thread.new - dRuby now much more useful with Rails (2.2)

Rails 2.2 recently entered RC1 with loads of exciting features. Among built-in internationalization and bunch of other improvements, long awaited thread safety arrived. This was something that we (RoR users) were jealous when looking at Merb framework for quite a long time now.

Even if you are not using threaded server for your applications, and still use traditional mongrel/thin/whatever cluster, it’s good news for you. It’s even better if you use JRuby… but back to topic now.

Now, it’s easy to run long lasting tasks in your models for excellent description, look at Pratik Naik blog. It’s perfectly safe to write following code in your controllers now:

...

def create
  @post = Post.create(params[:post])
  Thread.new do
    @post.republish_content_on_some_slow_responding_sites
  end
end

...

However, I found thread safety even more useful for my recent project, with dRuby server running in the background. Now I can get rid of global mutex in my background process and enjoy one dRuby server shared among multiple server instances. I am running 5 instances of mongrel, each of them using heavily drb daemon which processes ActiveRecord objects - now I get 5x boost in speed with thread safe Rails :)

Posted by Hubert Łępicki Wed, 05 Nov 2008 22:48:00 GMT