title: Capistrano 3 Start Server Error (Rails 4.2)
body: <p>This is my spec for deployment to my staging:</p>
  
  <ul>
  <li>Rails 4.2.5</li>
  <li>Capistrano 3.4.1</li>
  <li>Thin 1.7.0</li>
  <li>Nginx 1.4.6</li>
  </ul>
  
  <p>Everything works fine, capistrano also able to deploy and run the server</p>
  
  <p><strong>BUT</strong></p>
  
  <p>When I try to access the staging, it's always internal server error and written on <code>log/thin.log</code> on the rails app:</p>
  
  <pre><code>Unexpected error while processing request: Missing 'secret_token' and 
  'secret_key_base' for 'production' environment, set these values in 
  'config/secrets.yml'
  </code></pre>
  
  <p>I also have set the <code>secret_key_base</code> for production environment generated from <code>rake secret RAILS_ENV=production</code></p>
  
  <p>if I kill the running server process run by capistrano and manually run the server using <code>bundle exec thin -p [MY_PORT] -e production -d start</code>, the error disappears and everything is normal</p>
  
  <p>So,</p>
  
  <ul>
  <li>it passes nginx so the error must be in thin or capistrano</li>
  <li>it bugs me everytime I deploy to production then I must kill the
  server process and start it manually</li>
  </ul>
  
  <p>my questions are:</p>
  
  <ol>
  <li><p>why thin server started by capistrano always have error with missing
  <code>secret_key_base</code> and <code>secret_token</code> although I already have it on
  my <code>secrets.yml</code>?</p></li>
  <li><p>how to fix it? I'm out of options</p></li>
  </ol>