"Deploying Rails" - permission problems when deploying

577 views
Skip to first unread message

paul h

unread,
Oct 3, 2012, 1:07:22 PM10/3/12
to capis...@googlegroups.com
Hi,

I've been going through 'Deploying Rails' from PragProg, and have hit a problem deploying with Capistrano.

I've set up a VM with Vagrant and provisioned it with Puppet. Puppet creates the directories for Cap as user => vagrant, group => vagrant

When I check the directories permissions I get:

drwxrwxr-x 3 vagrant vagrant 4096 2012-10-03 01:16 /var/massiveapp

When I run cap deploy:setup I get the following errors:

* executing `deploy:setup' * executing "mkdir -p /var/massiveapp /var/massiveapp/releases /var/massiveapp/shared /var/massiveapp/shared/system /var/massiveapp/shared/log /var/massiveapp/shared/pids" servers: ["localhost"] [localhost] executing command [localhost] sh -c 'mkdir -p /var/massiveapp /var/massiveapp/releases /var/massiveapp/shared /var/massiveapp/shared/system /var/massiveapp/shared/log /var/massiveapp/shared/pids' *** [err :: localhost] mkdir: cannot create directory `/var/massiveapp': Permission denied *** [err :: localhost] mkdir: cannot create directory `/var/massiveapp': Permission denied *** [err :: localhost] mkdir: cannot create directory `/var/massiveapp': Permission denied *** [err :: localhost] mkdir: cannot create directory `/var/massiveapp': Permission denied *** [err :: localhost] mkdir: cannot create directory `/var/massiveapp': Permission denied *** [err :: localhost] mkdir: cannot create directory `/var/massiveapp': Permission denied command finished in 43ms failed: "sh -c 'mkdir -p /var/massiveapp /var/massiveapp/releases /var/massiveapp/shared /var/massiveapp/shared/system /var/massiveapp/shared/log /var/massiveapp/shared/pids'" on localhost

Here is my deploy.rb which deploys as user vagrant(?) which should be allowed read/write access but the above errors seem to say otherwise....

#---
# Excerpted from "Deploying Rails",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material, 
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/cbdepra for more book information.
#---
require 'bundler/capistrano'
set :application, "massiveapp"
set :scm, :git
set :repository, "git://github.com/deployingrails/massiveapp.git"
server "localhost", :web, :app, :db, :primary => true
ssh_options[:port] = 2222
ssh_options[:keys] = "~/.vagrant.d/insecure_private_key"
set :user, "vagrant"
set :group, "vagrant"
set :deploy_to, "/var/massiveapp"
set :use_sudo, false
set :deploy_via, :copy
set :copy_strategy, :export
namespace :deploy do
  task :start do ; end
  task :stop do ; end
  desc "Restart the application"
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
  desc "Copy the database.yml file into the latest release"
  task :copy_in_database_yml do
    run "cp #{shared_path}/config/database.yml #{latest_release}/config/"
  end
end
before "deploy:assets:precompile", "deploy:copy_in_database_yml"

Can anyone help? I'm stuck because the directories appear to have the correct permissions for Cap?????

Thanks

Paul




Rafa García

unread,
Oct 8, 2012, 4:50:57 AM10/8/12
to capis...@googlegroups.com
Have you re-checked /var permissions? It seems to fail because it cann't create /var/massiveapp with vagrant user

Off-topic: BTW I have this ebook bought but in my pending reading list :) How is it?

2012/10/3 paul h <pa...@hollyer.me.uk>




--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

Paul Hollyer

unread,
Oct 8, 2012, 1:15:41 PM10/8/12
to capis...@googlegroups.com
Hi Rafa,

Thanks for that. What a basic oversight on my part, won't do that again.


On 8 Oct 2012, at 09:50, Rafa García <cont...@rafagarcia.net> wrote:

Have you re-checked /var permissions? It seems to fail because it cann't create /var/massiveapp with vagrant user

/var is set as root for owner and group, so that's the problem. Forgot to check the permissions. There's no write access for 'other' group, or root group - will fix that tonight.


Off-topic: BTW I have this ebook bought but in my pending reading list :) How is it?

I like it. I've got vagrant working to set up and create VM's, and I've got some of the Puppet DSL under my belt now. 

Just need to get Capistrano deploying and I'll be good to go for the basic server setup I need to deploy my apps to. I've been reluctant to upgrade my Centos 5 server, not wanting to take a current app offline in case I have problems setting it all up again. So rather than do it all manually again, I thought I'd plump for using Puppet to make future upgrades more of an automated process.

Vagrant is good too, it makes it simple to set up and manage VM's just as you would with a remote server, so I can set up a Centos 6 server VM with Vagrant, provision it with Puppet, deploy with Capistrano, then use what I learn to make sure I can setup my production server as needed.

I'd highly recommend the book, it's a good read, with good examples, and so far everything has worked just as the examples say they should. The books forum appears to be a little quiet - maybe it's just temporary though.

Thanks for the help - I need to get started on the second year of my CS Degree with the OU, and I'm hoping there's a Linux module so I can get a decent grounding on Linux - as my original question clearly shows I need…..otherwise it's going to be books I guess.

Thanks again,

Paul

Rafa García

unread,
Oct 8, 2012, 6:21:03 PM10/8/12
to capis...@googlegroups.com

You're welcome and thanks for the comments about the book. :-)

enviado desde mi tabla de planchar

Reply all
Reply to author
Forward
0 new messages