1

I am following this tutorial to deploy a rails app on my cloud server. It's my first time deploying a rails project on a server.

When trying to start unicorn or nginx from folder /app/current and user portfolio, I am getting the error:

authentication failure; logname=portfolio uid=1002 euid=0 tty=/dev/pts/0 ruser=portfolio rhost=  user=portfolio

And: Could not locate Gemfile or .bundle/ directory

I do have the Gemfile in my current folder as well as .bundle. Permissions are

-rw-r--r--   1 portfolio portfolio   2214 Mar 31 06:53 Gemfile
drwxr-xr-x   2 portfolio portfolio   4096 Mar 31 06:54 .bundle

my nginx.conf looks like this:

    http {
    include /etc/nginx/conf.d/*.conf;
}

upstream app {
  # Path to Unicorn SOCK file, as defined previously
  server unix:/tmp/unicorn.sock fail_timeout=0;
}

server {


  listen 80;
  server_name mywebsite.com www.mywebsite.com;

  # Application root, as defined previously
  root /var/www/portfolio/current/public;

  location / {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_pass http://localhost:22/;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
}

my unicorn.rb file looks like this:

# set path to the application
app_dir = File.expand_path('../..', __FILE__)
shared_dir = "#{app_dir}/shared"
working_directory app_dir

current_path = "#{app_dir}/current"

before_exec do |server|
  ENV['BUNDLE_GEMFILE'] = "#{current_path}/Gemfile"
end

# Set unicorn options
worker_processes 2
preload_app true
timeout 30

# Path for the Unicorn socket
listen "#{shared_dir}/sockets/unicorn.sock", :backlog => 64

# Set path for logging
stderr_path "#{shared_dir}/log/unicorn.stderr.log"
stdout_path "#{shared_dir}/log/unicorn.stdout.log"

# Set proccess id path
pid "#{shared_dir}/pids/unicorn.pid"

0 Answers0