# Setting up mongrel

**URL:** <https://www.ruby-forum.com/t/setting-up-mongrel/96206>\
**Category:** Rails\
**Created:** [June 27, 2006, 8:42am UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206 "2006-06-27T08:42:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [June 27, 2006, 8:42am UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206/1 "2006-06-27T08:42:10Z")

</div>

okay, i have officially given up on:

apache with fastcgi  
lighttpd with fastcgi

and now i am working on getting mongrel running…

not that i don’t think that the above two are viable options, i have  
just spent more time trying to get this app live than i did actually  
writing the app… and i need to have something working for beta  
testing…

i installed mongrel according to:

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

and spent a little time reading this:

[http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/](http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)

but found that i needed to take a look capistrano… which doesn’t look  
terrible… but it means probably another few hours of goofing around  
rather than getting something working for beta…

i have the app running on the remote server on webrick, and everything  
seems to be running fine… so i don’t think that’s the problem…

when i try running it on mongrel, uising:

mongrel\_rails start -d

i get the error tacked on to the end of this as a result…

i think i am just going to unroll this via webrick for test, so i can  
have something to start with… but i would sure like to get on the road  
with a production server…

any help would be greatly appreciated:

error is as follows:

* * *

Errno::ENOENT in LoggerController#index

No such file or directory - /tmp/mysql.sock  
RAILS\_ROOT: /home/sergio/railssites/chatlogger/config/…

Application Trace | Framework Trace | Full Trace  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/vendor/mysql.rb:104:in  
`initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/vendor/mysql.rb:104:in `real\_connect’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:331:in  
`connect' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `initialize’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:37:in  
`mysql_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `connection\_without\_query\_cache=’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/query\_cache.rb:54:in  
`connection=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in `retrieve\_connection’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:78:in  
`connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:in `columns’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/base.rb:1969:in  
`attributes_from_column_definition' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1351:in `initialize\_without\_callbacks’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/callbacks.rb:236:in  
`initialize' #{RAILS_ROOT}/app/controllers/logger_controller.rb:4:in `index’  
/usr/bin/mongrel\_rails:18

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [June 27, 2006, 8:59am UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206/2 "2006-06-27T08:59:45Z")

</div>

On Tue, 2006-06-27 at 08:42 +0200, sergio ruiz wrote:

> okay, i have officially given up on:
> 
> apache with fastcgi  
> lighttpd with fastcgi
> 
> and now i am working on getting mongrel running…

Another sucker uh convert. 🙂

> rather than getting something working for beta…

You don’t need capistrano, you can just do it via mongrel\_cluster and  
apache manually, then hit the capistrano later.

> i have the app running on the remote server on webrick, and everything  
> seems to be running fine… so i don’t think that’s the problem…
> 
> when i try running it on mongrel, uising:
> 
> mongrel\_rails start -d
> 
> i get the error tacked on to the end of this as a result…

You get this mysql error when you have your mysql in databases.yml  
configured to use “localhost” but localhost isn’t resolvable for some  
reason. Try changing to 127.0.0.1 and that should do it. Or, try  
configuring to use the /tmp socket and make sure that mysql can use it  
too.

–  
Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [June 27, 2006, 9:12am UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206/3 "2006-06-27T09:12:49Z")

</div>

> You get this mysql error when you have your mysql in databases.yml  
> configured to use “localhost” but localhost isn’t resolvable for some  
> reason. Try changing to 127.0.0.1 and that should do it. Or, try  
> configuring to use the /tmp socket and make sure that mysql can use it  
> too.

i tried changing to 127.0.0.1, but that didn’t seem to do the trick…

from my.cnf:

socket=/var/lib/mysql/mysql.sock

should i change to the /tmp in my.cnf?

or where should i change it so that it works correctly?

this looks like i am on the right track…

also…

i am firing up mongrel by running:

mongrel\_rails start -d

and doing a:

mongrel-rails restart

when things change drastically on the system…

is running this way good enough for basic beta testing?

will i run into other problems while i flesh out the rest of this whole  
thing?

thanks!

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [June 27, 2006, 10:02am UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206/4 "2006-06-27T10:02:08Z")

</div>

On Tue, 2006-06-27 at 09:12 +0200, sergio ruiz wrote:

> socket=/var/lib/mysql/mysql.sock
> 
> should i change to the /tmp in my.cnf?

Not quite sure, you may have to google around for it. I know there’s a  
few answers to the general problem. Most likely that configuration is  
in your mysql configuration, but probably not configured your  
databases.yml to use the same socket.

> i am firing up mongrel by running:

> when things change drastically on the system…
> 
> is running this way good enough for basic beta testing?

Generally that’ll work, but if you’re doing dev work it’s just easier to  
run with mongrel\_rails start.

Also, did you know there’s a -G option which will generate a config file  
to match the options you give? You run it once with -G mongrel.yml and  
the options you need. And then just run mongrel\_rails start -C  
mongrel.yml. Very handy.

> will i run into other problems while i flesh out the rest of this whole  
> thing?

Nope, but I’d say keep it simpler. Just do mongrel\_rails start during  
development, and then do little deployments by just running  
mongrel\_rails start -C and a config that puts it on a single port. Very  
easy.

–  
Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [June 27, 2006, 3:07pm UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206/5 "2006-06-27T15:07:35Z")

</div>

sergio ruiz wrote:

> > You get this mysql error when you have your mysql in databases.yml  
> > configured to use “localhost” but localhost isn’t resolvable for some  
> > reason. Try changing to 127.0.0.1 and that should do it. Or, try  
> > configuring to use the /tmp socket and make sure that mysql can use it  
> > too.
> 
> i tried changing to 127.0.0.1, but that didn’t seem to do the trick…
> 
> from my.cnf:
> 
> socket=/var/lib/mysql/mysql.sock
> 
> should i change to the /tmp in my.cnf?

I’d play it safe and change the database.yml to match what’s specified  
in the my.cnf. Easier to mess with something thats ‘app’, than  
something thats ‘system’ right now (since your main goal is getting up  
and running).

Make sure you change the right entry in databse.yml. I assume you’re  
going to be running production rather than development.

A.

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [June 27, 2006, 3:09pm UTC](https://www.ruby-forum.com/t/setting-up-mongrel/96206/6 "2006-06-27T15:09:15Z")

</div>

> > should i change to the /tmp in my.cnf?
> 
> Not quite sure, you may have to google around for it. I know there’s a  
> few answers to the general problem. Most likely that configuration is  
> in your mysql configuration, but probably not configured your  
> databases.yml to use the same socket.

for the benefit of all the kiddies following this thread, i have  
figgured it out… i think i was just sleep deprived last night…

here’s what i did…

inside database.yml,

i added this line:

socket: /var/lib/mysql/mysql.sock

to match the info from my.cnf…

fired up mongrel, and it works!

thanks, zed…
