SwitchTower: why symlink releases/under -> current?

Hi,

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

[…]
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?

Hi !

2006/3/1, Gyoung-Yoon N. [email protected]:

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 Peak Obsession for more
details.

Hope that helps !

Hi,

Thanks for replying.

On 3/2/06, Francois B. [email protected] wrote:

See Peak Obsession 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