title: Dokku on Ubuntu refusing connection
body: <p>I've installed a fresh image of <strong>Dokku v0.2.3 on 14.04 (w/ Docker 1.2.0)</strong> on a <strong>512MB droplet</strong> in DigitalOcean. To avoid memory issues I create a swap file as usual.</p>
  
  <p>I deployed two apps for testing, one on a subdomain an another with a custom domain <strong>and they worked great</strong>.</p>
  
  <p>That was just a test server, just to see how it works, <strong>if</strong> it works and overall to see if <strong>I</strong> can make it work.</p>
  
  <p>So. Next thing was destroying that droplet and create a new one to deploy there some apps. I have, like at the first time everything worked, done <a href="http://reallybusywizards.com/dokku-digitalocean-your-very-own-cheap-heroku-clone" rel="nofollow">these steps here in this article</a>.</p>
  
  <p>Basically:</p>
  
  <ol>
  <li><p><em>SSH keys generation</em> (this obviously works fine)</p></li>
  <li><p><em>Access to server (http://) to do dokku's setup</em> (here I activated <strong>use virtualhost naming for apps</strong>)</p></li>
  <li><p><em>Update the dokku deploy step</em></p>
  
  <p>cd ~/dokku
  git pull origin master
  make install</p></li>
  <li><p><em>Install the dokku postgresql plugin</em></p>
  
  <p>cd /var/lib/dokku/plugins
  git clone <a href="https://github.com/Kloadut/dokku-pg-plugin" rel="nofollow">https://github.com/Kloadut/dokku-pg-plugin</a> postgresql
  dokku plugins-install</p></li>
  <li><p><em>Pushed a rails test app to the server</em> This is the ouput:</p>
  
  <pre><code>git push dokku master
  Counting objects: 6, done.
  Delta compression using up to 4 threads.
  Compressing objects: 100% (5/5), done.
  Writing objects: 100% (6/6), 491 bytes | 0 bytes/s, done.
  Total 6 (delta 2), reused 3 (delta 0)
  -----&gt; Cleaning up ...
  -----&gt; Building rails-sample ...
         Ruby app detected
  -----&gt; Compiling Ruby/Rails
  -----&gt; Using Ruby version: ruby-2.1.2
  -----&gt; Installing dependencies using 1.6.3
         Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --    deployment
         Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
         installing your bundle as root will break this application for all non-root
         users on this machine.
         Using rake 10.1.1
         Using i18n 0.6.9
         Using minitest 4.7.5
         Using multi_json 1.8.4
         Using tzinfo 0.3.38
         Using builder 3.1.4
         Using erubis 2.7.0
         Using atomic 1.1.15
         Using rack 1.5.2
         Using polyglot 0.3.4
         Using activerecord-deprecated_finders 1.0.3
         Using arel 4.0.2
         Using coffee-script-source 1.7.0
         Using mime-types 1.25.1
         Using execjs 2.0.2
         Using hike 1.2.3
         Using thor 0.18.1
         Using kgio 2.9.2
         Using json 1.8.1
         Using tilt 1.4.1
         Using bundler 1.6.3
         Using pg 0.17.1
         Using raindrops 0.13.0
         Using rails_serve_static_assets 0.0.2
         Using rails_stdout_logging 0.0.3
         Using sass 3.2.14
         Using thread_safe 0.2.0
         Using rack-test 0.6.2
         Using treetop 1.4.15
         Using coffee-script 2.2.0
         Using sprockets 2.11.0
         Using uglifier 2.4.0
         Using rails_12factor 0.0.2
         Using unicorn 4.8.2
         Using rdoc 4.1.1
         Using activesupport 4.0.3
         Using sdoc 0.4.0
         Using mail 2.5.4
         Using actionpack 4.0.3
         Using activemodel 4.0.3
         Using jbuilder 1.5.3
         Using actionmailer 4.0.3
         Using railties 4.0.3
         Using coffee-rails 4.0.1
         Using sprockets-rails 2.0.1
         Using jquery-rails 3.1.0
         Using turbolinks 2.2.1
         Using activerecord 4.0.3
         Using sass-rails 4.0.1
         Using rails 4.0.3
         Your bundle is complete!
         Gems in the groups development and test were not installed.
         It was installed into ./vendor/bundle
         Bundle completed (1.64s)
         Cleaning up the bundler cache.
  -----&gt; Writing config/database.yml to read from DATABASE_URL
  -----&gt; Preparing app for Rails asset pipeline
         Running: rake assets:precompile
         Asset precompilation completed (2.47s)
         Cleaning assets
         Running: rake assets:clean
  
  -----&gt; Discovering process types
         Procfile declares types -&gt; web
         Default process types for Ruby -&gt; rake, console, web, worker
  -----&gt; Releasing rails-sample ...
  -----&gt; Deploying rails-sample ...
  -----&gt; Checking status of PostgreSQL
         Found image postgresql/rails-sample database
         Checking status... ok.
  -----&gt; Running pre-flight checks
         check-deploy: /home/dokku/rails-sample/CHECKS not found. attempting to retrieve it from container ...
         CHECKS file not found in container. skipping checks.
  -----&gt; Running post-deploy
  -----&gt; Creating non-ssl nginx.conf
  -----&gt; Running nginx-pre-reload
         Reloading nginx
  -----&gt; Shutting down old container in 60 seconds
  =====&gt; Application deployed:
         http://rails-sample.domain.com
  </code></pre></li>
  <li><p><em>And finally back to the server, created the database and run the rake migration</em></p>
  
  <p>dokku postgresql:create rails-sample
  docker run -i -t dokku/rails-sample /bin/bash
  export HOME=/app
  for file in /app/.profile.d/*; do source $file; done
  hash -r
  cd /app
  RAILS_ENV=production rake db:migrate</p></li>
  </ol>
  
  <p>Now web I access to rails-sample.domain.com it just doesn't do anything. On Chrome I get <code>ERR_CONNECTION_REFUSED</code> error.</p>
  
  <p>The domain resolves well to the server's IP address. There's even an A record with a wildcard pointed to the server.</p>
  
  <p>Haven't seen this kind of error on Google. Even have a clue where to look what could be wrong. Dokku logs are almost empty. There're just the starting log part:</p>
  
  <pre><code>INFO -- : Refreshing Gem list
  INFO -- : listening on addr=0.0.0.0:5000 fd=9
  INFO -- : master process ready
  INFO -- : worker=0 ready
  INFO -- : worker=1 ready
  INFO -- : worker=2 ready
  </code></pre>
  
  <p>So obviously there are never have been an access to the app.</p>
  
  <p><code>docker ps</code> output:</p>
  
  <pre><code>CONTAINER ID        IMAGE                            COMMAND                CREATED             STATUS              PORTS                     NAMES
  ce2d9d46f769        dokku/rails-sample:latest        "/bin/bash -c '/star   About an hour ago   Up About an hour    0.0.0.0:49156-&gt;5000/tcp   dreamy_curie        
  89a111191b6a        postgresql/rails-sample:latest   "/usr/bin/start_pgsq   About an hour ago   Up About an hour    0.0.0.0:49154-&gt;5432/tcp   focused_mayer   
  </code></pre>
  
  <p>Where can I have a look to see what's wrong with it? I have done the creating process about five times (on new droplets) and there's always the same error, but I can't figure out what is wrong. It's even more frustrating because the first time it worked all great.</p>
  
  <p>Thanks.</p>
  
  <p><strong>UPDATE</strong>
  When I access to domain.com:49158 the app seems to work fine.</p>
  
  <p><strong>UPDATE II</strong>
  So domain configuration seems to be fine. It runs with the subdomain also but just if a specify the port after it. <strong>Seems like port 80</strong> is refusing connections. But don't know how. nginx configuration files seems all ok (ips/ports/hostnames/etc)</p>