Forum: Ruby on Rails SwitchTower: why symlink releases/under -> current?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Gyoung-Yoon N. (Guest)
on 2006-03-02 05:10
(Received via mailing list)
Hi,

I have a trouble with deploying my ordinary rails application(myapp).
When I execute 'rake deploy',

[...]
    command finished
  * executing task symlink
  * executing "ls -x1 /var/www/myapp/releases"
    servers: ["app1.olalog.com"]
    [app1.olalog.com] executing command
    command finished
  * executing "ln -nfs /var/www/myapp/releases/under
/var/www/myapp/current"
    servers: ["app1.myapp.com"]
    [app1.olalog.com] executing command
 ** [out :: app1.myapp.com] KeyChain 2.5.5;
http://www.gentoo.org/proj/en/keychain/
 ** [out :: app1.myapp.com] Copyright 2002-2004 Gentoo Foundation;
Distributed under the GPL
 ** [out :: app1.myapp.com] * Found existing ssh-agent (1892)
 ** [out :: app1.myapp.com] * Known ssh key: /home/nohmad/.ssh/id_dsa
    command finished
[...]

I don't understand why ST execute
"ln -nfs /var/www/myapp/releases/under /var/www/myapp/current"
Did I omit some necessary settings?
Francois B. (Guest)
on 2006-03-02 06:08
(Received via mailing list)
Hi !

2006/3/1, Gyoung-Yoon N. <removed_email_address@domain.invalid>:
> I don't understand why ST execute
> "ln -nfs /var/www/myapp/releases/under /var/www/myapp/current"
> Did I omit some necessary settings?

No, SwitchTower releases under current/ because it allows it to update
a copy of the application before atomically changing the symlink.  The
application continues to run in the meantime, without interruptions.

See http://manuals.rubyonrails.com/read/chapter/98#page263 for more
details.

Hope that helps !
Gyoung-Yoon N. (Guest)
on 2006-03-02 06:50
(Received via mailing list)
Hi,

Thanks for replying.

On 3/2/06, Francois B. <removed_email_address@domain.invalid> wrote:
>
> See http://manuals.rubyonrails.com/read/chapter/98#page263 for more details.
>

I know the deployment structure of SwitchTower and the way 'current'
symlinks to under 'releases' directory.
But '/var/www/myapp/releases/under' does not exists.
The SwitchTower manual indicates
current --> [deploy_to]/releases/20050824141402
not [deploy_to]/releases/under.

Here's more verbose log.

$ rake deploy
(in /home/users/nohmad/myapp)
    loading configuration
/usr/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/recipes/standard.rb
    loading configuration ./config/deploy.rb
  * executing task deploy
 ** transaction: start
  * executing task update_code
  * querying latest revision...
  * executing "if [[ ! -d /var/www/myapp/releases/20060302132844 ]];
then\n              svn co  -q -r38
svn+ssh://dev.myapp.com/home/svn/myapp
/var/www/myapp/releases/20060302132844 &&\n              (test -e
/var/www/myapp/revisions.log || touch /var/www/myapp/revisions.log &&
chmod 666 /var/www/myapp/revisions.log) && echo `date +\"%Y-%m-%d
%H:%M:%S\"` $USER 38 20060302132844 >> /var/www/myapp/revisions.log;\n
           fi"
    servers: ["app1.myapp.com"]
    [app1.myapp.com] executing command
    command finished
  * executing "rm -rf /var/www/myapp/releases/20060302132844/log
/var/www/myapp/releases/20060302132844/public/system &&\n    ln -nfs
/var/www/myapp/shared/log /var/www/myapp/releases/20060302132844/log
&&\n    ln -nfs /var/www/myapp/shared/system
/var/www/myapp/releases/20060302132844/public/system"
    servers: ["app1.myapp.com"]
    [app1.myapp.com] executing command
    command finished
  * executing task symlink
  * executing "ls -x1 /var/www/myapp/releases"
    servers: ["app1.myapp.com"]
    [app1.myapp.com] executing command
    command finished
  * executing "ln -nfs /var/www/myapp/releases/under
/var/www/myapp/current"
    servers: ["app1.myapp.com"]
    [app1.myapp.com] executing command
    command finished
 ** transaction: commit
  * executing task restart
  * executing "sudo /var/www/myapp/current/script/process/reaper"
    servers: ["app1.myapp.com"]
    [app1.myapp.com] executing command
 ** [out :: app1.myapp.com] sudo:
/var/www/myapp/current/script/process/reaper: command not found
    command finished
rake aborted!
command "sudo /var/www/myapp/current/script/process/reaper" failed on
app1.myapp.com

(See full trace by running task with --trace)

$ ls -al /var/www/myapp/
total 20
drwxr-xr-x  4 nohmad wheel 4096 Mar  2 13:28 .
drwxrwxr-x  6 root   wheel 4096 Mar  2 12:04 ..
lrwxrwxrwx  1 nohmad wheel   30 Mar  2 13:28 current ->
/var/www/myapp/releases/under
drwxrwxr-x  4 nohmad wheel 4096 Mar  2 13:28 releases
-rw-rw-rw-  1 nohmad wheel   90 Mar  2 13:28 revisions.log
drwxr-xr-x  4 nohmad wheel 4096 Mar  2 12:04 shared
$ ls -al /var/www/myapp/releases/
total 16
drwxrwxr-x   4 nohmad wheel 4096 Mar  2 13:28 .
drwxr-xr-x   4 nohmad wheel 4096 Mar  2 13:28 ..
drwxr-xr-x  13 nohmad wheel 4096 Mar  2 12:04 20060302120451
drwxr-xr-x  13 nohmad wheel 4096 Mar  2 13:28 20060302132844
This topic is locked and can not be replied to.