How do I get unicorn to work with my contact form?

I am using the Ruby on Rails on Ubuntu (nginx and unicorn) application image for my server. I configured unicorn and nginx to load my app and everything seemed to be working. Then I tried to use the contact form on my site and it appeared to work but nothing went through (it also completed too fast).

My first question is where can I find webrick like logs for my unicorn server? I looked at /home/unicorn/log/unicorn.log but that doesn’t have the information I need.

On reboot this is what the unicorn process looks like:

rails@edawebdesign:~$ ps -e f | grep unicorn 1179 pts/1 S+ 0:00 _ grep unicorn 779 ? Sl 0:00 unicorn master -D -c /home/unicorn/unicorn.conf -E production 782 ? Sl 0:02 _ unicorn worker[0] -D -c /home/unicorn/unicorn.conf -E production 784 ? Sl 0:02 _ unicorn worker[1] -D -c /home/unicorn/unicorn.conf -E production

This is the only way I can get my contact form to work:

  1. sudo kill the master and worker processes
  2. go to the root of my app and run unicorn_rails &: rails@edawebdesign:~/apps/edawebdesign/current$ unicorn_rails & [1] 1243 rails@edawebdesign:~/apps/edawebdesign/current$ I, [2014-02-22T19:59:19.695911 #1243] INFO – : listening on addr= fd=9 I, [2014-02-22T19:59:19.696312 #1243] INFO – : worker=0 spawning… I, [2014-02-22T19:59:19.697360 #1243] INFO – : master process ready I, [2014-02-22T19:59:19.698812 #1245] INFO – : worker=0 spawned pid=1245 I, [2014-02-22T19:59:19.699163 #1245] INFO – : Refreshing Gem list I, [2014-02-22T19:59:21.426114 #1245] INFO – : worker=0 ready

Then I get a slightly different looking unicorn process list:

rails@edawebdesign:~/apps/edawebdesign/current$ ps -e f | grep unicorn 1243 pts/1 Sl 0:00 _ unicorn_rails master -l0.0.0.0:8080 1245 pts/1 Sl 0:01 | _ unicorn_rails worker[0] -l0.0.0.0:8080 1266 pts/1 S+ 0:00 _ grep unicorn

This results in my app working as expected. Anyone have an idea of what is going on here?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Check <code>/home/unicorn/log/unicorn.log</code> for info on why it’s failing to send emails. Are there any errors in there?

edit: this is the end of my production.rb: <br> <br> config.log_formatter = <br> <br> config.assets.debug = true <br> config.action_mailer.smtp_settings = { <br> address: “”, <br> port: 587, <br> domain: ENV[“DOMAIN_NAME”], <br> authentication: “plain”, <br> enable_starttls_auto: true, <br> user_name: ENV[“GMAIL_USERNAME”], <br> password: ENV[“GMAIL_PASSWORD”] <br> } <br> # ActionMailer Config <br> config.action_mailer.default_url_options = { :host => ENV[“DOMAIN_NAME”] } <br> config.action_mailer.delivery_method = :smtp <br> config.action_mailer.raise_delivery_errors = false <br> config.action_mailer.perform_deliveries = true

This is my unicorn.conf: <br> <br>isten "" <br>worker_processes 2 <br>user "rails" <br>working_directory "/home/rails/apps/edawebdesign/current" <br>pid "/home/unicorn/pids/" <br>stderr_path "/home/unicorn/log/unicorn.log" <br>stdout_path "/home/unicorn/log/unicorn.log" <br> <br>and this is the end of my /config/environments/production.rb: <br> <br>isten "" <br>worker_processes 2 <br>user "rails" <br>working_directory "/home/rails/apps/edawebdesign/current" <br>pid "/home/unicorn/pids/" <br>stderr_path "/home/unicorn/log/unicorn.log" <br>stdout_path "/home/unicorn/log/unicorn.log"