I'm trying to learn Rails, so I'm new, and would like a little help.
I'm trying to run multiple apps at once, and I'm having an odd problem. When I try to generate things with rails, it gives me a permissions error. I've looked around stackoverflow and several other sites and haven't found any good solutions.
Details: This setup successfully runs two rails apps in these locations:
- http://rails.mechapps.co/
- http://slide.mechapps.co/
2 currently shows an error because of a missing controller (4/19/2014 12:30am). However, when I navigate to that app's directory, and run 'rails generate controller slideshow view' I get this error:
$ rails generate controller slideshow create
/usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `initialize': Permission denied @ rb_sysopen - /tmp/spring/bff8002d6fbedba8d81e3befe2342559.pid (Errno::EACCES)
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `open'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `open'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `server_running?'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/run.rb:18:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/rails.rb:23:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /var/www/html/slide.mechapps.co/slide/bin/spring:16:in `require'
from /var/www/html/slide.mechapps.co/slide/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Here's my setup: /etc/http/conf/httpd.conf:
...
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
</IfModule>
...
RackEnv development
<VirtualHost *:80>
ServerName rails.mechapps.co
DocumentRoot /var/www/html/rails.mechapps.co/blog/public
<Directory /var/www/html/rails.mechapps.co>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName slide.mechapps.co
DocumentRoot /var/www/html/slide.mechapps.co/slide/public
<Directory /var/www/html/slide.mechapps.co>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
My Root Directory's permissions:
drwxr-xr-x [user] [group] 4096 Apr 18 23:17 rails.mechapps.co
drwxr-xr-x [user] [group] 4096 Apr 19 04:22 slide.mechapps.co
The App Directory's permissions:
-rw-rw-r-- 1 [user] [group] 1337 Apr 19 04:22 Gemfile
-rw-rw-r-- 1 [user] [group] 2982 Apr 19 04:22 Gemfile.lock
-rw-rw-r-- 1 [user] [group] 478 Apr 19 04:22 README.rdoc
-rw-rw-r-- 1 [user] [group] 249 Apr 19 04:22 Rakefile
drwxrwxr-x 8 [user] [group] 4096 Apr 19 04:22 app
drwxr-xr-x 2 [user] [group] 4096 Apr 19 04:22 bin
drwxrwxr-x 5 [user] [group] 4096 Apr 19 04:26 config
-rw-rw-r-- 1 [user] [group] 154 Apr 19 04:22 config.ru
drwxrwxr-x 2 [user] [group] 4096 Apr 19 04:24 db
drwxrwxr-x 4 [user] [group] 4096 Apr 19 04:22 lib
drwxrwxr-x 2 [user] [group] 4096 Apr 19 04:22 log
drwxrwxr-x 2 [user] [group] 4096 Apr 19 04:22 public
drwxrwxr-x 8 [user] [group] 4096 Apr 19 04:22 test
drwxrwxr-x 3 [user] [group] 4096 Apr 19 04:22 tmp
drwxrwxr-x 3 [user] [group] 4096 Apr 19 04:22 vendor
I am logged in as the owner of both locations.
I suspect the following problems:
- Running multiple rails Apps at once is confusing the rails generator
- I somehow messed up a ruby/rails configuration and the apps are conflicting
- Ruby was installed as root, and my user was added to the rvm group. Perhaps this is a rvm issue?
If you know how to fix this, or have any ideas, please help. I've spent almost 8 hours searching the internet and trying various configurations. Thanks!