2

I'm trying to setup my production server for capifony. I've setup my deploy.rb like this:

set :application,   "myappname"
set :domain,        "#{application}.eu"
set :deploy_to,     "/#{application}"   # I don't know if this is correct?

default_run_options[:pty] = true
#set :repository,   "#{domain}:/var/repos/#{application}.git"
set :repository,    "/home/username/myappname"
set :scm,           :git
set :deploy_via,    :rsync_with_remote_cache

set :model_manager, "doctrine"

role :web,        domain                        
role :app,        domain                         
role :db,         domain, :primary => true       

set  :keep_releases,  3

set  :user,       "mylogintossh"
set  :use_sudo,   false

It's trying to create /myappname /myappname/releases /myappname/shared /myappname/shared/app/logs /myappname/shared/web/uploads

But permission is denied. What am I doing wrong here? :) Thx.

mattyh88
  • 1,585
  • 5
  • 26
  • 48

2 Answers2

1

Are you sure that user mylogintossh has permissions to create directories there? Try to login and check permissions of that directory.

As a workaround you can put your user to sudoers and set use_sudo to true or set permissions of /myappname to 777.

Anton Babenko
  • 6,586
  • 2
  • 36
  • 44
  • I logged in with putty with mylogintossh and tried to create a directory and that works. I've also tried creating the /myappname dir and then doing the cap deploy:setup command but that didn't work either. The directory that I set at "deploy_to" that does equal to the root-dir that I see when I would login with filezilla, right? – mattyh88 Feb 05 '12 at 10:33
  • Sounds, right. Create `/myappname` yourself with that user and make sure that it has permissions like 777. Does it help? If not, show more of your error message in the question. – Anton Babenko Feb 05 '12 at 16:30
  • I tried that but that didn't work. I'll post the full error message later this day. – mattyh88 Feb 06 '12 at 08:17
  • I just tried it again and it worked. This time I was logged in as a normal non sudo user on my dev server. :) – mattyh88 Feb 08 '12 at 22:16
0

You can add

set :admin_runner, "my_apps_username"

in config/deploy.rb. Alternatively, you can override the deploy:setup task like this:

namespace :deploy do
  task :setup, :except => { :no_release => true } do
    dirs = [deploy_to, releases_path, shared_path]
    dirs += shared_children.map { |d| File.join(shared_path, d.split('/').last) }
    run "mkdir -p #{dirs.join(' ')}"
    run "chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
  end
end
Jeroen Rosenberg
  • 4,552
  • 3
  • 27
  • 39