rails s doesn't start server, no error messages - ruby

I haven't been able to find previous answered questions on this, unless I'm missing one. Anyways, when I try starting a rails server:
vagrant [accounts]> rails s
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-06-06 02:38:50] INFO WEBrick 1.3.1
[2015-06-06 02:38:50] INFO ruby 2.2.2 (2015-04-13) [i686-linux]
[2015-06-06 02:38:50] INFO WEBrick::HTTPServer#start: pid=23016 port=3000
But that's all I ever get, no error messages or anything. Of course localhost:3000 produces 'no data received'
As you can see I'm using Ruby 2.2.2 and Rails 4.2.1
I'm in the root for the app, have tried updating bin.
I'm using the sqlite3 gem, I've created and migrated the db.
I am convinced it has nothing to do with this particular rails app because I've gone back and tried to open old projects that are now having the same problem. Recently I've upgraded from Ubuntu 12.04 to 14.04 on my vm. I've also recently upgraded ruby (I manage with rvm) and rails. I've also recently put some stuff on heroku. All of this has messed with $PATH (I'm not sure if this is related, I'm pretty new to all this stuff). Just wanted to detail everything I could think of that might have an effect.
Thanks!

I ran into the following problem recently, could this be your issue also?
If so try
rails s -b 0.0.0.0
3.3 Default Host for rails server Due to a change in Rack, rails server now listens on localhost instead of 0.0.0.0 by default. This
should have minimal impact on the standard development workflow as
both http://127.0.0.1:3000 and http://localhost:3000 will continue to
work as before on your own machine.
However, with this change you will no longer be able to access the
Rails server from a different machine, for example if your development
environment is in a virtual machine and you would like to access it
from the host machine. In such cases, please start the server with
rails server -b 0.0.0.0 to restore the old behavior.
If you do this, be sure to configure your firewall properly such that
only trusted machines on your network can access your development
server.
See the release notes here for the details.

Related

Setting Up Symfony Dev Environment in Heroku

So as the title suggests, I am setting up a Symfony project in heroku. It is on my Mac OSX laptop. I followed the directions here to set it up. I got everything installed, pushed my project to heroku, tested it and it works on the web.
Now I'm trying to set up the local dev environment. I would like to be able to simply use heroku local to launch the dev server as usual. I installed the heroku php buildpack, and I created a Procfile with these contents:
web: $(composer config bin-dir)/heroku-php-apache2 web/
the composer config bin-dir command returns vendor/bin, and then I can see that heroku-php-apache2 file in there. Everything looks good.
When I run heroku local I get this error:
[WARN] No ENV file found
15:48:49 web.1 | This program requires Apache 2.4.10 or newer with mod_proxy and mod_proxy_fcgi enabled; check your 'httpd' command.
15:48:49 web.1 Exited with exit code 1
So I checked the httpd -v and I have:
Server version: Apache/2.4.27 (Unix)
Server built: Oct 3 2017 10:26:24
I just enabled (uncommented) mod_proxy and mod_proxy_fcgi in the /etc/apache2/httpd.conf file and restarted the machine, but still seeing the same error. I am starting to think it is a problem with my Procfile or something.
Any help is greatly appreciated.
For anyone having a similar problem, I was able to fix the issue. The issue WAS that I edited the wrong httpd.conf file, since I installed the apache from homebrew.
The path /etc/apache2/httpd.conf is correct if you are using the default apache2 installation on the mac. If you installed apache from homebrew like I did, you will find the httpd.conf file at /usr/local/etc/httpd/httpd.conf.
You need to uncomment the 2 lines for mod_proxy and mod_proxy_fcgi and also uncomment the port listener directive, since heroku likes to listen on non-default port 5000 and heroku will automatically do that at run time.
Also the server cannot be running already when you use heroku local.
:-)

No such file or directory - getcwd

I uploaded my Sinatra app to Beanstalk. When I go to my site my logs are returned
No such file or directory - getcwd
The app was working before. I believe the issue has to do with the fact that I added SASS to my app, but I'm not positive. In my config.ru, I have the following code dealing with SASS...
# use scss for stylesheets
Sass::Plugin.options[:style] = :compressed
use Sass::Plugin::Rack
If it could be another issue, let me know and I can provide more information. Thanks.
Some people received this error after trying to run from an already deleted directory.
I received this error after switching databases and leaving the server running. The old server info was still showing up but I was getting this error. Restarted my rails server and everything works fine with the new db.
Basically it means that there is a significant state change on the server, and your environment needs to be reset/restarted.
The key for me was starting a new terminal session.
I just ran into this after trying vagrant up on a newly created directory (after deleting one by the same name) in the same terminal session (oddly, for the first time after working with Vagrant for years). In my case I had already run vagrant destroy, so nothing about the environment needed to or could be be restarted. I was blocked until I started a new terminal session, then vagrant up ran smoothly again.
Found out pg was installed instead of mysql2 in bundler.
Ran across this issue with an Amazon EC2 and rails 5. I had to delete my directory and git clone it. I used bundle install and rake db:migrate and afterwards I ran into the same error. All I had to do to fix it was run sudo service nginx restart to restart the server and when I went back to the website it was working again.

Connection error when running memcached with dalli

I'm having trouble connecting to a Memcached server running on localhost from Dalli. I have been using Dalli with the Memcachier Heroku add-on for a while without any problems though I don't have any experience running Memcached locally.
I downloaded memcached with homebrew and it seems to have installed without a problem. I'm running it like this:
memcached -l 127.0.0.1 -p 11211 -vv
I can connect to the server and query it with
telnet 127.0.0.1 11211
The verbose output of memcached logs all the requests, so I know it's running fine. However, I'm unable to run it with Dalli. I am trying to connect like this:
require 'dalli'
dc = Dalli::Client.new('127.0.0.1:11211')
dc.set('foo', 123)
After I run the last command, Dalli unfailingly spits out
Dalli::RingError: No server available
from /Users/mac/.rvm/gems/ruby-1.9.3-p392/gems/dalli-2.6.4/lib/dalli/ring.rb:45:in `server_for_key'
from /Users/mac/.rvm/gems/ruby-1.9.3-p392/gems/dalli-2.6.4/lib/dalli/client.rb:347:in `perform'
from /Users/mac/.rvm/gems/ruby-1.9.3-p392/gems/dalli-2.6.4/lib/dalli/client.rb:199:in `set'
... so I'm getting this connection error, but I don't know why. Here's the weird part: Memcached is receiving the request, but it never succeeds in connecting. The following two lines are spit out by the verbose output whenever I try to connect:
<6 new client connection
<6 connection closed.
So what's going on here? Is this an authentication thing? Am I forgetting a command-line option?
EDIT: Figured out what was going on -- I was doing everything right except I was using the builtin version of Memcached. Installed the latest version and everything was fine.
Pretty simple issue, actually: I was just using an out-of-date Memcached version. No idea why that breaks Dalli, but installing a new Memcached fixed it.
That breaks dalli because dalli uses the newer binary memcached protocol instead of the older text-only protocol.
It does this for performance, but unfortunately makes dalli unusable with versions older than memcached 1.4

Selenium-WebDriver won't work with proxy

I have a couple of dev machines. One works, the other doesn't.
Setup that doesn't work:
Host: quad
Firefox: 13.0.1
Ubuntu: 12.04 Desktop
Ruby: 1.8.7 (2011-06-30 patchlevel 352)
RubyGems: 1.8.15
Selenium-WebDriver: 2.24.0
Proxy: 192.168.1.70:8118
Setup that does work:
Host: dev
Firefox: 13.0
Ubuntu: 12.04 Desktop
Ruby: 1.8.7 (2011-06-30 patchlevel 352)
RubyGems: 1.8.24
Selenium-WebDriver: 2.22.2
Proxy: 127.0.0.1:8118
In the setup that doesn't work (host quad) Firefox will pop up but then log an error regarding an unexpected 503 response (I use Privoxy and on the machine that doesn't work I make the proxy available to the whole LAN, so my proxy is 192.168.1.70:8118).
Firefox opens and doesn't close when the Ruby script crashes. So I've been able to use that Firefox instance to surf the internet. That works fine. So Firefox is able to start up and go through Privoxy just fine. The Privoxy 503 page never shows up on the Firefox I'm seeing pop up only in the logs.
I've also tried this script (on host quad) with Chrome. Same error in the logs but Chrome never pops up a window for me. I assume this is due to the difference in the way proxies are handled by the 2 browsers.
On host dev, this script works fine. The script works without error when the proxy is 127.0.0.1:8118 (it's local Privoxy). Since the Privoxy on host quad is available to the whole LAN I changed the proxy setting on host dev to 192.168.1.70:8118. Once I did this I ran the script on host dev and got the Privoxy error in the terminal but Firefox opened and executed the rest of the script as if the error never happened.
My assumption is that this is a subtle difference in my setup that is causing issues. But I don't know if it is Firefox 13.0.1. vs 13.0 or my version of RubyGems or my version of Selenium-WebDriver.
I figure that ideally I should have the same setup on both machines. But which setup is better? I'd prefer to be able to work with the latest Firefox just because I get sick of telling the Update Manager in Ubuntu to not execute all the Firefox updates every day. And when I run apt-get update/upgrade I don't want to have to manually remove all of the Firefox updates. That said, if the best setup is to use Firefox 10, Ruby 1.8.7, RubyGems ... then I'll just go setup some VM that I don't bother running apt-get update/upgrade on so I have a more stable environment.
Thanks
Turns out it was a forward setting in Privoxy. I had to setup forwarding for 127...*/ in /etc/privoxy/config. I had already setup forwarding for 192.168../ and thought that was fine since the Proxy IP was 192.168.1.70 but it wasn't good enough.

Unicorn, RVM and Mac OS X Leopard

I am trying to set up a small web server on my old mac mini G4 at home using the technologies mentioned in the title. I have learned that to serve anything on port 80, the server has to be started with sudo. Since I am using RVM to manage my Ruby Gems, I use rvmsudo to start the server.
I have created a user for running the server, and I can start the server by logging in via SSH and typing 'rvmsudo unicorn -p 80'. But of course when I close the connection the process is terminated, so this is obviously not the way to go.
What is the 'right' way to set up a server on Mac OS Leopard? Keeping in mind that I would like to keep using RVM to manage my gems. I would also like the server to start running automatically when the computer is booted.
you could use the tool GNU screen
http://www.gnu.org/software/screen/
and detach the screen, so the processes will continue running.
alternatively, you could try if this command does the trick:
rvmsudo unicorn -p 80

Resources