Ask A Question

Notifications

You’re not receiving notifications from this thread.

Deploy Ubuntu 14.04 Trusty Tahr Discussion

Chris Oliver asked in General

Hi,
Thanks for the tutorial. I'm having trouble uncommenting the /etc/nginx/nginx.conf file. It says I have read only permission and cannot edit it, even though I followed the previous steps of setting the permissions. How do I fix this? Thanks again.

Reply

Make sure you open up the file using sudo before. So either "sudo vim /etc/nginx/nginx.conf" or "sudo nano /etc/nginx/nginx.conf"

Reply

Hi Chris

When I ran the commend `cap install STAGES=production`, I came across the following issue.

```

cap aborted!

ArgumentError: invalid byte sequence in US-ASCII

(See full trace by running task with --trace)

cap aborted!

NoMethodError: undefined method `deploying?' for #<capistrano::application:0x007fe88153d1c8>

```

I ran this commend on my local machine, not server end.

Reply

Sounds like you might have a foreign character somewhere in there that isn't US-ASCII. Are you using UTF8 characters anywhere?

Reply

When I use 'cap install STAGES=production' i get error kernel_require.rb:55:in `require': cannot load such file -- capistrano/cli (LoadError)
Any ideas to fix it?

Reply

Good article, I would like to see how a simple setup like this could be provisioned with Chef. Future article maybe?

Reply

Thanks Ben, definitely plan on doing that. Chef scripts are super duper awesome and it's incredibly useful. Hopefully I'll be able to do that soon!

Reply

Great Tutorial,

but I am getting:

cap aborted!

SSHKit::Runner::ExecuteError: Exception while executing on ip_address: Authentication failed for user user@ip_address

/home/user/.rvm/gems/ruby-2.1.2@myapp/gems/net-ssh-2.9.1/lib/net/ssh.rb:219:in `start'

Any ideas how to get authentication working?

Reply

user@ip_address

It looks like you didn't change user or ip_address to the actual user account or IP number. Change that and it should work.

Reply

Hi chris, what's the difference with PUMA ? best performance ?

Reply

Depends on what you want to do, but generally Passenger is quite good on all fronts. You can read some more about some performance testing but no matter what, it isn't going to be definitive that one is always better than another. https://blog.engineyard.com...

Reply

Thanks for awesome guide! just a heads up, in Capfile part you didn't change Ruby version. I chose 2.1.2 but in Capfile it's still 2.0.0-p451.

I changed it to 2.1.2 and all works now,

Reply

Oh hey, good find. I'll be sure to update that soon.

Reply

I have setup nginx + passenger on EC2 instance ubuntu 14.04. I successfully get first page "Welcome aboard" but when I try to get some controller's action I get "page not found 404" error.

Configuration in sites_enabled/default is as given below

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

server_name localhost;
passenger_enabled on;
rails_env production;

location / {

root /home/ubuntu/myapp/public;

}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

Reply

how can I run rake on server? I tried to do it via ssh by root and deploy. they both give me following error:

ActiveRecord::NoDatabaseError: FATAL: role "deploy" does not exist

should I run rake via Capistrano? if so, how?

Reply

It would be awesome if you could also include how to set up a background job processor like Sidekiq or Resque as a service in ubuntu.

Reply

Absolutely! I'll probably plan on covering this in a screencast or a separate tutorial.

Reply

I'm having this problem
$ cap production deploy
DEBUG[e90accc1] Running /usr/bin/env [ -d ~/.rvm ] on xxx.xx.xxx.xxx
DEBUG[e90accc1] Command: [ -d ~/.rvm ]
DEBUG[f6a43b18] Running /usr/bin/env [ -d ~/.rvm ] on domain.com
DEBUG[f6a43b18] Command: [ -d ~/.rvm ]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host domain.com: Connection refused - connect(2)

my config/deploy/production.rb is:

role :app, %w{domain.com}
role :web, %w{domain.com}

set :stage, :production

server 'xxx.xx.xxx.xxx', user: 'user_name', roles: %w{web app}

my /etc/nginx/sites-enabled/default is:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

server_name domain.com;
passenger_enabled on;
rails_env production;
root /home/user_name/apps/app_name/current/public;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {OA
root html;
}
}

Any advise?

Reply

-

Reply

Ok, it was due to my port, which wasn't 22. Anyway, right now I'm having this problem :

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host domain.com: Authentication failed for user @domain.com

Any suggestion? I guess it is related with ssh keys?

Reply
Miloš Mihajlović Miloš Mihajlović

Hi guys, great tutorial. :)
I did it exactly the same way like described here prior to reading it and wrote a blog on how to install rbenv globally for all users. Check it out here: http://toschas.com/rbenv-se... .

Reply

{You'll want to open up /etc/nginx/nginx.conf in your favorite editor} where can find nginx.conf

Reply

It's on the server in the /etc/nginx folder. You can type nano /etc/nginx/nginx.conf or use vim instead to edit it through your SSH connection.

Reply

Nice tutorial, very well explained! @excid3:disqus , could I translate to pt-BR (Brazilian portuguese), to help my Brazilian friends? Thanks a lot.

Reply

Thanks for translating! :)

Reply

Thanks for the tutorial! I get most of the way through, but when i try running

cap production deploy

I get the 'authentication failed for user deploy@1.1.1.1' message.

I'm able to SSH into my remote server without entering the deploy user's password, so I'm not really sure where else to tweak. My stackoverflow searching hasn't really turned up any easy solutions. I'd appreciate any thoughts that worked for others.

Reply

I'm trying to add my ssh key but when I try to log in into the dropplet my password is asked

sh-3.2# ssh-copy-id deploy@162.243.xxx.xxx

/usr/local/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/local/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.

sh-3.2# ssh deploy@162.243.xxx.xxx
deploy@162.243.xxx.xxx's password:

What should I do?

Reply

Hi Chris, Time to add ruby 2.1.3

Reply

Done!

Reply

good job Chris, any plans to add sidekiq integration to this post?

Reply

I'll probably do a screencast on Sidekiq (and other background workers) in the future. For now, you might want to check out this post http://chrisdyer.info/2013/...

Reply

I get lost at the nginx.conf part. After editing the file and do a restart I get a [fail] message which I suspect ain't a good thing. When I do which ruby I get /home/deploy/.rvm/rubies/ruby-1.9.3-p547/bin/ruby. (yes i am doing 1.9.3)

Should I have both

passenger_ruby /usr/bin/ruby;
and
passenger_ruby /home/deploy/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
in the conf ?

Reply

ah i figured it out

Only one line for passenger_ruby

Reply

People still use Capistrano? Dokku FTW

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.