Help on error using ec2onrails-experimental and ami-1501e27c

12 views
Skip to first unread message

Daryl

unread,
Nov 12, 2009, 2:49:20 AM11/12/09
to ec2-on-rails-discuss
OK, probably serves me right for using the experimental branch but
we're exploring completely moving over to ec2. Anyhow, following the
instrucitons I have the instance up fine and can connect to it no
problem as well as copy keys down and the like.

However, cap deploy:setup continually throws a permissions error in
trying to create the base directories for the deploy. Changing
deploy.rb to use the admin user doesn't work nor does trying to set
deploy_to . It may be something silly I've done but somehow I think
it's a bit deeper than that. Any help or suggestions appreciated.

So, help appreciated. Kinda stumped. Will most likely be building our
own image at some point but have to say, kinda loving EC2 in general
so far.

Cap log follows :
====
* executing `deploy:setup'
* executing "mkdir -p /mnt/app /mnt/app/releases /mnt/app/shared /
mnt/app/shared/system /mnt/app/shared/log /mnt/app/shared/pids &&
chmod g+w /mnt/app /mnt/app/releases /mnt/app/shared /mnt/app/shared/
system /mnt/app/shared/log /mnt/app/shared/pids"
servers: ["ec2-75-101-182-150.compute-1.amazonaws.com"]
[ec2-75-101-182-150.compute-1.amazonaws.com] executing command
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot
create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot
create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot
create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot
create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot
create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot
create directory `/mnt/app': Permission denied
command finished
failed: "sh -c 'mkdir -p /mnt/app /mnt/app/releases /mnt/app/shared /
mnt/app/shared/system /mnt/app/shared/log /mnt/app/shared/pids &&
chmod g+w /mnt/app /mnt/app/releases /mnt/app/shared /mnt/app/shared/
system /mnt/app/shared/log /mnt/app/shared/pids'" on
ec2-75-101-182-150.compute-1.amazonaws.com
====

I get the failures despite changing the deploy_to which still tries to
write to mnt. Did I miss a critical step here (I know Paul said he
hadn't had time to update the docs, but something still seems amiss).

Also, do we have a list of amis that people have crafted for these
purposes (in particular, being probably as fusy as everyone else I
have a particular config in mind. I can build a custom image, but
figure someone has probably beat me to it... =] ).

thanks !
Daryl.

Paul Dowman

unread,
Nov 12, 2009, 8:42:45 AM11/12/09
to ec2-on-rai...@googlegroups.com
Did you run "cap ec2onrails:setup" first?


--

You received this message because you are subscribed to the Google Groups "ec2-on-rails-discuss" group.
To post to this group, send email to ec2-on-rai...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ec2-on-rails-discuss?hl=.



Daryl Manning

unread,
Nov 12, 2009, 8:58:52 AM11/12/09
to ec2-on-rai...@googlegroups.com
Yes, I believe I did. Rerunning it... looks like the same issue. Should I destroy the instance and start from scratch ?

===
cap ec2onrails:setup
    triggering load callbacks
  * executing `ec2onrails:setup'
  * executing `ec2onrails:server:upload_deploy_keys'
  * executing `deploy:setup'
  * executing "mkdir -p /mnt/app /mnt/app/releases /mnt/app/shared /mnt/app/shared/system /mnt/app/shared/log /mnt/app/shared/pids &&  chmod g+w /mnt/app /mnt/app/releases /mnt/app/shared /mnt/app/shared/system /mnt/app/shared/log /mnt/app/shared/pids"

    servers: ["ec2-75-101-182-150.compute-1.amazonaws.com"]
    [ec2-75-101-182-150.compute-1.amazonaws.com] executing command
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot create directory `/mnt/app': Permission denied
*** [err :: ec2-75-101-182-150.compute-1.amazonaws.com] mkdir: cannot create directory `/mnt/app': Permission denied
    command finished
failed: "sh -c 'mkdir -p /mnt/app /mnt/app/releases /mnt/app/shared /mnt/app/shared/system /mnt/app/shared/log /mnt/app/shared/pids &&  chmod g+w /mnt/app /mnt/app/releases /mnt/app/shared /mnt/app/shared/system /mnt/app/shared/log /mnt/app/shared/pids'" on ec2-75-101-182-150.compute-1.amazonaws.com

Daryl Manning

unread,
Nov 13, 2009, 6:33:20 AM11/13/09
to ec2-on-rai...@googlegroups.com
Alright, I nuked the old instance and tried again with the same image and adding a few packages (like apache etc). Seems to have *almost* run fine... it gets down to here before going thump :

  * executing `ec2onrails:server:deploy_files'
*****  DEPRECATION WARNING: you're using the deploy_files task which has been deprecated
  * executing "rm -f /tmp/config_files.tar"
    servers: ["ec2-75-101-195-114.compute-1.amazonaws.com"]
    [ec2-75-101-195-114.compute-1.amazonaws.com] executing command
    command finished
  * executing `ec2onrails:server:restrict_sudo_access'
  * executing "groups"
    servers: ["ec2-75-101-195-114.compute-1.amazonaws.com"]
    [ec2-75-101-195-114.compute-1.amazonaws.com] executing command
    command finished
  * executing "deluser app rootequiv"
    servers: ["ec2-75-101-195-114.compute-1.amazonaws.com"]
    [ec2-75-101-195-114.compute-1.amazonaws.com] executing command
 ** [out :: ec2-75-101-195-114.compute-1.amazonaws.com] Removing user `app' from group `rootequiv' ...
 ** [out :: ec2-75-101-195-114.compute-1.amazonaws.com] Done.
    command finished
/usr/local/lib/ruby/1.8/fileutils.rb:121:in `chdir': No such file or directory - ../server_configs (Errno::ENOENT)
    from /usr/local/lib/ruby/1.8/fileutils.rb:121:in `cd'
    from /usr/local/lib/ruby/gems/1.8/gems/ec2onrails-experimental-0.9.11/lib/ec2onrails/recipes/server.rb:320

rake deploy:migrations then also fails due to ec2onrails-experimental gem not being present even though I installed it in the last step and it confirmed the install. Something weird going on with permissions, perhaps ? Any help appreciated.

Basically what I am trying to get to is a mirror of the standard setup and deployments I do on slicehost and autoconfiging the box as such (so passenger installed, monit etc)

I also usually deploy to /home/user/www/whatever.thisdomain.com as a matter of course, so perhaps it is appropriate me to fork and alter the gem ?

Anyhow, could use some advice at this point if you're got a moment. *Very* impressed so far. getting excited about the promise of completely having our entire web infrastructure moved over to ec2, load balnced and spining up server as required for load and fault tolerance.

ciao !
Daryl.

Paul Dowman

unread,
Nov 17, 2009, 5:05:40 PM11/17/09
to ec2-on-rai...@googlegroups.com
Hi Daryl,

I have added comments inline below:


On Fri, Nov 13, 2009 at 6:33 AM, Daryl Manning <daryl....@gmail.com> wrote:
Alright, I nuked the old instance and tried again with the same image and adding a few packages (like apache etc). Seems to have *almost* run fine... it gets down to here before going thump :

  * executing `ec2onrails:server:deploy_files'
*****  DEPRECATION WARNING: you're using the deploy_files task which has been deprecated
  * executing "rm -f /tmp/config_files.tar"
    servers: ["ec2-75-101-195-114.compute-1.amazonaws.com"]
    [ec2-75-101-195-114.compute-1.amazonaws.com] executing command
    command finished
  * executing `ec2onrails:server:restrict_sudo_access'
  * executing "groups"
    servers: ["ec2-75-101-195-114.compute-1.amazonaws.com"]
    [ec2-75-101-195-114.compute-1.amazonaws.com] executing command
    command finished
  * executing "deluser app rootequiv"
    servers: ["ec2-75-101-195-114.compute-1.amazonaws.com"]
    [ec2-75-101-195-114.compute-1.amazonaws.com] executing command
 ** [out :: ec2-75-101-195-114.compute-1.amazonaws.com] Removing user `app' from group `rootequiv' ...
 ** [out :: ec2-75-101-195-114.compute-1.amazonaws.com] Done.
    command finished
/usr/local/lib/ruby/1.8/fileutils.rb:121:in `chdir': No such file or directory - ../server_configs (Errno::ENOENT)
    from /usr/local/lib/ruby/1.8/fileutils.rb:121:in `cd'
    from /usr/local/lib/ruby/gems/1.8/gems/ec2onrails-experimental-0.9.11/lib/ec2onrails/recipes/server.rb:320


In your deploy.rb you have :ec2onrails_config[:server_config_files_root] = "../server_configs". but the ../server_configs directory doesn't exist.

However, one of the changes I've made on the experimental branch that I haven't had a chance to document is a better way of deploying files to the server (i.e. files that go anywhere on the server, outside of your app). The way it works is you create a directory in your rails app: "config/ec2onrails/system_files", and files that are in there will be copied to the root directory (or subdirs if you have them in a directory structure) when the app is deployed.

You can optionally create a file named "config/ec2onrails/system_files/_manifest" that lists all the files and if you do that then they will be removed when your app is redeployed (with the old system there was no way of removing files from the server). Using the manifest also (optionally) allows you to specify an owner and permissions for the files.
 
rake deploy:migrations then also fails due to ec2onrails-experimental gem not being present even though I installed it in the last step and it confirmed the install. Something weird going on with permissions, perhaps ? Any help appreciated.

It sounds like your app relies on that gem, but it doesn't exist on the server (and doesn't need to). Remove it from your Rails app's list of gems.
 
Basically what I am trying to get to is a mirror of the standard setup and deployments I do on slicehost and autoconfiging the box as such (so passenger installed, monit etc)

I also usually deploy to /home/user/www/whatever.thisdomain.com as a matter of course, so perhaps it is appropriate me to fork and alter the gem ?

It sounds like you're trying to do something pretty different from what the intention of this project is since you're installing apache and wanting to deploy to a different place, etc., so you probably should fork it and alter it as you like.
 
Anyhow, could use some advice at this point if you're got a moment. *Very* impressed so far. getting excited about the promise of completely having our entire web infrastructure moved over to ec2, load balnced and spining up server as required for load and fault tolerance.

I want to stress again though that you're using unreleased code, so I can't guarantee everything will go smoothly. Good luck.

Paul

Reply all
Reply to author
Forward
0 new messages