Hello All -

           This is my first post into this forum and somewhat of a newb
to RoR so I'm hoping someone can help.  I currently have a RoR app that
runs on Ubuntu with Apache and Mysql. There are two issues I'm having
and they are causing me to bang my head against the wall.

First one is RAILS_ENV: If I run ruby script/console it says that my
environment is development however if I run RAILS_ENV it says
production.  I'm trying to find a way to permanently keep the
environment set to production either through the environment.rb or some
other method.  I do have the RAILSENV production set in the VHost but it
seems as if that conflicts with the output of ruby script/console.  If I
run export RAILS_ENV=production before running ruby script/console it
comes back in production mode up until I log of the shell and come back
in.  Is there a way to permanently set the environment to production
without having to do RAILS_ENV=production everytime I need to do a rake
task?

Seconde Question:  For all of our development, we have been running the
app via port 80 and all has worked fine.  Now I need to implement SSL so
I got a certificate from a CA and installed it without any problems.
However when I bring up the application in a browser, the application
doesn't seem like it connects to MySQL.  The page loads and I see the
security lock but the menue (which is derived from MySQL) doesn't load.
I have successfully made sure that the rails app can connect to MySQL
via command line by running ActiveRecord::Base.connection via the
console and it connects using the mysql socket.  The MySQL is running on
the same server as the app so no outside connection is needed. If I
change my VHost back to port 80, everything runs correctly and it
connects to the db. I've looked into the logs for the app and notice
that even though I connect using https:// the app logs show http:.  I
know SSL is working correctly in Apache because I can put up a plain
jane webiste using SSL and it comes up but when using this app
connecting to MySQL and https I get errors like "null could not be
retrieved:Send Failed" and "menuModule could not be retrieved:Send
Failed".  Looking at the MySQL logs, I can see that it tries to connect
using user@localhost on db which is all correct.



Things I have tried or looked through:

*confirmed connection to db using command line
*confirmed the database.yml file is correct because when on port 80
everything works fine
*checked the my.cnf to confirm no skip networking and tried to bind to
loopback address and local IP and still nothing.  Again this only
happens with SSL.
* Tried setting up apache using both <virtualhost *:443> and
<virtualhost IP:443> and still same issue.

*One issue I have experienced is that sometimes apache serves up a page
but the data comes from a different database. I've checked and double
checked my VHost files to confirm everything is correct so I don't know
if this is a RoR issue or Apache issue or MySQL issue.  Any help is
appreciated.



<virtualhost *:443>
  SSLEngine On
  SSLCertificateFile /etc/apache2/ssl/domain.com.crt
  SSLCertificateKeyFile /etc/apache2/ssl/domain.key

  ServerAdmin admin@localhost
  ServerName  test.domain.com
  DocumentRoot /home/sysadmin/projects/App/public
  <directory /home/sysadmin/projects/App/public>
    Options FollowSymLinks
    AllowOverride None
    RAILSENV production
  </directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </directory>

  ErrorLog /var/log/apache2/error.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
LogLevel warn

  CustomLog /var/log/apache2/access.log combined
  ServerSignature On

  Alias /doc/ "/usr/share/doc/"
  <directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
  </directory>

</virtualhost>

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to