Connection Refused with ofn_deployment Local Deployment

It’s been a few months and we’re gearing back up again.

Local dev server deployed successfully, and App seems to be rolling out without any significant complaints:

    vagrant@vagrant-ubuntu-precise-64:~/apps/ofn_america/current$ bundle exec rails server -b 0.0.0.0
    => Booting Unicorn
    => Rails 3.2.21 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    (eval):1: warning: encountered \r in middle of line, treated as a mere space
    listening on addr=0.0.0.0:3000 fd=14
    worker=0 spawning...
    master process ready
    worker=0 spawned pid=5492
    worker=0 ready

However:

    $ wget http://127.0.0.1:3000/
--2016-05-02 01:05:56--  http://127.0.0.1:3000/
Connecting to 127.0.0.1:3000... failed: Connection refused.
$ telnet localhost 3000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

Not seeming to find any relevant info in nginx, monit or unicorn logs. I imagine the unicorn pid is supposed to be different from the rails one:

$ cat ofn_america/shared/pids/unicorn.pid 
6834

This is contents of /etc/nginx/sites-available/ofn_america:

upstream unicorn {
  server unix:/home/vagrant/apps/ofn_america/shared/sock/unicorn.ofn_america.sock fail_timeout=1;
}

            
server {
  listen 80;
  server_name   127.0.0.1;
  rewrite ^/(.*) http://127.0.0.1/$1 permanent;
}


server {
  listen 80;
  server_name 127.0.0.1;
  root /home/vagrant/apps/ofn_america/current/public;


  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_redirect off;
    proxy_pass http://unicorn;
  }

  location ~ ^/(assets)/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
    #add_header Last-Modified "";
    #add_header ETag "";
  }
  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 60;
}

Any suggestions?

Hiya @MikeiLL would suggest jumping on to the #deployment channel on Slack to get some help on this, seems the tech bods are talking/more accessible on there than here :slight_smile:

Thanks @danielle. I’m not seeing that channel. I only see #united-states, #random and #general. Possibly I need to be added as a user to #deployment? @Selmo?

Solution is that ofn_deployment is set (ofn_deployment/Vagrantfile) to have vagrant/VM available on the host machine at http://127.0.0.1:8080, not http://127.0.0.1:3000.

see https://www.vagrantup.com/docs/networking/forwarded_ports.html